Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue1389 crash course package #1403

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
402 changes: 402 additions & 0 deletions IDEAS/Examples/Tutorial/CrashCourse/Exercise1/SimpleHouse.mo

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions IDEAS/Examples/Tutorial/CrashCourse/Exercise1/package.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
within IDEAS.Examples.Tutorial.CrashCourse;
package Exercise1 "Exercise 1 Modelica crash course: Exploring Dymola, MSL and IDEAS"
annotation (Documentation(info="<html>
<p>
This exercise introduces the Dymola environment, the Modelica Standard Library
(MSL), and the IDEAS library. The objective is to help users become familiar with
model simulation, parameter adaptation, and result visualization using Dymola.
</p>
</html>"));
end Exercise1;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SimpleHouse
22 changes: 22 additions & 0 deletions IDEAS/Examples/Tutorial/CrashCourse/Exercise2/package.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
within IDEAS.Examples.Tutorial.CrashCourse;
package Exercise2 "Exercise 2 Modelica crash course: IDEAS SimpleHouse"

annotation (Documentation(info="<html>
<p>
This exercise focuses on developing familiarity with Modelica and the IDEAS library.
It emphasizes graphical modeling using library components rather than equation-based
modeling. The exercise involves constructing and incrementally extending a simple
house model.
</p>
<p>
Use the step-by-step approach outlined in <a href=\"modelica://IDEAS.Examples.Tutorial.SimpleHouse\">
IDEAS.Examples.Tutorial.SimpleHouse</a> for detailed guidance on each stage of the exercise.
</p>
The graphical representation of the final model is given below.
</p>
<p align=\"center\">
<img alt=\"Graphical representation of the final simple house model.\"
src=\"modelica://IDEAS/Resources/Images/Examples/Tutorial/SimpleHouse/simpleHouse.png\"/>
</p>
</html>"));
end Exercise2;
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
within IDEAS.Examples.Tutorial;
within IDEAS.Examples.Tutorial.CrashCourse.Exercise3;
model Example1 "First example model containing one zone"
extends Modelica.Icons.Example;
package Medium = IDEAS.Media.Air "Air medium";
Expand All @@ -7,7 +7,6 @@ model Example1 "First example model containing one zone"
parameter Modelica.Units.SI.Length w=4 "Zone width";
parameter Modelica.Units.SI.Length h=2.7 "Zone height";


//SimInfoManager must be 'inner' at the top level
inner IDEAS.BoundaryConditions.SimInfoManager sim
annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
Expand Down Expand Up @@ -76,31 +75,31 @@ model Example1 "First example model containing one zone"
origin={70,10})));
equation
connect(outerWall.propsBus_a, zone.propsBus[1]) annotation (Line(
points={{-45,12},{-38.5,12},{-38.5,15.7143},{-20,15.7143}},
points={{-45,12},{-38.5,12},{-38.5,13.1429},{-20,13.1429}},
color={255,204,51},
Comment on lines -79 to +78
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see quite some unintended changes, due to different Dymola versions. Sometimes Dymola changes other lines in the text if you save a model. However, it is a good practice to check the lines of code that you commit and only commit the lines that you really want to change. You can discard all other changes.

As there are many, and you will change the structure anyway, I propose to start from a new branch, which is easier than reverting these changes.

thickness=0.5));
connect(zone.propsBus[2], outerWall2.propsBus_a) annotation (Line(
points={{-20,15.1429},{-22,15.1429},{-22,47},{-12,47}},
points={{-20,13.4286},{-22,13.4286},{-22,47},{-12,47}},
color={255,204,51},
thickness=0.5));
connect(zone.propsBus[3], outerWall1.propsBus_a) annotation (Line(
points={{-20,14.5714},{-20,28},{25,28},{25,12}},
points={{-20,13.7143},{-20,28},{25,28},{25,12}},
color={255,204,51},
thickness=0.5));
connect(outerWall3.propsBus_a, zone.propsBus[4]) annotation (Line(
points={{-12,-25},{-12,-6},{-20,-6},{-20,14}},
color={255,204,51},
thickness=0.5));
connect(window.propsBus_a, zone.propsBus[5]) annotation (Line(
points={{-38,-25},{-38,14},{-20,14},{-20,13.4286}},
points={{-38,-25},{-38,14},{-20,14},{-20,14.2857}},
color={255,204,51},
thickness=0.5));
connect(floor.propsBus_a, zone.propsBus[6]) annotation (Line(
points={{68,15},{68,28},{-20,28},{-20,12.8571}},
points={{68,15},{68,28},{-20,28},{-20,14.5714}},
color={255,204,51},
thickness=0.5));
connect(floor.propsBus_b, zone.propsBus[7]) annotation (Line(
points={{68,5},{68,-6},{-20,-6},{-20,12.2857}},
points={{68,5},{68,-6},{-20,-6},{-20,14.8571}},
color={255,204,51},
thickness=0.5));
annotation (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
within IDEAS.Examples.Tutorial;
within IDEAS.Examples.Tutorial.CrashCourse.Exercise3;
model Example2 "Adding closed screens"
extends Example1(window(redeclare Buildings.Components.Shading.Screen shaType));
extends Exercise3.Example1(
window(redeclare Buildings.Components.Shading.Screen shaType));
Modelica.Blocks.Sources.Constant const(k=1)
annotation (Placement(transformation(extent={{-100,-60},{-80,-40}})));
equation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
within IDEAS.Examples.Tutorial;
within IDEAS.Examples.Tutorial.CrashCourse.Exercise3;
model Example3 "Adding occupant and lighting"
extends Example2(zone(
extends Exercise3.Example2(
zone(
redeclare replaceable Buildings.Components.Occupants.Fixed occNum(nOccFix=1),
redeclare Buildings.Components.OccupancyType.OfficeWork occTyp,
redeclare Buildings.Components.RoomType.Office rooTyp,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
within IDEAS.Examples.Tutorial;
within IDEAS.Examples.Tutorial.CrashCourse.Exercise3;
model Example4 "Including custom occupant schedule"
extends Example3(zone(redeclare OccSched occNum(k=2)));
extends Exercise3.Example3(
zone(redeclare OccSched occNum(k=2)));

protected
model OccSched "Simple occupancy schedule"
Expand Down
91 changes: 91 additions & 0 deletions IDEAS/Examples/Tutorial/CrashCourse/Exercise3/Example5.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
within IDEAS.Examples.Tutorial.CrashCourse.Exercise3;
model Example5 "New model with 2 coupled zones"
extends Modelica.Icons.Example;
replaceable package Medium = IDEAS.Media.Air "Air medium";

parameter Modelica.Units.SI.Length l=8 "Zone length";
parameter Modelica.Units.SI.Length w=4 "Zone width";
parameter Modelica.Units.SI.Length h=2.7 "Zone height";

inner BoundaryConditions.SimInfoManager sim
annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
Buildings.Components.RectangularZoneTemplate rectangularZoneTemplate(
redeclare package Medium = Medium,
aziA=IDEAS.Types.Azimuth.N,
h=h,
bouTypA=IDEAS.Buildings.Components.Interfaces.BoundaryType.OuterWall,
bouTypB=IDEAS.Buildings.Components.Interfaces.BoundaryType.OuterWall,
bouTypD=IDEAS.Buildings.Components.Interfaces.BoundaryType.OuterWall,
redeclare Buildings.Validation.Data.Constructions.HeavyWall conTypA,
redeclare Buildings.Validation.Data.Constructions.HeavyWall conTypB,
redeclare Buildings.Validation.Data.Constructions.HeavyWall conTypC,
redeclare Buildings.Validation.Data.Constructions.HeavyWall conTypD,
bouTypC=IDEAS.Buildings.Components.Interfaces.BoundaryType.InternalWall,
bouTypFlo=IDEAS.Buildings.Components.Interfaces.BoundaryType.InternalWall,
bouTypCei=IDEAS.Buildings.Components.Interfaces.BoundaryType.External,
l=w,
w=l/2,
hasWinA=true,
A_winA=2*1.3,
redeclare TwinHouses.BaseClasses.Data.Materials.Glazing glazingA,
redeclare Buildings.Validation.Data.Constructions.HeavyWall conTypFlo)
"North part of the zone"
annotation (Placement(transformation(extent={{-10,20},{10,40}})));
Buildings.Components.RectangularZoneTemplate rectangularZoneTemplate1(
redeclare package Medium = Medium,
aziA=IDEAS.Types.Azimuth.N,
h=h,
bouTypB=IDEAS.Buildings.Components.Interfaces.BoundaryType.OuterWall,
bouTypC=IDEAS.Buildings.Components.Interfaces.BoundaryType.OuterWall,
bouTypD=IDEAS.Buildings.Components.Interfaces.BoundaryType.OuterWall,
bouTypFlo=IDEAS.Buildings.Components.Interfaces.BoundaryType.InternalWall,
bouTypCei=IDEAS.Buildings.Components.Interfaces.BoundaryType.External,
redeclare Buildings.Validation.Data.Constructions.HeavyWall conTypB,
redeclare Buildings.Validation.Data.Constructions.HeavyWall conTypC,
redeclare Buildings.Validation.Data.Constructions.HeavyWall conTypD,
redeclare Buildings.Validation.Data.Constructions.HeavyWall conTypFlo,
bouTypA=IDEAS.Buildings.Components.Interfaces.BoundaryType.External,
l=w,
w=l/2,
hasWinC=true,
A_winC=2*1.3,
redeclare TwinHouses.BaseClasses.Data.Materials.Glazing glazingC)
"South part of the zone"
annotation (Placement(transformation(extent={{-10,-40},{10,-20}})));
equation
connect(rectangularZoneTemplate.proBusFlo, rectangularZoneTemplate.proBusCei)
annotation (Line(
points={{0,24},{28,24},{28,36},{-0.2,36}},
color={255,204,51},
thickness=0.5));
connect(rectangularZoneTemplate1.proBusA, rectangularZoneTemplate.proBusC)
annotation (Line(
points={{-6,-21},{-6,2},{6.8,2},{6.8,20.2}},
color={255,204,51},
thickness=0.5));
connect(rectangularZoneTemplate1.proBusCei, rectangularZoneTemplate1.proBusFlo)
annotation (Line(
points={{-0.2,-24},{28,-24},{28,-36},{0,-36}},
color={255,204,51},
thickness=0.5));
annotation (Documentation(revisions="<html>
<ul>
<li>
September 18, 2019 by Filip Jorissen:<br/>
First implementation for the IDEAS crash course.
</li>
</ul>
</html>", info="<html>
<p>
This example demonstrates the use of the RectangularZoneTemplate.
The one-zone implementation with one window of example 1 is repeated here as
a two-zone implementation with two windows that are north and south oriented.
Note the different temperature responses of the zones.
</p>
</html>"), experiment(
StartTime=10000000,
StopTime=11000000,
__Dymola_NumberOfIntervals=5000,
Tolerance=1e-06,
__Dymola_Algorithm="Lsodar"));
end Example5;
12 changes: 12 additions & 0 deletions IDEAS/Examples/Tutorial/CrashCourse/Exercise3/package.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
within IDEAS.Examples.Tutorial.CrashCourse;
package Exercise3 "Exercise 3 Modelica crash course: Detailed Building Envelope Modeling"

annotation (Documentation(info="<html>
<p>
This exercise introduces the IDEAS.Buildings package in Modelica and focuses on
building a simple house model with detailed building envelope components.
Starting from scratch, the model will be incrementally developed, leveraging the
Modelica extends clause to build upon the previous step's model.
</p>
</html>"));
end Exercise3;
5 changes: 5 additions & 0 deletions IDEAS/Examples/Tutorial/CrashCourse/Exercise3/package.order
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Example1
Example2
Example3
Example4
Example5
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
within IDEAS.Examples.Tutorial;
within IDEAS.Examples.Tutorial.CrashCourse.Exercise4;
model Example10 "Speeding up the code"
extends Example9(
extends Exercise4.Example9(
fanRet(
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, use_riseTime=
false),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
within IDEAS.Examples.Tutorial;
within IDEAS.Examples.Tutorial.CrashCourse.Exercise4;
model Example6 "Extension of example 5 that adds a heating system"
extends Example5;
extends Exercise3.Example5;
package MediumWater = IDEAS.Media.Water "Water Medium";

Fluid.HeatPumps.ScrollWaterToWater heaPum(
Expand Down Expand Up @@ -121,9 +121,9 @@ equation
connect(heaPum.port_a2, pumpPrim.port_b)
annotation (Line(points={{196,20},{196,60},{220,60}}, color={0,127,255}));
connect(heaPum.port_b2, bou.ports[1]) annotation (Line(points={{196,0},{196,
-30},{248,-30},{248,8},{260,8}}, color={0,127,255}));
-30},{248,-30},{248,11},{260,11}}, color={0,127,255}));
connect(pumpPrim.port_a, bou.ports[2]) annotation (Line(points={{240,60},{248,
60},{248,12},{260,12}}, color={0,127,255}));
60},{248,9},{260,9}}, color={0,127,255}));
connect(rad.heatPortCon, rectangularZoneTemplate.gainCon) annotation (Line(
points={{42.8,-8},{20,-8},{20,27},{10,27}}, color={191,0,0}));
connect(rad.heatPortRad, rectangularZoneTemplate.gainRad) annotation (Line(
Expand All @@ -146,9 +146,10 @@ equation
connect(senTemSup.port_b, pumpSec.port_a)
annotation (Line(points={{126,60},{120,60}}, color={0,127,255}));
connect(senTemSup.port_a, tan.port_b)
annotation (Line(points={{146,60},{158,60}}, color={0,127,255}));
annotation (Line(points={{146,60},{158,60},{158,50},{168,50}},
color={0,127,255}));
connect(tan.port_a, heaPum.port_b1)
annotation (Line(points={{178,60},{184,60},{184,20}}, color={0,127,255}));
annotation (Line(points={{168,70},{184,70},{184,20}}, color={0,127,255}));
connect(rad1.port_b, heaPum.port_a1) annotation (Line(points={{90,-20},{90,
-30},{184,-30},{184,0}}, color={0,127,255}));
connect(rad.port_b, heaPum.port_a1) annotation (Line(points={{50,-20},{50,-30},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
within IDEAS.Examples.Tutorial;
within IDEAS.Examples.Tutorial.CrashCourse.Exercise4;
model Example7 "Adding a controller"
extends Example6(heaPum(enable_variable_speed=true));
extends Exercise4.Example6(
heaPum(enable_variable_speed=true));
Modelica.Blocks.Logical.Hysteresis hys(uLow=273.15 + 40, uHigh=273.15 + 45)
"Hysteresis controller"
annotation (Placement(transformation(extent={{60,-80},{80,-60}})));
Expand All @@ -12,8 +13,8 @@ equation
connect(hys.y, booToRea.u) annotation (Line(points={{81,-70},{88,-70},{88,-70},
{98,-70}}, color={255,0,255}));
connect(booToRea.y, heaPum.y)
annotation (Line(points={{121,-70},{167,-70},{167,-2}}, color={0,0,127}));
connect(senTemSup.T, hys.u) annotation (Line(points={{140,49},{140,4},{120,4},
annotation (Line(points={{121,-70},{187,-70},{187,-2}}, color={0,0,127}));
connect(senTemSup.T, hys.u) annotation (Line(points={{136,49},{136,4},{120,4},
{120,-40},{40,-40},{40,-70},{58,-70}}, color={0,0,127}));
annotation (
Documentation(revisions="<html>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
within IDEAS.Examples.Tutorial;
within IDEAS.Examples.Tutorial.CrashCourse.Exercise4;
model Example8 "JSOn writer"
extends Example7;
extends Exercise4.Example7;
Utilities.IO.Files.JSONWriter jsonWri(
nin=1,
fileName="EEl.json",
varKeys={"Electrical energy [kWh]"},
outputTime=IDEAS.Utilities.IO.Files.BaseClasses.OutputTime.Terminal)
annotation (Placement(transformation(extent={{280,-42},{260,-22}})));
equation
connect(jsonWri.u[1], EEl.y) annotation (Line(points={{280,-32},{286,-32},{
286,50},{281,50}}, color={0,0,127}));
connect(jsonWri.u[1], EEl.y) annotation (Line(points={{280,-32},{286,-32},{286,
50},{301,50}}, color={0,0,127}));
annotation (Documentation(revisions="<html>
<ul>
<li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
within IDEAS.Examples.Tutorial;
within IDEAS.Examples.Tutorial.CrashCourse.Exercise4;
model Example9 "Adding CO2-controlled ventilation"
extends Example7(
extends Exercise4.Example7(
redeclare package Medium = IDEAS.Media.Air(extraPropertiesNames={"CO2"}),
rectangularZoneTemplate(
redeclare OccSched occNum(k=2),
Expand All @@ -11,7 +11,6 @@ model Example9 "Adding CO2-controlled ventilation"
pumpSec(nominalValuesDefineDefaultPressureCurve=true),
pumpPrim(nominalValuesDefineDefaultPressureCurve=true));


Fluid.Actuators.Dampers.PressureIndependent vavSup(
redeclare package Medium = Medium,
m_flow_nominal=100*1.2/3600,
Expand Down Expand Up @@ -94,7 +93,6 @@ protected
annotation (Line(points={{1,0},{120,0}}, color={0,0,127}));
end OccSched;


equation
connect(vavSup.port_a, fanSup.port_b) annotation (Line(points={{-120,60},{-180,
60},{-180,20},{-200,20}}, color={0,127,255}));
Expand Down Expand Up @@ -124,10 +122,11 @@ equation
annotation (Line(points={{19,90},{-38,90}}, color={0,0,127}));
connect(ppmSet.y, conPID1.u_s) annotation (Line(points={{19,90},{-20,90},{-20,
10},{-38,10}}, color={0,0,127}));
connect(outsideAir.ports[1], hex.port_b2) annotation (Line(points={{-260,-2},
{-250,-2},{-250,-6}}, color={0,127,255}));
connect(outsideAir.ports[2], hex.port_a1) annotation (Line(points={{-260,2},{
-252,2},{-252,6},{-250,6}}, color={0,127,255}));
connect(outsideAir.ports[1], hex.port_b2) annotation (Line(points={{-260,1},
{-250,1},{-250,-6}}, color={0,127,255}));
connect(outsideAir.ports[2], hex.port_a1) annotation (Line(points={{-260,-1},
{-252,-1},{-252,6},{-250,6}},
color={0,127,255}));
connect(vavSup.port_b, rectangularZoneTemplate.ports[1]) annotation (Line(
points={{-100,60},{-2,60},{-2,40},{0,40}}, color={0,127,255}));
connect(vavRet.port_a, rectangularZoneTemplate.ports[2]) annotation (Line(
Expand Down
12 changes: 12 additions & 0 deletions IDEAS/Examples/Tutorial/CrashCourse/Exercise4/package.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
within IDEAS.Examples.Tutorial.CrashCourse;
package Exercise4 "Exercise 4 Modelica crash course: Extending the Simple House Model with HVAC and Complementary Components"

annotation (Documentation(info="<html>
<p>
This exercise explores the Modelica packages of IDEAS that complement the
IDEAS.Buildings package used in Exercise 3. The goal is to extend the simple house
model with HVAC systems and other components, starting from a predefined example.
Incremental development will be used to enhance the model, employing the Modelica
extends clause to build upon each step’s model.</p>
</html>"));
end Exercise4;
5 changes: 5 additions & 0 deletions IDEAS/Examples/Tutorial/CrashCourse/Exercise4/package.order
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Example6
Example7
Example8
Example9
Example10
4 changes: 4 additions & 0 deletions IDEAS/Examples/Tutorial/CrashCourse/package.order
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Exercise1
Exercise2
Exercise3
Exercise4
Loading
Loading