const inputTerminalElement = flux.getNodeById("1d4060bd-e40d-a647-82ba-62984ac90112"); //Vin
const groundTerminalElement = flux.getNodeById("c504fb36-e2fe-b06c-a6f3-63f11040faf8"); //GND
const voltageInputNode = flux.createOutputNode("Vin");
const assertionExpressiontNode = flux.createOutputNode("AssertionExpression");
const assertionResultNode = flux.createOutputNode("AssertionResult");
// Setup Event
flux.on("setup", () => {
// The resistance of virtually every digital voltmeter is standardized at 10 megohms.
// The idea is the circuit should not "see" the meter. Almost no current flows through the meter.
const resistance = 10000000;
flux.simulationModel = {
type: "resistor",
resistance: resistance,
map_input_to_terminal_uid: inputTerminalElement?.uid,
map_output_to_terminal_uid: groundTerminalElement?.uid,
}
});
// Calculation Event
flux.on("afterStep", (event) => {
const expressionToAssert = flux.properties.find((prop) => prop.name === "Assert Voltage")?.value;
assertionResultNode.name = "Assertion Result";
assertionResultNode.displayInline = true;
if (assert(expressionToAssert, inputTerminalElement?.voltage)) {
flux.assertSuccess = true;