// see https://docs.flux.ai/simulator/invertingschmitt
const terminals = [];
terminals[0] = flux.getNodeById("9f1d66d5-5b9b-cd6a-1c3c-9bbbcd70d71b");
terminals[1] = flux.getNodeById("9fe37c50-725e-a400-00f6-9b1d9e73e87e");
flux.on("setup", () => {
flux.simulationModel = {
type: "invertingSchmitt",
map_input_to_terminal_uid: terminals[0]?.uid,
map_output_to_terminal_uid: terminals[1]?.uid
}
})
const v0 = flux.createOutputNode({ name: "VP0", value: 0, unit: "V" });
const v1 = flux.createOutputNode({ name: "VP1", value: 0, unit: "V" });
const vdrop = flux.createOutput({ name: "Vdrop", value: 0, unit: "V" });
const current = flux.createOutputNode({ name: "Current", value: 0, unit: "A" });
flux.on("afterStep", () => {
v0.value = Number(terminals[0]?.voltage);