// see https://docs.flux.ai/simulator/tristate
const terminals: Array<any> = [];
terminals[0] = flux.getNodeById("ab0c77e3-45a1-cd16-b5a1-23ec39bf22cd");
flux.on("setup", () => {
flux.simulationModel = {
type: "tristate",
map_output_to_terminal_uid: terminals[0]?.uid
}
})
const v0 = flux.createOutputNode({ name: "VP0", value: 0, unit: "V" });
const current = flux.createOutputNode({ name: "Current", value: 0, unit: "A" });
flux.on("afterStep", () => {
v0.value = Number(terminals[0]?.voltage);
current.value = Number(terminals[0]?.current);
flux.outputs = [v0, current];
})