| 1 | within Modelica.Thermal; |
|---|
| 2 | package HeatTransfer |
|---|
| 3 | "Library of 1-dimensional heat transfer with lumped elements" |
|---|
| 4 | import Modelica.SIunits.Conversions.*; |
|---|
| 5 | import SI = Modelica.SIunits; |
|---|
| 6 | import NonSI = Modelica.SIunits.Conversions.NonSIunits; |
|---|
| 7 | extends Modelica.Icons.Library2; |
|---|
| 8 | |
|---|
| 9 | annotation (version="1.1", versionDate="2005-06-13", |
|---|
| 10 | preferedView="info", Icon( |
|---|
| 11 | Polygon(points=[-54, -6; -61, -7; -75, -15; -79, -24; -80, -34; -78, -42; |
|---|
| 12 | -73, -49; -64, -51; -57, -51; -47, -50; -41, -43; -38, -35; -40, |
|---|
| 13 | -27; -40, -20; -42, -13; -47, -7; -54, -5; -54, -6], style(color=10, |
|---|
| 14 | fillColor=8)), |
|---|
| 15 | Polygon(points=[-75, -15; -79, -25; -80, -34; -78, -42; -72, -49; -64, - |
|---|
| 16 | 51; -57, -51; -47, -50; -57, -47; -65, -45; -71, -40; -74, -33; -76, |
|---|
| 17 | -23; -75, -15; -75, -15], style(color=0, fillColor=9)), |
|---|
| 18 | Polygon(points=[39, -6; 32, -7; 18, -15; 14, -24; 13, -34; 15, -42; 20, - |
|---|
| 19 | 49; 29, -51; 36, -51; 46, -50; 52, -43; 55, -35; 53, -27; 53, -20; |
|---|
| 20 | 51, -13; 46, -7; 39, -5; 39, -6], style(color=9, fillColor=8)), |
|---|
| 21 | Polygon(points=[18, -15; 14, -25; 13, -34; 15, -42; 21, -49; 29, -51; 36, |
|---|
| 22 | -51; 46, -50; 36, -47; 28, -45; 22, -40; 19, -33; 17, -23; 18, - |
|---|
| 23 | 15; 18, -15], style(color=0, fillColor=9)), |
|---|
| 24 | Polygon(points=[-9, -23; -9, -10; 18, -17; -9, -23], style( |
|---|
| 25 | color=42, |
|---|
| 26 | fillColor=42, |
|---|
| 27 | fillPattern=1)), |
|---|
| 28 | Line(points=[-41, -17; -9, -17], style(color=42, thickness=2)), |
|---|
| 29 | Line(points=[-17, -40; 15, -40], style(color=42, thickness=2)), |
|---|
| 30 | Polygon(points=[-17, -46; -17, -34; -40, -40; -17, -46], style( |
|---|
| 31 | color=42, |
|---|
| 32 | fillColor=42, |
|---|
| 33 | fillPattern=1))), Documentation(info="<HTML> |
|---|
| 34 | <p> |
|---|
| 35 | This package contains components to model <b>1-dimensional heat transfer</b> |
|---|
| 36 | with lumped elements. This allows especially to model heat transfer in |
|---|
| 37 | machines provided the parameters of the lumped elements, such as |
|---|
| 38 | the heat capacity of a part, can be determined by measurements |
|---|
| 39 | (due to the complex geometries and many materials used in machines, |
|---|
| 40 | calculating the lumped element parameters from some basic analytic |
|---|
| 41 | formulas is usually not possible). |
|---|
| 42 | </p> |
|---|
| 43 | <p> |
|---|
| 44 | Example models how to use this library are given in subpackage <b>Examples</b>.<br> |
|---|
| 45 | For a first simple example, see <b>Examples.TwoMasses</b> where two masses |
|---|
| 46 | with different initial temperatures are getting in contact to each |
|---|
| 47 | other and arriving after some time at a common temperature.<br> |
|---|
| 48 | <b>Examples.ControlledTemperature</b> shows how to hold a temperature |
|---|
| 49 | within desired limits by switching on and off an electric resistor.<br> |
|---|
| 50 | A more realistic example is provided in <b>Examples.Motor</b> where the |
|---|
| 51 | heating of an electrical motor is modelled, see the following screen shot |
|---|
| 52 | of this example: |
|---|
| 53 | </p> |
|---|
| 54 | <img src=\"../Images/driveWithHeatTransfer.png\" ALT=\"driveWithHeatTransfer\"> |
|---|
| 55 | <p> |
|---|
| 56 | The <b>filled</b> and <b>non-filled red squares</b> at the left and |
|---|
| 57 | right side of a component represent <b>thermal ports</b> (connector HeatPort). |
|---|
| 58 | Drawing a line between such squares means that they are thermally connected. |
|---|
| 59 | The variables of a HeatPort connector are the temperature <b>T</b> at the port |
|---|
| 60 | and the heat flow rate <b>Q_flow</b> flowing into the component (if Q_flow is positive, |
|---|
| 61 | the heat flows into the element, otherwise it flows out of the element): |
|---|
| 62 | </p> |
|---|
| 63 | <pre> Modelica.SIunits.Temperature T \"absolute temperature at port in Kelvin\"; |
|---|
| 64 | Modelica.SIunits.HeatFlowRate Q_flow \"flow rate at the port in Watt\"; |
|---|
| 65 | </pre> |
|---|
| 66 | <p> |
|---|
| 67 | Note, that all temperatures of this package, including initial conditions, |
|---|
| 68 | are given in Kelvin. For convenience, in subpackages <b>HeatTransfer.Celsius</b>, |
|---|
| 69 | <b>HeatTransfer.Fahrenheit</b> and <b>HeatTransfer.Rankine</b> components are provided such that source and |
|---|
| 70 | sensor information is available in degree Celsius, degree Fahrenheit, or degree Rankine, |
|---|
| 71 | respectively. Additionally, in package <b>SIunits.Conversions</b> conversion |
|---|
| 72 | functions between the units Kelvin and Celsius, Fahrenheit, Rankine are |
|---|
| 73 | provided. These functions may be used in the following way: |
|---|
| 74 | </p> |
|---|
| 75 | <pre> <b>import</b> SI=Modelica.SIunits; |
|---|
| 76 | <b>import</b> Modelica.SIunits.Conversions.*; |
|---|
| 77 | ... |
|---|
| 78 | <b>parameter</b> SI.Temperature T = from_degC(25); // convert 25 degree Celsius to Kelvin |
|---|
| 79 | </pre> |
|---|
| 80 | |
|---|
| 81 | <p> |
|---|
| 82 | There are several other components available, such as AxialConduction (discretized PDE in |
|---|
| 83 | axial direction), which have been temporarily removed from this library. The reason is that |
|---|
| 84 | these components reference material properties, such as thermal conductivity, and currently |
|---|
| 85 | the Modelica design group is discussing a general scheme to describe material properties. |
|---|
| 86 | </p> |
|---|
| 87 | <p> |
|---|
| 88 | For technical details in the design of this library, see the following reference:<br> |
|---|
| 89 | <b>Michael Tiller (2001)</b>: <a href=\"http://www.amazon.de\"> |
|---|
| 90 | Introduction to Physical Modeling with Modelica</a>. |
|---|
| 91 | Kluwer Academic Publishers Boston. |
|---|
| 92 | </p> |
|---|
| 93 | <p> |
|---|
| 94 | <b>Acknowledgements:</b><br> |
|---|
| 95 | Several helpful remarks from the following persons are acknowledged: |
|---|
| 96 | John Batteh, Ford Motors, Dearborn, U.S.A; |
|---|
| 97 | <a href=\"http://www.haumer.at/\">Anton Haumer</a>, Technical Consulting & Electrical Engineering, Austria; |
|---|
| 98 | Ludwig Marvan, VA TECH ELIN EBG Elektronik GmbH, Wien, Austria; |
|---|
| 99 | Hans Olsson, Dynasim AB, Sweden; |
|---|
| 100 | Hubertus Tummescheit, Lund Institute of Technology, Lund, Sweden. |
|---|
| 101 | </p> |
|---|
| 102 | <p><b>Copyright © 2001-2007, Modelica Association, Michael Tiller and DLR.</b></p> |
|---|
| 103 | <p><i> |
|---|
| 104 | This Modelica package is free software; it can be redistributed and/or modified |
|---|
| 105 | under the terms of the Modelica license, see the license conditions |
|---|
| 106 | and the accompanying disclaimer in the documentation of package |
|---|
| 107 | Modelica in file \"Modelica/package.mo\". |
|---|
| 108 | </i></p> |
|---|
| 109 | </HTML> |
|---|
| 110 | ", revisions="<html> |
|---|
| 111 | <ul> |
|---|
| 112 | <li><i>July 15, 2002</i> |
|---|
| 113 | by Michael Tiller, <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> |
|---|
| 114 | and <a href=\"http://www.robotic.dlr.de/Nikolaus.Schuermann/\">Nikolaus Schürmann</a>:<br> |
|---|
| 115 | Implemented. |
|---|
| 116 | </li> |
|---|
| 117 | <li><i>June 13, 2005</i> |
|---|
| 118 | by <a href=\"http://www.haumer.at/\">Anton Haumer</a><br> |
|---|
| 119 | Refined placing of connectors (cosmetic).<br> |
|---|
| 120 | Refined all Examples; removed Examples.FrequencyInverter, introducing Examples.Motor<br> |
|---|
| 121 | Introduced temperature dependent correction (1 + alpha*(T - T_ref)) in Fixed/PrescribedHeatFlow<br> |
|---|
| 122 | </li> |
|---|
| 123 | </ul> |
|---|
| 124 | </html>")); |
|---|
| 125 | package Examples |
|---|
| 126 | "Example models to demonstrate the usage of package Modelica.Thermal.HeatTransfer" |
|---|
| 127 | extends Modelica.Icons.Library2; |
|---|
| 128 | |
|---|
| 129 | model TwoMasses "Simple conduction demo" |
|---|
| 130 | extends Modelica.Icons.Example; |
|---|
| 131 | parameter SI.Temperature T_final_K(fixed=false) |
|---|
| 132 | "Projected final temperature"; |
|---|
| 133 | parameter NonSI.Temperature_degC T_final_degC(fixed=false) |
|---|
| 134 | "Projected final temperature"; |
|---|
| 135 | HeatTransfer.HeatCapacitor mass1(C=15, T(start=from_degC(100))) |
|---|
| 136 | annotation (extent=[-100, 20; -40, 80]); |
|---|
| 137 | HeatTransfer.HeatCapacitor mass2(C=15, T(start=from_degC(0))) annotation ( |
|---|
| 138 | extent=[40, 20; 100, 80]); |
|---|
| 139 | HeatTransfer.ThermalConductor conduction(G=10) annotation (extent=[-30, - |
|---|
| 140 | 20; 30, 40]); |
|---|
| 141 | annotation (Documentation(info="<HTML> |
|---|
| 142 | <p> |
|---|
| 143 | This example demonstrates the thermal response of two masses connected by |
|---|
| 144 | a conducting element. The two masses have the same heat capacity but different |
|---|
| 145 | initial temperatures (T1=100 [degC], T2= 0 [degC]). The mass with the higher |
|---|
| 146 | temperature will cool off while the mass with the lower temperature heats up. |
|---|
| 147 | They will each asymptotically approach the calculated temperature <b>T_final_K</b> |
|---|
| 148 | (<b>T_final_degC</b>) that results from dividing the total initial energy in the system by the sum |
|---|
| 149 | of the heat capacities of each element. |
|---|
| 150 | </p> |
|---|
| 151 | <p> |
|---|
| 152 | Simulate for 5 s and plot the variables<br> |
|---|
| 153 | mass1.T, mass2.T, T_final_K or <br> |
|---|
| 154 | Tsensor1.T, Tsensor2.T, T_final_degC |
|---|
| 155 | </p> |
|---|
| 156 | </HTML> |
|---|
| 157 | "), experiment(StopTime=5), |
|---|
| 158 | experimentSetupOutput); |
|---|
| 159 | HeatTransfer.Celsius.TemperatureSensor Tsensor1 annotation (extent=[-60, |
|---|
| 160 | -80; -20, -40]); |
|---|
| 161 | HeatTransfer.Celsius.TemperatureSensor Tsensor2 annotation (extent=[60, - |
|---|
| 162 | 80; 20, -40]); |
|---|
| 163 | equation |
|---|
| 164 | connect(mass1.port, conduction.port_a) annotation (points=[-70,20; -70,10; |
|---|
| 165 | -30,10], style(color=42)); |
|---|
| 166 | connect(conduction.port_b, mass2.port) annotation (points=[30,10; 70,10; |
|---|
| 167 | 70,20], style(color=42)); |
|---|
| 168 | connect(mass1.port, Tsensor1.port) annotation (points=[-70,20; -70,-60; |
|---|
| 169 | -60,-60], style(color=42)); |
|---|
| 170 | connect(mass2.port, Tsensor2.port) annotation (points=[70, 20; 70, -60; |
|---|
| 171 | 60, -60], style(color=42)); |
|---|
| 172 | initial equation |
|---|
| 173 | T_final_K = (mass1.port.T*mass1.C + mass2.port.T*mass2.C)/(mass1.C + |
|---|
| 174 | mass2.C); |
|---|
| 175 | T_final_degC = to_degC(T_final_K); |
|---|
| 176 | end TwoMasses; |
|---|
| 177 | |
|---|
| 178 | model ControlledTemperature "Control temperature of a resistor" |
|---|
| 179 | extends Modelica.Icons.Example; |
|---|
| 180 | parameter NonSI.Temperature_degC TAmb=20 "Ambient Temperature"; |
|---|
| 181 | parameter NonSI.Temperature_degC TDif=2 "Error in Temperature"; |
|---|
| 182 | output NonSI.Temperature_degC TRes = to_degC(HeatingResistor1.heatPort.T) |
|---|
| 183 | "Resulting Temperature"; |
|---|
| 184 | annotation (Documentation(info="<HTML> |
|---|
| 185 | <P> |
|---|
| 186 | A constant voltage of 10 V is applied to a |
|---|
| 187 | temperature dependent resistor of 10*(1+(T-20C)/(235+20C)) Ohms, |
|---|
| 188 | whose losses v**2/r are dissipated via a |
|---|
| 189 | thermal conductance of 0.1 W/K to ambient temperature 20 degree C. |
|---|
| 190 | The resistor is assumed to have a thermal capacity of 1 J/K, |
|---|
| 191 | having ambient temparature at the beginning of the experiment. |
|---|
| 192 | The temperature of this heating resistor is held by an OnOff-controller |
|---|
| 193 | at reference temperature within a given bandwith +/- 1 K |
|---|
| 194 | by switching on and off the voltage source. |
|---|
| 195 | The reference temperature starts at 25 degree C |
|---|
| 196 | and rises between t = 2 and 8 seconds linear to 50 degree C. |
|---|
| 197 | An approppriate simulating time would be 10 seconds. |
|---|
| 198 | </P> |
|---|
| 199 | </HTML> |
|---|
| 200 | "), Diagram, |
|---|
| 201 | experiment(StopTime=10), |
|---|
| 202 | experimentSetupOutput); |
|---|
| 203 | Modelica.Electrical.Analog.Basic.Ground Ground1 |
|---|
| 204 | annotation (extent=[-100, -100; -80, -80]); |
|---|
| 205 | Modelica.Electrical.Analog.Sources.ConstantVoltage ConstantVoltage1(V=10) |
|---|
| 206 | annotation (extent= |
|---|
| 207 | [-100, -60; -80, -40], rotation=-90); |
|---|
| 208 | HeatTransfer.HeatCapacitor HeatCapacitor1(C=1, T(start=from_degC(TAmb))) |
|---|
| 209 | annotation (extent=[0, -60; 20, -80]); |
|---|
| 210 | Modelica.Electrical.Analog.Basic.HeatingResistor HeatingResistor1( |
|---|
| 211 | R_ref=10, |
|---|
| 212 | T_ref=from_degC(20), |
|---|
| 213 | alpha=1/(235 + 20)) annotation (extent=[-20, -60; -40, -40], rotation=- |
|---|
| 214 | 90); |
|---|
| 215 | HeatTransfer.Celsius.FixedTemperature FixedTemperature1(T=TAmb) |
|---|
| 216 | annotation (extent=[100, -60; 80, -40]); |
|---|
| 217 | HeatTransfer.Celsius.TemperatureSensor TemperatureSensor1 annotation ( |
|---|
| 218 | extent=[0, -40; 20, -20], rotation=90); |
|---|
| 219 | HeatTransfer.ThermalConductor ThermalConductor1(G=0.1) annotation (extent=[40, |
|---|
| 220 | -60; 60,-40]); |
|---|
| 221 | Modelica.Electrical.Analog.Ideal.IdealOpeningSwitch IdealSwitch1 |
|---|
| 222 | annotation (extent=[-70, -50; -50, -30]); |
|---|
| 223 | Modelica.Blocks.Sources.Ramp Ramp1( |
|---|
| 224 | height=25, |
|---|
| 225 | duration=6, |
|---|
| 226 | offset=25, |
|---|
| 227 | startTime=2) annotation (extent=[40,0; 20,20]); |
|---|
| 228 | Modelica.Blocks.Logical.OnOffController OnOffController1(bandwidth=TDif) |
|---|
| 229 | annotation (extent=[0,-20; -20,0]); |
|---|
| 230 | Modelica.Blocks.Logical.Not Not1 annotation (extent=[-30,-20; -50,0]); |
|---|
| 231 | equation |
|---|
| 232 | connect(ConstantVoltage1.n, HeatingResistor1.n) annotation (points=[-90, |
|---|
| 233 | -60; -30, -60], style(color=3)); |
|---|
| 234 | connect(ConstantVoltage1.n, Ground1.p) annotation (points=[-90, -60; -90, |
|---|
| 235 | -80], style(color=3)); |
|---|
| 236 | connect(HeatingResistor1.heatPort, ThermalConductor1.port_a) annotation ( |
|---|
| 237 | points=[-20,-50; 40,-50], style(color=42)); |
|---|
| 238 | connect(ThermalConductor1.port_b, FixedTemperature1.port) annotation ( |
|---|
| 239 | points=[60,-50; 80,-50], style(color=42)); |
|---|
| 240 | connect(HeatingResistor1.heatPort, TemperatureSensor1.port) annotation ( |
|---|
| 241 | points=[-20, -50; 10, -50; 10, -40], style(color=42)); |
|---|
| 242 | connect(HeatingResistor1.heatPort, HeatCapacitor1.port) annotation ( |
|---|
| 243 | points=[-20, -50; 10, -50; 10, -60], style(color=42)); |
|---|
| 244 | connect(ConstantVoltage1.p, IdealSwitch1.p) annotation (points=[-90, -40; |
|---|
| 245 | -70, -40], style(color=3)); |
|---|
| 246 | connect(IdealSwitch1.n, HeatingResistor1.p) annotation (points=[-50, -40; |
|---|
| 247 | -30, -40], style(color=3)); |
|---|
| 248 | connect(Ramp1.y, OnOffController1.reference) annotation (points=[19,10; |
|---|
| 249 | 10,10; 10,-4; 2,-4], style(color=74, rgbcolor={0,0,127})); |
|---|
| 250 | connect(TemperatureSensor1.T, OnOffController1.u) annotation (points=[10, |
|---|
| 251 | -20; 10,-16; 2,-16], style(color=74, rgbcolor={0,0,127})); |
|---|
| 252 | connect(OnOffController1.y, Not1.u) annotation (points=[-21,-10; -28,-10], |
|---|
| 253 | style(color=5, rgbcolor={255,0,255})); |
|---|
| 254 | connect(Not1.y, IdealSwitch1.control) annotation (points=[-51,-10; -60, |
|---|
| 255 | -10; -60,-33], style(color=5, rgbcolor={255,0,255})); |
|---|
| 256 | end ControlledTemperature; |
|---|
| 257 | |
|---|
| 258 | model Motor "Second order thermal model of a motor" |
|---|
| 259 | extends Modelica.Icons.Example; |
|---|
| 260 | parameter NonSI.Temperature_degC TAmb = 20 "Ambient temperature"; |
|---|
| 261 | annotation (Documentation(info="<HTML> |
|---|
| 262 | <p> |
|---|
| 263 | This example contains a simple second order thermal model of a motor. |
|---|
| 264 | The periodic power losses are described by table \"lossTable\":<br> |
|---|
| 265 | <table> |
|---|
| 266 | <tr><td valign=\"top\">time</td><td valign=\"top\">winding losses</td><td valign=\"top\">core losses</td></tr> |
|---|
| 267 | <tr><td valign=\"top\"> 0</td><td valign=\"top\"> 100</td><td valign=\"top\"> 500</td></tr> |
|---|
| 268 | <tr><td valign=\"top\"> 360</td><td valign=\"top\"> 100</td><td valign=\"top\"> 500</td></tr> |
|---|
| 269 | <tr><td valign=\"top\"> 360</td><td valign=\"top\"> 1000</td><td valign=\"top\"> 500</td></tr> |
|---|
| 270 | <tr><td valign=\"top\"> 600</td><td valign=\"top\"> 1000</td><td valign=\"top\"> 500</td></tr> |
|---|
| 271 | </table><br> |
|---|
| 272 | Since constant speed is assumed, the core losses keep constant |
|---|
| 273 | whereas the winding losses are low for 6 minutes (no-load) and high for 4 minutes (over load). |
|---|
| 274 | <br> |
|---|
| 275 | The winding losses are corrected by (1 + alpha*(T - T_ref)) because the winding's resistance is temperature dependent whereas the core losses are kept constant (alpha = 0). |
|---|
| 276 | </p> |
|---|
| 277 | <p> |
|---|
| 278 | The power dissipation to the environment is approximated by heat flow through |
|---|
| 279 | a thermal conductance between winding and core, |
|---|
| 280 | partially storage of the heat in the winding's heat capacity |
|---|
| 281 | as well as the core's heat capacity and finally by forced convection to the environment.<br> |
|---|
| 282 | Since constant speed is assumed, the cinvective conductance keeps constant.<br> |
|---|
| 283 | Using Modelica.Thermal.FluidHeatFlow it would be possible to model the coolant air flow, too |
|---|
| 284 | (instead of simple dissipation to a constant ambient's temperature). |
|---|
| 285 | </p> |
|---|
| 286 | <p> |
|---|
| 287 | Simulate for 7200 s; plot Twinding.T and Tcore.T. |
|---|
| 288 | </p> |
|---|
| 289 | </HTML> |
|---|
| 290 | "), experiment(StopTime=7200), |
|---|
| 291 | experimentSetupOutput, |
|---|
| 292 | Diagram); |
|---|
| 293 | Modelica.Blocks.Sources.CombiTimeTable lossTable(extrapolation=Modelica. |
|---|
| 294 | Blocks.Types.Extrapolation.Periodic, table=[0,100,500; 360,100,500; |
|---|
| 295 | 360,1000,500; 600,1000,500]) |
|---|
| 296 | annotation (extent=[-50,60; -30,80], rotation= |
|---|
| 297 | -90); |
|---|
| 298 | HeatTransfer.PrescribedHeatFlow windingLosses(T_ref=from_degC(95), alpha= |
|---|
| 299 | 3.03E-3) annotation (extent=[-90,0; -70,20], |
|---|
| 300 | rotation=-90); |
|---|
| 301 | HeatTransfer.HeatCapacitor winding(T(start=from_degC(TAmb)), C=2500) |
|---|
| 302 | annotation (extent=[-90,-20; -70, |
|---|
| 303 | -40]); |
|---|
| 304 | HeatTransfer.Celsius.TemperatureSensor Twinding |
|---|
| 305 | annotation (extent=[-70, |
|---|
| 306 | -60; -50,-40], rotation=-90); |
|---|
| 307 | HeatTransfer.ThermalConductor winding2core(G=10) |
|---|
| 308 | annotation (extent=[-50,-20; -30,0]); |
|---|
| 309 | HeatTransfer.PrescribedHeatFlow coreLosses |
|---|
| 310 | annotation (extent=[-10,0; 10,20], |
|---|
| 311 | rotation=-90); |
|---|
| 312 | HeatTransfer.HeatCapacitor core(T(start=from_degC(TAmb)), C=25000) |
|---|
| 313 | annotation (extent=[-10,-20; 10,-40]); |
|---|
| 314 | HeatTransfer.Celsius.TemperatureSensor Tcore annotation (extent=[-30, |
|---|
| 315 | -60; -10,-40], |
|---|
| 316 | rotation=-90); |
|---|
| 317 | Modelica.Blocks.Sources.Constant convectionConstant(k=25) |
|---|
| 318 | annotation (extent=[30,20; 50,40], rotation=-90); |
|---|
| 319 | HeatTransfer.Convection convection annotation (extent=[30,-20; 50,0]); |
|---|
| 320 | HeatTransfer.Celsius.FixedTemperature environment(T=TAmb) |
|---|
| 321 | annotation ( |
|---|
| 322 | extent=[70,-20; 90,0], rotation=180); |
|---|
| 323 | equation |
|---|
| 324 | connect(windingLosses.port, winding.port) annotation (points=[-80,0; -80, |
|---|
| 325 | -20], style(color=42, rgbcolor={191,0,0})); |
|---|
| 326 | connect(coreLosses.port, core.port) annotation (points=[6.12303e-016,0; |
|---|
| 327 | 6.12303e-016,-10; 0,-10; 0,-20], |
|---|
| 328 | style(color=42, rgbcolor={191,0,0})); |
|---|
| 329 | connect(winding.port, winding2core.port_a) |
|---|
| 330 | annotation (points=[-80,-20; -80,-10; |
|---|
| 331 | -50,-10], style(color=42, rgbcolor={191,0,0})); |
|---|
| 332 | connect(winding2core.port_b, core.port) |
|---|
| 333 | annotation (points=[-30,-10; 0,-10; 0,-20], |
|---|
| 334 | style(color=42, rgbcolor={191,0,0})); |
|---|
| 335 | connect(winding.port, Twinding.port) annotation (points=[-80,-20; -80, |
|---|
| 336 | -10; -60,-10; -60,-40], style(color=42, rgbcolor={191,0,0})); |
|---|
| 337 | connect(core.port, Tcore.port) annotation (points=[0,-20; 0,-10; -20,-10; |
|---|
| 338 | -20,-40], style(color=42, rgbcolor={191,0,0})); |
|---|
| 339 | connect(winding2core.port_b, convection.solid) |
|---|
| 340 | annotation (points=[-30,-10; 30,-10], |
|---|
| 341 | style(color=42, rgbcolor={191,0,0})); |
|---|
| 342 | connect(convection.fluid, environment.port) annotation (points=[50,-10; |
|---|
| 343 | 60,-10; 60,-10; 70,-10], style(color=42, rgbcolor={191,0,0})); |
|---|
| 344 | connect(convectionConstant.y, convection.Gc) |
|---|
| 345 | annotation (points=[40,19; 40,0], style(color=74, rgbcolor={0,0,127})); |
|---|
| 346 | connect(lossTable.y[1], windingLosses.Q_flow) annotation (points=[-40,59; |
|---|
| 347 | -40,40; -80,40; -80,20], style(color=74, rgbcolor={0,0,127})); |
|---|
| 348 | connect(lossTable.y[2], coreLosses.Q_flow) annotation (points=[-40,59; |
|---|
| 349 | -40,40; -6.12303e-016,40; -6.12303e-016,20], |
|---|
| 350 | style(color=74, rgbcolor={0,0,127})); |
|---|
| 351 | end Motor; |
|---|
| 352 | annotation (Icon( |
|---|
| 353 | Ellipse(extent=[-60,10; 40,-90], style(color=10, rgbcolor={135,135,135})), |
|---|
| 354 | Polygon(points=[-30,-12; -30,-68; 28,-40; -30,-12], style( |
|---|
| 355 | color=10, |
|---|
| 356 | rgbcolor={135,135,135}, |
|---|
| 357 | fillColor=10, |
|---|
| 358 | rgbfillColor={135,135,135}, |
|---|
| 359 | fillPattern=1))), Documentation(info="<html> |
|---|
| 360 | |
|---|
| 361 | </html>")); |
|---|
| 362 | end Examples; |
|---|
| 363 | |
|---|
| 364 | package Interfaces "Connectors and partial models" |
|---|
| 365 | |
|---|
| 366 | extends Modelica.Icons.Library2; |
|---|
| 367 | |
|---|
| 368 | partial connector HeatPort "Thermal port for 1-dim. heat transfer" |
|---|
| 369 | SI.Temperature T "Port temperature"; |
|---|
| 370 | flow SI.HeatFlowRate Q_flow |
|---|
| 371 | "Heat flow rate (positive if flowing from outside into the component)"; |
|---|
| 372 | annotation (Documentation(info="<html> |
|---|
| 373 | |
|---|
| 374 | </html>")); |
|---|
| 375 | end HeatPort; |
|---|
| 376 | |
|---|
| 377 | connector HeatPort_a |
|---|
| 378 | "Thermal port for 1-dim. heat transfer (filled rectangular icon)" |
|---|
| 379 | |
|---|
| 380 | extends HeatPort; |
|---|
| 381 | |
|---|
| 382 | annotation(defaultComponentName = "port_a", |
|---|
| 383 | Documentation(info="<HTML> |
|---|
| 384 | <p>This connector is used for 1-dimensional heat flow between components. |
|---|
| 385 | The variables in the connector are:</p> |
|---|
| 386 | <pre> |
|---|
| 387 | T Temperature in [Kelvin]. |
|---|
| 388 | Q_flow Heat flow rate in [Watt]. |
|---|
| 389 | </pre> |
|---|
| 390 | <p>According to the Modelica sign convention, a <b>positive</b> heat flow |
|---|
| 391 | rate <b>Q_flow</b> is considered to flow <b>into</b> a component. This |
|---|
| 392 | convention has to be used whenever this connector is used in a model |
|---|
| 393 | class.</p> |
|---|
| 394 | <p>Note, that the two connector classes <b>HeatPort_a</b> and |
|---|
| 395 | <b>HeatPort_b</b> are identical with the only exception of the different |
|---|
| 396 | <b>icon layout</b>.</p></HTML> |
|---|
| 397 | "), Icon(Rectangle(extent=[-100, 100; 100, -100], style(color=42, fillColor= |
|---|
| 398 | 42))), |
|---|
| 399 | Diagram(Rectangle(extent=[-50,50; 50,-50], style(color=42, |
|---|
| 400 | fillColor=42)), Text( |
|---|
| 401 | extent=[-120,120; 100,60], |
|---|
| 402 | string="%name", |
|---|
| 403 | style(color=42)))); |
|---|
| 404 | end HeatPort_a; |
|---|
| 405 | |
|---|
| 406 | connector HeatPort_b |
|---|
| 407 | "Thermal port for 1-dim. heat transfer (unfilled rectangular icon)" |
|---|
| 408 | |
|---|
| 409 | extends HeatPort; |
|---|
| 410 | |
|---|
| 411 | annotation(defaultComponentName = "port_b", |
|---|
| 412 | Documentation(info="<HTML> |
|---|
| 413 | <p>This connector is used for 1-dimensional heat flow between components. |
|---|
| 414 | The variables in the connector are:</p> |
|---|
| 415 | <pre> |
|---|
| 416 | T Temperature in [Kelvin]. |
|---|
| 417 | Q_flow Heat flow rate in [Watt]. |
|---|
| 418 | </pre> |
|---|
| 419 | <p>According to the Modelica sign convention, a <b>positive</b> heat flow |
|---|
| 420 | rate <b>Q_flow</b> is considered to flow <b>into</b> a component. This |
|---|
| 421 | convention has to be used whenever this connector is used in a model |
|---|
| 422 | class.</p> |
|---|
| 423 | <p>Note, that the two connector classes <b>HeatPort_a</b> and |
|---|
| 424 | <b>HeatPort_b</b> are identical with the only exception of the different |
|---|
| 425 | <b>icon layout</b>.</p></HTML> |
|---|
| 426 | "), Diagram(Rectangle(extent=[-50,50; 50,-50], style(color=42, |
|---|
| 427 | fillColor=7)), Text( |
|---|
| 428 | extent=[-100,120; 120,60], |
|---|
| 429 | string="%name", |
|---|
| 430 | style(color=42))), |
|---|
| 431 | Icon(Rectangle(extent=[-100, 100; 100, -100], style(color=42, fillColor= |
|---|
| 432 | 7)))); |
|---|
| 433 | end HeatPort_b; |
|---|
| 434 | |
|---|
| 435 | partial model Element1D |
|---|
| 436 | "Partial heat transfer element with two HeatPort connectors that does not store energy" |
|---|
| 437 | |
|---|
| 438 | SI.HeatFlowRate Q_flow "Heat flow rate from port_a -> port_b"; |
|---|
| 439 | SI.TemperatureDifference dT "port_a.T - port_b.T"; |
|---|
| 440 | public |
|---|
| 441 | HeatPort_a port_a annotation (extent=[-110,-10; -90,10]); |
|---|
| 442 | HeatPort_b port_b annotation (extent=[90,-10; 110,10]); |
|---|
| 443 | annotation (Documentation(info="<HTML> |
|---|
| 444 | <p> |
|---|
| 445 | This partial model contains the basic connectors and variables to |
|---|
| 446 | allow heat transfer models to be created that <b>do not store energy</b>, |
|---|
| 447 | This model defines and includes equations for the temperature |
|---|
| 448 | drop across the element, <b>dT</b>, and the heat flow rate |
|---|
| 449 | through the element from port_a to port_b, <b>Q_flow</b>. |
|---|
| 450 | </p> |
|---|
| 451 | <p> |
|---|
| 452 | By extending this model, it is possible to write simple |
|---|
| 453 | constitutive equations for many types of heat transfer components. |
|---|
| 454 | </p> |
|---|
| 455 | </HTML> |
|---|
| 456 | "), Icon, |
|---|
| 457 | Diagram); |
|---|
| 458 | equation |
|---|
| 459 | dT = port_a.T - port_b.T; |
|---|
| 460 | port_a.Q_flow = Q_flow; |
|---|
| 461 | port_b.Q_flow = -Q_flow; |
|---|
| 462 | end Element1D; |
|---|
| 463 | annotation (Icon( |
|---|
| 464 | Rectangle(extent=[-60,10; 40,-90], style(color=42, |
|---|
| 465 | fillColor=42))), Documentation(info="<html> |
|---|
| 466 | |
|---|
| 467 | </html>")); |
|---|
| 468 | end Interfaces; |
|---|
| 469 | |
|---|
| 470 | model HeatCapacitor "Lumped thermal element storing heat" |
|---|
| 471 | parameter SI.HeatCapacity C "Heat capacity of part (= cp*m)"; |
|---|
| 472 | parameter Boolean steadyStateStart=false |
|---|
| 473 | "true, if component shall start in steady state"; |
|---|
| 474 | SI.Temperature T(start=from_degC(20)) "Temperature of part"; |
|---|
| 475 | annotation ( |
|---|
| 476 | Icon( |
|---|
| 477 | Text(extent=[-129, 121; 131, 70], string="%name"), |
|---|
| 478 | Polygon(points=[0,67; -20,63; -40,57; -52,43; -58,35; -68,25; -72,13; |
|---|
| 479 | -76,-1; -78,-15; -76,-31; -76,-43; -76,-53; -70,-65; -64,-73; -48, |
|---|
| 480 | -77; -30,-83 |
|---|