| 1 | REQUESTED CHANGES TO MODELICA.MEDIA |
|---|
| 2 | 0. |
|---|
| 3 | Add package constants for all physical data that is needed by physical |
|---|
| 4 | property estimation routines, and add to NASA data were available. |
|---|
| 5 | Initial list: |
|---|
| 6 | Molar Masses |
|---|
| 7 | Critical Temperature, Pressure and Volume/Density |
|---|
| 8 | Accentric factor |
|---|
| 9 | Dipole Moments |
|---|
| 10 | ? Association factors |
|---|
| 11 | |
|---|
| 12 | scalar for pure substance, vector otherwise |
|---|
| 13 | |
|---|
| 14 | 1. |
|---|
| 15 | Remove references to "gas" from Interfaces.PartialMixtureMedium |
|---|
| 16 | --- |
|---|
| 17 | Date submitted: 13 Jan 2005 by: Francesco Casella |
|---|
| 18 | Date fixed: 2005-01-14 by: Hubertus |
|---|
| 19 | --- |
|---|
| 20 | |
|---|
| 21 | 2. |
|---|
| 22 | IdealGases.Common.SingleGas should probably be renamed to |
|---|
| 23 | IdealGases.Common.SingleGasNasa for uniformity reasons |
|---|
| 24 | --- |
|---|
| 25 | Date submitted: 13 Jan 2005 by: Francesco Casella |
|---|
| 26 | Date fixed: 2005-01-14 by: Hubertus |
|---|
| 27 | --- |
|---|
| 28 | |
|---|
| 29 | 3. |
|---|
| 30 | Interfaces.TemplateMedium should be updated with the last changes |
|---|
| 31 | (add R=0 to BaseProperties, new nX and reducedX, etc.) |
|---|
| 32 | It should be tested by creating a new, simple medium model from scratch |
|---|
| 33 | just before the release of the library |
|---|
| 34 | --- |
|---|
| 35 | Date submitted: 13 Jan 2005 by: Francesco Casella |
|---|
| 36 | Assigned to: Francesco |
|---|
| 37 | Date fixed: None by: None |
|---|
| 38 | --- |
|---|
| 39 | |
|---|
| 40 | 4. |
|---|
| 41 | References to Prandtl and Brigdman are sometimes misspelled throughout |
|---|
| 42 | the library |
|---|
| 43 | --- |
|---|
| 44 | Date submitted: 13 Jan 2005 by: Francesco Casella |
|---|
| 45 | Date fixed: 2005-01-14 by: Hubertus |
|---|
| 46 | --- |
|---|
| 47 | |
|---|
| 48 | 5. |
|---|
| 49 | A final check of all the "restricted" WaterIF97 models should be performed, |
|---|
| 50 | some of them, though restricted, do not perform better than the base model, |
|---|
| 51 | and should then probably be removed. |
|---|
| 52 | --- |
|---|
| 53 | Date submitted: 13 Jan 2005 by: Francesco Casella |
|---|
| 54 | Assigned to: Francesco (keep me posted, Hubertus) |
|---|
| 55 | Date fixed: None by: None |
|---|
| 56 | --- |
|---|
| 57 | |
|---|
| 58 | 6. |
|---|
| 59 | Add WaterIF97_ph models, restricted to Region 1 and to Region 2, to |
|---|
| 60 | allow for faster performance. |
|---|
| 61 | --- |
|---|
| 62 | Date submitted: 13 Jan 2005 by: Francesco Casella |
|---|
| 63 | Assigned to: Francesco Casella (?) |
|---|
| 64 | Date fixed: None by: None |
|---|
| 65 | --- |
|---|
| 66 | |
|---|
| 67 | 7. |
|---|
| 68 | The unit type used for the Volumetric coefficient of thermal expansion |
|---|
| 69 | [Bejan], a.k.a. volume expansivity or beta coefficient, is called |
|---|
| 70 | RelativePressureCoefficient. Although the actual unit is OK (1/K), |
|---|
| 71 | this has nothing to do with pressure, so the name should be changed. |
|---|
| 72 | ---- |
|---|
| 73 | Date submitted: 13 Jan 2005 by: Francesco Casella |
|---|
| 74 | Date fixed: 2005-01-14 by: Hubertus |
|---|
| 75 | --- |
|---|
| 76 | |
|---|
| 77 | 8. |
|---|
| 78 | Function Interfaces.PartialMixtureMedium.density_derX requires the molar |
|---|
| 79 | mass of the mixture as an input. Although this can be useful for ideal gas |
|---|
| 80 | mixtures, it is probably of no use, e.g., for liquid mixtures. Therefore, |
|---|
| 81 | it is probably better to remove it as an input, and to add it to the |
|---|
| 82 | ThermodynamicState vector. |
|---|
| 83 | Comment: I dissagree on that issue: the ThermodynamicState vector |
|---|
| 84 | should be minimal if possible. But: this shows the need that a lot |
|---|
| 85 | more package constants are needed, molar masses, critical data and the like. |
|---|
| 86 | |
|---|
| 87 | I fixed it a little differently: a new function mixtureMolaMass that |
|---|
| 88 | takes state as input. It works for ideal gas mixtures. |
|---|
| 89 | |
|---|
| 90 | Name later changed to molarMass, since it also applies to pure media. |
|---|
| 91 | ---- |
|---|
| 92 | Date submitted: 13 Jan 2005 by: Francesco Casella |
|---|
| 93 | Assigned to: Hubertus |
|---|
| 94 | Testing assigned to: Francesco |
|---|
| 95 | Date fixed: 2005-01-14 by: Hubertus |
|---|
| 96 | Date fixed: 2005-02-17 by: Francesco |
|---|
| 97 | --- |
|---|
| 98 | |
|---|
| 99 | 9. |
|---|
| 100 | 1) Nasa vs. NASA: this is consistent: as part of a function or class |
|---|
| 101 | name nameNasa, if by itself NASA |
|---|
| 102 | * The spelling should be "discontinuous" and "monatomic" in the documentation of SingleGas that currently reads "A few of the data sets for monoatomic gases have a discontinous 1st derivative at 1000K, but this never caused problems so far." |
|---|
| 103 | [The first I saw myself - the second I detected when using spell-checking in word, and Webster confirmed it.] |
|---|
| 104 | * The Media-model should be SingleGas (singular) as you wrote in req_changes.txt. |
|---|
| 105 | |
|---|
| 106 | Date submitted: 13 Jan 2005 by: Hans |
|---|
| 107 | Date fixed: 2005-01-14 by: Hubertus |
|---|
| 108 | |
|---|
| 109 | 10. |
|---|
| 110 | Renaming of cp and cv |
|---|
| 111 | Date fixed: 2005-01-16 by: Hubertus |
|---|
| 112 | --- |
|---|
| 113 | |
|---|
| 114 | 11. |
|---|
| 115 | Modelica_Media.Interfaces.PartialMixtureMedium.ThermodynamicState already contains p,T,X. |
|---|
| 116 | Although fairly sophisticated models would probably just need those |
|---|
| 117 | variables, an incompressible fluid model (e.g.) won't need the pressure |
|---|
| 118 | p by definition. I would thus remove those declarations, and leave to |
|---|
| 119 | each single medium model the task to declare its own state variables, as |
|---|
| 120 | it's done with media extending PartialMedium. |
|---|
| 121 | --- |
|---|
| 122 | Date submitted: 17 Jan 2005 by: Francesco Casella |
|---|
| 123 | Assigned to: None |
|---|
| 124 | Testing assigned to: None |
|---|
| 125 | Date fixed: by: None |
|---|
| 126 | --- |
|---|
| 127 | |
|---|
| 128 | 12. |
|---|
| 129 | Modelica_Media.Interfaces.PartialMixtureMedium.BaseProperties.MM |
|---|
| 130 | This is surely needed for ideal gas mixtures, but maybe not for other |
|---|
| 131 | models (e.g. for liquid mixtures). Same cure, remove from here and add |
|---|
| 132 | to IdealGas.MixtureGasNasa.* models. |
|---|
| 133 | --- |
|---|
| 134 | Date submitted: 17 Jan 2005 by: Francesco Casella |
|---|
| 135 | Assigned to: None |
|---|
| 136 | Testing assigned to: None |
|---|
| 137 | Date fixed: by: None |
|---|
| 138 | --- |
|---|
| 139 | |
|---|
| 140 | 13. |
|---|
| 141 | Modelica_Media.Interfaces.PartialMixtureMedium.BaseProperties.h_component[] |
|---|
| 142 | Externally supplied media models (e.g. foreign C models) could supply the total |
|---|
| 143 | mixture enthalpy h, but not the componentwise enthalpy. It is of course possible |
|---|
| 144 | to set them to zero, but maybe it's better to remove this from the standard |
|---|
| 145 | interface and to add it to gas mixture models as well. |
|---|
| 146 | --- |
|---|
| 147 | Date submitted: 17 Jan 2005 by: Francesco Casella |
|---|
| 148 | Assigned to: None |
|---|
| 149 | Testing assigned to: None |
|---|
| 150 | Date fixed: by: None |
|---|
| 151 | --- |
|---|
| 152 | |
|---|
| 153 | 14. |
|---|
| 154 | Component molar masses in current IdealGases NASA models are contained |
|---|
| 155 | in the package "data" record. Unfortunately, this datum, which can be |
|---|
| 156 | important when dealing with chemical reactions, is not included in any |
|---|
| 157 | generic medium interfaces. I'd suggest adding it to the PartialMixtureMedium |
|---|
| 158 | interface. |
|---|
| 159 | --- |
|---|
| 160 | Date submitted: 17 Jan 2005 by: Francesco Casella |
|---|
| 161 | Assigned to: None |
|---|
| 162 | Testing assigned to: None |
|---|
| 163 | Date fixed: by: None |
|---|
| 164 | --- |
|---|
| 165 | |
|---|
| 166 | |
|---|
| 167 | 15. |
|---|
| 168 | o Dimension of nX is number of substances (nX=1 for one substance) |
|---|
| 169 | o Changed size(substanceNames,1) everywhere to nX |
|---|
| 170 | o Changed p_reference to reference_p |
|---|
| 171 | Changed referenceX to reference_X |
|---|
| 172 | o Changed SimpleMedium to PartialSimpleMedium |
|---|
| 173 | o Introduced "MM_const" in PartialSimpleMedium |
|---|
| 174 | o Set MM_const=18.016e-3 for ConstantPropertyLiquidWater |
|---|
| 175 | --- |
|---|
| 176 | Date submitted: 21 Jan 2005 by: Martin Otter |
|---|
| 177 | Assigned to: None |
|---|
| 178 | Testing assigned to: None |
|---|
| 179 | Date fixed: by: Martin Otter |
|---|
| 180 | |
|---|
| 181 | |
|---|
| 182 | 16) Fixing viscosity and thermal conductivity for gases and consistent |
|---|
| 183 | addition of data as it becomes available: |
|---|
| 184 | |
|---|
| 185 | Current situation: |
|---|
| 186 | The currently implemented functions for ideal gas viscosity and |
|---|
| 187 | thermal conductivity don't follow the standard for all other functions |
|---|
| 188 | that have the state record as input. They can't: they require data |
|---|
| 189 | that is not yet present in Modelica.Media. |
|---|
| 190 | |
|---|
| 191 | In order to fix the situation, more data is needed, and if the input |
|---|
| 192 | convention is to be kept, the data has to be present in the form of |
|---|
| 193 | package constants. |
|---|
| 194 | |
|---|
| 195 | The following constants are currently declared in the Media package: |
|---|
| 196 | |
|---|
| 197 | In PartialMedium |
|---|
| 198 | constant String mediumName "Name of the medium"; |
|---|
| 199 | constant String substanceNames[:]= fill("",0) "Names of the mixture substances. Set substanceNames=fill(\"\",0) if only one substance."; |
|---|
| 200 | constant String extraPropertiesNames[:]= fill("",0) "Names of ... Set extraPropertiesNames=fill(\"\",0) if unused"; |
|---|
| 201 | constant Boolean incompressible "= true, if medium is incompressible (i.e., density = constant)"; |
|---|
| 202 | constant Integer nX = if size(substanceNames, 1) > 1 then size(substanceNames, 1) else 0; |
|---|
| 203 | constant MassFraction referenceX[nX] "Default composition of medium"; |
|---|
| 204 | constant Integer nC = size(extraPropertiesNames,1) ; |
|---|
| 205 | constant AbsolutePressure p_reference = 101325 "reference pressure of Medium: default 1 atmosphere"; |
|---|
| 206 | |
|---|
| 207 | In PartialPureSubstance: |
|---|
| 208 | constant String iupacName "complete IUPAC name"; |
|---|
| 209 | constant String casRegistryNumber "chemical abstracts sequencing number"; |
|---|
| 210 | constant String chemicalFormula "Chemical formula, (brutto, nomenclature according to Hill"; |
|---|
| 211 | constant String structureFormula "Chemical structure formula"; |
|---|
| 212 | |
|---|
| 213 | |
|---|
| 214 | The following additional constants are needed to compute viscosity and |
|---|
| 215 | thermal conductivity: |
|---|
| 216 | |
|---|
| 217 | criticalPressure |
|---|
| 218 | criticalTemperature |
|---|
| 219 | criticalDensity (or criticalVolume) |
|---|
| 220 | molarMass |
|---|
| 221 | dipoleMoment |
|---|
| 222 | |
|---|
| 223 | They could be in a record for each pure component, and a vector of |
|---|
| 224 | records for each mixture, parallel to the heat capacity data from |
|---|
| 225 | NASA. Most of the above are already defined the the record |
|---|
| 226 | FluidConstats for two phase media, which would instead be "redeclare |
|---|
| 227 | extends" from the basic one. |
|---|
| 228 | |
|---|
| 229 | Except for the molar mass, none of these is available in the NASA |
|---|
| 230 | data. The NASA data comes with extra coefficients for viscosity in an |
|---|
| 231 | extra file, but for much fewer components, and complex to use in |
|---|
| 232 | mixtures due to separate "interaction parameters" for each pair of |
|---|
| 233 | gases in a mixture. I have acess to a few hundred sets of |
|---|
| 234 | critical data, but far less than the NASA-coefficients, and not even a |
|---|
| 235 | proper subset. |
|---|
| 236 | |
|---|
| 237 | This highlights particular problems with medium data: |
|---|
| 238 | 1) Data has to be obtained and used from different sources. |
|---|
| 239 | 2) The situation changes yearly. |
|---|
| 240 | 3) Users need a simple means to take some data from Modelica.Media, |
|---|
| 241 | and add their own when they have better data (subscription to a |
|---|
| 242 | particularly "good" property databases comes at 36 000 Euro/year |
|---|
| 243 | |
|---|
| 244 | Obviously the best solution would be to completely separate the data |
|---|
| 245 | from the model, and query the data on demand from a database (unless |
|---|
| 246 | you run embedded of course). |
|---|
| 247 | |
|---|
| 248 | A solution that takes this situation into account should at least do |
|---|
| 249 | the following: |
|---|
| 250 | 1) Each "data-source" that is used in Modelica.Media should have a |
|---|
| 251 | name (e.g. the NASA-data comes from 1 public file that is widely used, |
|---|
| 252 | the critical data that I have comes from a book, etc.) |
|---|
| 253 | 2) Each medium package should have a set of Booleans (a data |
|---|
| 254 | structure) that lets a user query what data is available, and from |
|---|
| 255 | what source it comes. This data structure can grow as we get access to |
|---|
| 256 | more data. See a suggestion that covers the current status below. |
|---|
| 257 | |
|---|
| 258 | |
|---|
| 259 | record DataSources "data sources" |
|---|
| 260 | constant Boolean hasIdealGasHeatCapacity=false "true if ideal gas heat capacity is available"; |
|---|
| 261 | constant String idealGasHeatCapacitySource="none" "data source for ideal gas heat capacity coefficients"; |
|---|
| 262 | constant Boolean hasCriticalPressure=false "true if critical pressure is known"; |
|---|
| 263 | constant Boolean hasCriticalTemperature=false "true if critical temperature is known"; |
|---|
| 264 | constant Boolean hasCriticalVolume=false "true if critical volume is known"; |
|---|
| 265 | constant String criticalDataSource="none" "source for critical data"; |
|---|
| 266 | constant Boolean hasFundamentalEquation=false "true if a fundamental |
|---|
| 267 | equation"; |
|---|
| 268 | constant String fundamentalEquationSource="none" "source of the fundamental |
|---|
| 269 | equation model"; |
|---|
| 270 | constant Boolean hasLiquidHeatCapacity=false "true if liquid heat capacity is available"; |
|---|
| 271 | constant Boolean hasSolidHeatCapacity=false "true if solid heat capacity is available"; |
|---|
| 272 | constant Boolean hasAccurateViscosityData "true if accurate data for |
|---|
| 273 | a viscosity function is available"; |
|---|
| 274 | constant Boolean hasAccurateConductivityData "true if accurate data for |
|---|
| 275 | a thermal conductivity function is available"; |
|---|
| 276 | end DataSources; |
|---|
| 277 | |
|---|
| 278 | For some of the NASA data, there are heat capacity coefficients for |
|---|
| 279 | the solid state too. Molar Mass is always known, and could be a |
|---|
| 280 | separate package constant that has to be defined always. |
|---|
| 281 | |
|---|
| 282 | That data record should be part of every pure medium data set, or |
|---|
| 283 | medium package if we don't separate it. Mixture models need a way to |
|---|
| 284 | query what data is available for all of the mixture constituents and |
|---|
| 285 | based on that, the best possible method for computing properties is |
|---|
| 286 | selected. In the current situation that woudl mean: only when critical |
|---|
| 287 | data and dipole moments of all species in a mixture are known can the |
|---|
| 288 | viscosity be computed. |
|---|
| 289 | |
|---|
| 290 | Now that there are a number of string parsing functions in |
|---|
| 291 | Modelica_Utilities, the critical data could be stored on file as a |
|---|
| 292 | primitive database and parsed: no changes to the medium models are |
|---|
| 293 | necessary as we get access to more data. |
|---|
| 294 | |
|---|
| 295 | The goal is, that this could even work with external data, using a |
|---|
| 296 | user-supplied query function. The casRegistryNumber is the simplest |
|---|
| 297 | generally accepted identifier for a substance. |
|---|
| 298 | |
|---|
| 299 | I would at least like to be able to compute viscosities and thermal |
|---|
| 300 | conductivity for the most important technical gases, i.e. combustion |
|---|
| 301 | poducts, natural gas mixtures, gaseous fuels, refrigerants, ... for the 1.0 |
|---|
| 302 | release. |
|---|
| 303 | |
|---|
| 304 | Date submitted: 27 Jan 2005 by: Hubertus |
|---|
| 305 | |
|---|
| 306 | |
|---|
| 307 | ====================================================================== |
|---|
| 308 | Martin Feb. 22 2005: |
|---|
| 309 | |
|---|
| 310 | |
|---|
| 311 | Results of Modelica_Media.Examples.Tests |
|---|
| 312 | |
|---|
| 313 | - Models that are satisfactorily (they simulate, |
|---|
| 314 | static state selection and no non-linear system of equations) |
|---|
| 315 | Modelica_Media.Examples.Tests.MediaTestModels.Air.SimpleAir |
|---|
| 316 | Modelica_Media.Examples.Tests.MediaTestModels.IdealGases.SimpleNaturalGas |
|---|
| 317 | Modelica_Media.Examples.Tests.MediaTestModels.Water.ConstantPropertyLiquidWater |
|---|
| 318 | Modelica_Media.Examples.Tests.MediaTestModels.Water.WaterIF97OnePhase_ph |
|---|
| 319 | Modelica_Media.Examples.Tests.MediaTestModels.Water.WaterIF97_ph |
|---|
| 320 | |
|---|
| 321 | |
|---|
| 322 | - Issues to be fixed by Dynasim (Sven Erik/Hans): |
|---|
| 323 | o Modelica_Media.Examples.Tests.MediaTestModels.Air.DryAirNasa |
|---|
| 324 | Modelica_Media.Examples.Tests.MediaTestModels.IdealGases.Air |
|---|
| 325 | Modelica_Media.Examples.Tests.MediaTestModels.Water.IdealSteam |
|---|
| 326 | two non-linear systems of equations of size 1 each |
|---|
| 327 | (the same reason for all media) |
|---|
| 328 | |
|---|
| 329 | o Modelica_Media.Examples.Tests.MediaTestModels.Incompressible.Glycol47 |
|---|
| 330 | Modelica_Media.Examples.Tests.MediaTestModels.Incompressible.Essotherm650 |
|---|
| 331 | two non-linear systems of equations of size 1 each |
|---|
| 332 | (the same reason for both media) |
|---|
| 333 | |
|---|
| 334 | o Modelica_Media.Examples.Tests.MediaTestModels.Water.WaterIF97_pT |
|---|
| 335 | two non-linear systems of equations of size 1 each |
|---|
| 336 | |
|---|
| 337 | o Modelica_Media.Examples.Tests.MediaTestModels.Water.WaterIF97_dT |
|---|
| 338 | three non-linear systems of equations of size {1,2,2} |
|---|
| 339 | |
|---|
| 340 | o Modelica_Media.Examples.Tests.MediaTestModels.Air.MoistAir |
|---|
| 341 | When using a function in MoistAir |
|---|
| 342 | h = h_pTX(p,T,X_i); |
|---|
| 343 | instead of |
|---|
| 344 | h = h_component *{X_steam, X_air} + enthalpyOfLiquid(T)*X_liquid; |
|---|
| 345 | Dymola does not translate |
|---|
| 346 | Error for function: Modelica_Media.Air.MoistAir.h_pTX:der. |
|---|
| 347 | This was already reported to Hans. |
|---|
| 348 | When replacing the function by the equation, the test model |
|---|
| 349 | translates and simulates. There are two non-linear systems of |
|---|
| 350 | equations of size 1 each (this is understandable, since h is not |
|---|
| 351 | computed via a function). |
|---|
| 352 | |
|---|
| 353 | |
|---|
| 354 | - Issues to be fixed by Hubertus and/or Jonas: |
|---|
| 355 | o Modelica_Media.Examples.Tests.MediaTestModels.Incompressible.Glycol47 |
|---|
| 356 | Modelica_Media.Examples.Tests.MediaTestModels.Incompressible.Essotherm650 |
|---|
| 357 | Simulation fails (wrong initial conditions?) |
|---|
| 358 | |
|---|
| 359 | The table based media have the general problem that "u" is a function |
|---|
| 360 | of "pressure". Therefore, there will be two states "p,T", two |
|---|
| 361 | differential equations and two initial conditions. The flag |
|---|
| 362 | "incompressible" was introduced to define whether an initial condition |
|---|
| 363 | for "p" or "d" has to be provided. This means "incompressible" has to |
|---|
| 364 | be set to "false", since 2 initial conditions are needed. I have |
|---|
| 365 | changed the flag from "true" to "false". However, then the general |
|---|
| 366 | name for the package "Incompressible" is odd. |
|---|
| 367 | |
|---|
| 368 | o Modelica_Media.Examples.Tests.MediaTestModels.Water.WaterIF97_pT |
|---|
| 369 | Modelica_Media.Examples.Tests.MediaTestModels.Water.WaterIF97_dT |
|---|
| 370 | Simulation fails. This is a bit strange, because simulation with |
|---|
| 371 | Modelica_Media.Examples.Tests.MediaTestModels.Water.WaterIF97_ph |
|---|
| 372 | works fine. |
|---|
| 373 | |
|---|
| 374 | o PartialMixtureMedium has "p" as ThermodynamicState. |
|---|
| 375 | This is not true for incompressible mixtures. |
|---|
| 376 | Probably best to remove redeclaration of ThermodynamicState |
|---|