# 电气方面的实例¶

$V = i_R R$
$C \frac{\mathrm{d}V}{\mathrm{d}t} = i_C$
$L \frac{\mathrm{d}i_L}{\mathrm{d}t} = (V_b-V)$

$i_L = i_R+i_C$

model RLC1 "A resistor-inductor-capacitor circuit model"
type Voltage=Real(unit="V");
type Current=Real(unit="A");
type Resistance=Real(unit="Ohm");
type Capacitance=Real(unit="F");
type Inductance=Real(unit="H");
parameter Voltage Vb=24 "Battery voltage";
parameter Inductance L = 1;
parameter Resistance R = 100;
parameter Capacitance C = 1e-3;
Voltage V;
Current i_L;
Current i_R;
Current i_C;
equation
V = i_R*R;
C*der(V) = i_C;
L*der(i_L) = (Vb-V);
i_L=i_R+i_C;
end RLC1;


model RLC1 "A resistor-inductor-capacitor circuit model"


  type Voltage=Real(unit="V");
type Current=Real(unit="A");
type Resistance=Real(unit="Ohm");
type Capacitance=Real(unit="F");
type Inductance=Real(unit="H");


  parameter Voltage Vb=24 "Battery voltage";
parameter Inductance L = 1;
parameter Resistance R = 100;
parameter Capacitance C = 1e-3;


  Voltage V;
Current i_L;
Current i_R;
Current i_C;


equation
V = i_R*R;
C*der(V) = i_C;
L*der(i_L) = (Vb-V);
i_L=i_R+i_C;


end RLC1;


  der(V) = i_C/C;
der(i_L) = (Vb-V)/L;
i_R = i_L-i_C;
V = i_R*R;