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

BEGINNER: How to take input in a model file

BEGINNER: How to take input in a model file

I am new to openModelica

this is "working" but I want to take input in this model file using OMshell

How to take input instead of = 10; I have not used function as der() is not allowed in function

  model Fluid
  parameter Real Fci(unit = "kg/h")=10 "Feed cold in/out";
  parameter Real Fhi(unit = "kg/h")=10 "Feed hot in/out";
  parameter Real Tci(unit = "K")=10 "Temp cold in";
  parameter Real Thi(unit = "K")=0 "Temp hot in";
  parameter Real Tho(unit = "K")=-1 "Temp hot out";
  parameter Real U(unit = "kg/Km^2s^2")=10 "Heat transfer coefficient";
  parameter Real Area(unit = "m^2")=10 "Area";
  parameter Real Volume(unit = "m^3")=10 "Volume";
  parameter Real Density(unit = "kg/m^3")=10 "Density";
  parameter Real Cp(unit = "Jkg^-1K-1")=10 "Specific Heat";
 
  Real Tco;
equation
  der(Tco)=(Fci*Cp*Density*(Tci-Tco)-U*Area*((Tci-Thi)-(Tco-Tho))/log((Tci-Thi)/(Tco-Tho)))/(Volume*Cp*Density);   
 
end Fluid;



I want something like this

model FluidVector
  input Real Fci;
  input Real Fhi;
  input Real Tci;
  input Real Thi;
  input Real Tho;
  input Real U;
  input Real Area;
  input Real Volume;
  input Real Density;
  input Real Cp;
 
  output Real Tco;
equation
 
  der(Tco)=(Fci*Cp*Density*(Tci-Tco)-U*Area*((Tci-Thi)-(Tco-Tho))/log((Tci-Thi)/(Tco-Tho)))/(Volume*Cp*Density);   
 
end FluidVector;


as in Functions der() is not allowed

There are 0 guests and 0 other users also viewing this topic
You are here: