blob: 45d5cb8341e9de9ff65616a962d702bb7d6ceedd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  | 
type Voltage = Real(unit="V");
type Current = Real(unit="A");
connector Pin
    Voltage v;
    flow Current i;
end Pin;
model Resistor
    Pin p, n;
    // "Positive" and "negative" pins.
    parameter Real R(unit="Ohm") "Resistance";
equation
    R*p.i = p.v - n.v;
    p.i + n.i = 0;
    // Positive currents into component.
end Resistor;
  |