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

Running a Script on a Model to simulate different Parameters

Running a Script on a Model to simulate different Parameters

Hello,

I'm learning Modelica and I have a model which I want to simulate 3 times with 3 different parameters:

model Ex44
  parameter Modelica.SIunits.CoefficientOfHeatTransfer h=50;
  Modelica.SIunits.Temperature T;
  Modelica.SIunits.Temperature Tsur = 300;
  Modelica.SIunits.Temperature Tinf = 300;
  Real  R = 0.4;
  Modelica.SIunits.Current I;
  Modelica.SIunits.Current Imin = 0;
  Modelica.SIunits.Current Imax = 10;
  Modelica.SIunits.Emissivity e=0.8;
  Modelica.SIunits.Length D = 1e-3;
equation
  I = Imin + time/100 * (Imax - Imin);
  R*I^2 = Modelica.Constants.pi * D * h * (T - Tinf) + Modelica.Constants.pi * D * e * 5.67e-8 * (T^4 - Tsur^4);
 
  annotation(experiment(StartTime=0,StopTime=100));
end Ex44;

I then wrote this script, which is in the same folder as the Model:

openModel("/home/lcsgoulart/Desktop/Lucas/Matérias/Termodinâmica/Modelica/");

values[3] = {50, 100, 250};

for i in values loop
         simulateExtendedModel(
         "Ex44",
         initialNames={"h"},
         initialValues={i},
         finalNames={"T"},
         resultFile="Ex44"+String(i));
end for;

On the OMShell I go into this folder and runScript("script.mos") and get Failed!

Could you help me with that?

Re: Running a Script on a Model to simulate different Parameters

Call getErrorString and you should see why. I guess that's Dymola syntax for a mos-script and the functions you try to call don't exist either. We don't have simulateExtendedModel

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