// see https://docs.flux.ai/simulator/thermistor
const terminals = [];
terminals[0] = flux.getNodeById("cd1c22f5-849b-9806-27fd-1bfcade00b50");
terminals[1] = flux.getNodeById("feb2dfd0-7fa0-6bf7-121a-fd5478f1962e");
flux.on("setup", () => {
flux.simulationModel = {
type: "thermistor",
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);