const cathodeTerminal = flux.getNodeById("c73eab0e-a208-d078-fd16-8c8e34764e5b"); // Vout
const anodeTerminal = flux.getNodeById("2768a0bb-657c-ac7b-fe7e-ad6ae5bd81ef"); // GND
flux.on("beforeStep", () => {
const maxPowerVoltage = flux.properties.find((prop) => prop.name === "Max Power Voltage")?.value;
flux.simulationModel = {
type: "voltageSource",
voltage: maxPowerVoltage,
map_anode_to_terminal_uid: anodeTerminal?.uid,
map_cathode_to_terminal_uid: cathodeTerminal?.uid,
};
});
flux.on("afterStep", () => {
const voltage = flux.createOutputNode("va");
voltage.name = "Voltage";
voltage.value = Number(cathodeTerminal?.voltage);
voltage.unit = "V";
voltage.displayInline = true;
flux.outputs = [voltage];
});