dacre / Generic Capacitor

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
// Howdy 👋.
// If you are new to writing code in Flux make sure to check out our get started docs: https://docs.flux.ai/reference/introduction 
// We also have a Flux Slack Community in case you need help: https://join.slack.com/t/fluxcommunity/shared_invite/zt-p48n941f-wzQ06kGmuFJ2HXnGYT1JkA 
// To infinity and beyond 🚀 
const p1TerminalId = "5237503d-4662-b83a-7859-31969858b9c0"; //P1
const p2TerminalId = "e5e04a27-c5c4-f2e6-5799-708eb3f01464"; //P2
const p1Terminal = flux.getNodeById(p1TerminalId, "elementTerminal");
const p2Terminal = flux.getNodeById(p2TerminalId, "elementTerminal");
const outputVoltage = flux.createOutputNode("vout");
const inputVoltage = flux.createOutputNode("vin");
const current = flux.createOutputNode("I");
const partTypeProperty : any  = flux.properties.find((prop) => prop.name === "Part Type");
//setup event
flux.on("setup", () => {
    const capacitance = Number(flux.properties.find((prop) => prop.name === "Capacitance")?.value || 0.000001);
    flux.simulationModel =  simModel(capacitance);
    if (partTypeProperty) {
        changeFluxSymbol(partTypeProperty.value);
    }
});
// Property was changed event
flux.on("propertyChange", (event: PropertyChangeEvent) => {
    if (event.property_name === "Capacitance") {
        flux.notify(event.property_name + " changed to " + event.value + "F", {

Reviews