Ticket #4582: RL.mo

File RL.mo, 2.1 KB (added by ceraolo, 7 years ago)
Line 
1within ;
2model RL
3  Modelica.Electrical.Analog.Basic.Resistor resistor(R=2) annotation (
4      Placement(visible=true, transformation(extent={{14,24},{34,44}},
5          rotation=0)));
6  Modelica.Electrical.Analog.Basic.Inductor inductor(L=0.001, i(start=1))
7                                                          annotation (
8      Placement(visible=true, transformation(
9        origin={58,14},
10        extent={{-10,-10},{10,10}},
11        rotation=270)));
12  Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(
13        visible=true, transformation(extent={{16,-38},{36,-18}}, rotation=0)));
14
15  Modelica.Electrical.Analog.Sources.SignalVoltage signalVoltage annotation (
16      Placement(transformation(
17        extent={{-10,10},{10,-10}},
18        rotation=-90,
19        origin={-12,8})));
20  Modelica.Blocks.Sources.Step step(
21    offset=0,
22    height=1,
23    startTime=0.003)
24    annotation (Placement(transformation(extent={{-50,-2},{-30,18}})));
25equation
26  connect(inductor.p, resistor.n)
27    annotation (Line(points={{58,24},{58,34},{34,34}}, color={0,0,255}));
28  connect(signalVoltage.p, resistor.p)
29    annotation (Line(points={{-12,18},{-12,34},{14,34}},  color={0,0,255}));
30  connect(inductor.n, signalVoltage.n) annotation (Line(points={{58,4},{58,
31          -12},{-12,-12},{-12,-2}},
32                              color={0,0,255}));
33  connect(ground.p, signalVoltage.n) annotation (Line(points={{26,-18},{26,
34          -12},{-12,-12},{-12,-2}},
35                              color={0,0,255}));
36  connect(step.y, signalVoltage.v) annotation (Line(points={{-29,8},{-29,8},{
37          -19,8}},           color={0,0,127}));
38  annotation (
39    experiment(StopTime=0.01),
40    experimentSetupOutput,
41    Diagram(coordinateSystem(
42        extent={{-60,-40},{80,60}},
43        preserveAspectRatio=true,
44        initialScale=0.1,
45        grid={2,2})),
46    Icon(coordinateSystem(
47        extent={{-60,-40},{80,60}},
48        preserveAspectRatio=true,
49        initialScale=0.1,
50        grid={2,2})),
51    uses(Modelica(version="3.2.2")));
52end RL;