const anodeTerminalId = "d727c28d-8dc3-54a3-dbd6-c7b78c0f1164";
const cathodeTerminalId = "189822c2-307d-3ef1-984d-6a157f530d3a";
const anodeTerminal = flux.getNodeById(anodeTerminalId, "elementTerminal");
const cathodeTerminal = flux.getNodeById(cathodeTerminalId, "elementTerminal");
const outputVoltage = flux.createOutputNode("vout");
const inputVoltage = flux.createOutputNode("vin");
const voltageDrop = flux.createOutputNode("vDrop");
const current = flux.createOutputNode("I");
// Setup Event
flux.on("setup", () => {
const voltprop = flux.properties.find((prop) => prop.name === "Voltage")?.value || 5.00;
flux.simulationModel = simModel(Number(voltprop));
});
// Property was changed event
flux.on("propertyChange", (event: PropertyChangeEvent) => {
if (event.property_name === "Voltage") {
flux.notify(event.property_name + " changed to " + event.value + "V", {
variant: "success",
});
flux.simulationModel = simModel(Number(event.value));
}
});