OpenSimula 0.9.0__tar.gz → 0.10.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {opensimula-0.9.0/src/opensimula.egg-info → opensimula-0.10.0}/PKG-INFO +5 -1
- {opensimula-0.9.0 → opensimula-0.10.0}/README.md +4 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/pyproject.toml +3 -1
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/Project.py +7 -6
- opensimula-0.10.0/src/opensimula/components/Boiler.py +125 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Calculator.py +15 -3
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/File_data.py +4 -8
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/HVAC_DX_system.py +1 -1
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/HVAC_MZW_system.py +53 -8
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/HVAC_SZW_system.py +9 -7
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/HVAC_perfect_system.py +1 -1
- opensimula-0.10.0/src/opensimula/components/HVAC_water_circuit.py +224 -0
- opensimula-0.10.0/src/opensimula/components/HVAC_water_generator.py +251 -0
- opensimula-0.10.0/src/opensimula/components/HVAC_water_system.py +662 -0
- opensimula-0.10.0/src/opensimula/components/Load_space.py +198 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Space.py +12 -182
- opensimula-0.10.0/src/opensimula/components/Thermal_zone.py +298 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/__init__.py +7 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/editor/results.py +20 -3
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/editor/static/editor.js +58 -21
- opensimula-0.10.0/src/opensimula/editor/static/results.js +4 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/editor/widget.py +12 -2
- opensimula-0.10.0/src/opensimula/examples/01_schedules.json +70 -0
- opensimula-0.10.0/src/opensimula/examples/02_weather.json +98 -0
- opensimula-0.10.0/src/opensimula/examples/03_walls.json +310 -0
- opensimula-0.10.0/src/opensimula/examples/04_windows_and_gains.json +369 -0
- opensimula-0.10.0/src/opensimula/examples/05_ideal_system.json +402 -0
- opensimula-0.10.0/src/opensimula/examples/06_dx_system.json +423 -0
- opensimula-0.10.0/src/opensimula/examples/07_fan_coil.json +471 -0
- opensimula-0.10.0/src/opensimula/examples/08_load_records.json +180 -0
- opensimula-0.10.0/src/opensimula/examples/09_water_plant.json +305 -0
- opensimula-0.10.0/src/opensimula/examples/__init__.py +1 -0
- opensimula-0.10.0/src/opensimula/examples/office_loads.csv +8761 -0
- opensimula-0.10.0/src/opensimula/examples/sevilla.met +8762 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/gui/__init__.py +53 -3
- {opensimula-0.9.0 → opensimula-0.10.0/src/opensimula.egg-info}/PKG-INFO +5 -1
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula.egg-info/SOURCES.txt +26 -0
- opensimula-0.10.0/test/test_Boiler.py +65 -0
- opensimula-0.10.0/test/test_Calculator.py +73 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_File_data.py +17 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_HVAC_FAN_COIL_water_system.py +17 -11
- opensimula-0.10.0/test/test_HVAC_MZW_water_system.py +103 -0
- opensimula-0.10.0/test/test_HVAC_water_circuit.py +140 -0
- opensimula-0.10.0/test/test_HVAC_water_generator.py +117 -0
- opensimula-0.10.0/test/test_HVAC_water_header.py +170 -0
- opensimula-0.10.0/test/test_HVAC_water_sequencing.py +135 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_HVAC_water_system_process.py +58 -23
- opensimula-0.10.0/test/test_Load_space.py +123 -0
- opensimula-0.10.0/test/test_Thermal_zone.py +28 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_editor_widget.py +32 -4
- opensimula-0.10.0/test/test_examples.py +133 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_results_viewer.py +55 -0
- opensimula-0.9.0/src/opensimula/components/HVAC_water_system.py +0 -314
- opensimula-0.9.0/src/opensimula/editor/static/results.js +0 -4
- opensimula-0.9.0/test/test_Calculator.py +0 -40
- {opensimula-0.9.0 → opensimula-0.10.0}/LICENSE +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/setup.cfg +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/Child.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/Component.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/Iterative_process.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/Message.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/Parameter_container.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/Parameters.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/Simulation.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/Variable.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/__init__.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Building.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Building_surface.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Chiller_heat_pump.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Construction.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/DX_unit.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Day_schedule.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Fan.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/File_met.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Frame.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Glazing.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Material.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Opening.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Opening_type.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Pump.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Solar_surface.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Space_type.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Surface.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Test_component.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Water_coil.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Week_schedule.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/components/Year_schedule.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/editor/__init__.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/editor/schema.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/editor/static/editor.css +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/editor/static/plotly3d.js +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/editor/static/results.css +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/editor/validation.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/gui/app.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/visual_3D/Environment_3D.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula/visual_3D/Polygon_3D.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula.egg-info/dependency_links.txt +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula.egg-info/entry_points.txt +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula.egg-info/requires.txt +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/src/opensimula.egg-info/top_level.txt +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_Case_600FF.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_Case_610.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_Construction.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_File_met.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_HVAC_DX_Equipment.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_HVAC_DX_system.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_Iterative_process.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_Project.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_Schedules.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_editor_schema.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_gui.py +0 -0
- {opensimula-0.9.0 → opensimula-0.10.0}/test/test_underground_repeated_simulation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opensimula
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.0
|
|
4
4
|
Summary: Component-based time simulation environment in Python
|
|
5
5
|
Author: Luis Pérez-Lombard, Ismael R. Maestre
|
|
6
6
|
Author-email: "Juan F. Coronel" <jfc@us.es>
|
|
@@ -137,6 +137,10 @@ pip install "opensimula[gui]"
|
|
|
137
137
|
opensimula gui project.json
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
+
To start, nine progressive [examples](https://jfcoronel.github.io/OpenSimula/examples/), from a
|
|
141
|
+
schedule to a water plant with a heat pump and a boiler, come with the package: `opensimula examples` copies them to
|
|
142
|
+
a folder, ready to open with `opensimula gui`.
|
|
143
|
+
|
|
140
144
|
## Component types
|
|
141
145
|
|
|
142
146
|
Components are grouped by what they define:
|
|
@@ -111,6 +111,10 @@ pip install "opensimula[gui]"
|
|
|
111
111
|
opensimula gui project.json
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
+
To start, nine progressive [examples](https://jfcoronel.github.io/OpenSimula/examples/), from a
|
|
115
|
+
schedule to a water plant with a heat pump and a boiler, come with the package: `opensimula examples` copies them to
|
|
116
|
+
a folder, ready to open with `opensimula gui`.
|
|
117
|
+
|
|
114
118
|
## Component types
|
|
115
119
|
|
|
116
120
|
Components are grouped by what they define:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "opensimula"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.10.0"
|
|
4
4
|
requires-python = ">=3.12"
|
|
5
5
|
authors = [
|
|
6
6
|
{ name="Juan F. Coronel", email="jfc@us.es" },
|
|
@@ -52,6 +52,8 @@ where = ["src"]
|
|
|
52
52
|
[tool.setuptools.package-data]
|
|
53
53
|
# The widget loads these at runtime; without this they are left out of the wheel.
|
|
54
54
|
"opensimula.editor" = ["static/*.js", "static/*.css"]
|
|
55
|
+
# the examples copied by `opensimula examples`
|
|
56
|
+
"opensimula.examples" = ["*.json", "*.met", "*.csv"]
|
|
55
57
|
|
|
56
58
|
[build-system]
|
|
57
59
|
requires = ["setuptools>=61.2", "wheel"]
|
|
@@ -4,6 +4,7 @@ import numpy as np
|
|
|
4
4
|
import pandas as pd
|
|
5
5
|
import psychrolib as sicro
|
|
6
6
|
from tqdm import trange
|
|
7
|
+
from opensimula.Component import Component
|
|
7
8
|
from opensimula.Message import Message
|
|
8
9
|
from opensimula.Parameter_container import Parameter_container
|
|
9
10
|
from opensimula.Parameters import (
|
|
@@ -205,13 +206,13 @@ class Project(Parameter_container):
|
|
|
205
206
|
Component: The new component with its default parameters, None if the type
|
|
206
207
|
does not exist.
|
|
207
208
|
"""
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
self._components_.append(comp)
|
|
212
|
-
return comp
|
|
213
|
-
except KeyError:
|
|
209
|
+
# globals() also holds modules (e.g. the base class module Thermal_zone)
|
|
210
|
+
clase = globals().get(comp_type)
|
|
211
|
+
if not (isinstance(clase, type) and issubclass(clase, Component)) or clase is Component:
|
|
214
212
|
return None
|
|
213
|
+
comp = clase(name, self)
|
|
214
|
+
self._components_.append(comp)
|
|
215
|
+
return comp
|
|
215
216
|
|
|
216
217
|
def duplicate_component(self, component_name, new_name):
|
|
217
218
|
"""Duplicate an existing component with a new name
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
from opensimula.Component import Component
|
|
2
|
+
from opensimula.Message import Message
|
|
3
|
+
from opensimula.Parameters import (
|
|
4
|
+
Parameter_float,
|
|
5
|
+
Parameter_float_list,
|
|
6
|
+
Parameter_math_exp,
|
|
7
|
+
Parameter_options,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
FUELS = ["NATURAL_GAS", "LPG", "DIESEL", "BIOMASS", "ELECTRICITY"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Boiler(Component):
|
|
14
|
+
"""Boiler equipment manufacturer information.
|
|
15
|
+
|
|
16
|
+
Equipment data, like DX_unit or Chiller_heat_pump: it is not simulated by
|
|
17
|
+
itself but used by a water generator to know the heat it can give and the
|
|
18
|
+
fuel it uses. Capacities, powers and efficiencies are on the lower heating
|
|
19
|
+
value (LHV) of the fuel.
|
|
20
|
+
|
|
21
|
+
The efficiency is the nominal one multiplied by ``efficiency_expression``, a
|
|
22
|
+
function of the part load ``F_load`` and of the water temperatures, return
|
|
23
|
+
``T_wi`` and supply ``T_wo``, and of the water flow fraction ``F_water``: a
|
|
24
|
+
condensing boiler is more efficient with a cold return.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def __init__(self, name, project):
|
|
28
|
+
Component.__init__(self, name, project)
|
|
29
|
+
self.parameter("type").value = "Boiler"
|
|
30
|
+
self.parameter("description").value = "Boiler equipment manufacturer information"
|
|
31
|
+
self.add_parameter(Parameter_options("fuel", "NATURAL_GAS", FUELS))
|
|
32
|
+
self.add_parameter(Parameter_float("nominal_heating_capacity", 0, "W", min=0))
|
|
33
|
+
self.add_parameter(Parameter_float("nominal_efficiency", 0.9, "frac", min=0.01))
|
|
34
|
+
self.add_parameter(Parameter_float("nominal_water_flow", 1, "dm³/s", min=0))
|
|
35
|
+
self.add_parameter(Parameter_float("max_supply_temperature", 80, "°C"))
|
|
36
|
+
self.add_parameter(Parameter_math_exp("efficiency_expression", "1", "frac"))
|
|
37
|
+
self.add_parameter(Parameter_float("auxiliary_power", 0, "W", min=0))
|
|
38
|
+
# T_wi, T_wo, F_water, F_load
|
|
39
|
+
self.add_parameter(Parameter_float_list("expression_max_values", [100, 100, 1.5, 1], "-"))
|
|
40
|
+
self.add_parameter(Parameter_float_list("expression_min_values", [0, 0, 0, 0], "-"))
|
|
41
|
+
|
|
42
|
+
def check(self):
|
|
43
|
+
errors = super().check()
|
|
44
|
+
for key in ("expression_max_values", "expression_min_values"):
|
|
45
|
+
if len(self.parameter(key).value) != 4:
|
|
46
|
+
msg = f"Error: {self.parameter('name').value}, {key} size must be 4 (T_wi, T_wo, F_water, F_load)"
|
|
47
|
+
errors.append(Message(msg, "ERROR"))
|
|
48
|
+
return errors
|
|
49
|
+
|
|
50
|
+
def get_heating_load(self, T_wo, T_wi, water_flow, Q_required):
|
|
51
|
+
"""Heat the boiler gives for a required load.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
T_wo (float): supply (outlet) water temperature (°C).
|
|
55
|
+
T_wi (float): return (inlet) water temperature (°C).
|
|
56
|
+
water_flow (float): water flow (dm³/s).
|
|
57
|
+
Q_required (float): heat required (W).
|
|
58
|
+
|
|
59
|
+
Returns:
|
|
60
|
+
tuple: (Q, F_load), heat given (W), at most the nominal capacity, and part
|
|
61
|
+
load fraction (0-1). (0, 0) if no heat is required, the capacity is 0
|
|
62
|
+
or the supply temperature is above the maximum.
|
|
63
|
+
"""
|
|
64
|
+
capacity = self.parameter("nominal_heating_capacity").value
|
|
65
|
+
if Q_required <= 0 or capacity <= 0:
|
|
66
|
+
return (0, 0)
|
|
67
|
+
if T_wo > self.parameter("max_supply_temperature").value:
|
|
68
|
+
return (0, 0)
|
|
69
|
+
if Q_required >= capacity:
|
|
70
|
+
return (capacity, 1)
|
|
71
|
+
return (Q_required, Q_required / capacity)
|
|
72
|
+
|
|
73
|
+
def get_efficiency(self, T_wo, T_wi, water_flow, F_load):
|
|
74
|
+
"""Efficiency on the LHV at the given conditions.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
T_wo (float): supply water temperature (°C).
|
|
78
|
+
T_wi (float): return water temperature (°C).
|
|
79
|
+
water_flow (float): water flow (dm³/s).
|
|
80
|
+
F_load (float): part load fraction (0-1).
|
|
81
|
+
|
|
82
|
+
Returns:
|
|
83
|
+
float: efficiency (heat given / fuel power).
|
|
84
|
+
"""
|
|
85
|
+
F_water = water_flow / self.parameter("nominal_water_flow").value
|
|
86
|
+
var_dic = self._var_state_dic([T_wi, T_wo, F_water, F_load])
|
|
87
|
+
return self.parameter("nominal_efficiency").value * self.parameter(
|
|
88
|
+
"efficiency_expression"
|
|
89
|
+
).evaluate(var_dic)
|
|
90
|
+
|
|
91
|
+
def get_fuel_power(self, T_wo, T_wi, water_flow, Q_required):
|
|
92
|
+
"""Fuel the boiler uses for a required load.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
T_wo (float): supply water temperature (°C).
|
|
96
|
+
T_wi (float): return water temperature (°C).
|
|
97
|
+
water_flow (float): water flow (dm³/s).
|
|
98
|
+
Q_required (float): heat required (W).
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
tuple: (fuel_power, efficiency), fuel power on the LHV (W) and efficiency;
|
|
102
|
+
(0, 0) if the boiler gives no heat.
|
|
103
|
+
"""
|
|
104
|
+
Q, F_load = self.get_heating_load(T_wo, T_wi, water_flow, Q_required)
|
|
105
|
+
if Q == 0:
|
|
106
|
+
return (0, 0)
|
|
107
|
+
efficiency = self.get_efficiency(T_wo, T_wi, water_flow, F_load)
|
|
108
|
+
return (Q / efficiency, efficiency)
|
|
109
|
+
|
|
110
|
+
def get_auxiliary_power(self, Q):
|
|
111
|
+
"""Electric power of the burner fan and controls.
|
|
112
|
+
|
|
113
|
+
Args:
|
|
114
|
+
Q (float): heat given (W).
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
float: auxiliary_power while the boiler gives heat, 0 otherwise (W).
|
|
118
|
+
"""
|
|
119
|
+
return self.parameter("auxiliary_power").value if Q > 0 else 0
|
|
120
|
+
|
|
121
|
+
def _var_state_dic(self, values):
|
|
122
|
+
maximum = self.parameter("expression_max_values").value
|
|
123
|
+
minimum = self.parameter("expression_min_values").value
|
|
124
|
+
values = [min(max(v, lo), hi) for v, lo, hi in zip(values, minimum, maximum)]
|
|
125
|
+
return {"T_wi": values[0], "T_wo": values[1], "F_water": values[2], "F_load": values[3]}
|
|
@@ -40,10 +40,22 @@ class Calculator(Component):
|
|
|
40
40
|
|
|
41
41
|
def pre_iteration(self, time_index, date, daylight_saving):
|
|
42
42
|
super().pre_iteration(time_index, date, daylight_saving)
|
|
43
|
-
#
|
|
43
|
+
# Already here, for the components that use the outputs during the
|
|
44
|
+
# time step (e.g. a schedule built from the weather)
|
|
45
|
+
self._calculate_(time_index)
|
|
46
|
+
|
|
47
|
+
def post_iteration(self, time_index, date, daylight_saving, converged):
|
|
48
|
+
super().post_iteration(time_index, date, daylight_saving, converged)
|
|
49
|
+
# Again with the final values of the time step: the variables that the
|
|
50
|
+
# other components compute during it (the loads of a space, the power
|
|
51
|
+
# of a system...) were not there yet in pre_iteration. The calculators
|
|
52
|
+
# are the last in the simulation order, so they are all final now.
|
|
53
|
+
# The base pre_iteration copies the input variables again.
|
|
54
|
+
Component.pre_iteration(self, time_index, date, daylight_saving)
|
|
55
|
+
self._calculate_(time_index)
|
|
56
|
+
|
|
57
|
+
def _calculate_(self, time_index):
|
|
44
58
|
var_dic = self.get_parameter_variable_dictionary(time_index)
|
|
45
|
-
|
|
46
|
-
# Output variables
|
|
47
59
|
for i in range(len(self.parameter("output_variables").value)):
|
|
48
60
|
calculated_value = self.parameter(
|
|
49
61
|
"output_expressions").evaluate(i, var_dic)
|
|
@@ -59,16 +59,12 @@ class File_data(Component):
|
|
|
59
59
|
self.data_array = self._df_.select_dtypes(include=np.number).to_numpy()
|
|
60
60
|
|
|
61
61
|
if self.parameter("file_step").value == "SIMULATION":
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
# one row per time step, from the first row of the file for every column,
|
|
63
|
+
# starting again from the first row if the file is shorter than the simulation
|
|
64
64
|
n = len(self._df_)
|
|
65
|
-
for
|
|
65
|
+
for i, var in enumerate(self._variables_.values()):
|
|
66
66
|
for j in range(n_time_steps):
|
|
67
|
-
var.values[j] = self.data_array[
|
|
68
|
-
k = k + 1
|
|
69
|
-
if k == n:
|
|
70
|
-
k = 0
|
|
71
|
-
i = i + 1
|
|
67
|
+
var.values[j] = self.data_array[j % n][i]
|
|
72
68
|
elif self.parameter("file_step").value == "OWN":
|
|
73
69
|
n = len(self._df_)
|
|
74
70
|
self._initial_date_ = dt.datetime.strptime(
|
|
@@ -11,7 +11,7 @@ class HVAC_DX_system(Component):
|
|
|
11
11
|
self.parameter("type").value = "HVAC_DX_system"
|
|
12
12
|
self.parameter("description").value = "HVAC Direct Expansion system for time simulation"
|
|
13
13
|
self.add_parameter(Parameter_component("equipment", "not_defined", ["DX_unit"]))
|
|
14
|
-
self.add_parameter(Parameter_component("spaces", "not_defined", ["Space"])) # Space, TODO: Add Air_distribution, Energy_load
|
|
14
|
+
self.add_parameter(Parameter_component("spaces", "not_defined", ["Space", "Load_space"])) # Space, TODO: Add Air_distribution, Energy_load
|
|
15
15
|
self.add_parameter(Parameter_float("air_flow", 1, "m³/s", min=0))
|
|
16
16
|
self.add_parameter(Parameter_math_exp("outdoor_air_fraction", "0", "frac"))
|
|
17
17
|
self.add_parameter(Parameter_variable_list("input_variables", []))
|
|
@@ -23,7 +23,7 @@ class HVAC_MZW_system(Component): # HVAC Multizone Water system
|
|
|
23
23
|
self.parameter("description").value = "HVAC Multizone Water system"
|
|
24
24
|
self.add_parameter(
|
|
25
25
|
Parameter_component_list(
|
|
26
|
-
"spaces", ["not_defined", "not_defined"], ["Space"]
|
|
26
|
+
"spaces", ["not_defined", "not_defined"], ["Space", "Load_space"]
|
|
27
27
|
)
|
|
28
28
|
)
|
|
29
29
|
self.add_parameter(
|
|
@@ -80,10 +80,10 @@ class HVAC_MZW_system(Component): # HVAC Multizone Water system
|
|
|
80
80
|
Parameter_options("water_source", "UNKNOWN", ["UNKNOWN", "WATER_SYSTEM"])
|
|
81
81
|
)
|
|
82
82
|
self.add_parameter(
|
|
83
|
-
Parameter_component("cooling_water_system", "not_defined", ["HVAC_water_system"])
|
|
83
|
+
Parameter_component("cooling_water_system", "not_defined", ["HVAC_water_system", "HVAC_water_circuit"])
|
|
84
84
|
)
|
|
85
85
|
self.add_parameter(
|
|
86
|
-
Parameter_component("heating_water_system", "not_defined", ["HVAC_water_system"])
|
|
86
|
+
Parameter_component("heating_water_system", "not_defined", ["HVAC_water_system", "HVAC_water_circuit"])
|
|
87
87
|
)
|
|
88
88
|
self.add_parameter(Parameter_float("cooling_water_flow", 1, "dm³/s", min=0))
|
|
89
89
|
self.add_parameter(Parameter_float("heating_water_flow", 1, "dm³/s", min=0))
|
|
@@ -122,7 +122,7 @@ class HVAC_MZW_system(Component): # HVAC Multizone Water system
|
|
|
122
122
|
Parameter_options("reheat_water_source", "UNKNOWN", ["UNKNOWN", "WATER_SYSTEM"])
|
|
123
123
|
)
|
|
124
124
|
self.add_parameter(
|
|
125
|
-
Parameter_component("reheat_water_system", "not_defined", ["HVAC_water_system"])
|
|
125
|
+
Parameter_component("reheat_water_system", "not_defined", ["HVAC_water_system", "HVAC_water_circuit"])
|
|
126
126
|
)
|
|
127
127
|
|
|
128
128
|
|
|
@@ -267,6 +267,13 @@ class HVAC_MZW_system(Component): # HVAC Multizone Water system
|
|
|
267
267
|
self.heating_water_flow = self.parameter("heating_water_flow").value/1000 # Convert to m³/s
|
|
268
268
|
self.cooling_water_temp = self.parameter("inlet_cooling_water_temp").value
|
|
269
269
|
self.heating_water_temp = self.parameter("inlet_heating_water_temp").value
|
|
270
|
+
self.reheat_water_temp = self.heating_water_temp
|
|
271
|
+
# Water systems: the inlet water temperatures come from them in each iteration
|
|
272
|
+
from_system = self.parameter("water_source").value == "WATER_SYSTEM"
|
|
273
|
+
self.heating_ws = self.parameter("heating_water_system").component if from_system else None
|
|
274
|
+
self.cooling_ws = self.parameter("cooling_water_system").component if from_system else None
|
|
275
|
+
reheat_from_system = self.parameter("reheat_water_source").value == "WATER_SYSTEM"
|
|
276
|
+
self.reheat_ws = self.parameter("reheat_water_system").component if reheat_from_system else None
|
|
270
277
|
self.rho_MA = self.props["RHO_A"]
|
|
271
278
|
# Fan operation
|
|
272
279
|
self.fan_operation = self.parameter("fan_operation").value
|
|
@@ -340,8 +347,26 @@ class HVAC_MZW_system(Component): # HVAC Multizone Water system
|
|
|
340
347
|
self._calculate_required_Q()
|
|
341
348
|
self._simulate_system()
|
|
342
349
|
self._send_air_to_spaces(time_index)
|
|
350
|
+
self._send_water_to_systems()
|
|
343
351
|
return True
|
|
344
352
|
|
|
353
|
+
def _send_water_to_systems(self):
|
|
354
|
+
# Loads of the coils to the water systems (positive when the coil heats the
|
|
355
|
+
# water); flow: the design one the fraction of the time (ON_OFF) or of the
|
|
356
|
+
# flow (PROPORTIONAL, estimated) the coil works
|
|
357
|
+
if self.heating_ws is not None and self.state in (1, 2):
|
|
358
|
+
self.heating_ws.add_coil_load(
|
|
359
|
+
-self.Q_coil, self.parameter("heating_water_flow").value * self.F_load
|
|
360
|
+
)
|
|
361
|
+
elif self.cooling_ws is not None and self.state in (-1, -2):
|
|
362
|
+
self.cooling_ws.add_coil_load(
|
|
363
|
+
-self.Q_coil, self.parameter("cooling_water_flow").value * self.F_load
|
|
364
|
+
)
|
|
365
|
+
if self.reheat_ws is not None and self.is_reheat:
|
|
366
|
+
Q = float(np.sum(self.Q_reheat))
|
|
367
|
+
if Q > 0:
|
|
368
|
+
self.reheat_ws.add_coil_load(-Q, self._reheat_flow)
|
|
369
|
+
|
|
345
370
|
def _calculate_return_air(self, time_index):
|
|
346
371
|
v_return = 0
|
|
347
372
|
self.T_ZA = 0
|
|
@@ -362,6 +387,9 @@ class HVAC_MZW_system(Component): # HVAC Multizone Water system
|
|
|
362
387
|
# Calculate F_OA based on return air flow
|
|
363
388
|
if self.is_vav:
|
|
364
389
|
self.F_OA = (self.air_flow * self.F_flow_total - v_return) / (self.air_flow* self.F_flow_total)
|
|
390
|
+
# with the return equal to the supply the rounding may leave it slightly
|
|
391
|
+
# negative, and the mixed air humidity with it
|
|
392
|
+
self.F_OA = min(max(self.F_OA, 0.0), 1.0)
|
|
365
393
|
elif self.V_OA > 0:
|
|
366
394
|
self._set_outdoor_air_from_flow(rho_ZA)
|
|
367
395
|
|
|
@@ -475,9 +503,19 @@ class HVAC_MZW_system(Component): # HVAC Multizone Water system
|
|
|
475
503
|
self.F_econo = 0.0
|
|
476
504
|
|
|
477
505
|
def _simulate_system(self):
|
|
478
|
-
|
|
506
|
+
heating = self.h_coil is not None and self.Q_required > 0
|
|
507
|
+
cooling = self.c_coil is not None and self.Q_required < 0
|
|
508
|
+
# From a water system: no heating (cooling) if it is off or its water is
|
|
509
|
+
# colder (warmer) than the mixed air
|
|
510
|
+
if heating and self.heating_ws is not None:
|
|
511
|
+
self.heating_water_temp = self.heating_ws.get_heating_coil_inlet_T()
|
|
512
|
+
heating = self.heating_ws.can_heat() and self.heating_water_temp >= self.T_MA
|
|
513
|
+
if cooling and self.cooling_ws is not None:
|
|
514
|
+
self.cooling_water_temp = self.cooling_ws.get_cooling_coil_inlet_T()
|
|
515
|
+
cooling = self.cooling_ws.can_cool() and self.cooling_water_temp <= self.T_MA
|
|
516
|
+
if heating:
|
|
479
517
|
self._simulate_heating()
|
|
480
|
-
elif
|
|
518
|
+
elif cooling:
|
|
481
519
|
self._simulate_cooling()
|
|
482
520
|
else: # Venting
|
|
483
521
|
self.state = 3
|
|
@@ -564,6 +602,11 @@ class HVAC_MZW_system(Component): # HVAC Multizone Water system
|
|
|
564
602
|
|
|
565
603
|
def _send_air_to_spaces(self, time_index):
|
|
566
604
|
self.Q_reheat = np.zeros(len(self.spaces))
|
|
605
|
+
self._reheat_flow = 0 # dm³/s, to the reheat water system
|
|
606
|
+
reheat_available = True
|
|
607
|
+
if self.is_reheat and self.reheat_ws is not None:
|
|
608
|
+
self.reheat_water_temp = self.reheat_ws.get_heating_coil_inlet_T()
|
|
609
|
+
reheat_available = self.reheat_ws.can_heat() and self.reheat_water_temp > self.T_SA
|
|
567
610
|
self.F_flow_total = 0
|
|
568
611
|
self.rho_CA = 1 / sicro.GetMoistAirVolume(
|
|
569
612
|
self.T_CA, self.w_CA / 1000, self.props["ATM_PRESSURE"]
|
|
@@ -610,7 +653,7 @@ class HVAC_MZW_system(Component): # HVAC Multizone Water system
|
|
|
610
653
|
# Reheat control
|
|
611
654
|
if self.is_reheat:
|
|
612
655
|
reheat_coil = self.reheat_coils[i]
|
|
613
|
-
if reheat_coil is not None and reheat_needed:
|
|
656
|
+
if reheat_coil is not None and reheat_needed and reheat_available:
|
|
614
657
|
# Reheat coil
|
|
615
658
|
water_flow = reheat_coil.parameter(
|
|
616
659
|
"nominal_heating_water_flow"
|
|
@@ -618,7 +661,7 @@ class HVAC_MZW_system(Component): # HVAC Multizone Water system
|
|
|
618
661
|
capacity, epsilon = reheat_coil.get_heating_capacity(
|
|
619
662
|
self.T_SA,
|
|
620
663
|
self.T_SAwb,
|
|
621
|
-
self.
|
|
664
|
+
self.reheat_water_temp,
|
|
622
665
|
self.air_flow * f_air_flow,
|
|
623
666
|
water_flow,
|
|
624
667
|
)
|
|
@@ -627,6 +670,8 @@ class HVAC_MZW_system(Component): # HVAC Multizone Water system
|
|
|
627
670
|
self.Q_reheat[i] = Q_reheat_required
|
|
628
671
|
else:
|
|
629
672
|
self.Q_reheat[i] = capacity
|
|
673
|
+
if capacity > 0:
|
|
674
|
+
self._reheat_flow += water_flow * 1000 * self.Q_reheat[i] / capacity
|
|
630
675
|
space.set_control_system(
|
|
631
676
|
{
|
|
632
677
|
"M_a": 0,
|
|
@@ -17,7 +17,7 @@ class HVAC_SZW_system(Component): # HVAC Single Zone Water system
|
|
|
17
17
|
self.parameter("type").value = "HVAC_SZW_system"
|
|
18
18
|
self.parameter("description").value = "HVAC Single Zone Water system"
|
|
19
19
|
self.add_parameter(
|
|
20
|
-
Parameter_component("space", "not_defined", ["Space"])
|
|
20
|
+
Parameter_component("space", "not_defined", ["Space", "Load_space"])
|
|
21
21
|
) # Space
|
|
22
22
|
self.add_parameter(
|
|
23
23
|
Parameter_component("cooling_coil", "not_defined", ["Water_coil"])
|
|
@@ -43,12 +43,12 @@ class HVAC_SZW_system(Component): # HVAC Single Zone Water system
|
|
|
43
43
|
)
|
|
44
44
|
self.add_parameter(
|
|
45
45
|
Parameter_component(
|
|
46
|
-
"cooling_water_system", "not_defined", ["HVAC_water_system"]
|
|
46
|
+
"cooling_water_system", "not_defined", ["HVAC_water_system", "HVAC_water_circuit"]
|
|
47
47
|
)
|
|
48
48
|
)
|
|
49
49
|
self.add_parameter(
|
|
50
50
|
Parameter_component(
|
|
51
|
-
"heating_water_system", "not_defined", ["HVAC_water_system"]
|
|
51
|
+
"heating_water_system", "not_defined", ["HVAC_water_system", "HVAC_water_circuit"]
|
|
52
52
|
)
|
|
53
53
|
)
|
|
54
54
|
self.add_parameter(Parameter_float("cooling_water_flow", 1, "dm³/s", min=0))
|
|
@@ -383,7 +383,7 @@ class HVAC_SZW_system(Component): # HVAC Single Zone Water system
|
|
|
383
383
|
"heating_water_system"
|
|
384
384
|
).component.get_heating_coil_inlet_T()
|
|
385
385
|
if (
|
|
386
|
-
not self.parameter("heating_water_system").component.
|
|
386
|
+
not self.parameter("heating_water_system").component.can_heat()
|
|
387
387
|
or heating_Tw < self.T_MA
|
|
388
388
|
):
|
|
389
389
|
self.state = 3
|
|
@@ -435,7 +435,7 @@ class HVAC_SZW_system(Component): # HVAC Single Zone Water system
|
|
|
435
435
|
"cooling_water_system"
|
|
436
436
|
).component.get_cooling_coil_inlet_T()
|
|
437
437
|
if (
|
|
438
|
-
not self.parameter("cooling_water_system").component.
|
|
438
|
+
not self.parameter("cooling_water_system").component.can_cool()
|
|
439
439
|
or cooling_Tw > self.T_MA
|
|
440
440
|
):
|
|
441
441
|
self.state = 3
|
|
@@ -513,13 +513,15 @@ class HVAC_SZW_system(Component): # HVAC Single Zone Water system
|
|
|
513
513
|
|
|
514
514
|
def _send_water_to_system(self):
|
|
515
515
|
if self.parameter("water_source").value == "WATER_SYSTEM": # from water system
|
|
516
|
+
# water flow through the coil: the design one the fraction of the time
|
|
517
|
+
# (ON_OFF) or of the flow (PROPORTIONAL, estimated) it works
|
|
516
518
|
if self.state == 1 or self.state == 2: # Heating
|
|
517
519
|
self.parameter("heating_water_system").component.add_coil_load(
|
|
518
|
-
-self.Q_coil
|
|
520
|
+
-self.Q_coil, self.parameter("heating_water_flow").value * self.F_load
|
|
519
521
|
)
|
|
520
522
|
elif self.state == -1 or self.state == -2: # Cooling
|
|
521
523
|
self.parameter("cooling_water_system").component.add_coil_load(
|
|
522
|
-
-self.Q_coil
|
|
524
|
+
-self.Q_coil, self.parameter("cooling_water_flow").value * self.F_load
|
|
523
525
|
)
|
|
524
526
|
|
|
525
527
|
def _update_supply_mass_flow(self):
|
|
@@ -10,7 +10,7 @@ class HVAC_perfect_system(Component):
|
|
|
10
10
|
Component.__init__(self, name, project)
|
|
11
11
|
self.parameter("type").value = "HVAC_perfect_system"
|
|
12
12
|
self.parameter("description").value = "HVAC Perfect system for cooling and heating load"
|
|
13
|
-
self.add_parameter(Parameter_component("spaces", "not_defined", ["Space"]))
|
|
13
|
+
self.add_parameter(Parameter_component("spaces", "not_defined", ["Space", "Load_space"]))
|
|
14
14
|
self.add_parameter(Parameter_variable_list("input_variables", []))
|
|
15
15
|
self.add_parameter(Parameter_math_exp("outdoor_air_flow", "0", "m³/s"))
|
|
16
16
|
self.add_parameter(Parameter_math_exp("heating_setpoint", "20", "°C"))
|