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

[WIP] Add blank lines after semicolons #31

Closed
wants to merge 2 commits into from
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
37 changes: 37 additions & 0 deletions examples/example-arrays-out.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
within Somewhere;
class MyClass
"Class to demo formatting arrays and matrices"
extends Modelica.Icons.BasesPackage;

parameter Real var1=3.14;

parameter Real x[3];

parameter Real y[3]={1.0,0.0,-1.0};

parameter Real z[5]={1.0,0.0,-1.0,2.0,0.0};

parameter Real A[2,3]={{1.0,2.0,3.0},{5.0,6.0,7.0}};

parameter Real B[:,3]={{1.0,2.0,3.0},{5.0,6.0,7.0},{1.0,2.0,3.0},{5.0,6.0,7.0},{1.0,2.0,3.0},{5.0,6.0,7.0},{1.0,2.0,3.0},{5.0,6.0,7.0}};

parameter Real C[2,3]=[
1.0,2.0,3.0;
5.0,6.0,7.0];

parameter Integer D[4,3]=[
0,1,1;
2,3,5;
8,13,21;
34,55,89];

parameter Real fraPFan_nominal(
unit="W/(kg/s)")=275/0.15
"Fan power divided by water mass flow rate at design condition"
annotation (Dialog(group="Fan"));

parameter Modelica.SIunits.Power PFan_nominal=fraPFan_nominal*m_flow_nominal
"Fan power"
annotation (Dialog(group="Fan"));

end MyClass;
33 changes: 33 additions & 0 deletions examples/example-arrays.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
within Somewhere;
class MyClass
"Class to demo formatting arrays and matrices"
extends Modelica.Icons.BasesPackage;

parameter Real var1 = 3.14;

parameter Real x[3];
parameter Real y[3] = {1.0, 0.0, -1.0};
parameter Real z[5] = {1.0, 0.0, -1.0, 2.0, 0.0};

parameter Real A[2,3] = {{1.0, 2.0, 3.0}, {5.0, 6.0, 7.0}};

parameter Real B[:,3] = {{1.0, 2.0, 3.0}, {5.0, 6.0, 7.0}, {1.0, 2.0, 3.0}, {5.0, 6.0, 7.0}, {1.0, 2.0, 3.0}, {5.0, 6.0, 7.0}, {1.0, 2.0, 3.0}, {5.0, 6.0, 7.0}};


parameter Real C[2,3] = [1.0, 2.0, 3.0; 5.0, 6.0, 7.0];

parameter Integer D[4,3] = [
0, 1, 1;
2, 3, 5;
8, 13, 21;
34, 55, 89
];

parameter Real fraPFan_nominal(unit="W/(kg/s)") = 275/0.15
"Fan power divided by water mass flow rate at design condition"
annotation (Dialog(group="Fan"));
parameter Modelica.SIunits.Power PFan_nominal = fraPFan_nominal*m_flow_nominal
"Fan power"
annotation (Dialog(group="Fan"));

end MyClass;
32 changes: 32 additions & 0 deletions examples/example-no-within-out.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class MyClass
"Class to demo function definitions"
extends Modelica.Icons.BasesPackage;

function constructor
"Construct to connect to a schedule in EnergyPlus"
extends Modelica.Icons.Function;

input Integer input1
"input 1 comment";

output MyClass adapter;

external "C" adapter=ExternalFunctionCall(
param1,
param2,
param3);

end constructor;

function destructor
"Some comment"
extends Modelica.Icons.Function;

input Integer input2;

external "C" EnergyPlusInputVariableFree(
input2);

end destructor;

end MyClass;
20 changes: 20 additions & 0 deletions examples/example-no-within.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class MyClass
"Class to demo function definitions"
extends Modelica.Icons.BasesPackage;

function constructor
"Construct to connect to a schedule in EnergyPlus"
extends Modelica.Icons.Function;

input Integer input1 "input 1 comment";
output MyClass adapter;
external "C" adapter = ExternalFunctionCall(param1, param2, param3);
end constructor;

function destructor "Some comment"
extends Modelica.Icons.Function;

input Integer input2;
external "C" EnergyPlusInputVariableFree(input2);
end destructor;
end MyClass;
10 changes: 10 additions & 0 deletions examples/functions-out.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,32 @@ within Somewhere;
class MyClass
"Class to demo function definitions"
extends Modelica.Icons.BasesPackage;

function constructor
"Construct to connect to a schedule in EnergyPlus"
extends Modelica.Icons.Function;

input Integer input1
"input 1 comment";

output MyClass adapter;

external "C" adapter=ExternalFunctionCall(
param1,
param2,
param3);

end constructor;

function destructor
"Some comment"
extends Modelica.Icons.Function;

input Integer input2;

external "C" EnergyPlusInputVariableFree(
input2);

end destructor;

end MyClass;
55 changes: 55 additions & 0 deletions examples/gmt-building-80-out.mo
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@ model building
have_fan=false,
have_eleHea=false,
have_eleCoo=false);

package MediumW=Buildings.Media.Water
"Source side medium";

package MediumA=Buildings.Media.Air
"Load side medium";

parameter Integer nZon=6
"Number of thermal zones";

parameter Integer facSca=3
"Scaling factor to be applied to on each extensive quantity";

parameter Modelica.SIunits.TemperatureDifference delTBuiCoo=5
"Nominal building supply and return chilled water temperature difference";

Buildings.Controls.OBC.CDL.Continuous.Sources.Constant minTSet[nZon](
k=fill(
293.15,
Expand All @@ -26,6 +32,7 @@ model building
each displayUnit="degC"))
"Minimum temperature set point"
annotation (Placement(transformation(extent={{-290,230},{-270,250}})));

Buildings.Controls.OBC.CDL.Continuous.Sources.Constant maxTSet[nZon](
k=fill(
297.15,
Expand All @@ -35,21 +42,29 @@ model building
each displayUnit="degC"))
"Maximum temperature set point"
annotation (Placement(transformation(extent={{-290,190},{-270,210}})));

Meeting meeting
annotation (Placement(transformation(extent={{-160,-20},{-140,0}})));

Floor floor
annotation (Placement(transformation(extent={{-120,-20},{-100,0}})));

Storage storage
annotation (Placement(transformation(extent={{-80,-20},{-60,0}})));

Office office
annotation (Placement(transformation(extent={{-40,-20},{-20,0}})));

Restroom restroom
annotation (Placement(transformation(extent={{0,-20},{20,0}})));

ICT ict
annotation (Placement(transformation(extent={{40,-20},{60,0}})));

Buildings.Controls.OBC.CDL.Continuous.MultiSum mulSum(
nin=2) if have_pum
annotation (Placement(transformation(extent={{260,70},{280,90}})));

Buildings.Applications.DHC.Loads.Examples.BaseClasses.FanCoil4PipeHeatPorts terUni[nZon](
redeclare each package Medium1=MediumW,
redeclare each package Medium2=MediumA,
Expand All @@ -66,6 +81,7 @@ model building
each mLoaCoo_flow_nominal=5)
"Terminal unit"
annotation (Placement(transformation(extent={{-200,-60},{-180,-40}})));

Buildings.Applications.DHC.Loads.BaseClasses.FlowDistribution disFloHea(
redeclare package Medium=MediumW,
m_flow_nominal=sum(
Expand All @@ -77,6 +93,7 @@ model building
nPorts_b1=nZon)
"Heating water distribution system"
annotation (Placement(transformation(extent={{-140,-100},{-120,-80}})));

Buildings.Applications.DHC.Loads.BaseClasses.FlowDistribution disFloCoo(
redeclare package Medium=MediumW,
m_flow_nominal=sum(
Expand All @@ -89,111 +106,147 @@ model building
nPorts_b1=nZon)
"Chilled water distribution system"
annotation (Placement(transformation(extent={{-140,-160},{-120,-140}})));

equation
connect(disFloHea.port_b,secHeaRet[1])
annotation (Line(points={{140,-70},{240,-70},{240,32},{300,32}},color={0,127,
255}));

connect(disFloHea.port_a,secHeaSup[1])
annotation (Line(points={{120,-70},{-242,-70},{-242,32},{-300,32}},color={0,
127,255}));

connect(disFloCoo.port_b,secCooRet[1])
annotation (Line(points={{140,-110},{252,-110},{252,-30},{300,-30}},color={0,
127,255}));

connect(disFloCoo.port_a,secCooSup[1])
annotation (Line(points={{120,-110},{-280,-110},{-280,-30},{-300,-30}},color=
{0,127,255}));

connect(disFloHea.ports_a1,terUni.port_bHeaWat)
annotation (Line(points={{-120,-80.6667},{-104,-80.6667},{-104,-58.3333},{-180,
-58.3333}},color={0,127,255}));

connect(disFloHea.ports_b1,terUni.port_aHeaWat)
annotation (Line(points={{-140,-80.6667},{-216,-80.6667},{-216,-58.3333},{-200,
-58.3333}},color={0,127,255}));

connect(disFloCoo.ports_a1,terUni.port_bChiWat)
annotation (Line(points={{-120,-144},{-94,-144},{-94,-56},{-180,-56},{-180,-56.6667}},
color={0,127,255}));

connect(disFloCoo.ports_b1,terUni.port_aChiWat)
annotation (Line(points={{-140,-144},{-226,-144},{-226,-56.6667},{-200,-56.6667}},
color={0,127,255}));

connect(weaBus,meeting.weaBus)
annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},
color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,
3},{6,3}},horizontalAlignment=TextAlignment.Left));

connect(terUni[0+1].heaPorCon,meeting.port_a)
annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,
0,0}));

connect(terUni[0+1].heaPorRad,meeting.port_a)
annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0}));

connect(weaBus,floor.weaBus)
annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},
color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,
3},{6,3}},horizontalAlignment=TextAlignment.Left));

connect(terUni[1+1].heaPorCon,floor.port_a)
annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,
0,0}));

connect(terUni[1+1].heaPorRad,floor.port_a)
annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0}));

connect(weaBus,storage.weaBus)
annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},
color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,
3},{6,3}},horizontalAlignment=TextAlignment.Left));

connect(terUni[2+1].heaPorCon,storage.port_a)
annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,
0,0}));

connect(terUni[2+1].heaPorRad,storage.port_a)
annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0}));

connect(weaBus,office.weaBus)
annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},
color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,
3},{6,3}},horizontalAlignment=TextAlignment.Left));

connect(terUni[3+1].heaPorCon,office.port_a)
annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,
0,0}));

connect(terUni[3+1].heaPorRad,office.port_a)
annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0}));

connect(weaBus,restroom.weaBus)
annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},
color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,
3},{6,3}},horizontalAlignment=TextAlignment.Left));

connect(terUni[4+1].heaPorCon,restroom.port_a)
annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,
0,0}));

connect(terUni[4+1].heaPorRad,restroom.port_a)
annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0}));

connect(weaBus,ict.weaBus)
annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},
color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,
3},{6,3}},horizontalAlignment=TextAlignment.Left));

connect(terUni[5+1].heaPorCon,ict.port_a)
annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,
0,0}));

connect(terUni[5+1].heaPorRad,ict.port_a)
annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0}));

connect(terUni.mReqHeaWat_flow,disFloHea.mReq_flow)
annotation (Line(points={{-179.167,-53.3333},{-179.167,-54},{-170,-54},{-170,
-94},{-141,-94}},color={0,0,127}));

connect(terUni.mReqChiWat_flow,disFloCoo.mReq_flow)
annotation (Line(points={{-179.167,-55},{-179.167,-56},{-172,-56},{-172,-154},
{-141,-154}},color={0,0,127}));

connect(mulSum.y,PPum)
annotation (Line(points={{282,80},{320,80}},color={0,0,127}));

connect(disFloHea.PPum,mulSum.u[1])
annotation (Line(points={{-119,-98},{240,-98},{240,81},{258,81}},color={0,0,
127}));

connect(disFloCoo.PPum,mulSum.u[2])
annotation (Line(points={{-119,-158},{240,-158},{240,79},{258,79}},color={0,
0,127}));

connect(disFloHea.QActTot_flow,QHea_flow)
annotation (Line(points={{-119,-96},{223.5,-96},{223.5,280},{320,280}},color=
{0,0,127}));

connect(disFloCoo.QActTot_flow,QCoo_flow)
annotation (Line(points={{-119,-156},{230,-156},{230,240},{320,240}},color={0,
0,127}));

connect(maxTSet.y,terUni.TSetCoo)
annotation (Line(points={{-268,200},{-240,200},{-240,-46.6667},{-200.833,-46.6667}},
color={0,0,127}));

connect(minTSet.y,terUni.TSetHea)
annotation (Line(points={{-268,240},{-220,240},{-220,-45},{-200.833,-45}},
color={0,0,127}));

annotation (
Documentation(
info="
Expand Down Expand Up @@ -249,5 +302,7 @@ First implementation.
fillColor={0,0,0},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None)}));

end building;

/* trailing comment */
Loading