Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » pa1padubidri
  • » Profile

Posts

Posts

Apr-02-19 10:23:19
I Need help for right Parameter Settings

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



Sep-19-18 13:41:23
How to use the Modelica media database?
Category: Programming

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

Sep-19-18 09:26:48
Category: Programming

https://imgur.com/a/MPMth67

I have made a small illustration showing how you can get parameter in graphical window. If this is not what you want, please explain your question with example

  • Index
  • » Users
  • » pa1padubidri
  • » Profile
You are here: