Ticket #6287: DC_Drive.mo

File DC_Drive.mo, 10.8 KB (added by ahaumer@…, 4 years ago)
Line 
1within ;
2package DC_Drive "Library of controlled DCPM drives"
3 extends Modelica.Icons.Package;
4 package Examples "Application and test examples of DCPM drives"
5 extends Modelica.Icons.ExamplesPackage;
6
7 model DCPMCurrentControlled "DCPM drive fed by ideal DC/DC inverter"
8 extends Modelica.Icons.Example;
9 import Modelica.Constants.pi;
10 parameter DriveParameters.DriveData driveData(redeclare
11 DC_Drive.DriveParameters.MachineDataSets.M48V machineData)
12 annotation (Placement(transformation(extent={{-80,60},{-60,80}})));
13 Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(
14 transformation(
15 extent={{-10,-10},{10,10}},
16 rotation=270,
17 origin={0,-40})));
18 Modelica.Blocks.Sources.Step iRef(
19 height=driveData.machineData.IANominal,
20 offset=0,
21 startTime=0.1)
22 annotation (Placement(transformation(extent={{-80,10},{-60,30}})));
23 Modelica.Mechanics.Rotational.Components.Inertia inertiaLoad(
24 J=driveData.JL,
25 phi(fixed=false, start=0),
26 w(fixed=false, start=0))
27 annotation (Placement(transformation(extent={{40,-70},{60,-50}})));
28 Modelica.Mechanics.Rotational.Sources.LinearSpeedDependentTorque
29 linearSpeedDependentTorque(
30 tau_nominal=-driveData.machineData.tauNominal,
31 TorqueDirection=false,
32 w_nominal=driveData.machineData.wNominal)
33 annotation (Placement(transformation(extent={{90,-70},{70,-50}})));
34 Components.DCPM dCPM(machineData=driveData.machineData)
35 annotation (Placement(transformation(extent={{10,-70},{30,-50}})));
36 Modelica.Electrical.Analog.Sources.SignalVoltage signalVoltage
37 annotation (Placement(transformation(extent={{30,-10},{10,10}})));
38 Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
39 annotation (Placement(transformation(
40 extent={{-10,10},{10,-10}},
41 rotation=90,
42 origin={10,-20})));
43 Modelica.Blocks.Continuous.FirstOrder firstOrder(k=1, T=driveData.Td)
44 annotation (Placement(transformation(extent={{-10,10},{10,30}})));
45 Modelica.Electrical.Machines.Examples.ControlledDCDrives.Utilities.LimitedPI
46 limitedPI(
47 k=driveData.controllerData.kpI,
48 Ti=driveData.controllerData.TiI,
49 useFF=true,
50 KFF=driveData.machineData.kPhi,
51 yMax=driveData.VBat)
52 annotation (Placement(transformation(extent={{-40,10},{-20,30}})));
53 equation
54 connect(dCPM.shaft, inertiaLoad.flange_a)
55 annotation (Line(points={{30,-60},{40,-60}},
56 color={0,0,0}));
57 connect(linearSpeedDependentTorque.flange, inertiaLoad.flange_b)
58 annotation (Line(points={{70,-60},{60,-60}}, color={0,0,0}));
59 connect(ground.p, dCPM.pin_n) annotation (Line(points={{10,-40},{14,-40},
60 {14,-50}}, color={0,0,255}));
61 connect(ground.p, currentSensor.p)
62 annotation (Line(points={{10,-40},{10,-30}}, color={0,0,255}));
63 connect(currentSensor.n, signalVoltage.n)
64 annotation (Line(points={{10,-10},{10,0}}, color={0,0,255}));
65 connect(signalVoltage.p, dCPM.pin_p) annotation (Line(points={{30,0},{30,
66 -40},{26,-40},{26,-50}}, color={0,0,255}));
67 connect(firstOrder.y, signalVoltage.v)
68 annotation (Line(points={{11,20},{20,20},{20,12}}, color={0,0,127}));
69 connect(limitedPI.y, firstOrder.u)
70 annotation (Line(points={{-19,20},{-12,20}}, color={0,0,127}));
71 connect(iRef.y, limitedPI.u)
72 annotation (Line(points={{-59,20},{-42,20}}, color={0,0,127}));
73 connect(currentSensor.i, limitedPI.u_m) annotation (Line(points={{-1,-20},
74 {-36,-20},{-36,8}}, color={0,0,127}));
75 connect(dCPM.w, limitedPI.feedForward)
76 annotation (Line(points={{9,-60},{-30,-60},{-30,8}}, color={0,0,127}));
77 annotation (experiment(
78 StopTime=1,
79 Interval=0.0001,
80 Tolerance=1e-06));
81 end DCPMCurrentControlled;
82 end Examples;
83
84 package Components "Components for DCPM drives"
85 extends Modelica.Icons.Package;
86 model DCPM
87 extends Modelica.Electrical.Machines.Icons.Machine;
88 Modelica.Electrical.Analog.Basic.Resistor resistor(R=machineData.RA,
89 T_ref=293.15)
90 annotation (Placement(transformation(extent={{-10,-10},{10,10}},
91 rotation=270,
92 origin={0,60})));
93 Modelica.Electrical.Analog.Basic.Inductor inductor(L=machineData.LA)
94 annotation (Placement(transformation(extent={{-10,-10},{10,10}},
95 rotation=270,
96 origin={0,30})));
97 Modelica.Electrical.Analog.Basic.EMF emf(k=machineData.kPhi)
98 annotation (Placement(
99 transformation(
100 extent={{-10,-10},{10,10}},
101 rotation=0,
102 origin={0,0})));
103 Modelica.Mechanics.Rotational.Components.Inertia inertia(J=machineData.J)
104 annotation (Placement(transformation(extent={{40,-10},{60,10}})));
105 Modelica.Electrical.Analog.Interfaces.PositivePin pin_p "Positive armature pin"
106 annotation (Placement(transformation(extent={{50,90},{70,110}})));
107 Modelica.Electrical.Analog.Interfaces.NegativePin pin_n "Negative armature pin"
108 annotation (Placement(transformation(extent={{-70,90},{-50,110}})));
109 Modelica.Mechanics.Rotational.Interfaces.Flange_a shaft "Shaft"
110 annotation (Placement(transformation(extent={{90,-10},{110,10}})));
111 Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor annotation (
112 Placement(transformation(
113 extent={{-10,-10},{10,10}},
114 rotation=270,
115 origin={80,-30})));
116 Modelica.Blocks.Interfaces.RealOutput w annotation (Placement(transformation(
117 extent={{-10,-10},{10,10}},
118 rotation=180,
119 origin={-110,0})));
120 parameter DriveParameters.MachineDataSets.MachineData machineData
121 annotation (Placement(transformation(extent={{60,40},{80,60}})));
122 equation
123 connect(resistor.n, inductor.p)
124 annotation (Line(points={{-1.77636e-15,50},{0,50},{0,40},{1.77636e-15,40}},
125 color={0,0,255}));
126 connect(inductor.n, emf.p)
127 annotation (Line(points={{-1.77636e-15,20},{0,20},{0,10}},
128 color={0,0,255}));
129 connect(emf.flange, inertia.flange_a)
130 annotation (Line(points={{10,0},{40,0}}, color={0,0,0}));
131 connect(resistor.p, pin_p) annotation (Line(points={{0,70},{0,80},{60,80},{60,
132 100}}, color={0,0,255}));
133 connect(emf.n, pin_n) annotation (Line(points={{0,-10},{0,-20},{-60,-20},{-60,
134 100}}, color={0,0,255}));
135 connect(inertia.flange_b, shaft)
136 annotation (Line(points={{60,0},{100,0}}, color={0,0,0}));
137 connect(inertia.flange_b, speedSensor.flange)
138 annotation (Line(points={{60,0},{80,0},{80,-20}}, color={0,0,0}));
139 connect(speedSensor.w, w) annotation (Line(points={{80,-41},{80,-60},{-80,-60},
140 {-80,0},{-110,0}}, color={0,0,127}));
141 annotation (
142 Icon(graphics={Text(
143 extent={{-100,-100},{100,-140}},
144 lineColor={28,108,200},
145 textString="%name")}));
146 end DCPM;
147
148 end Components;
149
150 package DriveParameters "Library with drive parameter data sets"
151 extends Modelica.Icons.RecordsPackage;
152 record DriveData
153 extends Modelica.Icons.Record;
154 import Modelica.Constants.pi;
155 replaceable parameter DC_Drive.DriveParameters.MachineDataSets.MachineData machineData
156 annotation (choicesAllMatching=true, Placement(transformation(extent={{-10,40},{10,60}})));
157 parameter ControllerData controllerData(
158 kpI=machineData.LA/(2*Td),
159 TiI=machineData.LA/machineData.RA,
160 Tsub=2*Td,
161 kpw=(machineData.J + JL)/(2*controllerData.Tsub),
162 Tiw=4*controllerData.Tsub)
163 annotation (Placement(transformation(extent={{-10,0},{10,20}})));
164 parameter Modelica.SIunits.Inertia JL=machineData.J "Load inertia";
165 parameter Modelica.SIunits.Voltage VBat=1.2*machineData.VANominal "Battery voltage";
166 parameter Modelica.SIunits.Frequency fSwitch=1e3 "Switching frequency";
167 parameter Modelica.SIunits.Time Td=0.5/fSwitch "Dead time of inverter"
168 annotation(Dialog(enable=false));
169 annotation(defaultComponentPrefixes="parameter", defaultComponentName="driveData");
170 end DriveData;
171
172 record ControllerData
173 extends Modelica.Icons.Record;
174 parameter Real kpI "Proportional gain of current controller";
175 parameter Modelica.SIunits.Time TiI "Integral time constant of current controller";
176 parameter Modelica.SIunits.Time Tsub "Substitute time constant";
177 parameter Real kpw "Porportional gain of speed controller";
178 parameter Modelica.SIunits.Time Tiw "Integral time constant of speed controller";
179 annotation(defaultComponentPrefixes="parameter", defaultComponentName="controllerData");
180 end ControllerData;
181
182 package MachineDataSets
183 extends Modelica.Icons.RecordsPackage;
184 record MachineData
185 extends Modelica.Icons.Record;
186 import Modelica.Constants.pi;
187 parameter Modelica.SIunits.Voltage VANominal=100 "Nominal armature voltage";
188 parameter Modelica.SIunits.Current IANominal=100 "Nominal armature current";
189 parameter Modelica.SIunits.AngularVelocity wNominal=1425*pi/30 "Nominal speed";
190 parameter Modelica.SIunits.Resistance RA=0.05 "Armature resistance";
191 parameter Modelica.SIunits.Inductance LA=0.0015 "Armature inductance";
192 parameter Modelica.SIunits.Voltage ViNominal=VANominal - RA*IANominal "Nominal induced voltage"
193 annotation(Dialog(enable=false));
194 parameter Modelica.SIunits.ElectricalTorqueConstant kPhi=ViNominal/wNominal "Flux constant";
195 parameter Modelica.SIunits.Inertia J=0.29 "Rotor inertia";
196 parameter Modelica.SIunits.Torque tauNominal=kPhi*IANominal "Nominal torque"
197 annotation(Dialog(enable=false));
198 annotation(defaultComponentPrefixes="parameter", defaultComponentName="machineData");
199 end MachineData;
200
201 record M48V
202 import Modelica.Constants.pi;
203 extends DC_Drive.DriveParameters.MachineDataSets.MachineData(
204 VANominal=48,
205 IANominal=25,
206 wNominal=3500*pi/30,
207 RA=0.24,
208 LA=0.004,
209 J=0.0008);
210 annotation(defaultComponentPrefixes="parameter", defaultComponentName="machineData");
211 end M48V;
212 end MachineDataSets;
213 end DriveParameters;
214 annotation (uses(Modelica(version="3.2.3")));
215end DC_Drive;