// see https://docs.flux.ai/simulator/memristor
const terminals = [];
terminals[0] = flux.getNodeById("2dc1706e-a16c-5749-75c7-1e6de8256d32");
terminals[1] = flux.getNodeById("be115c61-73c9-8ec7-435d-7e8f2a684da0");
flux.on("setup", () => {
flux.simulationModel = {
type: "memristor",
map_input_to_terminal_uid: terminals[0]?.uid,
map_output_to_terminal_uid: terminals[1]?.uid
}
})
const v0 = flux.createOutputNode({ name: "VP0", value: 0, unit: "V" });
const v1 = flux.createOutputNode({ name: "VP1", value: 0, unit: "V" });
const vdrop = flux.createOutput({ name: "Vdrop", value: 0, unit: "V" });
const current = flux.createOutputNode({ name: "Current", value: 0, unit: "A" });
flux.on("afterStep", () => {
v0.value = Number(terminals[0]?.voltage);