Opened 5 years ago

Last modified 3 years ago

#5975 new defect

Numerical problems with initialization of thermofluid model in BuildingSystems

Reported by: hendrikjob98@… Owned by: Lennart Ochel
Priority: critical Milestone:
Component: Run-time Version: v1.14.1
Keywords: Cc: Andreas Heuermann, Karim Adbdelhak, Lennart Ochel

Description

Hi,
I'm new to OM. So I hope, that this issue can be solve by more experienced people...
I want to simulate a thermal building under weather conditions. For this i mostly use Blocks from the BuildingSystems library.
I just cant get the following code working. I'm German, so there are some German expression in the comments or the name-declarations.

model Wohncontainer
  "Wohncontainer in Putlos"
  extends Modelica.Icons.Example;

  parameter Integer nSurfaces = 8;
  parameter Modelica.SIunits.Position Laenge = 5.758;
  parameter Modelica.SIunits.Position Breite = 2.174;
  parameter Modelica.SIunits.Position Hoehe = 2.290;

  parameter Real C_max(final unit="l/m3")=1;
  parameter Real C_Zuluft(final unit="l/m3")=0.35;
  parameter Real C_CO2Atmen(final unit="1")=0.04;
  parameter Real Vdot_Atmen(final unit="l/h")=240;
  Real nNutzer;
  Real Luftwechsel(final unit="1/h");
  Real CO2AustossNutzer;

  record wand 
  extends BuildingSystems.Buildings.Data.Constructions.OpaqueThermalConstruction(nLayers=3, thickness={0.012,0.284,0.004}, material={Sperrholz(), Isolierung(), Stahl()});
  end wand;

  
  record boden 
  extends BuildingSystems.Buildings.Data.Constructions.OpaqueThermalConstruction(nLayers=4, thickness={0.002,0.018,0.278,0.004}, material={PVCBelag(), Sperrholz(), Isolierung(), Stahl()});
  end boden;
  
  record fenster 
  extends BuildingSystems.Buildings.Data.Constructions.TransparentConstruction(nPanes=2, thickness={0.003,0.003}, UValGla = 1.0, UValFra = 1.5, g = 0.52, b0 = 0.7);
  end fenster;
  
  record Isolierung 
    extends BuildingSystems.HAM.Data.MaterialProperties.BaseClasses.MaterialThermalGeneral
    (
    id=11,
    name="Isolierung",
    lambda=0.03,
    c=1400,
    rho=35);
  end Isolierung;
    
  record PVCBelag 
    extends BuildingSystems.HAM.Data.MaterialProperties.BaseClasses.MaterialThermalGeneral
    (
    id=13,
    name="PVCBelag",
    lambda=0.15,
    c=850,
    rho=138);
  end PVCBelag;
  
  record Sperrholz 
    extends BuildingSystems.HAM.Data.MaterialProperties.BaseClasses.MaterialThermalGeneral
    (
    id=12,
    name="Sperrholz",
    lambda=0.17,
    c=2100,
    rho=720);
  end Sperrholz;
  
  record Stahl 
    extends BuildingSystems.HAM.Data.MaterialProperties.BaseClasses.MaterialThermalGeneral
    (
    id=10,
    name="Stahl",
    lambda=50,
    c=490,
    rho=7900);
  end Stahl;
  
  BuildingSystems.Buildings.Constructions.Doors.Door door( redeclare wand constructionData, angleDegAzi=180.0, angleDegTil=90.0, calcAirchange = false,height=2.0, width=0.9) annotation(
    Placement(visible = true, transformation(origin = { -54, -88}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  BuildingSystems.Buildings.Constructions.Walls.WallThermal1DNodes wall3(height=Hoehe, width=Breite, angleDegAzi=180.0, angleDegTil=90.0, redeclare wand constructionData, AInnSur=door.width*door.height) annotation(
    Placement(visible = true, transformation(origin = {-30, -44}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  BuildingSystems.Buildings.Constructions.Walls.WallThermal1DNodes wall4(height=Hoehe, width=Laenge, angleDegAzi=-90.0, angleDegTil=90.0, redeclare wand constructionData) annotation(
    Placement(visible = true, transformation(origin = {-30, -70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  BuildingSystems.Buildings.Constructions.Walls.WallThermal1DNodes ceiling(height=Laenge, width=Breite, angleDegAzi=0.0, angleDegTil=180.0, redeclare wand constructionData) annotation(
    Placement(visible = true, transformation(origin = {-30, 32}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  BuildingSystems.Buildings.Constructions.Walls.WallThermal1DNodes bottom(height=Laenge, width=Breite, angleDegAzi=0.0, angleDegTil=0.0, redeclare boden constructionData) annotation(
    Placement(visible = true, transformation(origin = {-30, 56}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  BuildingSystems.Buildings.Constructions.Windows.Window window( redeclare fenster constructionData,angleDegAzi=0.0, angleDegTil=90.0, calcAirchange = false,height=1.2, width=0.9) annotation(
    Placement(visible = true, transformation(origin = {-48, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  BuildingSystems.Buildings.Constructions.Walls.WallThermal1DNodes wall1(height=Hoehe, width=Breite, angleDegAzi=0.0, angleDegTil=90.0, redeclare wand constructionData, AInnSur=window.width*window.height) annotation(
    Placement(visible = true, transformation(origin = {-30, 8}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  BuildingSystems.Buildings.Constructions.Walls.WallThermal1DNodes wall2(height=Hoehe, width=Laenge, angleDegAzi=90.0, angleDegTil=90.0, redeclare wand constructionData) annotation(
    Placement(visible = true, transformation(origin = {-30, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

  BuildingSystems.Buildings.Ambience ambience(redeclare block WeatherData = BuildingSystems.Climate.WeatherDataMeteonorm.Germany_Berlin_Meteonorm_ASCII, nSurfaces = nSurfaces)  annotation(
    Placement(visible = true, transformation(origin = {-102, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

  BuildingSystems.Buildings.Zones.ZoneTemplateAirvolumeMixed zone( Q_flow_coolingMax = -2000, Q_flow_heatingMax = 2000,T_start = 293.15,V=Laenge*Breite*Hoehe, airchange = Luftwechsel, calcIdealLoads=true, heatSources = true, height = Hoehe, heightAirpath = {0.5, 1.7, 0.0, 2.0}, moistureSources = true, nAirpaths = 4, nConstructions = 8, nMoistureSources = 0, prescribedAirchange = false, x_start = 0.005)  annotation(
    Placement(visible = true, transformation(origin = {28, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

  Modelica.Blocks.Sources.Constant TSetHeating(k = 293.15)  annotation(
    Placement(visible = true, transformation(origin = {4, 16}, extent = {{-3, -3}, {3, 3}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant TSetCooling(k = 297.15)  annotation(
    Placement(visible = true, transformation(origin = {4, 6}, extent = {{-3, -3}, {3, 3}}, rotation = 0)));

  BuildingSystems.Buildings.Surfaces.SurfaceToAir surfaceToAirWall1(T(fixed = true)) annotation(
    Placement(visible = true, transformation(origin = {-38, 8}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  BuildingSystems.Buildings.Surfaces.SurfaceToAir surfaceToAirWall2(T(fixed = true)) annotation(
    Placement(visible = true, transformation(origin = {-38, -20}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  BuildingSystems.Buildings.Surfaces.SurfaceToAir surfaceToAirWall3(T(fixed = true)) annotation(
    Placement(visible = true, transformation(origin = {-38, -44}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  BuildingSystems.Buildings.Surfaces.SurfaceToAir surfaceToAirWall4(T(fixed = true)) annotation(
    Placement(visible = true, transformation(origin = {-38, -70}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  BuildingSystems.Buildings.Surfaces.SurfaceToAir surfaceToAirCeiling(T(fixed = true)) annotation(
    Placement(visible = true, transformation(origin = {-38, 32}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  BuildingSystems.Buildings.Surfaces.SurfaceToAir surfaceToAirWindow(T(fixed = true))  annotation(
    Placement(visible = true, transformation(origin = {-70, -4}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  BuildingSystems.Buildings.Surfaces.SurfaceToAir surfaceToAirDoor(T(fixed = true)) annotation(
    Placement(visible = true, transformation(origin = {-74, -88}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  BuildingSystems.Buildings.Surfaces.SurfaceToAir surfaceToAirBottom(T(fixed = true)) annotation(
    Placement(visible = true, transformation(origin = {-40, 56}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));

equation

  nNutzer = Modelica.Math.Special.erfc((time - 25200)/2000) + 1000 * Modelica.Math.Distributions.Normal.density(time, mu=43200, sigma=1000) + Modelica.Math.Special.erf((time - 61200)/2000) + 1;
  //random number generator einfuegen * Modelica.Math.Random.Generators.Xorshift64star.random(Modelica.Math.Random.Generators.Xorshift64star.initialState(  614657, 30020))
  CO2AustossNutzer = C_CO2Atmen * Vdot_Atmen * nNutzer;
  Luftwechsel = CO2AustossNutzer / ((C_max - C_Zuluft) * Laenge * Breite * Hoehe);
  
  connect(bottom.toSurfacePort_2, zone.toConstructionPorts[8]) annotation(
    Line(points = {{-28, 56}, {28, 56}, {28, -4}}));
  connect(ceiling.toSurfacePort_2, zone.toConstructionPorts[1]) annotation(
    Line(points = {{-28, 32}, {-9, 32}, {-9, -4}, {28, -4}}));
  connect(wall1.toSurfacePort_2, zone.toConstructionPorts[2]) annotation(
    Line(points = {{-28, 8}, {-9, 8}, {-9, -4}, {28, -4}}));
  connect(wall2.toSurfacePort_2, zone.toConstructionPorts[4]) annotation(
    Line(points = {{-28, -20}, {-9, -20}, {-9, -4}, {28, -4}}));
  connect(wall3.toSurfacePort_2, zone.toConstructionPorts[5]) annotation(
    Line(points = {{-28, -44}, {-9, -44}, {-9, -4}, {28, -4}}));
  connect(wall4.toSurfacePort_2, zone.toConstructionPorts[7]) annotation(
    Line(points = {{-28, -70}, {28, -70}, {28, -4}}));
  connect(window.toSurfacePort_2, zone.toConstructionPorts[3]) annotation(
    Line(points = {{-46, -4}, {28, -4}}));
  connect(door.toSurfacePort_2, zone.toConstructionPorts[6]) annotation(
    Line(points = {{-52, -88}, {28, -88}, {28, -4}}));
  connect(TSetHeating.y, zone.T_setHeating) annotation(
    Line(points = {{7, 16}, {11.5, 16}, {11.5, 3}, {17, 3}}, color = {0, 0, 127}));
  connect(TSetCooling.y, zone.T_setCooling) annotation(
    Line(points = {{7, 6}, {9.5, 6}, {9.5, 1}, {17, 1}}, color = {0, 0, 127}));
  connect(ambience.TAirRef, zone.TAirAmb) annotation(
    Line(points = {{-110, 4}, {-126, 4}, {-126, -32}, {0, -32}, {0, -10}, {18, -10}, {18, -8}}, color = {0, 0, 127}));
  connect(ambience.xAir, zone.xAirAmb) annotation(
    Line(points = {{-110, 2}, {-124, 2}, {-124, -34}, {2, -34}, {2, -12}, {18, -12}, {18, -10}}, color = {0, 0, 127}));
  connect(surfaceToAirWall1.toConstructionPort, wall1.toSurfacePort_1) annotation(
    Line(points = {{-38, 8}, {-32, 8}, {-32, 8}, {-32, 8}}));
  connect(surfaceToAirWall2.toConstructionPort, wall2.toSurfacePort_1) annotation(
    Line(points = {{-38, -20}, {-32, -20}, {-32, -20}, {-32, -20}}));
  connect(surfaceToAirWall3.toConstructionPort, wall3.toSurfacePort_1) annotation(
    Line(points = {{-38, -44}, {-32, -44}, {-32, -44}, {-32, -44}}));
  connect(surfaceToAirWall4.toConstructionPort, wall4.toSurfacePort_1) annotation(
    Line(points = {{-38, -70}, {-32, -70}, {-32, -70}, {-32, -70}}));
  connect(surfaceToAirCeiling.toConstructionPort, ceiling.toSurfacePort_1) annotation(
    Line(points = {{-38, 32}, {-32, 32}, {-32, 32}, {-32, 32}}));
  connect(surfaceToAirWindow.toConstructionPort, window.toSurfacePort_1) annotation(
    Line(points = {{-69, -4}, {-50, -4}}));
  connect(surfaceToAirDoor.toConstructionPort, door.toSurfacePort_1) annotation(
    Line(points = {{-73, -88}, {-56, -88}}));
  connect(ambience.toSurfacePorts[1], surfaceToAirCeiling.toSurfacesPort) annotation(
    Line(points = {{-92, 0}, {-88, 0}, {-88, 36}, {-38, 36}, {-38, 36}}));
  connect(ambience.toSurfacePorts[2], surfaceToAirWall1.toSurfacesPort) annotation(
    Line(points = {{-92, 0}, {-88, 0}, {-88, 12}, {-38, 12}, {-38, 12}}));
  connect(ambience.toSurfacePorts[3], surfaceToAirWindow.toSurfacesPort) annotation(
    Line(points = {{-92, 0}, {-71, 0}}));
  connect(ambience.toSurfacePorts[4], surfaceToAirWall2.toSurfacesPort) annotation(
    Line(points = {{-92, 0}, {-88, 0}, {-88, -16}, {-38, -16}, {-38, -16}}));
  connect(ambience.toSurfacePorts[5], surfaceToAirWall3.toSurfacesPort) annotation(
    Line(points = {{-92, 0}, {-88, 0}, {-88, -40}, {-38, -40}, {-38, -40}}));
  connect(ambience.toSurfacePorts[6], surfaceToAirDoor.toSurfacesPort) annotation(
    Line(points = {{-92, 0}, {-88, 0}, {-88, -84}, {-75, -84}}));
  connect(ambience.toSurfacePorts[7], surfaceToAirWall4.toSurfacesPort) annotation(
    Line(points = {{-92, 0}, {-88, 0}, {-88, -66}, {-38, -66}, {-38, -66}}));
  connect(ambience.toAirPorts[1], surfaceToAirCeiling.toAirPort) annotation(
    Line(points = {{-92, -8}, {-84, -8}, {-84, 28}, {-38, 28}, {-38, 28}}));
  connect(ambience.toAirPorts[2], surfaceToAirWall1.toAirPort) annotation(
    Line(points = {{-92, -8}, {-84, -8}, {-84, 4}, {-38, 4}, {-38, 4}}));
  connect(ambience.toAirPorts[3], surfaceToAirWindow.toAirPort) annotation(
    Line(points = {{-92, -8}, {-71, -8}}));
  connect(ambience.toAirPorts[4], surfaceToAirWall2.toAirPort) annotation(
    Line(points = {{-92, -8}, {-84, -8}, {-84, -24}, {-38, -24}, {-38, -24}}));
  connect(ambience.toAirPorts[6], surfaceToAirDoor.toAirPort) annotation(
    Line(points = {{-92, -8}, {-84, -8}, {-84, -92}, {-75, -92}}));
  connect(ambience.toAirPorts[7], surfaceToAirWall4.toAirPort) annotation(
    Line(points = {{-92, -8}, {-84, -8}, {-84, -74}, {-38, -74}, {-38, -74}}));
  connect(surfaceToAirBottom.toConstructionPort, bottom.toSurfacePort_1) annotation(
    Line(points = {{-38, 56}, {-32, 56}, {-32, 56}, {-32, 56}}));
  connect(ambience.toSurfacePorts[8], surfaceToAirBottom.toSurfacesPort) annotation(
    Line(points = {{-92, 0}, {-88, 0}, {-88, 60}, {-38, 60}, {-38, 60}}));
  connect(ambience.toAirPorts[8], surfaceToAirBottom.toAirPort) annotation(
    Line(points = {{-92, -8}, {-84, -8}, {-84, 52}, {-38, 52}, {-38, 52}}));
  connect(ambience.toAirPorts[5], surfaceToAirWall3.toAirPort) annotation(
    Line(points = {{-92, -8}, {-84, -8}, {-84, -48}, {-38, -48}, {-38, -48}}));
//31536000s = 1 Jahr, 86400s = 1 Tag
  connect(door.port_b1, zone.airpathPorts[1]) annotation(
    Line(points = {{-52, -82}, {-2, -82}, {-2, 26}, {18, 26}, {18, 8}, {22, 8}}, color = {0, 127, 255}));
  connect(window.port_b1, zone.airpathPorts[2]) annotation(
    Line(points = {{-46, 2}, {-42, 2}, {-42, -2}, {-6, -2}, {-6, 30}, {22, 30}, {22, 8}}, color = {0, 127, 255}));
  connect(window.port_a2, zone.airpathPorts[3]) annotation(
    Line(points = {{-46, -10}, {-42, -10}, {-42, -6}, {-4, -6}, {-4, 28}, {20, 28}, {20, 8}, {22, 8}}, color = {0, 127, 255}));
  connect(door.port_a2, zone.airpathPorts[4]) annotation(
    Line(points = {{-52, -94}, {-8, -94}, {-8, 32}, {24, 32}, {24, 8}, {22, 8}}, color = {0, 127, 255}));
  connect(ambience.toAirpathPorts[1], door.port_a1) annotation(
    Line(points = {{-96, 6}, {-56, 6}, {-56, -82}, {-56, -82}}, color = {0, 127, 255}));
  connect(ambience.toAirpathPorts[2], door.port_b2) annotation(
    Line(points = {{-96, 6}, {-64, 6}, {-64, -94}, {-56, -94}, {-56, -94}}, color = {0, 127, 255}));
  connect(ambience.toAirpathPorts[3], window.port_a1) annotation(
    Line(points = {{-96, 6}, {-54, 6}, {-54, 2}, {-50, 2}, {-50, 2}}, color = {0, 127, 255}));
  connect(ambience.toAirpathPorts[4], window.port_b2) annotation(
    Line(points = {{-96, 6}, {-54, 6}, {-54, -10}, {-50, -10}, {-50, -10}}, color = {0, 127, 255}));
  annotation(experiment(StartTime=0, StopTime=86400),
    uses(BuildingSystems(version = "2.0.0-beta"), Modelica(version = "3.2.3")));
end Wohncontainer;

Currently I am getting the following Error, when trying to simulate:

... loading "tab1" from "F:\OpenModelica\lib\omlibrary\BuildingSystems 2.0.0-beta\Climate\weather\Germany_Berlin.txt"

Wohncontainer_functions.c:196: Invalid root: (-4.409e-016)^(0.4)
simulation terminated by an assertion at initialization
Simulation process failed. Exited with code -1.

When I simulate in Debug-mode, it outputs the following:

stdout            | info    | ... loading "tab1" from "F:\OpenModelica\lib\omlibrary\BuildingSystems 2.0.0-beta\Climate\weather\Germany_Berlin.txt"
assert            | debug   | F:/OpenModelica/lib/omlibrary/BuildingSystems 2.0.0-beta/Buildings/Functions/vWind.mo:16: Invalid root: (-4.409e-016)^(0.4)
assert            | info    | simulation terminated by an assertion at initialization
You can't do that without a process to debug.

I hope that someone can help me with this.

Change History (11)

comment:1 by Adeel Asghar, 5 years ago

Cc: Andreas Heuermann Karim Adbdelhak Lennart Ochel added
Component: OMEditRun-time
Milestone: Future1.16.0
Owner: changed from Adeel Asghar to Lennart Ochel

comment:2 by Karim Adbdelhak, 5 years ago

When i compile your model i get additional warnings at the bottom. These should pinpoint to what is going wrong:

Warning: The model contains alias variables with redundant start and/or conflicting nominal values. It is recommended to resolve the conflicts, because otherwise the system could be hard to solve. To print the conflicting alias sets and the chosen candidates please use -d=aliasConflicts.
Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").

They propose to use the debug flags -d=aliasConflicts and -d=initialization. The alias conflicts do not seem to pose problems, since all the start values you defined just overwrite the ones defined in the libraries, but you should check them anyway just to be sure. If you have two variables being set equal in your system, one of them will be removed and replaced by the other. If the start values (or min, max, nominal) of those variables do not match, it will be an alias conflict.

The initialization on the other hand should be the problematic part since the simulation fails during initialization. It reports the following variables to be fixed during the process of initialization:

Warning: Assuming fixed start value for the following 19 variables:
         zone.airvolume.U:VARIABLE(start = (1.2 * zone.airvolume.V * 1006.0 + 1.2 * zone.airvolume.V * zone.airvolume.x_start[1] * 1860.0 + zone.airvolume.mH2OLiq_start * 4184.0) * zone.airvolume.T_start[1] + 3001217.4 * zone.airvolume.V * zone.airvolume.x_start[1] unit = "J" fixed = true protected = true )  "Internal energy of the air volume" type: Real
         zone.airvolume.mH2OLiq:VARIABLE(min = 0.0 start = zone.airvolume.mH2OLiq_start unit = "kg" fixed = true )  "Mass of liquid water" type: Real
         zone.airvolume.mH2OAir:VARIABLE(min = 0.0 start = zone.airvolume.x_start[1] * zone.airvolume.V * 1.2 unit = "kg" fixed = true )  "Mass of water vapor in the air" type: Real
         zone.airvolume.m:VARIABLE(min = 0.0 start = zone.airvolume.V * 1.2 unit = "kg" fixed = true )  "Mass of dry air" type: Real
         wall2.construction.layer[3].T[1]:VARIABLE(min = max(0.0, 0.0) start = wall2.construction.layer[3].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [3,1]
         wall2.construction.layer[2].T[1]:VARIABLE(min = max(0.0, 0.0) start = wall2.construction.layer[2].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [3,1]
         wall1.construction.layer[3].T[1]:VARIABLE(min = max(0.0, 0.0) start = wall1.construction.layer[3].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [3,1]
         wall1.construction.layer[2].T[1]:VARIABLE(min = max(0.0, 0.0) start = wall1.construction.layer[2].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [3,1]
         bottom.construction.layer[4].T[1]:VARIABLE(min = max(0.0, 0.0) start = bottom.construction.layer[4].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [4,1]
         bottom.construction.layer[3].T[1]:VARIABLE(min = max(0.0, 0.0) start = bottom.construction.layer[3].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [4,1]
         bottom.construction.layer[2].T[1]:VARIABLE(min = max(0.0, 0.0) start = bottom.construction.layer[2].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [4,1]
         ceiling.construction.layer[3].T[1]:VARIABLE(min = max(0.0, 0.0) start = ceiling.construction.layer[3].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [3,1]
         ceiling.construction.layer[2].T[1]:VARIABLE(min = max(0.0, 0.0) start = ceiling.construction.layer[2].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [3,1]
         wall4.construction.layer[3].T[1]:VARIABLE(min = max(0.0, 0.0) start = wall4.construction.layer[3].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [3,1]
         wall4.construction.layer[2].T[1]:VARIABLE(min = max(0.0, 0.0) start = wall4.construction.layer[2].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [3,1]
         wall3.construction.layer[3].T[1]:VARIABLE(min = max(0.0, 0.0) start = wall3.construction.layer[3].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [3,1]
         wall3.construction.layer[2].T[1]:VARIABLE(min = max(0.0, 0.0) start = wall3.construction.layer[2].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [3,1]
         door.construction.layer[2].T[1]:VARIABLE(min = max(0.0, 0.0) start = door.construction.layer[2].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [3,1]
         door.construction.layer[3].T[1]:VARIABLE(min = max(0.0, 0.0) start = door.construction.layer[3].T_start unit = "K" fixed = true nominal = 300.0 )  "Temperature of the numerical node" type: Real [3,1]
"

You should check if these are actually the ones that should be used for initialization and you should check if all the T_start attributes which are used here have sensible values.

I also tracked down the functions that throws the assert, it is BuildingSystems.Buildings.Functions.vWind which gets called from BuildingSystems.Buildings.Ambience. Unfortunately it is really hard to tell where the problem originates from since the BuildingSystem connectors are not balanced. It is hard to predict the flow of information without knowledge about the system itself. None of the inputs or outputs are one of the reported missing fixed values, they are indirectly influenced by it. Since all of the calls have identical structure besides zMean, i guess those are the values you have to look for.

(1): ambience.toAirPorts[8].vAir = BuildingSystems.Buildings.Functions.vWind(ambience.vWindRef, ambience.toSurfacePorts[8].zMean, ambience.zRefvWind, ambience.P)   [unknown |0|0|0|0|]
(1): ambience.toAirPorts[7].vAir = BuildingSystems.Buildings.Functions.vWind(ambience.vWindRef, ambience.toSurfacePorts[7].zMean, ambience.zRefvWind, ambience.P)   [unknown |0|0|0|0|]
(1): ambience.toAirPorts[6].vAir = BuildingSystems.Buildings.Functions.vWind(ambience.vWindRef, ambience.toSurfacePorts[6].zMean, ambience.zRefvWind, ambience.P)   [unknown |0|0|0|0|]
(1): ambience.toAirPorts[5].vAir = BuildingSystems.Buildings.Functions.vWind(ambience.vWindRef, ambience.toSurfacePorts[5].zMean, ambience.zRefvWind, ambience.P)   [unknown |0|0|0|0|]
(1): ambience.toAirPorts[4].vAir = BuildingSystems.Buildings.Functions.vWind(ambience.vWindRef, ambience.toSurfacePorts[4].zMean, ambience.zRefvWind, ambience.P)   [unknown |0|0|0|0|]
(1): ambience.toAirPorts[3].vAir = BuildingSystems.Buildings.Functions.vWind(ambience.vWindRef, ambience.toSurfacePorts[3].zMean, ambience.zRefvWind, ambience.P)   [unknown |0|0|0|0|]
(1): ambience.toAirPorts[2].vAir = BuildingSystems.Buildings.Functions.vWind(ambience.vWindRef, ambience.toSurfacePorts[2].zMean, ambience.zRefvWind, ambience.P)   [unknown |0|0|0|0|]
(1): ambience.toAirPorts[1].vAir = BuildingSystems.Buildings.Functions.vWind(ambience.vWindRef, ambience.toSurfacePorts[1].zMean, ambience.zRefvWind, ambience.P)   [unknown |0|0|0|0|]

Hard to tell more about your system without further information since i do not really know what sensible start values should look like!

comment:3 by Francesco Casella, 5 years ago

In my experience relying on any Modelica tool to pick up initial equations automatically for this kind of systems is extremely dangerous, because the tool may not do what the modeller intends. Also, different Modelica tools or different versions of the same tool may pick different initial equations and produce different results (or fail).

It should be the model/library developer that puts the appropriate fixed = true modifiers or initial equations so that the message "The initial conditions are not fully specified." does not show up.

Are the automatically selected equations the right ones?

Last edited 5 years ago by Francesco Casella (previous) (diff)

comment:4 by Francesco Casella, 5 years ago

You may also turn on LOG_NLS or LOG_NLS_V and inspect the initial guesses of the iteratives solvers used for nonlinear systems at initialization. This is a bit awkward, we have plans to make this more user-friendly in the future based onthis paper, but it's not ready yet.

comment:5 by Francesco Casella, 5 years ago

Summary: Simulation process failed. Exited with code -1.Numerical problems with initialization of thermofluid model in BuildingSystems

comment:6 by Hendrik Job <hendrikjob98@…>, 5 years ago

I fixed the zMean issue by adding a zLevel value to the settings of the ceiling, in this case zLevel = 2.290 (and also to the window). I don't know if there should be values set in the other constructional elements, but I think it shouldbe correct in this way. Right now the simulation works but still with some warnings:

The initialization finished successfully without homotopy method.
The following assertion has been violated at time 518.400000
zone.airvolume.mH2OLiq >= 0.0
Variable violating min constraint: 0.0 <= zone.airvolume.mH2OLiq, has value: -7.60466e-024
### STATISTICS ###
The simulation finished successfully.

There are still some start value issues, which I have to fix step by step. But beside of those, the simulation look quite good now.

in reply to:  3 ; comment:7 by Hendrik Job <hendrikjob98@…>, 5 years ago

Also the airchange evaluation didn't work, because, the door and the window had no control for opening and closing, so I have added those and set the calcAirchange = true for the door and the window.

BuildingSystems.Buildings.Constructions.Doors.Door door(redeclare wand constructionData, T_start = {293.15 for i in 1:wand.nLayers}, angleDegAzi = 180.0, angleDegTil = 90.0, calcAirchange = true, height = 2.0, nNodes = fill(1, wand.nLayers), width = 0.9) annotation(
    Placement(visible = true, transformation(origin = {-54, -88}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

I tried to fix some start value issues with T_start = {293.15 for i in 1:wand.nLayers} and nNodes = fill(1, wand.nLayers) but this didn't work fine for me. Any suggestions on this?

Replying to casella:

In my experience relying on any Modelica tool to pick up initial equations automatically for this kind of systems is extremely dangerous, because the tool may not do what the modeller intends. Also, different Modelica tools or different versions of the same tool may pick different initial equations and produce different results (or fail).

I do not know exactly how to fix this. There is a call of a verion of some library at the end: uses(BuildingSystems(version = "2.0.0-beta"), Modelica(version = "3.2.3"))); but just deleting those did not mkae anything better... (sorry if this is too basic, I'm a noob in Modelica)

in reply to:  7 comment:8 by Karim Adbdelhak, 5 years ago

Replying to Hendrik Job <hendrikjob98@…>:

Replying to casella:

In my experience relying on any Modelica tool to pick up initial equations automatically for this kind of systems is extremely dangerous, because the tool may not do what the modeller intends. Also, different Modelica tools or different versions of the same tool may pick different initial equations and produce different results (or fail).

I do not know exactly how to fix this. There is a call of a verion of some library at the end: uses(BuildingSystems(version = "2.0.0-beta"), Modelica(version = "3.2.3"))); but just deleting those did not mkae anything better... (sorry if this is too basic, I'm a noob in Modelica)

What he means with Modelica tool is OpenModelica itself. If the initial system is not balanced it has to figure out a balanced initialization by itself, which can be different of what the modeler is expecting. That has nothing to do with the libraries (Modelica Standard Library, BuildingSystems) that you use.

The basic idea is that you provide initial equations in the block initial equation or fix certain start values instead of the tool having to do that itself. Just as a short reference, during initialization each state of your system and each discrete variable needs to have an extra equation or state value such that the initial system is (uniquely) solvable. For starters i would stick to fixing variables and giving them proper start values.

Let's say you know that a tank in your system has to start at a certain temperature, than you would provide extra information to that variable like so:

Real T(fixed = true, start = 300);

Note that you can provide sensible start values for all of your variables, but with fixed=true you tell the system that you want this to be in the initial system. Other unfixed values will be used if your provided fixed variables and initial equations do not suffice.

In my first comment i posted an output that is generated when using d=initialization (which you can set in Tools->Options->Simulation->Translation Flags->Additional Translation Flags). In that output you can see all the variables that were fixed during initialization. You have to make sure that those are correct and in general provide proper fixing to your model.

Version 0, edited 5 years ago by Karim Adbdelhak (next)

comment:9 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:10 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:11 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.