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
  • » lcsgoulart
  • » Profile

Posts

Posts

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?

May-12-20 14:54:38
Category: Programming

Hello,

I'm working on implementing a model on Dymola with TILSuite but I'm very new to the language and cannot pass this error.

The code is basically  the following and there are division by Zero on the bold lines. I think the problem lies on the variables Retp and Ftp. Should I somehow give them a value?

equation
  PipeInternalRoughness = 0.0015 "For Copper";

  Usg = (noEvent(abs(mdotHydraulic))*vapor/properties.VLE.d_v) / cellGeometry.hydraulicCrossSectionalArea;
  Usl = (noEvent(abs(mdotHydraulic))*liquid/properties.VLE.d_v) / cellGeometry.hydraulicCrossSectionalArea;
  Ugm = (0.35*sin(0) + 0.45*cos(0))*((g*hxGeometry.tubeSideHydraulicDiameter*(properties.VLE.d_l-properties.VLE.d_v))/properties.VLE.d_l)^0.5*(1-alpha)^0.5*C2*C3*1;
  Co = ((2 - (properties.VLE.d_v/properties.VLE.d_l)^2)/(1+(Retp/1000)^2))+(((((1+((properties.VLE.d_v/properties.VLE.d_l)^2)*cos(0))/(1+cos(0)))^0.5)^(1-alpha))^(2/5)+ Co1)/(1+(1000/Retp)^2);
  Co1 = (C1 - C1*sqrt(properties.VLE.d_v / properties.VLE.d_l)) * ((2.6 - beta)^0.15 - sqrt(Ftp)) * (1-massQuality)^1.5;
  C1 = if hxGeometry.portIsCircular then 0.2 else 0.4;

  beta = Usg / (Usg + Usl + Modelica.Constants.small);

  Retp=(properties.VLE.d_l * (Usg + Usl) * hxGeometry.tubeSideHydraulicDiameter) / properties.VLETransp.eta_l;
  1 / sqrt(Ftp) = -4.0 * log10((PipeInternalRoughness/hxGeometry.tubeSideHydraulicDiameter)/3.7 + 1.256/(Retp*sqrt(Ftp)));


  alpha = Usg / (Co * (Usg + Usl) + Ugm);


  C2 = if properties.VLETransp.eta_l/0.0001>10 then (0.435/(log10(properties.VLETransp.eta_l/0.001)))^0.15 else 1;
  C3 = if La < 0.025 then (La/0.025)^0.9 else 1;
  La = sqrt(properties.transp.sigma/(g*(properties.VLE.d_v - properties.VLE.d_l)))/hxGeometry.tubeSideHydraulicDiameter;

Thank you! I updated to OpenModelica 14 and downloaded the ModelicaStandard Library 3.2.3 from Github and now it works current/smile

Exactly that!

Could you tell me how to install the version 3.2.3? I'm on Ubuntu and cannot find how to do it...
Sorry if I'm asking silliness  current/hmm

CTG wrote:


From the annotations I see you are using Dymola. At the end I have been successful with your model, not using the AixLib, but using my own library. It is open source and you can download it from here
I attach your original model and a modification where I changed the Medium reference and I returned to the use of Cfnom.
Just to tell you how tricky is the enthalpy issue, I started extending the  CO2 package using “User” reference for enthalpy at 100K. It run, but stopped before arriving to 1e6 seconds. It was due to the fact that the gas was going down 200K that is the limit of its media model. I changed the reference to 120K for CO2 and the problem was solved. The reason is when you are specifying 250e3 for the liquid inlet, you are giving a number that is referenced to the base enthalpy.
The problem has been interesting for me, as I decided to check the compatibility of my library with ThermoPower and solve the remaining problems.

ModelicaTest5a.mo

Oh wow! Thank you so much!
I'm actually using OpenModelica, not Dymola, but it's really nice to know that you could make this Model work. I have been struggling with it quite a lot because I couldn't make the Media work. I have already downloaded your Library and will try to work with it, thank you! current/smile

Trying to run your model I get these errors:

[1] 21:45:00 Scripting Error
Gtk-Message: 21:43:24.808: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: 21:43:54.911: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: 21:44:14.229: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: 21:44:18.379: GtkDialog mapped without a transient parent. This is discouraged.

[2] 21:45:00 Translation Notification
[FreeFluids.TMedia: 20:5-20:262]: From here:

[3] 21:45:00 Translation Error
[Modelica.Media: 5790:44-5791:66]: Trying to redeclare record FluidConstants but record not declared as replaceable.

[4] 21:45:00 Translation Error
[FreeFluids.TMedia: 868:105-868:162]: Variable FreeFluids.MediaCommon.MediaDataAL.CO2 not found in scope ThermoPower.Water.FlangeA$fluidSink$flange.Medium.

[5] 21:45:00 Translation Error
[FreeFluids.TMedia: 868:105-868:162]: Variable FreeFluids.MediaCommon.MediaDataAL.CO2 not found in scope ModelicaTest5a.Medium.

[6] 21:45:00 Translation Error
[FreeFluids.TMedia: 868:105-868:162]: Variable FreeFluids.MediaCommon.MediaDataAL.CO2 not found in scope FreeFluids.TMedia.Fluids.Medium.

[7] 21:45:00 Translation Error
[ThermoPower.Water: 11:5-12:93]: Variable Medium.nXi not found in scope ThermoPower.Water.FlangeA$fluidSink$flange.

[8] 21:45:00 Translation Error
Error occurred while flattening model ModelicaTest5a.R744

hello guys,

I'm new to modelica and I would like to simulate parts of a Heat Pump, that's why I'm using the example TestRefrigerantEvaporator with the Media R744 from the Library AixLib.
I really don't understand what I should do to make it work or why it doesnt work and I've been trying for a while now. Could someone please have a look?

You can download the AixLib here: https://github.com/RWTH-EBC/AixLib/tree … elsR744R32

R744.mo

I’m getting the second error too. Did you manage to fix it?

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