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

Fixed supply temperature not set correctly. #190

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,10 @@ def to_entity(self, esdl_asset: EsdlAssetObject) -> ControllerConsumer:
if power == 0:
power = np.inf

temperature_supply = esdl_asset.get_supply_temperature("In")
temperature_return = esdl_asset.get_return_temperature("Out")
# It looks like they are switch, but this is because of the definition used in ESDL,
# which is different as what we use.
temperature_supply = esdl_asset.get_return_temperature("Out")
temperature_return = esdl_asset.get_supply_temperature("In")
profile = esdl_asset.get_profile()
contr_consumer = ControllerConsumer(
name=esdl_asset.esdl_asset.name,
Expand All @@ -147,14 +149,14 @@ def to_entity(self, esdl_asset: EsdlAssetObject) -> ControllerStorage:

:return: Entity object.
"""
result = esdl_asset.get_property(esdl_property_name="maxDischargeRate",
default_value=np.inf)
result = esdl_asset.get_property(
esdl_property_name="maxDischargeRate", default_value=np.inf
)
discharge_power = np.inf
if result[1]:
discharge_power = result[0]

result = esdl_asset.get_property(esdl_property_name="maxChargeRate",
default_value=np.inf)
result = esdl_asset.get_property(esdl_property_name="maxChargeRate", default_value=np.inf)
charge_power = np.inf
if result[1]:
charge_power = result[0]
Expand Down
6 changes: 3 additions & 3 deletions src/omotes_simulator_core/entities/assets/demand_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ def set_setpoints(self, setpoints: Dict) -> None:
f"The setpoints {necessary_setpoints.difference(setpoints_set)} are missing."
)
self.thermal_power_allocation = setpoints[PROPERTY_HEAT_DEMAND]
self.temperature_return_target = setpoints[PROPERTY_TEMPERATURE_SUPPLY]
self.temperature_supply = setpoints[PROPERTY_TEMPERATURE_RETURN]
self.temperature_return_target = setpoints[PROPERTY_TEMPERATURE_RETURN]
self.temperature_supply = setpoints[PROPERTY_TEMPERATURE_SUPPLY]
adjusted_mass_flowrate = heat_demand_and_temperature_to_mass_flow(
self.thermal_power_allocation, self.temperature_supply, self.temperature_return_target
)
self.solver_asset.supply_temperature = self.temperature_return_target
self.solver_asset.supply_temperature = self.temperature_supply
self.solver_asset.mass_flow_rate_set_point = adjusted_mass_flowrate # type: ignore

def add_physical_data(self, esdl_asset: EsdlAssetObject) -> None:
Expand Down
44 changes: 44 additions & 0 deletions unit_test/entities/test_esdl_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,50 @@ def test_get_return_temperature_out(self):
# Assert
self.assertEqual(return_temperature, 313.15)

def test_get_supply_temperature_consumer(self):
vanmeerkerk marked this conversation as resolved.
Show resolved Hide resolved
"""Test get_supply_temperature method."""
# Arrange
asset = self.esdl_object.get_all_assets_of_type("consumer")[0]

# Act
supply_temperature = asset.get_return_temperature("Out")

# Assert
self.assertEqual(supply_temperature, 313.15)

def test_get_return_temperature_consumer(self):
"""Test get_supply_temperature method."""
# Arrange
asset = self.esdl_object.get_all_assets_of_type("consumer")[0]

# Act
supply_temperature = asset.get_supply_temperature("In")

# Assert
self.assertEqual(supply_temperature, 353.15)

def test_get_supply_temperature_producer(self):
"""Test get_supply_temperature method."""
# Arrange
asset = self.esdl_object.get_all_assets_of_type("producer")[0]

# Act
supply_temperature = asset.get_supply_temperature("Out")

# Assert
self.assertEqual(supply_temperature, 353.15)

def test_get_return_temperature_producer(self):
"""Test get_supply_temperature method."""
# Arrange
asset = self.esdl_object.get_all_assets_of_type("producer")[0]

# Act
supply_temperature = asset.get_return_temperature("In")

# Assert
self.assertEqual(supply_temperature, 313.15)

def test_get_port_type_in(self):
"""Test get_port_type method."""
# Arrange
Expand Down
Loading