Search code examples
openmodelica

Openmodelica How to take input for model and use OMshell


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 enter image description here

I want this in OMshell

>loadFile("Fluid.mo")
>Fluid(1,2,3,4,5,6,7,8,9,10)
>simulate(Fluid,startTime=0,stopTime=5)
>plot(Tco)

6


Solution

  • You wanted this:

    loadFile("Fluid.mo")
    Fluid(1,2,3,4,5,6,7,8,9,10)
    simulate(Fluid,startTime=0,stopTime=5)
    plot(Tco)
    

    But you should be able to use:

    loadFile("Fluid.mo")
    simulate(Fluid,startTime=0,stopTime=5,simflags="-override Fci=1,Fhi=2")
    plot(Tco)