|
| 1 | +within OpenIPSL.Electrical.VSD.Generic.PowerElectronics; |
| 2 | +model AC2DCandDC2AC "Phasor based voltage source converter model." |
| 3 | + extends OpenIPSL.Electrical.Essentials.pfComponent( |
| 4 | + final enabledisplayPF=false, |
| 5 | + final enablefn=false, |
| 6 | + final enableV_b=false, |
| 7 | + final enableangle_0=true, |
| 8 | + final enableP_0 = false, |
| 9 | + final enableQ_0=false, |
| 10 | + final enablev_0=true, |
| 11 | + final enableS_b=true); |
| 12 | + |
| 13 | + import Modelica.Constants.eps; |
| 14 | + import Modelica.Constants.pi; |
| 15 | + OpenIPSL.Interfaces.PwPin p "Grid side pin" |
| 16 | + annotation (Placement(transformation(extent={{-110,-10},{-90,10}}), |
| 17 | + iconTransformation(extent={{-110,-10},{-90,10}}))); |
| 18 | + OpenIPSL.Interfaces.PwPin n "Motor side pin" annotation (Placement(transformation(extent={{90,-10}, |
| 19 | + {110,10}}), iconTransformation(extent={{90,-10},{110,10}}))); |
| 20 | + Modelica.Electrical.Analog.Sources.SignalVoltage Voltage "DC voltage source" annotation ( |
| 21 | + Placement(transformation( |
| 22 | + extent={{-10,10},{10,-10}}, |
| 23 | + rotation=270, |
| 24 | + origin={-46,-14}))); |
| 25 | + Modelica.Blocks.Sources.RealExpression Vd0(y=3*sqrt(6)*Vs.y*(V_b)/Modelica.Constants.pi) "DC voltage after converter stage" |
| 26 | + annotation (Placement(transformation(extent={{-84,-24}, |
| 27 | + {-64,-4}}))); |
| 28 | + Modelica.Electrical.Analog.Basic.Resistor Resistor(R=Rdc) "DC link resistor" |
| 29 | + annotation (Placement(transformation(extent={{-42,-10},{-22,10}}))); |
| 30 | + Modelica.Electrical.Analog.Basic.Inductor Inductor(i(start=Il0, fixed=false), |
| 31 | + L=Ldc) "DC link inductor" |
| 32 | + annotation (Placement(transformation(extent={{-16,-10},{4,10}}))); |
| 33 | + Modelica.Electrical.Analog.Ideal.IdealOpeningSwitch switch(Ron=1e-5, Goff=1e-5) "Switch enforcing no inverse current flow in DC link" |
| 34 | + annotation (Placement(transformation(extent={{10,-10},{30,10}}))); |
| 35 | + Modelica.Electrical.Analog.Basic.Capacitor Capacitor(v(start=Vc0, fixed=true), |
| 36 | + C=Cdc) "DC link capacitor" |
| 37 | + annotation ( |
| 38 | + Placement(transformation( |
| 39 | + extent={{-10,-10},{10,10}}, |
| 40 | + rotation=270, |
| 41 | + origin={30,-14}))); |
| 42 | + Modelica.Electrical.Analog.Sources.SignalCurrent signalCurrent "Current drawn source" annotation (Placement(transformation( |
| 43 | + extent={{-10,-10},{10,10}}, |
| 44 | + rotation=270, |
| 45 | + origin={50,-14}))); |
| 46 | + Modelica.Blocks.Sources.RealExpression Ii(y=Pmotor.y*S_b/Capacitor.v) "Current drawn expression" |
| 47 | + annotation (Placement(transformation( |
| 48 | + extent={{-10,10},{10,-10}}, |
| 49 | + rotation=180, |
| 50 | + origin={78,-14}))); |
| 51 | + Modelica.Blocks.Sources.RealExpression Vs(y=sqrt(p.vr^2 + p.vi^2)) "Inverter side voltage magnitude" |
| 52 | + annotation (Placement(transformation(extent={{-70,50},{-50,70}}))); |
| 53 | + Modelica.Blocks.Sources.BooleanExpression open_circuit_condition(y=if |
| 54 | + Resistor.i < 0 then true else false) "Boolean expression for boolean switch to block current from flowing the opposite direction " |
| 55 | + annotation (Placement(transformation(extent={{52,6},{32,26}}))); |
| 56 | + Modelica.Blocks.Sources.RealExpression Pmotor(y=-(n.vr*n.ir + n.vi*n.ii)) "Active power for drawn motor current" |
| 57 | + annotation (Placement(transformation(extent={{24,70},{44,90}}))); |
| 58 | + Modelica.Blocks.Sources.RealExpression Qmotor(y=n.vr*n.ii - n.vi*n.ir) "Reactive power for drawn motor current" |
| 59 | + annotation (Placement(transformation(extent={{24,54},{44,74}}))); |
| 60 | + OpenIPSL.Types.PerUnit P "Active Power"; |
| 61 | + Modelica.Units.SI.ActivePower Pdc "DC Circuit Active Power"; |
| 62 | + OpenIPSL.Types.PerUnit Q "Reactive Power"; |
| 63 | + OpenIPSL.Types.PerUnit S "Apparent Power"; |
| 64 | + |
| 65 | + Modelica.Blocks.Sources.RealExpression Vmotor(y=Capacitor.v*m_input/(2*sqrt(2) |
| 66 | + *V_b)) "Motor terminal voltage" |
| 67 | + annotation (Placement(transformation(extent={{24,38},{44,58}}))); |
| 68 | + Modelica.Blocks.Interfaces.RealInput m_input "PWM modulation index input" annotation (Placement(transformation( |
| 69 | + extent={{-20,-20},{20,20}}, |
| 70 | + rotation=90, |
| 71 | + origin={60,-120}), iconTransformation( |
| 72 | + extent={{-20,-20},{20,20}}, |
| 73 | + rotation=90, |
| 74 | + origin={60,-120}))); |
| 75 | + Modelica.Blocks.Sources.RealExpression vr_m(y=Vmotor.y*cos(0)) "Motor real current" |
| 76 | + annotation (Placement(transformation(extent={{62,70},{82,90}}))); |
| 77 | + Modelica.Blocks.Sources.RealExpression vi_m(y=Vmotor.y*sin(0)) "Motor imaginary current" |
| 78 | + annotation (Placement(transformation(extent={{62,54},{82,74}}))); |
| 79 | + Modelica.Electrical.Analog.Basic.Ground ground "Electrical ground" |
| 80 | + annotation (Placement(transformation(extent={{-14,-50},{6,-30}}))); |
| 81 | + |
| 82 | + Modelica.Blocks.Interfaces.RealOutput Vc "Value of Real output" annotation ( |
| 83 | + Placement(transformation( |
| 84 | + extent={{-10,-10},{10,10}}, |
| 85 | + rotation=270, |
| 86 | + origin={-50,-110}), iconTransformation( |
| 87 | + extent={{-18.1811,-18.1819},{21.819,-58.1819}}, |
| 88 | + rotation=270, |
| 89 | + origin={-21.8181,-118.181}))); |
| 90 | + parameter Modelica.Units.SI.Resistance Rdc=0.1 |
| 91 | + "DC link resistance" |
| 92 | + annotation (Dialog(group="DC Link Parameters")); |
| 93 | + parameter Modelica.Units.SI.Inductance Ldc=0.001 |
| 94 | + "DC link inductance" |
| 95 | + annotation (Dialog(group="DC Link Parameters")); |
| 96 | + parameter Modelica.Units.SI.Capacitance Cdc=0.02 |
| 97 | + "DC link capacitance" |
| 98 | + annotation (Dialog(group="DC Link Parameters")); |
| 99 | + parameter Real m0= 0.1 "Initial PWM modulation value" annotation (Dialog(group="DC Link Parameters")); |
| 100 | + Modelica.Blocks.Sources.RealExpression Smotor(y=sqrt(Pmotor.y^2 + Qmotor.y^2)) "Motor apparent power" |
| 101 | + annotation (Placement(transformation(extent={{62,38},{82,58}}))); |
| 102 | + |
| 103 | +protected |
| 104 | + parameter OpenIPSL.Types.Voltage Vc0 = 2*sqrt(2)*Vmotor0*V_b/m0 "Initial capacitor voltage"; |
| 105 | + parameter OpenIPSL.Types.Current Il0 = 0 "Initial inductor current"; |
| 106 | + parameter OpenIPSL.Types.PerUnit Vmotor0 = (3*sqrt(3)/(2*pi))*m0 "Initial terminal voltage"; |
| 107 | + |
| 108 | + Modelica.Blocks.Sources.RealExpression Capacitor_Voltage(y=Capacitor.v) "Capacitor voltage" |
| 109 | + annotation (Placement(transformation(extent={{-84,-84},{-64,-64}}))); |
| 110 | + |
| 111 | +equation |
| 112 | + connect(Vd0.y, Voltage.v) |
| 113 | + annotation (Line(points={{-63,-14},{-58,-14}}, color={0,0,127})); |
| 114 | + connect(Voltage.p, Resistor.p) |
| 115 | + annotation (Line(points={{-46,-4},{-46,0},{-42,0}}, color={0,0,255})); |
| 116 | + connect(Resistor.n, Inductor.p) |
| 117 | + annotation (Line(points={{-22,0},{-16,0}}, color={0,0,255})); |
| 118 | + connect(Inductor.n, switch.p) |
| 119 | + annotation (Line(points={{4,0},{10,0}}, color={0,0,255})); |
| 120 | + connect(switch.n, Capacitor.p) |
| 121 | + annotation (Line(points={{30,0},{30,-4}}, color={0,0,255})); |
| 122 | + connect(Voltage.n, Capacitor.n) annotation (Line(points={{-46,-24},{-46,-28},{ |
| 123 | + 30,-28},{30,-24}}, color={0,0,255})); |
| 124 | + connect(switch.n, signalCurrent.p) annotation (Line(points={{30,0},{50,0},{50, |
| 125 | + -4}}, color={0,0,255})); |
| 126 | + connect(signalCurrent.n, Capacitor.n) annotation (Line(points={{50,-24},{50,-28}, |
| 127 | + {30,-28},{30,-24}}, color={0,0,255})); |
| 128 | + connect(signalCurrent.i, Ii.y) annotation (Line(points={{62,-14},{67,-14}}, color={0,0,127})); |
| 129 | + connect(open_circuit_condition.y, switch.control) |
| 130 | + annotation (Line(points={{31,16},{20,16},{20,12}}, color={255,0,255})); |
| 131 | + P = p.vr*p.ir + p.vi*p.ii; |
| 132 | + Q = (-p.vr*p.ii) + p.vi*p.ir; |
| 133 | + Q = 0; |
| 134 | + S = sqrt(P^2 + Q^2); |
| 135 | + Pdc = Vd0.y*Resistor.i; |
| 136 | + P*S_b = Pdc; |
| 137 | + |
| 138 | + n.vr = vr_m.y; |
| 139 | + n.vi = vi_m.y; |
| 140 | + connect(ground.p, Capacitor.n) annotation (Line(points={{-4,-30},{-4,-28},{30, |
| 141 | + -28},{30,-24}}, |
| 142 | + color={0,0,255})); |
| 143 | + connect(Capacitor_Voltage.y, Vc) annotation (Line(points={{-63,-74},{-50,-74}, |
| 144 | + {-50,-110}}, color={0,0,127})); |
| 145 | + annotation (preferredView = "info",Icon( |
| 146 | + graphics={Rectangle( |
| 147 | + extent={{-100,100},{100,-100}}, |
| 148 | + lineColor={28,108,200}), |
| 149 | + Line(points={{-100,-100},{100,100}}, color={28,108,200}), |
| 150 | + Text( |
| 151 | + extent={{-90,80},{30,20}}, |
| 152 | + textColor={28,108,200}, |
| 153 | + textString="AC/DC"), |
| 154 | + Text( |
| 155 | + extent={{-30,-20},{90,-80}}, |
| 156 | + textColor={28,108,200}, |
| 157 | + textString="DC/AC")}), Diagram( graphics={Rectangle( |
| 158 | + extent={{14,90},{94,40}}, |
| 159 | + lineColor={0,0,255}, |
| 160 | + pattern=LinePattern.Dash), Text( |
| 161 | + extent={{24,98},{84,92}}, |
| 162 | + lineColor={0,0,255}, |
| 163 | + pattern=LinePattern.Dash, |
| 164 | + textString="Motor Variables"), Rectangle( |
| 165 | + extent={{-80,80},{-40,40}}, |
| 166 | + lineColor={0,0,255}, |
| 167 | + pattern=LinePattern.Dash), Text( |
| 168 | + extent={{-92,88},{-30,82}}, |
| 169 | + lineColor={0,0,255}, |
| 170 | + pattern=LinePattern.Dash, |
| 171 | + textString="Grid Variables"), Rectangle( |
| 172 | + extent={{-94,-54},{-54,-94}}, |
| 173 | + lineColor={0,0,255}, |
| 174 | + pattern=LinePattern.Dash), Text( |
| 175 | + extent={{-106,-46},{-44,-52}}, |
| 176 | + lineColor={0,0,255}, |
| 177 | + pattern=LinePattern.Dash, |
| 178 | + textString="DC Link Variables")}), |
| 179 | + Documentation(info="<html> |
| 180 | +<p>The AC2DCandDC2AC component represents the power electronics component of the variable speed drive. |
| 181 | +The model provides an interface between two terminals. Terminal pin p is related to the grid bus side and terminal pin n is related to the |
| 182 | +motor terminal bus. The model is an average representation of the switching components of a real variable speed drive, thus being ideal for long simulation durations on phasor dynamic simulations.</p> |
| 183 | +<p>The model has one input and one output connectors. The m_input input connector represents the pwn modulation index, while the Vc output connector represents the capacitor voltage value used in the controller logic block.</p> |
| 184 | +<p>The modelling of such devices is based, mainly, on the following reference:</p> |
| 185 | +<ul> |
| 186 | +<li>Panasetsky: Variable Speed Drive Modeling\" |
| 187 | +<a href=\"modelica://OpenIPSL.UsersGuide.References\">[Panasetsky2016]</a>,</li> |
| 188 | +</ul> |
| 189 | +</html>")); |
| 190 | +end AC2DCandDC2AC; |
0 commit comments