const gateTerminalId = "d4705b32-ebd5-e041-cb38-748831726582"; //gate
const drainTerminalId = "b50a105a-0fa7-3419-f176-24e4103e029f"; //drain
const sourceTerminalId = "470f452b-3deb-a180-5510-3fe7b2058e85"; //source
const gateTerminal = flux.getNodeById(gateTerminalId, "elementTerminal");
const drainTerminal = flux.getNodeById(drainTerminalId, "elementTerminal");
const sourceTerminal = flux.getNodeById(sourceTerminalId, "elementTerminal");
const gateVoltage = flux.createOutputNode("gate-voltage");
const drainVoltage = flux.createOutputNode("drain-voltage");
const sourceVoltage = flux.createOutputNode("source-voltage");
// Setup Event
flux.on("setup", () => {
flux.simulationModel = simModel();
});
// Before Event
flux.on("beforeStep", () => {
flux.simulationModel = simModel();
});
// Calculation Event
flux.on("afterStep", () => {
gateVoltage.name = "Vg";
gateVoltage.value = Number(gateTerminal?.voltage);
gateVoltage.unit = "V";
drainVoltage.name = "Vd";