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

Issue639 actuator travel #699

Open
wants to merge 27 commits into
base: issue639_actuatorTravel
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9864653
Add missing weather variable warning to data_manager
EttoreZ May 14, 2024
43cb2ae
Merge branch 'master' into issue500_update_data_manager
EttoreZ May 14, 2024
45134e8
Update release notes
EttoreZ May 14, 2024
28b2aa7
Moved warning to _append_csv_data and update release notes
EttoreZ May 14, 2024
a1a54d4
Update release notes
EttoreZ May 14, 2024
71b5e01
Merge pull request #645 from ibpsa/issue500_update_data_manager
dhblum May 14, 2024
be80b23
First implementation of actuator travel KPI using bestest_hydronic_he…
terrancelu92 May 28, 2024
dedcec4
Revert the unecessary change
terrancelu92 May 28, 2024
0888d5d
Update the mapping of the actuators in all cases
terrancelu92 May 28, 2024
247fcf8
Update core_kpi.rst
terrancelu92 May 31, 2024
44132be
Enable remote debug function
terrancelu92 Aug 13, 2024
1780afe
Enable debug environment by ptvsd
terrancelu92 Aug 16, 2024
28c4c3d
Add parser development environment
terrancelu92 Oct 15, 2024
1f6757f
Adding IBPSA and IDEAS in the docker container
terrancelu92 Oct 15, 2024
8e464e1
Test the parsing.py using bestest_hydronic_heat_pump
terrancelu92 Oct 29, 2024
db62bae
Update the bestest_hydronic_heat_pump with new kpi fmu
terrancelu92 Oct 29, 2024
57a8110
Update the kpi_calculator for new testcases; Add a json file for exis…
terrancelu92 Nov 1, 2024
26136d4
Revert the debugging environment: required library
terrancelu92 Nov 1, 2024
c9014b9
Revert the debugging environment files
terrancelu92 Nov 1, 2024
a855a90
Revert all these changes back to those in remote issue 639 repo
terrancelu92 Nov 1, 2024
a6e8a62
Revert baseline.py
terrancelu92 Nov 1, 2024
5027455
Update kpi_calculator.py
terrancelu92 Nov 1, 2024
c698587
Update kpi_calculator.py
terrancelu92 Nov 1, 2024
1eaef77
Update kpi_calculator.py
terrancelu92 Nov 10, 2024
e5ac5a5
Revert "Update kpi_calculator.py"
terrancelu92 Nov 10, 2024
ee16163
Update kpi_calculator.py
terrancelu92 Nov 10, 2024
7be8520
Correct some control actuator variable names
terrancelu92 Nov 12, 2024
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
Prev Previous commit
Next Next commit
Revert all these changes back to those in remote issue 639 repo
terrancelu92 committed Nov 1, 2024
commit a855a903c19fe4f3acab3c1ec7442b30e88bfd75
37 changes: 0 additions & 37 deletions .vscode/launch.json

This file was deleted.

7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ RUN cd $HOME && \
conda create --name pyfmi3 python=3.10 -y && \
conda activate pyfmi3 && \
conda install -c conda-forge pyfmi=2.12 -y && \
pip install ptvsd==4.3.2 flask-restful==0.3.9 werkzeug==2.2.3 && \
pip install flask-restful==0.3.9 werkzeug==2.2.3 && \
conda install pandas==1.5.3 flask_cors==3.0.10 matplotlib==3.7.1 requests==2.28.1 scipy==1.13.0

WORKDIR $HOME
@@ -37,7 +37,6 @@ RUN mkdir models && \
ENV PYTHONPATH $PYTHONPATH:$HOME
ENV BOPTEST_DASHBOARD_SERVER https://dashboard.boptest.net/

EXPOSE 8080
EXPOSE 5678
CMD . miniconda/bin/activate && conda activate pyfmi3 && python restapi.py && bash

ENTRYPOINT ["/bin/bash", "-c", ". miniconda/bin/activate && conda activate pyfmi3 && python restapi.py"]
EXPOSE 5000
12 changes: 1 addition & 11 deletions data/data_manager.py
Original file line number Diff line number Diff line change
@@ -146,20 +146,12 @@ def _append_csv_data(self):

# Get zone and boundary data keys allowed
zon_keys, bou_keys = self._get_zone_and_boundary_keys()
weather_keys = list(self.categories['weather'].keys())

# Search for .csv files in the resources folder
for f in self.files:
if f.endswith('.csv'):
df = pd.read_csv(f, comment='#')
cols = df.keys()

# Check if all weather variables are included in weather.csv
if 'weather' in f:
if not set(cols) <= set(weather_keys):
warnings.warn('The file weather.csv is missing '\
'the following variables '+str(set(weather_keys).difference(set(cols)))+'.', Warning)

if 'time' in cols:
for col in cols.drop('time'):
# Raise error if col already appended
@@ -435,8 +427,7 @@ def load_data_and_jsons(self):

# Get zone and boundary data keys allowed
zon_keys, bou_keys = self._get_zone_and_boundary_keys()



# Initialize test case data frame
self.case.data = \
pd.DataFrame(index=index).rename_axis('time')
@@ -445,7 +436,6 @@ def load_data_and_jsons(self):
for f in files:
df = pd.read_csv(z_fmu.open(f))
cols = df.keys()

if 'time' in cols:
for col in cols.drop('time'):
# Check that column has any of the allowed data keys
6 changes: 1 addition & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -15,11 +15,7 @@ services:
- ./forecast:${APP_PATH}/forecast/
- ./kpis:${APP_PATH}/kpis/
ports:
- "8080:8080"
- "5678:5678" # Port for remote debugging
environment:
- DEBUG_MODE=true # Add this line to enable debugging

- 127.0.0.1:5000:5000
networks:
- boptest-net

53 changes: 0 additions & 53 deletions examples/python/controllers/baseline.py

This file was deleted.

2 changes: 1 addition & 1 deletion examples/python/interface.py
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ def control_test(control_module='', start_time=0, warmup_period=0, length=24*360
# SETUP TEST
# -------------------------------------------------------------------------
# Set URL for testcase
url = 'http://127.0.0.1:8080'
url = 'http://127.0.0.1:5000'
# Instantiate concrete controller (pid, pidTwoZones, sup, etc.)
controller = Controller(control_module, use_forecast)

2 changes: 1 addition & 1 deletion parsing/SimpleRC.mo
Original file line number Diff line number Diff line change
@@ -84,5 +84,5 @@ equation
annotation (Line(points={{70,20},{98,20}}, color={0,0,127}));
connect(eff.y, PHeat.u) annotation (Line(points={{41,-80},{98,-80}},
color={0,0,127}));
annotation (uses(Modelica(version="3.2.3"), IBPSA(version="4.0.0")));
annotation (uses(Modelica(version="3.2.2"), IBPSA(version="3.0.0")));
end SimpleRC;
7 changes: 0 additions & 7 deletions parsing/TestCase.mo

This file was deleted.

1 change: 0 additions & 1 deletion parsing/kpis.json

This file was deleted.

34 changes: 4 additions & 30 deletions parsing/parser.py
Original file line number Diff line number Diff line change
@@ -11,28 +11,14 @@
5) Save test case data within wrapper FMU.

"""
import ptvsd

# Allow other computers to attach to ptvsd at port 5679
ptvsd.enable_attach(address=('0.0.0.0', 5679), redirect_output=True)

# Pause the program until a remote debugger is attached
print("Waiting for debugger to attach...")
ptvsd.wait_for_attach()

import sys
import os
# Add the parent directory to PYTHONPATH to include 'data'
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'data'))
from pyfmi import load_fmu
from pymodelica import compile_fmu

import os
import json
from data.data_manager import Data_Manager
import warnings



def parse_instances(model_path, file_name):
'''Parse the signal exchange block class instances using fmu xml.

@@ -89,26 +75,14 @@ def parse_instances(model_path, file_name):
# KPI
elif 'KPIs' in var:
label = 'kpi'
# CAT
elif 'CAT' in var:
label = 'cat'
else:
continue
# Save instance
if label is not 'kpi' and label is not 'cat':
if label is not 'kpi':
instances[label][instance] = {'Unit' : unit}
instances[label][instance]['Description'] = description
instances[label][instance]['Minimum'] = mini
instances[label][instance]['Maximum'] = maxi
elif label is 'cat':
actuator_type = fmu.get_variable_declared_type(var).items[fmu.get(var)[0]][0]
signal_type = '{0}[{1}]'.format("ControlActuator", actuator_type)
if actuator_type == 'None':
continue
elif signal_type in signals:
signals[signal_type].append(_make_var_name(instance,style='input_signal'))
else:
signals[signal_type] = [_make_var_name(instance,style='input_signal')]
else:
signal_type = fmu.get_variable_declared_type(var).items[fmu.get(var)[0]][0]
# Split certain signal types for multi-zone
@@ -296,8 +270,8 @@ def _make_var_name(block, style, description='', attribute=''):

if __name__ == '__main__':
# Define model
model_path = 'TestCase'
mo_path = 'TestCase.mo'
model_path = 'SimpleRC'
mo_path = 'SimpleRC.mo'
# Parse and export
fmu_path, kpi_path = export_fmu(model_path, [mo_path])
# Print information
Binary file removed parsing/wrapped.fmu
Binary file not shown.
62 changes: 0 additions & 62 deletions parsing/wrapped.mo

This file was deleted.

2 changes: 1 addition & 1 deletion releasenotes.md
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ Released on xx/xx/xxxx.

- Update pyfmi version from 2.11 to 2.12 and miniconda version from py310_23.1.0-1-Linux-x86_64 to py310_24.3.0-0-Linux-x86_64. This is for [#643](https://github.com/ibpsa/project1-boptest/issues/643).
- Remove support and unit testing of example python controllers using Python 2. This is for [#634](https://github.com/ibpsa/project1-boptest/issues/634).
- Add a warning message upon test case compilation in ``data/data_manager.py`` that is displayed if any of the weather variables in ``data/categories.json`` is not in ``<testcase_folder>/resources/weather.csv``. This is for [#500](https://github.com/ibpsa/project1-boptest/issues/500).


## BOPTEST v0.6.0

12 changes: 1 addition & 11 deletions restapi.py
Original file line number Diff line number Diff line change
@@ -13,16 +13,7 @@
from flask_cors import CORS
import six
# ----------------------
import ptvsd
import os

# Check if debugging is enabled
if os.getenv('DEBUG_MODE', 'false').lower() == 'true':
# Allow other computers to attach to ptvsd at this IP address and port.
ptvsd.enable_attach(address=('0.0.0.0', 5678), redirect_output=True)
print("Waiting for debugger to attach...")
# Timeout for the wait function to avoid indefinite blocking
ptvsd.wait_for_attach(timeout=19) # Timeout in seconds

# GENERAL HTTP RESPONSE
# ----------------------
@@ -284,5 +275,4 @@ def post(self):
# --------------------------------------

if __name__ == '__main__':
print("Starting Flask server on port 8080...")
app.run(host='0.0.0.0', port=8080)
app.run(host='0.0.0.0')
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
within BESTESTHydronicHeatPump;
model TestCase "This model just extends the test case model from IDEAS library"
extends IDEAS.Examples.IBPSA.SingleZoneResidentialHydronicHeatPump(
ovePum(CAT=IDEAS.Utilities.IO.SignalExchange.SignalTypes.SignalsForActuatorTravel.Pump),
oveHeaPumY(CAT=IDEAS.Utilities.IO.SignalExchange.SignalTypes.SignalsForActuatorTravel.HVACEquipment),
oveFan(CAT=IDEAS.Utilities.IO.SignalExchange.SignalTypes.SignalsForActuatorTravel.Fan));

extends IDEAS.Examples.IBPSA.SingleZoneResidentialHydronicHeatPump;
annotation ();
end TestCase;
Binary file modified testcases/bestest_hydronic_heat_pump/models/wrapped.fmu
Binary file not shown.
8 changes: 2 additions & 6 deletions testcases/bestest_hydronic_heat_pump/models/wrapped.mo
Original file line number Diff line number Diff line change
@@ -12,10 +12,8 @@ model wrapped "Wrapped model"
Modelica.Blocks.Interfaces.RealOutput weaSta_reaWeaSolHouAng_y(unit="rad") = mod.weaSta.reaWeaSolHouAng.y "Solar hour angle measurement";
Modelica.Blocks.Interfaces.RealOutput weaSta_reaWeaWinDir_y(unit="rad") = mod.weaSta.reaWeaWinDir.y "Wind direction measurement";
Modelica.Blocks.Interfaces.RealOutput reaQFloHea_y(unit="W") = mod.reaQFloHea.y "Floor heating thermal power released to the zone";
Modelica.Blocks.Interfaces.RealOutput reaTSet_y(unit="K") = mod.reaTSet.y "Zone operative temperature setpoint";
Modelica.Blocks.Interfaces.RealOutput weaSta_reaWeaTBlaSky_y(unit="K") = mod.weaSta.reaWeaTBlaSky.y "Black-body sky temperature measurement";
Modelica.Blocks.Interfaces.RealOutput reaTZon_y(unit="K") = mod.reaTZon.y "Zone operative temperature";
Modelica.Blocks.Interfaces.RealOutput reaHeaPumY_y(unit="1") = mod.reaHeaPumY.y "Block for reading the heat pump modulating signal";
Modelica.Blocks.Interfaces.RealOutput weaSta_reaWeaNTot_y(unit="1") = mod.weaSta.reaWeaNTot.y "Sky cover measurement";
Modelica.Blocks.Interfaces.RealOutput weaSta_reaWeaWinSpe_y(unit="m/s") = mod.weaSta.reaWeaWinSpe.y "Wind speed measurement";
Modelica.Blocks.Interfaces.RealOutput weaSta_reaWeaNOpa_y(unit="1") = mod.weaSta.reaWeaNOpa.y "Opaque sky cover measurement";
@@ -27,7 +25,7 @@ model wrapped "Wrapped model"
Modelica.Blocks.Interfaces.RealOutput weaSta_reaWeaSolAlt_y(unit="rad") = mod.weaSta.reaWeaSolAlt.y "Solar altitude angle measurement";
Modelica.Blocks.Interfaces.RealOutput weaSta_reaWeaCeiHei_y(unit="m") = mod.weaSta.reaWeaCeiHei.y "Cloud cover ceiling height measurement";
Modelica.Blocks.Interfaces.RealOutput reaPPumEmi_y(unit="W") = mod.reaPPumEmi.y "Emission circuit pump electrical power";
Modelica.Blocks.Interfaces.RealOutput reaFan_y(unit="1") = mod.reaFan.y "Control signal for fan";
Modelica.Blocks.Interfaces.RealOutput weaSta_reaWeaHHorIR_y(unit="W/m2") = mod.weaSta.reaWeaHHorIR.y "Horizontal infrared irradiation measurement";
Modelica.Blocks.Interfaces.RealOutput reaQHeaPumCon_y(unit="W") = mod.reaQHeaPumCon.y "Heat pump thermal power exchanged in the condenser";
Modelica.Blocks.Interfaces.RealOutput weaSta_reaWeaSolZen_y(unit="rad") = mod.weaSta.reaWeaSolZen.y "Solar zenith angle measurement";
Modelica.Blocks.Interfaces.RealOutput reaTSup_y(unit="K") = mod.reaTSup.y "Supply water temperature to radiant floor";
@@ -46,15 +44,13 @@ model wrapped "Wrapped model"
Modelica.Blocks.Interfaces.RealOutput weaSta_reaWeaTDewPoi_y(unit="K") = mod.weaSta.reaWeaTDewPoi.y "Dew point temperature measurement";
Modelica.Blocks.Interfaces.RealOutput reaCO2RooAir_y(unit="ppm") = mod.reaCO2RooAir.y "CO2 concentration in the zone";
Modelica.Blocks.Interfaces.RealOutput reaTRet_y(unit="K") = mod.reaTRet.y "Return water temperature from radiant floor";
Modelica.Blocks.Interfaces.RealOutput weaSta_reaWeaHHorIR_y(unit="W/m2") = mod.weaSta.reaWeaHHorIR.y "Horizontal infrared irradiation measurement";
Modelica.Blocks.Interfaces.RealOutput reaPum_y(unit="1") = mod.reaPum.y "Control signal for emission cirquit pump";
Modelica.Blocks.Interfaces.RealOutput weaSta_reaWeaTWetBul_y(unit="K") = mod.weaSta.reaWeaTWetBul.y "Wet bulb temperature measurement";
Modelica.Blocks.Interfaces.RealOutput ovePum_y(unit="1") = mod.ovePum.y "Integer signal to control the emission circuit pump either on or off";
Modelica.Blocks.Interfaces.RealOutput oveHeaPumY_y(unit="1") = mod.oveHeaPumY.y "Heat pump modulating signal for compressor speed between 0 (not working) and 1 (working at maximum capacity)";
Modelica.Blocks.Interfaces.RealOutput oveFan_y(unit="1") = mod.oveFan.y "Integer signal to control the heat pump evaporator fan either on or off";
Modelica.Blocks.Interfaces.RealOutput oveTSet_y(unit="K") = mod.oveTSet.y "Zone operative temperature setpoint";
// Original model
TestCase mod(
BESTESTHydronicHeatPump.TestCase mod(
ovePum(uExt(y=ovePum_u),activate(y=ovePum_activate)),
oveHeaPumY(uExt(y=oveHeaPumY_u),activate(y=oveHeaPumY_activate)),
oveFan(uExt(y=oveFan_u),activate(y=oveFan_activate)),