Ticket #5849: RL.mo

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