mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-04-19 08:55:15 +00:00
Add first unit test for heatpump COP calculation
This commit is contained in:
parent
22c6a38513
commit
0056e71695
@ -1,10 +1,5 @@
|
|||||||
import json
|
|
||||||
from datetime import datetime, timedelta, timezone
|
|
||||||
import numpy as np
|
|
||||||
from pprint import pprint
|
|
||||||
|
|
||||||
|
class Heatpump:
|
||||||
class Waermepumpe:
|
|
||||||
MAX_HEIZLEISTUNG = 5000 # Maximum heating power in watts
|
MAX_HEIZLEISTUNG = 5000 # Maximum heating power in watts
|
||||||
BASE_HEIZLEISTUNG = 235.0 # Base heating power value
|
BASE_HEIZLEISTUNG = 235.0 # Base heating power value
|
||||||
TEMPERATURE_COEFFICIENT = -11.645 # Coefficient for temperature
|
TEMPERATURE_COEFFICIENT = -11.645 # Coefficient for temperature
|
||||||
@ -48,7 +43,7 @@ if __name__ == '__main__':
|
|||||||
start_innentemperatur = 15 # Initial indoor temperature
|
start_innentemperatur = 15 # Initial indoor temperature
|
||||||
isolationseffizienz = 0.8 # Insulation efficiency
|
isolationseffizienz = 0.8 # Insulation efficiency
|
||||||
gewuenschte_innentemperatur = 20 # Desired indoor temperature
|
gewuenschte_innentemperatur = 20 # Desired indoor temperature
|
||||||
wp = Waermepumpe(max_heizleistung, 24) # Initialize heat pump with prediction hours
|
wp = Heatpump(max_heizleistung, 24) # Initialize heat pump with prediction hours
|
||||||
|
|
||||||
# Print COP for various outside temperatures
|
# Print COP for various outside temperatures
|
||||||
print(wp.cop_berechnen(-10), " ", wp.cop_berechnen(0), " ", wp.cop_berechnen(10))
|
print(wp.cop_berechnen(-10), " ", wp.cop_berechnen(0), " ", wp.cop_berechnen(10))
|
||||||
|
1
requirements-dev.txt
Normal file
1
requirements-dev.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
pytest==8.3.3
|
1
tests/conftest.py
Normal file
1
tests/conftest.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
from test_heatpump import heatpump
|
16
tests/test_heatpump.py
Normal file
16
tests/test_heatpump.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import pytest
|
||||||
|
from modules.class_heatpump import Heatpump
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope='function')
|
||||||
|
def heatpump() -> Heatpump:
|
||||||
|
""" Heatpump with 5 kw heating power and 24 h prediction
|
||||||
|
"""
|
||||||
|
return Heatpump(5000, 24)
|
||||||
|
|
||||||
|
class TestHeatpump:
|
||||||
|
def test_cop(self, heatpump):
|
||||||
|
"""Testing calculate COP for variouse outside temperatures"""
|
||||||
|
assert heatpump.cop_berechnen(-10) == 2.0, "COP for -10 degree isn't correct"
|
||||||
|
assert heatpump.cop_berechnen(0) == 3.0, "COP for 0 degree isn't correct"
|
||||||
|
assert heatpump.cop_berechnen(10) == 4.0, "COP for 10 degree isn't correct"
|
Loading…
x
Reference in New Issue
Block a user