Skip to content

Commit

Permalink
feat: Rename common to Trano.
Browse files Browse the repository at this point in the history
  • Loading branch information
andoludo committed Nov 1, 2024
1 parent 36e228a commit 87e79f4
Show file tree
Hide file tree
Showing 43 changed files with 349 additions and 443 deletions.
16 changes: 8 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def buildings_free_float_single_zone_ahu_complex(
boundary = Boundary(name="boundary")
ahu = AirHandlingUnit(
name="ahu",
template=""" {{package_name}}.Common.Fluid.Ventilation.AhuWithEconomizer {{element.name}}(redeclare
template=""" {{package_name}}.Trano.Fluid.Ventilation.AhuWithEconomizer {{element.name}}(redeclare
package
MediumA = Medium,
VRoo={100,100},
Expand Down Expand Up @@ -611,7 +611,7 @@ def buildings_free_float_single_zone_ahu_complex(
],
control=AhuControl(
name="ahu_control",
template=""" {{package_name}}.Common.Controls.ventilation.AHU_G36 {{element.name}}
template=""" {{package_name}}.Trano.Controls.ventilation.AHU_G36 {{element.name}}
annotation (
Placement(transformation(origin = {{ macros.join_list(element.position) }},
extent = {% raw %}{{-10, -10}, {10, 10}}
Expand Down Expand Up @@ -822,12 +822,12 @@ def remove_annotation(model: str) -> str:
return model


def remove_common_package(model: str) -> str:
for annotation in re.findall(r"package Common(.*?)end Common;", model, re.DOTALL):
def remove_trano_package(model: str) -> str:
for annotation in re.findall(r"package Trano(.*?)end Trano;", model, re.DOTALL):
model = (
model.replace(annotation, "")
.replace("package Common", "")
.replace("end Common;", "")
.replace("package Trano", "")
.replace("end Trano;", "")
)
return model

Expand All @@ -837,7 +837,7 @@ def clean_model(model: str, model_name: str) -> set:
path_file = Path(__file__).parent.joinpath("data", f"{model_name}.mo")
with path_file.open("w") as f:
f.write(model)
model = remove_common_package(model)
model = remove_trano_package(model)
model_ = remove_annotation(model)
return {
line
Expand All @@ -853,7 +853,7 @@ def _read(file_name: str) -> Set:
line
for line in set(
remove_annotation(
remove_common_package(
remove_trano_package(
Path(__file__)
.parent.joinpath("data", f"{file_name}.mo")
.read_text()
Expand Down
14 changes: 7 additions & 7 deletions tests/data/buildings_free_float_single_zone.mo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package buildings_free_float_single_zone

package Common
package Trano
package Occupancy

model SimpleOccupancy
Expand Down Expand Up @@ -121,7 +121,7 @@ constructed by the signals connected to this bus.

package SpaceControls
model PID
extends Common.Controls.Interfaces.BaseSpaceControl;
extends Trano.Controls.Interfaces.BaseSpaceControl;

parameter .Modelica.Blocks.Types.SimpleController controllerType=
.Modelica.Blocks.Types.SimpleController.PID "Type of controller";
Expand Down Expand Up @@ -163,7 +163,7 @@ constructed by the signals connected to this bus.

replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
"Medium model" annotation (choicesAllMatching=true);
extends Common.Controls.Interfaces.BaseSubstanceSpaceControl;
extends Trano.Controls.Interfaces.BaseSubstanceSpaceControl;

parameter .Modelica.Blocks.Types.SimpleController controllerType=
.Modelica.Blocks.Types.SimpleController.PID "Type of controller";
Expand Down Expand Up @@ -405,7 +405,7 @@ constructed by the signals connected to this bus.
preserveAspectRatio=false)));
end AHU_G36;
model OccupancyOccupancy_0
extends buildings_free_float_single_zone.Common.Occupancy.SimpleOccupancy ;
extends buildings_free_float_single_zone.Trano.Occupancy.SimpleOccupancy ;
Controls.BaseClasses.DataBus dataBus
annotation (Placement(transformation(
extent={{-120,-18},{-80,22}}), iconTransformation(extent={{-120,62},{-78,98}})));
Expand Down Expand Up @@ -2129,7 +2129,7 @@ end PartialVAVBox;
IDEAS(version="3.0.0")),
Icon(graphics={ Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248},
fillPattern = FillPattern.HorizontalCylinder, extent = {{-100, -100}, {100, 100}}, radius = 25), Rectangle(lineColor = {128, 128, 128}, extent = {{-100, -100}, {100, 100}}, radius = 25)}));
end Common;
end Trano;

model building
parameter Buildings.HeatTransfer.Data.GlazingSystems.Generic double_glazing(
Expand Down Expand Up @@ -2224,7 +2224,7 @@ package MediumW = Buildings.Media.Water "Medium model";
Placement(transformation(origin = { 0, 0 },
extent = {{-20, -20}, {20, 20}}
)));
buildings_free_float_single_zone.Common.Controls.ventilation.OccupancyOccupancy_0
buildings_free_float_single_zone.Trano.Controls.ventilation.OccupancyOccupancy_0
occupancy_0( gain=[35; 70; 30],
k=1/6/4,
occupancy=3600*{7, 19}
Expand All @@ -2239,7 +2239,7 @@ package MediumW = Buildings.Media.Water "Medium model";
Placement(transformation(origin = { -100, 200 },
extent = {{-10, -10}, {10, 10}}
)));
buildings_free_float_single_zone.Common.Controls.ventilation.DataServer
buildings_free_float_single_zone.Trano.Controls.ventilation.DataServer
data_bus (redeclare package
Medium = Medium) annotation (
Placement(transformation(origin = { -188.23379566178366, -80.53383946840174 },
Expand Down
14 changes: 7 additions & 7 deletions tests/data/buildings_free_float_single_zone_with_data.mo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package buildings_free_float_single_zone_with_data

package Common
package Trano
package Occupancy

model SimpleOccupancy
Expand Down Expand Up @@ -121,7 +121,7 @@ constructed by the signals connected to this bus.

package SpaceControls
model PID
extends Common.Controls.Interfaces.BaseSpaceControl;
extends Trano.Controls.Interfaces.BaseSpaceControl;

parameter .Modelica.Blocks.Types.SimpleController controllerType=
.Modelica.Blocks.Types.SimpleController.PID "Type of controller";
Expand Down Expand Up @@ -163,7 +163,7 @@ constructed by the signals connected to this bus.

replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
"Medium model" annotation (choicesAllMatching=true);
extends Common.Controls.Interfaces.BaseSubstanceSpaceControl;
extends Trano.Controls.Interfaces.BaseSubstanceSpaceControl;

parameter .Modelica.Blocks.Types.SimpleController controllerType=
.Modelica.Blocks.Types.SimpleController.PID "Type of controller";
Expand Down Expand Up @@ -405,7 +405,7 @@ constructed by the signals connected to this bus.
preserveAspectRatio=false)));
end AHU_G36;
model OccupancyOccupancy_0
extends buildings_free_float_single_zone_with_data.Common.Occupancy.SimpleOccupancy ;
extends buildings_free_float_single_zone_with_data.Trano.Occupancy.SimpleOccupancy ;
Controls.BaseClasses.DataBus dataBus
annotation (Placement(transformation(
extent={{-120,-18},{-80,22}}), iconTransformation(extent={{-120,62},{-78,98}})));
Expand Down Expand Up @@ -2136,7 +2136,7 @@ end PartialVAVBox;
IDEAS(version="3.0.0")),
Icon(graphics={ Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248},
fillPattern = FillPattern.HorizontalCylinder, extent = {{-100, -100}, {100, 100}}, radius = 25), Rectangle(lineColor = {128, 128, 128}, extent = {{-100, -100}, {100, 100}}, radius = 25)}));
end Common;
end Trano;

model building
parameter Buildings.HeatTransfer.Data.GlazingSystems.Generic double_glazing(
Expand Down Expand Up @@ -2231,7 +2231,7 @@ package MediumW = Buildings.Media.Water "Medium model";
Placement(transformation(origin = { 0, 0 },
extent = {{-20, -20}, {20, 20}}
)));
buildings_free_float_single_zone_with_data.Common.Controls.ventilation.OccupancyOccupancy_0
buildings_free_float_single_zone_with_data.Trano.Controls.ventilation.OccupancyOccupancy_0
occupancy_0( gain=[35; 70; 30],
k=1/6/4,
occupancy=3600*{7, 19}
Expand All @@ -2246,7 +2246,7 @@ package MediumW = Buildings.Media.Water "Medium model";
Placement(transformation(origin = { -100, 200 },
extent = {{-10, -10}, {10, 10}}
)));
buildings_free_float_single_zone_with_data.Common.Controls.ventilation.DataServer
buildings_free_float_single_zone_with_data.Trano.Controls.ventilation.DataServer
data_bus (redeclare package
Medium = Medium) annotation (
Placement(transformation(origin = { -175.00821851028516, -124.22446399572215 },
Expand Down
22 changes: 11 additions & 11 deletions tests/data/buildings_free_float_three_zones.mo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package buildings_free_float_three_zones

package Common
package Trano
package Occupancy

model SimpleOccupancy
Expand Down Expand Up @@ -121,7 +121,7 @@ constructed by the signals connected to this bus.

package SpaceControls
model PID
extends Common.Controls.Interfaces.BaseSpaceControl;
extends Trano.Controls.Interfaces.BaseSpaceControl;

parameter .Modelica.Blocks.Types.SimpleController controllerType=
.Modelica.Blocks.Types.SimpleController.PID "Type of controller";
Expand Down Expand Up @@ -163,7 +163,7 @@ constructed by the signals connected to this bus.

replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
"Medium model" annotation (choicesAllMatching=true);
extends Common.Controls.Interfaces.BaseSubstanceSpaceControl;
extends Trano.Controls.Interfaces.BaseSubstanceSpaceControl;

parameter .Modelica.Blocks.Types.SimpleController controllerType=
.Modelica.Blocks.Types.SimpleController.PID "Type of controller";
Expand Down Expand Up @@ -405,7 +405,7 @@ constructed by the signals connected to this bus.
preserveAspectRatio=false)));
end AHU_G36;
model OccupancyOccupancy_0
extends buildings_free_float_three_zones.Common.Occupancy.SimpleOccupancy ;
extends buildings_free_float_three_zones.Trano.Occupancy.SimpleOccupancy ;
Controls.BaseClasses.DataBus dataBus
annotation (Placement(transformation(
extent={{-120,-18},{-80,22}}), iconTransformation(extent={{-120,62},{-78,98}})));
Expand All @@ -414,7 +414,7 @@ connect(dataBus.OccupiedSpace_1, occSch2.occupied);
end OccupancyOccupancy_0;

model OccupancyOccupancy_1
extends buildings_free_float_three_zones.Common.Occupancy.SimpleOccupancy ;
extends buildings_free_float_three_zones.Trano.Occupancy.SimpleOccupancy ;
Controls.BaseClasses.DataBus dataBus
annotation (Placement(transformation(
extent={{-120,-18},{-80,22}}), iconTransformation(extent={{-120,62},{-78,98}})));
Expand All @@ -423,7 +423,7 @@ connect(dataBus.OccupiedSpace_2, occSch2.occupied);
end OccupancyOccupancy_1;

model OccupancyOccupancy_2
extends buildings_free_float_three_zones.Common.Occupancy.SimpleOccupancy ;
extends buildings_free_float_three_zones.Trano.Occupancy.SimpleOccupancy ;
Controls.BaseClasses.DataBus dataBus
annotation (Placement(transformation(
extent={{-120,-18},{-80,22}}), iconTransformation(extent={{-120,62},{-78,98}})));
Expand Down Expand Up @@ -2155,7 +2155,7 @@ end PartialVAVBox;
IDEAS(version="3.0.0")),
Icon(graphics={ Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248},
fillPattern = FillPattern.HorizontalCylinder, extent = {{-100, -100}, {100, 100}}, radius = 25), Rectangle(lineColor = {128, 128, 128}, extent = {{-100, -100}, {100, 100}}, radius = 25)}));
end Common;
end Trano;

model building
parameter Buildings.HeatTransfer.Data.GlazingSystems.Generic double_glazing(
Expand Down Expand Up @@ -2267,7 +2267,7 @@ package MediumW = Buildings.Media.Water "Medium model";
Placement(transformation(origin = { 0, 0 },
extent = {{-20, -20}, {20, 20}}
)));
buildings_free_float_three_zones.Common.Controls.ventilation.OccupancyOccupancy_0
buildings_free_float_three_zones.Trano.Controls.ventilation.OccupancyOccupancy_0
occupancy_0( gain=[35; 70; 30],
k=1/6/4,
occupancy=3600*{7, 19}
Expand Down Expand Up @@ -2313,7 +2313,7 @@ package MediumW = Buildings.Media.Water "Medium model";
Placement(transformation(origin = { 250, 150 },
extent = {{-20, -20}, {20, 20}}
)));
buildings_free_float_three_zones.Common.Controls.ventilation.OccupancyOccupancy_1
buildings_free_float_three_zones.Trano.Controls.ventilation.OccupancyOccupancy_1
occupancy_1( gain=[35; 70; 30],
k=1/6/4,
occupancy=3600*{7, 19}
Expand Down Expand Up @@ -2359,7 +2359,7 @@ package MediumW = Buildings.Media.Water "Medium model";
Placement(transformation(origin = { 500, 150 },
extent = {{-20, -20}, {20, 20}}
)));
buildings_free_float_three_zones.Common.Controls.ventilation.OccupancyOccupancy_2
buildings_free_float_three_zones.Trano.Controls.ventilation.OccupancyOccupancy_2
occupancy_2( gain=[35; 70; 30],
k=1/6/4,
occupancy=3600*{7, 19}
Expand Down Expand Up @@ -2401,7 +2401,7 @@ package MediumW = Buildings.Media.Water "Medium model";
Placement(transformation(origin = { -100, 200 },
extent = {{-10, -10}, {10, 10}}
)));
buildings_free_float_three_zones.Common.Controls.ventilation.DataServer
buildings_free_float_three_zones.Trano.Controls.ventilation.DataServer
data_bus (redeclare package
Medium = Medium) annotation (
Placement(transformation(origin = { 134.41673241227394, -158.2902907181113 },
Expand Down
18 changes: 9 additions & 9 deletions tests/data/buildings_free_float_two_zones.mo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package buildings_free_float_two_zones

package Common
package Trano
package Occupancy

model SimpleOccupancy
Expand Down Expand Up @@ -121,7 +121,7 @@ constructed by the signals connected to this bus.

package SpaceControls
model PID
extends Common.Controls.Interfaces.BaseSpaceControl;
extends Trano.Controls.Interfaces.BaseSpaceControl;

parameter .Modelica.Blocks.Types.SimpleController controllerType=
.Modelica.Blocks.Types.SimpleController.PID "Type of controller";
Expand Down Expand Up @@ -163,7 +163,7 @@ constructed by the signals connected to this bus.

replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
"Medium model" annotation (choicesAllMatching=true);
extends Common.Controls.Interfaces.BaseSubstanceSpaceControl;
extends Trano.Controls.Interfaces.BaseSubstanceSpaceControl;

parameter .Modelica.Blocks.Types.SimpleController controllerType=
.Modelica.Blocks.Types.SimpleController.PID "Type of controller";
Expand Down Expand Up @@ -405,7 +405,7 @@ constructed by the signals connected to this bus.
preserveAspectRatio=false)));
end AHU_G36;
model OccupancyOccupancy_0
extends buildings_free_float_two_zones.Common.Occupancy.SimpleOccupancy ;
extends buildings_free_float_two_zones.Trano.Occupancy.SimpleOccupancy ;
Controls.BaseClasses.DataBus dataBus
annotation (Placement(transformation(
extent={{-120,-18},{-80,22}}), iconTransformation(extent={{-120,62},{-78,98}})));
Expand All @@ -414,7 +414,7 @@ connect(dataBus.OccupiedSpace_1, occSch2.occupied);
end OccupancyOccupancy_0;

model OccupancyOccupancy_1
extends buildings_free_float_two_zones.Common.Occupancy.SimpleOccupancy ;
extends buildings_free_float_two_zones.Trano.Occupancy.SimpleOccupancy ;
Controls.BaseClasses.DataBus dataBus
annotation (Placement(transformation(
extent={{-120,-18},{-80,22}}), iconTransformation(extent={{-120,62},{-78,98}})));
Expand Down Expand Up @@ -2142,7 +2142,7 @@ end PartialVAVBox;
IDEAS(version="3.0.0")),
Icon(graphics={ Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248},
fillPattern = FillPattern.HorizontalCylinder, extent = {{-100, -100}, {100, 100}}, radius = 25), Rectangle(lineColor = {128, 128, 128}, extent = {{-100, -100}, {100, 100}}, radius = 25)}));
end Common;
end Trano;

model building
parameter Buildings.HeatTransfer.Data.GlazingSystems.Generic double_glazing(
Expand Down Expand Up @@ -2254,7 +2254,7 @@ package MediumW = Buildings.Media.Water "Medium model";
Placement(transformation(origin = { 0, 0 },
extent = {{-20, -20}, {20, 20}}
)));
buildings_free_float_two_zones.Common.Controls.ventilation.OccupancyOccupancy_0
buildings_free_float_two_zones.Trano.Controls.ventilation.OccupancyOccupancy_0
occupancy_0( gain=[35; 70; 30],
k=1/6/4,
occupancy=3600*{7, 19}
Expand Down Expand Up @@ -2291,7 +2291,7 @@ package MediumW = Buildings.Media.Water "Medium model";
Placement(transformation(origin = { 250, 150 },
extent = {{-20, -20}, {20, 20}}
)));
buildings_free_float_two_zones.Common.Controls.ventilation.OccupancyOccupancy_1
buildings_free_float_two_zones.Trano.Controls.ventilation.OccupancyOccupancy_1
occupancy_1( gain=[35; 70; 30],
k=1/6/4,
occupancy=3600*{7, 19}
Expand All @@ -2315,7 +2315,7 @@ package MediumW = Buildings.Media.Water "Medium model";
Placement(transformation(origin = { -100, 200 },
extent = {{-10, -10}, {10, 10}}
)));
buildings_free_float_two_zones.Common.Controls.ventilation.DataServer
buildings_free_float_two_zones.Trano.Controls.ventilation.DataServer
data_bus (redeclare package
Medium = Medium) annotation (
Placement(transformation(origin = { -41.50247909072355, 190.00204552385694 },
Expand Down
Loading

0 comments on commit 87e79f4

Please sign in to comment.