const inputTerminalElement = flux.getNodeById("a7ecaea1-98a6-99b9-c767-688d35a1e15e"); //anode
const outputTerminalElement = flux.getNodeById("97d9626c-ca44-51df-1b75-3ad12a65c5fe"); //cathode
const outputVoltage = flux.createOutputNode("vout");
const inputVoltage = flux.createOutputNode("vin");
const current = flux.createOutputNode("I");
const voltageDrop = flux.createOutputNode("vdrop");
const statusOutput = flux.createOutputNode("stats");
// Setup Event
flux.on("setup", (event) => {
const capacitance = flux.properties.find((prop) => prop.name === "Capacitance")?.value || 10e-6;
flux.simulationModel = {
type: "capacitor",
capacitance: capacitance,
map_input_to_terminal_uid: inputTerminalElement?.uid,
map_output_to_terminal_uid: outputTerminalElement?.uid
};
});
// Before Event
flux.on("beforeStep", (event) => {
const capacitance = flux.properties.find((prop) => prop.name === "Capacitance")?.value || 10e-6;
flux.simulationModel = {
type: "capacitor",
capacitance: capacitance,
};
});