const inputTerminalElement = flux.getNodeById("4604cbed-0f2c-cd8e-a780-801ffe69663e"); //a terminal
const outputTerminalElement = flux.getNodeById("cf44714b-531e-03fa-464e-b8c53d0db880"); //b terminal
const voltageInputNode = flux.createOutputNode("va");
const voltageOutputNode = flux.createOutputNode("vb");
const amperageOutputNode = flux.createOutputNode("current");
const voltageDrop = flux.createOutputNode("vdrop");
// Setup Event
flux.on("setup", (event) => {
const inductance = flux.properties.find((prop) => prop.name === "Inductance")?.value || 6.8;
flux.simulationModel = {
type: "inductor",
inductance: inductance,
map_input_to_terminal_uid: inputTerminalElement?.uid,
map_output_to_terminal_uid: outputTerminalElement?.uid,
};
});
// Before Event
flux.on("beforeStep", (event) => {
const inductance = flux.properties.find((prop) => prop.name === "Inductance")?.value || 6.8;
flux.simulationModel = {
inductance: inductance,
};
});
// Calculation Event
flux.on("afterStep", (event) => {
voltageInputNode.name = "Va";