Tags and keywords
The export of block
Circuit
from the MagicDraw SysML Plugin or Magic Cyber-Systems Engineer® (Cameo Systems Modeler®) gives:
model Circuit
Circuit _Circuit;
model Circuit
Ground g;
Resistor rc(r.start=10.0,r.fixed=true);
Resistor ri(r.start=20.0,r.fixed=true);
Capacitor c(c.start=0.01,c.fixed=true);
Inductor i(i.start=0.1,i.fixed=true);
Source s(amp.start=220.0,amp.fixed=true);
equation
connect(s.p,rc.p);
connect(s.n,g.p);
connect(rc.n,c.p);
connect(rc.p,ri.p);
connect(ri.n,i.p);
connect(i.n,g.p);
connect(c.n,g.p);
end Circuit;
model Ground
ChargeFlowElement p;
equation
p.v=0;
end Ground;
model Resistor
extends TwoPinElectricalComponent;
parameter Resistance r;
equation
r*iThru=vDrop;
0=p.i+n.i;
vDrop=p.v-n.v;
iThru=p.i;
end Resistor;
model Capacitor
extends TwoPinElectricalComponent;
parameter Capacitance c;
equation
c*der(vDrop)=iThru;
0=p.i+n.i;
vDrop=p.v-n.v;
iThru=p.i;
end Capacitor;
model Inductor
extends TwoPinElectricalComponent;
parameter Inductance i;
equation
i*der(iThru)=vDrop;
0=p.i+n.i;
vDrop=p.v-n.v;
iThru=p.i;
end Inductor;
model Source
extends TwoPinElectricalComponent;
parameter Voltage amp;
equation
vDrop=amp*sin(2*3.14*time);
0=p.i+n.i;
vDrop=p.v-n.v;
iThru=p.i;
end Source;
connector ChargeFlowElement
flow Current i;
Voltage v;
end ChargeFlowElement;
model TwoPinElectricalComponent
Current iThru;
Voltage vDrop;
ChargeFlowElement p;
ChargeFlowElement n;
end TwoPinElectricalComponent;
type Resistance=Real(unit="Ω");
type Capacitance=Real(unit="F");
type Inductance=Real(unit="H");
type Voltage=Real(unit="V");
type Current=Real(unit="A");
end Circuit;
The plot shows voltage levels and voltage drop values at various locations in the circuit from a typical simulation execution in Wolfram SystemModeler.