jbreidfjord-dev / Pulsed Voltage Source

Files

Pins

Symbol

PCB

Open in Flux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const anodeTerminalUid = "9b43137e-5678-604b-097b-07055b46b0c6";
const cathodeTerminalUid = "8d0d6e5c-9570-643c-7237-cd6c714368b5";
const anodeTerminal = flux.getNodeById(anodeTerminalUid, "elementTerminal");
const cathodeTerminal = flux.getNodeById(cathodeTerminalUid, "elementTerminal");
if (!anodeTerminal || !cathodeTerminal) {
    throw new Error("Oops! Couldn't find terminals");
}
const voltagePeakToPeakOutput = flux.createOutputNode("vptop");
voltagePeakToPeakOutput.name = "Vp-p";
voltagePeakToPeakOutput.unit = "V";
const voltageAnodeOutput = flux.createOutputNode("Vanode");
voltageAnodeOutput.name = "Vanode";
voltageAnodeOutput.unit = "V";
const voltageCathodeOutput = flux.createOutputNode("Vcathode");
voltageCathodeOutput.name = "Vcathode";
voltageCathodeOutput.unit = "V";
const currentOutput = flux.createOutputNode("current");
currentOutput.name = "Current";
currentOutput.unit = "A";
function castPropertyValue(value: Readonly<PropertyValue>): number | undefined {
    return value === "" ? undefined : Number(value);
}
function setModel() {
    const initialVoltage = Number(flux.properties.find((prop) => prop.name === "Initial Voltage")?.value ?? 0);
    const pulsedVoltage = Number(flux.properties.find((prop) => prop.name === "Pulsed Voltage")?.value ?? 5);
    const delay = castPropertyValue(flux.properties.find((prop) => prop.name === "Delay")!.value);
Enter to Rename, Shift+Enter to Preview

Reviews