- Index
- » Users
- » pa1padubidri
- » Profile
Posts
Posts
It would be helpful if you could attach the code you are running, inputs start with zero value, if your code crashes for zero input, you have to fix it.
BTW, here OPCTest.mo is a small code that you can try which works for me. The variable speedRef can be changed from UAExpert. WHile running this model give the flag
-embeddedServer opc-ua -rt 1.0
once you connect from UAExpert, make run variable as true, then change the speedRef to 40, and you should be able to see speedSensor.w value change
Hello,
There are only two concepts you need to understand - BaseProperties and ThermodynamicState.
To start with you call the fluid medium first
Code:
package SomeName = Modelica.Media.IdealGases.SingleGases.FluidName;
SomeName is of your choice but the FluidName must be in the Modelica Media database.
BaseProperties: To compute the basic thermodynamic properties of the fluid
You give any two inputs to compute a bunch of basic properties[pressure, enthalpy,density, temperature,internal energy,gas constant, molar mass, vapour fraction].
Usage: To get basic properties at p=2e5 Pa, T = 298.15K of CO2
Code:
model test
parameter Real pressure=2e5, temperature=298.15;
package CO2 = Modelica.Media.IdealGases.SingleGases.CO2;
CO2.BaseProperties medium;
Real density;
equation
medium.p = pressure;
medium.T = temperature;
density = medium.d;
end test
This will calculate [medium.p, medium.h, medium.d, medium.T, medium.u, medium.R, medium.MM, medium.X]
Read the documentation to understand what other combination of inputs are allowed
ThermodynamicState: To compute additional properties that are not present in BaseProperties
You give any two inputs and compute properties you require
Usage: To get Cp and Cv at p=2e5 Pa, T=298.15 of CO2
Code:
model test
parameter Real pressure=2e5, temperature=298.15;
package CO2 = Modelica.Media.IdealGases.SingleGases.CO2;
CO2.ThermodynamicState state;
Real Cp, Cv;
equation
state = CO2.setState_pT(pressure,temperature);
Cp = CO2.specificHeatCapacityCp(state);
Cv = CO2.specificHeatCapacityCv(state);
end test
Read the documentation to understand what other functions are available for property calculation eg: dynamicViscosity(state), isentropicExponent(state), etc. and the combination of input allowed eg: setState_ps(pressure, entropy), setState_dT(density,Temperature), etc.
BaseProperties is used to calculate a bunch of basic properties at once, but ThermodynamicState is used to calculate only the properties you want
Hope this helps
- Index
- » Users
- » pa1padubidri
- » Profile