const anodeTerminal = flux.getNodeById("d6839958-464a-22d4-c933-293fecbddc1c");
const cathodeTerminal = flux.getNodeById("1e5f31d6-2e01-427f-18b7-c4661ce4f0d2");
const outputVoltage = flux.createOutputNode("vout");
const inputVoltage = flux.createOutputNode("vin");
const current = flux.createOutputNode("I");
// Setup Event
flux.on("setup", (event) => {
const volTage = flux.properties.find((prop) => prop.name === "Max Voltage per cell")?.value || 1.5;
const multiplier = flux.properties.find((prop) => prop.name === "Number of Cell")?.value || 2;
flux.simulationModel = {
type: "voltageSource",
voltage: Number(volTage * multiplier),
map_anode_to_terminal_uid: anodeTerminal?.uid,
map_cathode_to_terminal_uid: cathodeTerminal?.uid,
};
});
// Before Event
flux.on("beforeStep", (event) => {
const volTage = flux.properties.find((prop) => prop.name === "Max Voltage per cell")?.value || 1.5;