| 1 | within Modelica.Blocks; |
|---|
| 2 | package Math "Library of mathematical functions as input/output blocks" |
|---|
| 3 | import Modelica.SIunits; |
|---|
| 4 | import Modelica.Blocks.Interfaces; |
|---|
| 5 | extends Modelica.Icons.Library; |
|---|
| 6 | |
|---|
| 7 | annotation ( |
|---|
| 8 | Documentation(info=" |
|---|
| 9 | <HTML> |
|---|
| 10 | <p> |
|---|
| 11 | This package contains basic <b>mathematical operations</b>, |
|---|
| 12 | such as summation and multiplication, and basic <b>mathematical |
|---|
| 13 | functions</b>, such as <b>sqrt</b> and <b>sin</b>, as |
|---|
| 14 | input/output blocks. All blocks of this library can be either |
|---|
| 15 | connected with continuous blocks or with sampled-data blocks. |
|---|
| 16 | </p> |
|---|
| 17 | </HTML> |
|---|
| 18 | ", revisions="<html> |
|---|
| 19 | <ul> |
|---|
| 20 | <li><i>October 21, 2002</i> |
|---|
| 21 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> |
|---|
| 22 | and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br> |
|---|
| 23 | New blocks added: RealToInteger, IntegerToReal, Max, Min, Edge, BooleanChange, IntegerChange.</li> |
|---|
| 24 | <li><i>August 7, 1999</i> |
|---|
| 25 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br> |
|---|
| 26 | Realized (partly based on an existing Dymola library |
|---|
| 27 | of Dieter Moormann and Hilding Elmqvist). |
|---|
| 28 | </li> |
|---|
| 29 | </ul> |
|---|
| 30 | </html>")); |
|---|
| 31 | |
|---|
| 32 | encapsulated package UnitConversions |
|---|
| 33 | "Conversion blocks to convert between SI and non-SI unit signals" |
|---|
| 34 | import Modelica; |
|---|
| 35 | import SI = Modelica.SIunits; |
|---|
| 36 | import NonSI = Modelica.SIunits.Conversions.NonSIunits; |
|---|
| 37 | |
|---|
| 38 | block To_degC "Convert from Kelvin to °Celsius" |
|---|
| 39 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="K"), y( |
|---|
| 40 | unit="degC")); |
|---|
| 41 | |
|---|
| 42 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 43 | -100},{100,100}}), graphics={Text( |
|---|
| 44 | extent={{-20,100},{-100,20}}, |
|---|
| 45 | lineColor={0,0,0}, |
|---|
| 46 | textString="K"), Text( |
|---|
| 47 | extent={{100,-20},{20,-100}}, |
|---|
| 48 | lineColor={0,0,0}, |
|---|
| 49 | textString="°C")}), |
|---|
| 50 | Documentation(info="<html> |
|---|
| 51 | <p> |
|---|
| 52 | This block converts the input signal from Kelvin to °Celsius and returns |
|---|
| 53 | the result as output signal. |
|---|
| 54 | </p> |
|---|
| 55 | </html>")); |
|---|
| 56 | equation |
|---|
| 57 | y = SI.Conversions.to_degC(u); |
|---|
| 58 | end To_degC; |
|---|
| 59 | |
|---|
| 60 | block From_degC "Convert from °Celsius to Kelvin" |
|---|
| 61 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="degC"), |
|---|
| 62 | y(unit="K")); |
|---|
| 63 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 64 | -100},{100,100}}), graphics={Text( |
|---|
| 65 | extent={{-20,100},{-100,20}}, |
|---|
| 66 | lineColor={0,0,0}, |
|---|
| 67 | textString="°C"), Text( |
|---|
| 68 | extent={{100,-20},{20,-100}}, |
|---|
| 69 | lineColor={0,0,0}, |
|---|
| 70 | textString="K")}), |
|---|
| 71 | Documentation(info="<html> |
|---|
| 72 | <p> |
|---|
| 73 | This block converts the input signal from °Celsius to Kelvin and returns |
|---|
| 74 | the result as output signal. |
|---|
| 75 | </p> |
|---|
| 76 | </html>")); |
|---|
| 77 | equation |
|---|
| 78 | y = SI.Conversions.from_degC(u); |
|---|
| 79 | end From_degC; |
|---|
| 80 | |
|---|
| 81 | block To_degF "Convert from Kelvin to °Fahrenheit" |
|---|
| 82 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="K"), y( |
|---|
| 83 | unit="degF")); |
|---|
| 84 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 85 | -100},{100,100}}), graphics={Text( |
|---|
| 86 | extent={{-20,100},{-100,20}}, |
|---|
| 87 | lineColor={0,0,0}, |
|---|
| 88 | textString="K"), Text( |
|---|
| 89 | extent={{100,-20},{20,-100}}, |
|---|
| 90 | lineColor={0,0,0}, |
|---|
| 91 | textString="°F")}), |
|---|
| 92 | Documentation(info="<html> |
|---|
| 93 | <p> |
|---|
| 94 | This block converts the input signal from Kelvin to °Fahrenheit and returns |
|---|
| 95 | the result as output signal. |
|---|
| 96 | </p> |
|---|
| 97 | </html>")); |
|---|
| 98 | equation |
|---|
| 99 | y = SI.Conversions.to_degF(u); |
|---|
| 100 | end To_degF; |
|---|
| 101 | |
|---|
| 102 | block From_degF "Convert from °Fahrenheit to Kelvin" |
|---|
| 103 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="degF"), |
|---|
| 104 | y(unit="K")); |
|---|
| 105 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 106 | -100},{100,100}}), graphics={Text( |
|---|
| 107 | extent={{-20,100},{-100,20}}, |
|---|
| 108 | lineColor={0,0,0}, |
|---|
| 109 | textString="°F"), Text( |
|---|
| 110 | extent={{100,-20},{20,-100}}, |
|---|
| 111 | lineColor={0,0,0}, |
|---|
| 112 | textString="K")}), |
|---|
| 113 | Documentation(info="<html> |
|---|
| 114 | <p> |
|---|
| 115 | This block converts the input signal from °Fahrenheit to Kelvin and returns |
|---|
| 116 | the result as output signal. |
|---|
| 117 | </p> |
|---|
| 118 | </html>")); |
|---|
| 119 | equation |
|---|
| 120 | y = SI.Conversions.from_degF(u); |
|---|
| 121 | end From_degF; |
|---|
| 122 | |
|---|
| 123 | block To_degRk "Convert from Kelvin to °Rankine" |
|---|
| 124 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="K"), y( |
|---|
| 125 | unit="degRk")); |
|---|
| 126 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 127 | -100},{100,100}}), graphics={Text( |
|---|
| 128 | extent={{-20,100},{-100,20}}, |
|---|
| 129 | lineColor={0,0,0}, |
|---|
| 130 | textString="K"), Text( |
|---|
| 131 | extent={{100,-20},{20,-100}}, |
|---|
| 132 | lineColor={0,0,0}, |
|---|
| 133 | textString="°Rk")}), |
|---|
| 134 | Documentation(info="<html> |
|---|
| 135 | <p> |
|---|
| 136 | This block converts the input signal from Kelvin to °Rankine and returns |
|---|
| 137 | the result as output signal. |
|---|
| 138 | </p> |
|---|
| 139 | </html>")); |
|---|
| 140 | equation |
|---|
| 141 | y = SI.Conversions.to_degRk(u); |
|---|
| 142 | end To_degRk; |
|---|
| 143 | |
|---|
| 144 | block From_degRk "Convert from °Rankine to Kelvin" |
|---|
| 145 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="degRk"), |
|---|
| 146 | y(unit="K")); |
|---|
| 147 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 148 | -100},{100,100}}), graphics={Text( |
|---|
| 149 | extent={{-20,100},{-100,20}}, |
|---|
| 150 | lineColor={0,0,0}, |
|---|
| 151 | textString="°Rk"), Text( |
|---|
| 152 | extent={{100,-20},{20,-100}}, |
|---|
| 153 | lineColor={0,0,0}, |
|---|
| 154 | textString="K")}), |
|---|
| 155 | Documentation(info="<html> |
|---|
| 156 | <p> |
|---|
| 157 | This block converts the input signal from °Rankine to Kelvin and returns |
|---|
| 158 | the result as output signal. |
|---|
| 159 | </p> |
|---|
| 160 | </html>")); |
|---|
| 161 | equation |
|---|
| 162 | y = SI.Conversions.from_degRk(u); |
|---|
| 163 | end From_degRk; |
|---|
| 164 | |
|---|
| 165 | block To_deg "Convert from radian to degree" |
|---|
| 166 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="rad"), |
|---|
| 167 | y(unit="deg")); |
|---|
| 168 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 169 | -100},{100,100}}), graphics={Text( |
|---|
| 170 | extent={{-20,100},{-100,20}}, |
|---|
| 171 | lineColor={0,0,0}, |
|---|
| 172 | textString="rad"), Text( |
|---|
| 173 | extent={{100,-20},{20,-100}}, |
|---|
| 174 | lineColor={0,0,0}, |
|---|
| 175 | textString="deg")}), |
|---|
| 176 | Documentation(info="<html> |
|---|
| 177 | <p> |
|---|
| 178 | This block converts the input signal from radian to degree and returns |
|---|
| 179 | the result as output signal. |
|---|
| 180 | </p> |
|---|
| 181 | </html>")); |
|---|
| 182 | equation |
|---|
| 183 | y = SI.Conversions.to_deg(u); |
|---|
| 184 | end To_deg; |
|---|
| 185 | |
|---|
| 186 | block From_deg "Convert from degree to radian" |
|---|
| 187 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="deg"), |
|---|
| 188 | y(unit="rad")); |
|---|
| 189 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 190 | -100},{100,100}}), graphics={Text( |
|---|
| 191 | extent={{-20,100},{-100,20}}, |
|---|
| 192 | lineColor={0,0,0}, |
|---|
| 193 | textString="deg"), Text( |
|---|
| 194 | extent={{100,-20},{20,-100}}, |
|---|
| 195 | lineColor={0,0,0}, |
|---|
| 196 | textString="rad")}), |
|---|
| 197 | Documentation(info="<html> |
|---|
| 198 | <p> |
|---|
| 199 | This block converts the input signal from degree to radian and returns |
|---|
| 200 | the result as output signal. |
|---|
| 201 | </p> |
|---|
| 202 | </html>")); |
|---|
| 203 | equation |
|---|
| 204 | y = SI.Conversions.from_deg(u); |
|---|
| 205 | end From_deg; |
|---|
| 206 | |
|---|
| 207 | block To_rpm "Convert from radian per second to revolutions per minute" |
|---|
| 208 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="rad/s"), |
|---|
| 209 | y(unit="1/min")); |
|---|
| 210 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 211 | -100},{100,100}}), graphics={Text( |
|---|
| 212 | extent={{26,82},{-98,50}}, |
|---|
| 213 | lineColor={0,0,0}, |
|---|
| 214 | textString="rad/s"), Text( |
|---|
| 215 | extent={{100,-42},{-62,-74}}, |
|---|
| 216 | lineColor={0,0,0}, |
|---|
| 217 | textString="1/min")}), |
|---|
| 218 | Documentation(info="<html> |
|---|
| 219 | <p> |
|---|
| 220 | This block converts the input signal from radian per second to revolutions per minute and returns |
|---|
| 221 | the result as output signal. |
|---|
| 222 | </p> |
|---|
| 223 | </html>")); |
|---|
| 224 | equation |
|---|
| 225 | y = SI.Conversions.to_rpm(u); |
|---|
| 226 | end To_rpm; |
|---|
| 227 | |
|---|
| 228 | block From_rpm "Convert from revolutions per minute to radian per second" |
|---|
| 229 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit= |
|---|
| 230 | "1/min"), y(unit="rad/s")); |
|---|
| 231 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 232 | -100},{100,100}}), graphics={Text( |
|---|
| 233 | extent={{50,84},{-94,56}}, |
|---|
| 234 | lineColor={0,0,0}, |
|---|
| 235 | textString="1/min"), Text( |
|---|
| 236 | extent={{94,-42},{-26,-74}}, |
|---|
| 237 | lineColor={0,0,0}, |
|---|
| 238 | textString="rad/s")}), |
|---|
| 239 | Documentation(info="<html> |
|---|
| 240 | <p> |
|---|
| 241 | This block converts the input signal from revolutions per minute to radian per second and returns |
|---|
| 242 | the result as output signal. |
|---|
| 243 | </p> |
|---|
| 244 | </html>")); |
|---|
| 245 | equation |
|---|
| 246 | y = SI.Conversions.from_rpm(u); |
|---|
| 247 | end From_rpm; |
|---|
| 248 | |
|---|
| 249 | block To_kmh "Convert from metre per second to kilometre per hour" |
|---|
| 250 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="m/s"), |
|---|
| 251 | y(unit="km/h")); |
|---|
| 252 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 253 | -100},{100,100}}), graphics={Text( |
|---|
| 254 | extent={{0,82},{-96,42}}, |
|---|
| 255 | lineColor={0,0,0}, |
|---|
| 256 | textString="m/s"), Text( |
|---|
| 257 | extent={{92,-40},{-14,-84}}, |
|---|
| 258 | lineColor={0,0,0}, |
|---|
| 259 | textString="km/h")}), |
|---|
| 260 | Documentation(info="<html> |
|---|
| 261 | <p> |
|---|
| 262 | This block converts the input signal from metre per second to kilometre per hour and returns |
|---|
| 263 | the result as output signal. |
|---|
| 264 | </p> |
|---|
| 265 | </html>")); |
|---|
| 266 | equation |
|---|
| 267 | y = SI.Conversions.to_kmh(u); |
|---|
| 268 | end To_kmh; |
|---|
| 269 | |
|---|
| 270 | block From_kmh "Convert from kilometre per hour to metre per second" |
|---|
| 271 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="km/h"), |
|---|
| 272 | y(unit="m/s")); |
|---|
| 273 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 274 | -100},{100,100}}), graphics={Text( |
|---|
| 275 | extent={{26,80},{-96,48}}, |
|---|
| 276 | lineColor={0,0,0}, |
|---|
| 277 | textString="km/h"), Text( |
|---|
| 278 | extent={{92,-46},{-20,-82}}, |
|---|
| 279 | lineColor={0,0,0}, |
|---|
| 280 | textString="m/s")}), |
|---|
| 281 | Documentation(info="<html> |
|---|
| 282 | <p> |
|---|
| 283 | This block converts the input signal from kilometre per hour to metre per second and returns |
|---|
| 284 | the result as output signal. |
|---|
| 285 | </p> |
|---|
| 286 | </html>")); |
|---|
| 287 | equation |
|---|
| 288 | y = SI.Conversions.from_kmh(u); |
|---|
| 289 | end From_kmh; |
|---|
| 290 | |
|---|
| 291 | block To_day "Convert from second to day" |
|---|
| 292 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="s"), y( |
|---|
| 293 | unit="d")); |
|---|
| 294 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 295 | -100},{100,100}}), graphics={Text( |
|---|
| 296 | extent={{-20,100},{-100,20}}, |
|---|
| 297 | lineColor={0,0,0}, |
|---|
| 298 | textString="s"), Text( |
|---|
| 299 | extent={{100,-20},{20,-100}}, |
|---|
| 300 | lineColor={0,0,0}, |
|---|
| 301 | textString="day")}), |
|---|
| 302 | Documentation(info="<html> |
|---|
| 303 | <p> |
|---|
| 304 | This block converts the input signal from second to day and returns |
|---|
| 305 | the result as output signal. |
|---|
| 306 | </p> |
|---|
| 307 | </html>")); |
|---|
| 308 | equation |
|---|
| 309 | y = SI.Conversions.to_day(u); |
|---|
| 310 | end To_day; |
|---|
| 311 | |
|---|
| 312 | block From_day "Convert from day to second" |
|---|
| 313 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="d"), y( |
|---|
| 314 | unit="s")); |
|---|
| 315 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 316 | -100},{100,100}}), graphics={Text( |
|---|
| 317 | extent={{-20,100},{-100,20}}, |
|---|
| 318 | lineColor={0,0,0}, |
|---|
| 319 | textString="day"), Text( |
|---|
| 320 | extent={{100,-20},{20,-100}}, |
|---|
| 321 | lineColor={0,0,0}, |
|---|
| 322 | textString="s")}), |
|---|
| 323 | Documentation(info="<html> |
|---|
| 324 | <p> |
|---|
| 325 | This block converts the input signal from day to second and returns |
|---|
| 326 | the result as output signal. |
|---|
| 327 | </p> |
|---|
| 328 | </html>")); |
|---|
| 329 | equation |
|---|
| 330 | y = SI.Conversions.from_day(u); |
|---|
| 331 | end From_day; |
|---|
| 332 | |
|---|
| 333 | block To_hour "Convert from second to hour" |
|---|
| 334 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="s"), y( |
|---|
| 335 | unit="h")); |
|---|
| 336 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 337 | -100},{100,100}}), graphics={Text( |
|---|
| 338 | extent={{-20,100},{-100,20}}, |
|---|
| 339 | lineColor={0,0,0}, |
|---|
| 340 | textString="s"), Text( |
|---|
| 341 | extent={{100,-20},{20,-100}}, |
|---|
| 342 | lineColor={0,0,0}, |
|---|
| 343 | textString="hour")}), |
|---|
| 344 | Documentation(info="<html> |
|---|
| 345 | <p> |
|---|
| 346 | This block converts the input signal from second to hour and returns |
|---|
| 347 | the result as output signal. |
|---|
| 348 | </p> |
|---|
| 349 | </html>")); |
|---|
| 350 | equation |
|---|
| 351 | y = SI.Conversions.to_hour(u); |
|---|
| 352 | end To_hour; |
|---|
| 353 | |
|---|
| 354 | block From_hour "Convert from hour to second" |
|---|
| 355 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="h"), y( |
|---|
| 356 | unit="s")); |
|---|
| 357 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 358 | -100},{100,100}}), graphics={Text( |
|---|
| 359 | extent={{-20,100},{-100,20}}, |
|---|
| 360 | lineColor={0,0,0}, |
|---|
| 361 | textString="hour"), Text( |
|---|
| 362 | extent={{100,-20},{20,-100}}, |
|---|
| 363 | lineColor={0,0,0}, |
|---|
| 364 | textString="s")}), |
|---|
| 365 | Documentation(info="<html> |
|---|
| 366 | <p> |
|---|
| 367 | This block converts the input signal from hour to second and returns |
|---|
| 368 | the result as output signal. |
|---|
| 369 | </p> |
|---|
| 370 | </html>")); |
|---|
| 371 | equation |
|---|
| 372 | y = SI.Conversions.from_hour(u); |
|---|
| 373 | end From_hour; |
|---|
| 374 | |
|---|
| 375 | block To_minute "Convert from second to minute" |
|---|
| 376 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="s"), y( |
|---|
| 377 | unit="min")); |
|---|
| 378 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 379 | -100},{100,100}}), graphics={Text( |
|---|
| 380 | extent={{-20,100},{-100,20}}, |
|---|
| 381 | lineColor={0,0,0}, |
|---|
| 382 | textString="s"), Text( |
|---|
| 383 | extent={{100,-20},{20,-100}}, |
|---|
| 384 | lineColor={0,0,0}, |
|---|
| 385 | textString="minute")}), |
|---|
| 386 | Documentation(info="<html> |
|---|
| 387 | <p> |
|---|
| 388 | This block converts the input signal from second to minute and returns |
|---|
| 389 | the result as output signal. |
|---|
| 390 | </p> |
|---|
| 391 | </html>")); |
|---|
| 392 | equation |
|---|
| 393 | y = SI.Conversions.to_minute(u); |
|---|
| 394 | end To_minute; |
|---|
| 395 | |
|---|
| 396 | block From_minute "Convert from minute to second" |
|---|
| 397 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="min"), |
|---|
| 398 | y(unit="s")); |
|---|
| 399 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 400 | -100},{100,100}}), graphics={Text( |
|---|
| 401 | extent={{-20,100},{-100,20}}, |
|---|
| 402 | lineColor={0,0,0}, |
|---|
| 403 | textString="minute"), Text( |
|---|
| 404 | extent={{100,-20},{20,-100}}, |
|---|
| 405 | lineColor={0,0,0}, |
|---|
| 406 | textString="s")}), |
|---|
| 407 | Documentation(info="<html> |
|---|
| 408 | <p> |
|---|
| 409 | This block converts the input signal from minute to second and returns |
|---|
| 410 | the result as output signal. |
|---|
| 411 | </p> |
|---|
| 412 | </html>")); |
|---|
| 413 | equation |
|---|
| 414 | y = SI.Conversions.from_minute(u); |
|---|
| 415 | end From_minute; |
|---|
| 416 | |
|---|
| 417 | block To_litre "Convert from cubic metre to litre" |
|---|
| 418 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="m3"), y( |
|---|
| 419 | unit="l")); |
|---|
| 420 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 421 | -100},{100,100}}), graphics={Text( |
|---|
| 422 | extent={{-20,100},{-100,20}}, |
|---|
| 423 | lineColor={0,0,0}, |
|---|
| 424 | textString="m3"), Text( |
|---|
| 425 | extent={{100,-20},{20,-100}}, |
|---|
| 426 | lineColor={0,0,0}, |
|---|
| 427 | textString="litre")}), |
|---|
| 428 | Documentation(info="<html> |
|---|
| 429 | <p> |
|---|
| 430 | This block converts the input signal from metre to litre and returns |
|---|
| 431 | the result as output signal. |
|---|
| 432 | </p> |
|---|
| 433 | </html>")); |
|---|
| 434 | equation |
|---|
| 435 | y = SI.Conversions.to_litre(u); |
|---|
| 436 | end To_litre; |
|---|
| 437 | |
|---|
| 438 | block From_litre "Convert from litre to cubic metre" |
|---|
| 439 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="l"), y( |
|---|
| 440 | unit="m3")); |
|---|
| 441 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 442 | -100},{100,100}}), graphics={Text( |
|---|
| 443 | extent={{-20,100},{-100,20}}, |
|---|
| 444 | lineColor={0,0,0}, |
|---|
| 445 | textString="litre"), Text( |
|---|
| 446 | extent={{100,-20},{20,-100}}, |
|---|
| 447 | lineColor={0,0,0}, |
|---|
| 448 | textString="m3")}), |
|---|
| 449 | Documentation(info="<html> |
|---|
| 450 | <p> |
|---|
| 451 | This block converts the input signal from litre to cubic metre and returns |
|---|
| 452 | the result as output signal. |
|---|
| 453 | </p> |
|---|
| 454 | </html>")); |
|---|
| 455 | equation |
|---|
| 456 | y = SI.Conversions.from_litre(u); |
|---|
| 457 | end From_litre; |
|---|
| 458 | |
|---|
| 459 | block To_kWh "Convert from Joule to kilo Watt hour" |
|---|
| 460 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="J"), y( |
|---|
| 461 | unit="kW.h")); |
|---|
| 462 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 463 | -100},{100,100}}), graphics={Text( |
|---|
| 464 | extent={{-20,100},{-100,20}}, |
|---|
| 465 | lineColor={0,0,0}, |
|---|
| 466 | textString="J"), Text( |
|---|
| 467 | extent={{100,-20},{20,-100}}, |
|---|
| 468 | lineColor={0,0,0}, |
|---|
| 469 | textString="kW.h")}), |
|---|
| 470 | Documentation(info="<html> |
|---|
| 471 | <p> |
|---|
| 472 | This block converts the input signal from Joule to kilo Watt hour and returns |
|---|
| 473 | the result as output signal. |
|---|
| 474 | </p> |
|---|
| 475 | </html>")); |
|---|
| 476 | equation |
|---|
| 477 | y = SI.Conversions.to_kWh(u); |
|---|
| 478 | end To_kWh; |
|---|
| 479 | |
|---|
| 480 | block From_kWh "Convert from kilo Watt hour to Joule" |
|---|
| 481 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="kW.h"), |
|---|
| 482 | y(unit="J")); |
|---|
| 483 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 484 | -100},{100,100}}), graphics={Text( |
|---|
| 485 | extent={{-20,100},{-100,20}}, |
|---|
| 486 | lineColor={0,0,0}, |
|---|
| 487 | textString="kW.h"), Text( |
|---|
| 488 | extent={{100,-20},{20,-100}}, |
|---|
| 489 | lineColor={0,0,0}, |
|---|
| 490 | textString="J")}), |
|---|
| 491 | Documentation(info="<html> |
|---|
| 492 | <p> |
|---|
| 493 | This block converts the input signal from kilo Watt hour to Joule and returns |
|---|
| 494 | the result as output signal. |
|---|
| 495 | </p> |
|---|
| 496 | </html>")); |
|---|
| 497 | equation |
|---|
| 498 | y = SI.Conversions.from_kWh(u); |
|---|
| 499 | end From_kWh; |
|---|
| 500 | |
|---|
| 501 | block To_bar "Convert from Pascal to bar" |
|---|
| 502 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="Pa"), y( |
|---|
| 503 | unit="bar")); |
|---|
| 504 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 505 | -100},{100,100}}), graphics={Text( |
|---|
| 506 | extent={{-20,100},{-100,20}}, |
|---|
| 507 | lineColor={0,0,0}, |
|---|
| 508 | textString="Pa"), Text( |
|---|
| 509 | extent={{100,-20},{20,-100}}, |
|---|
| 510 | lineColor={0,0,0}, |
|---|
| 511 | textString="bar")}), |
|---|
| 512 | Documentation(info="<html> |
|---|
| 513 | <p> |
|---|
| 514 | This block converts the input signal from Pascal to bar and returns |
|---|
| 515 | the result as output signal. |
|---|
| 516 | </p> |
|---|
| 517 | </html>")); |
|---|
| 518 | equation |
|---|
| 519 | y = SI.Conversions.to_bar(u); |
|---|
| 520 | end To_bar; |
|---|
| 521 | |
|---|
| 522 | block From_bar "Convert from bar to Pascal" |
|---|
| 523 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="bar"), |
|---|
| 524 | y(unit="Pa")); |
|---|
| 525 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 526 | -100},{100,100}}), graphics={Text( |
|---|
| 527 | extent={{-20,100},{-100,20}}, |
|---|
| 528 | lineColor={0,0,0}, |
|---|
| 529 | textString="bar"), Text( |
|---|
| 530 | extent={{100,-20},{20,-100}}, |
|---|
| 531 | lineColor={0,0,0}, |
|---|
| 532 | textString="Pa")}), |
|---|
| 533 | Documentation(info="<html> |
|---|
| 534 | <p> |
|---|
| 535 | This block converts the input signal from bar to Pascal and returns |
|---|
| 536 | the result as output signal. |
|---|
| 537 | </p> |
|---|
| 538 | </html>")); |
|---|
| 539 | equation |
|---|
| 540 | y = SI.Conversions.from_bar(u); |
|---|
| 541 | end From_bar; |
|---|
| 542 | |
|---|
| 543 | block To_gps "Convert from kilogram per second to gram per second" |
|---|
| 544 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="kg/s"), |
|---|
| 545 | y(unit="g/s")); |
|---|
| 546 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 547 | -100},{100,100}}), graphics={Text( |
|---|
| 548 | extent={{-20,100},{-100,20}}, |
|---|
| 549 | lineColor={0,0,0}, |
|---|
| 550 | textString="kg/s"), Text( |
|---|
| 551 | extent={{100,-20},{20,-100}}, |
|---|
| 552 | lineColor={0,0,0}, |
|---|
| 553 | textString="g/s")}), |
|---|
| 554 | Documentation(info="<html> |
|---|
| 555 | <p> |
|---|
| 556 | This block converts the input signal from kilogram per second to gram per seconds and returns |
|---|
| 557 | the result as output signal. |
|---|
| 558 | </p> |
|---|
| 559 | </html>")); |
|---|
| 560 | equation |
|---|
| 561 | y = SI.Conversions.to_gps(u); |
|---|
| 562 | end To_gps; |
|---|
| 563 | |
|---|
| 564 | block From_gps "Convert from gram per second to kilogram per second" |
|---|
| 565 | extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="g/s"), |
|---|
| 566 | y(unit="kg/s")); |
|---|
| 567 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 568 | -100},{100,100}}), graphics={Text( |
|---|
| 569 | extent={{-20,100},{-100,20}}, |
|---|
| 570 | lineColor={0,0,0}, |
|---|
| 571 | textString="g/s"), Text( |
|---|
| 572 | extent={{100,-20},{20,-100}}, |
|---|
| 573 | lineColor={0,0,0}, |
|---|
| 574 | textString="kg/s")}), |
|---|
| 575 | Documentation(info="<html> |
|---|
| 576 | <p> |
|---|
| 577 | This block converts the input signal from gram per second to kilogram per second and returns |
|---|
| 578 | the result as output signal. |
|---|
| 579 | </p> |
|---|
| 580 | </html>")); |
|---|
| 581 | equation |
|---|
| 582 | y = SI.Conversions.from_gps(u); |
|---|
| 583 | end From_gps; |
|---|
| 584 | annotation (Documentation(info="<html> |
|---|
| 585 | <p> |
|---|
| 586 | This package consists of blocks that convert an input signal |
|---|
| 587 | with a specific unit to an output signal in another unit |
|---|
| 588 | (e.g. conversion of an angle signal from \"deg\" to \"rad\"). |
|---|
| 589 | Block \"ConvertAllUnits\" converts between a set of units that |
|---|
| 590 | can be selected in a pull-down menu of the parameter menu. |
|---|
| 591 | All other blocks convert exactly between two different units. |
|---|
| 592 | </p> |
|---|
| 593 | |
|---|
| 594 | </html>")); |
|---|
| 595 | end UnitConversions; |
|---|
| 596 | |
|---|
| 597 | block InverseBlockConstraints |
|---|
| 598 | "Construct inverse model by requiring that two inputs and two outputs are identical (replaces the previously, unbalanced, TwoInputs and TwoOutputs blocks)" |
|---|
| 599 | |
|---|
| 600 | Modelica.Blocks.Interfaces.RealInput u1 "Input signal 1 (u1 = u2)" |
|---|
| 601 | annotation (Placement(transformation(extent={{-240, |
|---|
| 602 | -20},{-200,20}}, rotation=0), iconTransformation(extent={{-240,-20}, |
|---|
| 603 | {-200,20}}))); |
|---|
| 604 | Modelica.Blocks.Interfaces.RealInput u2 "Input signal 2 (u1 = u2)" |
|---|
| 605 | annotation (Placement(transformation(extent={{ |
|---|