// see https://docs.flux.ai/simulator/inductor
const terminals = [];
terminals[0] = flux.getNodeById("55fac657-fecb-393c-67b5-f83c0be46188");
terminals[1] = flux.getNodeById("d3fef124-64ce-ab07-b83d-e95e38234f0a");
flux.on("setup", () => {
flux.simulationModel = {
type: "inductor",
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);
v1.value = Number(terminals[1]?.voltage);
vdrop.value = v2.value - v1.value
current.value = Number(terminals[0]?.current);
flux.outputs = [v0, v1, current, vdrop];
})