SenHuang19 / BuildingControlTest

"A Docker setup for building control testing"
3 stars 1 forks source link

Error implementing leaky actuator #2

Closed ajaugust closed 3 years ago

ajaugust commented 3 years ago

I'm implementing a leaky cooling coil valve:

import requests

url_eplus = 'http://127.0.0.1:5501'
url_modelica = 'http://127.0.0.1:5001'

# Set the step
requests.put(f'{url_eplus}/step', data={'step': 60})

# Set the fault scenario
fault = {"floor2_coil_valve": {"value": 0.6, "fault_time": 240}}
requests.put(f'{url_modelica}/fault_scenario', json=fault)

This prints the error message below.

jmodelica_1  | {u'floor2_vav4_cooling_set': None, u'floor3_ahu_mix_temp_set': None, u'floor2_pre': None, u'floor2_vav3_flow_set': None, u'floor2_outdoor_damper': None, u'floor1_ahu_dis_mflow': None, u'floor2_vav5_dis_mflow_ratio': None, u'floor2_vav3_dis_mflow_ratio': None, u'floor2_vav2_cooling_set': None, u'floor3_vav2_damper_pos_real': None, u'floor2_vav4_dis_T': None, u'floor1_pressure': None, u'floor1_vav5_rehea_val_pos': None, u'floor3_vav3_flow_set': None, u'floor3_vav4_flow_set': None, u'floor2_ahu_ret_T': None, u'floor3_ahu_return_fan_power': None, u'floor2_vav1_dis_mflow_ratio': None, u'floor1_vav5_dis_mflow_ratio': None, u'occ': None, u'floor1_vav2_dis_mflow': None, u'floor3_vav3_dis_mflow': None, u'floor1_vav1_cooling_set': None, u'floor3_pressure': None, u'floor1_vav1_rehea_val_pos': None, u'floor3_vav3_dis_mflow_ratio': None, u'floor2_ahu_return_fan_power': None, u'floor1_vav4_dis_T': None, u'floor2_vav5_flow_set': None, u'floor2_ahu_dis_mflow': None, u'floor2_vav3_damper_pos_real': None, u'floor3_ahu_coil_val_pos': None, u'floor2_mix_T_set': None, u'floor2_vav3_dis_T': None, u'floor1_vav2_flow_set': None, u'floor3_coil_valve': None, u'floor1_vav4_dis_mflow_ratio': None, u'floor1_vav2_dis_mflow_ratio': None, u'floor3_vav4_dis_mflow': None, u'floor1_vav3_cooling_set': None, u'floor3_dis_T_set': None, u'floor2_vav1_damper_pos': None, u'floor3_vav2_heating_set': None, u'floor3_ahu_mix': None, u'floor1_vav3_dis_T': None, u'floor1_vav1_damper_pos_real': None, u'floor3_fan_spe': None, u'floor3_pre': None, u'floor3_vav1_dis_mflow_ratio': None, u'floor3_vav3_dis_T': None, u'floor1_ahu_mix_T': None, u'floor3_ahu_dis': None, u'floor3_vav4_heating_set': None, u'floor2_vav1_dis_mflow': None, u'floor3_vav5_dis_T': None, u'floor1_vav4_flow_set': None, u'floor3_vav1_dis_T': None, u'floor1_vav4_heating_set': None, u'floor1_vav2_dis_T': None, u'floor3_vav1_cooling_set': None, u'floor1_vav4_cooling_set': None, u'floor2_ahu_fre_damper_pos': None, u'floor1_vav4_damper_pos_real': None, u'floor3_outdoor_damper': None, u'floor2_ahu_dis_T': None, u'floor1_vav1_damper_pos': None, u'floor3_ahu_dis_T': None, u'floor3_ahu_dis_pre_set': None, u'floor2_zonT': None, u'floor2_vav2_dis_mflow_ratio': None, u'floor1_vav5_dis_mflow': None, u'floor3_vav3_damper_pos': None, u'floor3_ahu_fre_damper_pos_real': None, u'floor2_ahu_dis': None, u'floor1_ahu_ret_T': None, u'floor1_dis_T_set': None, u'floor1_vav5_heating_set': None, u'floor3_ahu_supply_fan_power': None, u'floor1_ahu_supply_fan_power': None, u'floor3_vav1_dis_mflow': None, u'floor2_vav1_cooling_set': None, u'floor3_ahu_dis_mflow': None, u'floor1_ahu_dis_temp_set': None, u'floor2_pressure': None, u'floor1_vav2_rehea_val_pos': None, u'floor3_vav2_rehea_val_pos': None, u'floor1_vav3_damper_pos': None, u'floor2_ahu_dis_temp_set': None, u'floor2_vav5_damper_pos': None, u'floor3_vav4': None, u'floor3_ahu_dis_temp_set': None, u'floor3_vav1_damper_pos_real': None, u'floor1_vav3_flow_set': None, u'floor3_vav5': None, u'floor3_mix_T_set': None, u'floor3_vav2_dis_mflow_ratio': None, u'floor2_vav2_flow_set': None, u'floor3_vav4_rehea_val_pos': None, u'floor2_vav4_dis_mflow_ratio': None, u'floor3_ahu_mix_T': None, u'floor3_vav2_flow_set': None, u'floor3_vav5_dis_mflow': None, u'floor1_vav4_dis_mflow': None, u'floor3_vav2_damper_pos': None, u'outdoor_air_temp': None, u'floor2_vav4_flow_set': None, u'floor2_vav5_dis_T': None, u'floor2_vav1_rehea_val_pos': None, u'floor1_vav3_dis_mflow': None, u'floor3_vav3_damper_pos_real': None, u'floor3_vav5_heating_set': None, u'floor2_vav3_rehea_val_pos': None, u'floor1_ahu_fre_damper_pos_real': None, u'floor2_fan_spe': None, u'floor1_vav4_damper_pos': None, u'floor1_ahu_dis_pre_set': None, u'floor2_ahu_coil_val_pos_real': None, u'floor1_ahu_mix_temp_set': None, u'floor2_vav2_rehea_val_pos': None, u'floor3_vav2_dis_mflow': None, u'floor3_ahu_coil_val_pos_real': None, u'floor3_vav5_dis_mflow_ratio': None, u'floor2_vav2_dis_T': None, u'floor1_vav1_dis_mflow': None, u'floor1_vav5_damper_pos_real': None, u'floor3_vav1_heating_set': None, u'floor2_vav3_damper_pos': None, u'floor2_vavError at line 30, column 41, in file '/home/developer/library/BuildingControlEmulator/Devices/Fault/TwoWayLeak.mo',
jmodelica_1  | In component floor2.duaFanAirHanUnit.cooCoil.val:
jmodelica_1  |   Cannot find class or component declaration for y_stuck
jmodelica_1  | [2021-11-05 01:12:06,002] ERROR in app: Exception on /fault_scenario [PUT]
jmodelica_1  | Traceback (most recent call last):
jmodelica_1  |   File "/home/developer/.local/lib/python2.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
jmodelica_1  |     rv = self.dispatch_request()
jmodelica_1  |   File "/home/developer/.local/lib/python2.7/site-packages/flask/app.py", line 1936, in dispatch_request
jmodelica_1  |     return self.view_functions[rule.endpoint](**req.view_args)
jmodelica_1  |   File "/home/developer/.local/lib/python2.7/site-packages/flask_restful/__init__.py", line 468, in wrapper
jmodelica_1  |     resp = resource(*args, **kwargs)
jmodelica_1  |   File "/home/developer/.local/lib/python2.7/site-packages/flask/views.py", line 89, in view
jmodelica_1  |     return self.dispatch_request(*args, **kwargs)
jmodelica_1  |   File "/home/developer/.local/lib/python2.7/site-packages/flask_restful/__init__.py", line 583, in dispatch_request
jmodelica_1  |     resp = meth(*args, **kwargs)
jmodelica_1  |   File "web.py", line 107, in put
jmodelica_1  |     self.case.set_scenario(args)
jmodelica_1  |   File "/home/developer/testcase.py", line 577, in set_scenario
jmodelica_1  |     self.__init__(self.con)
jmodelica_1  |   File "/home/developer/testcase.py", line 206, in __init__
jmodelica_1  |     jvm_args='-Xmx5g')
jmodelica_1  |   File "/usr/local/JModelica/Python/pymodelica/compiler.py", line 148, in compile_fmu
jmodelica_1  |     separate_process, jvm_args)
jmodelica_1  |   File "/usr/local/JModelica/Python/pymodelica/compiler.py", line 257, in _compile_unit
jmodelica_1  |     compiler_options, compile_to, compiler_log_level, jvm_args)
jmodelica_1  |   File "/usr/local/JModelica/Python/pymodelica/compiler.py", line 378, in compile_separate_process
jmodelica_1  |     return log.end();
jmodelica_1  |   File "/usr/local/JModelica/Python/pymodelica/compiler_logging.py", line 312, in end
jmodelica_1  |     raise CompilerError(errors, warnings)
jmodelica_1  | CompilerError:
jmodelica_1  | 1 error(s) and 493 warning(s) found:
jmodelica_1  |
jmodelica_1  | Warning at line 5, column 44, in file './fmu/test.mo':
jmodelica_1  |   In the declaration 'redeclare BuildingControlEmulator.Devices.Control.conPIWithOve pI', pI can't be redeclared since it has already been redeclared without 'replaceable'

Similarly, implementing a leaky outdoor damper:

import requests

url_eplus = 'http://127.0.0.1:5501'
url_modelica = 'http://127.0.0.1:5001'

# Init simulation
requests.put(f'{url_eplus}/step', data={'step': 60})

# Set the fault scenario
fault = {"floor2_outdoor_damper": {"value": 0.6, "fault_time": 240}}
requests.put(f'{url_modelica}/fault_scenario', json=fault)
jmodelica_1  | {u'floor2_vav4_cooling_set': None, u'floor3_ahu_mix_temp_set': None, u'floor2_pre': None, u'floor2_vav3_flow_set': None, u'floor2_outdoor_damper': u"{u'fault_time': 240, u'value': 0.6}", u'floor1_ahu_dis_mflow': None, u'floor2_vav5_dis_mflow_ratio': None, u'floor2_vav3_dis_mflow_ratio': None, u'floor2_vav2_cooling_set': None, u'floor3_vav2_damper_pos_real': None, u'floor2_vav4_dis_T': None, u'floor1_pressure': None, u'floor1_vav5_rehea_val_pos': None, u'floor3_vav3_flow_set': None, u'floor3_vav4_flow_set': None, u'floor2_ahu_ret_T': None, u'floor3_ahu_return_fan_power': None, u'floor2_vav1_dis_mflow_ratio': None, u'floor1_vav5_dis_mflow_ratio': None, u'occ': None, u'floor1_vav2_dis_mflow': None, u'floor3_vav3_dis_mflow': None, u'floor1_vav1_cooling_set': None, u'floor3_pressure': None, u'floor1_vav1_rehea_val_pos': None, u'floor3_vav3_dis_mflow_ratio': None, u'floor2_ahu_return_fan_power': None, u'floor1_vav4_dis_T': None, u'floor2_vav5_flow_set': None, u'floor2_ahu_dis_mflow': None, u'floor2_vav3_damper_pos_real': None, u'floor3_ahu_coil_val_pos': None, u'floor2_mix_T_set': None, u'floor2_vav3_dis_T': None, u'floor1_vav2_flow_set': None, u'floor3_coil_valve': None, u'floor1_vav4_dis_mflow_ratio': None, u'floor1_vav2_dis_mflow_ratio': None, u'floor3_vav4_dis_mflow': None, u'floor1_vav3_cooling_set': None, u'floor3_dis_T_set': None, u'floor2_vav1_damper_pos': None, u'floor3_vav2_heating_set': None, u'floor3_ahu_mix': None, u'floor1_vav3_dis_T': None, u'floor1_vav1_damper_pos_real': None, u'floor3_fan_spe': None, u'floor3_pre': None, u'floor3_vav1_dis_mflow_ratio': None, u'floor3_vav3_dis_T': None, u'floor1_ahu_mix_T': None, u'floor3_ahu_dis': None, u'floor3_vav4_heating_set': None, u'floor2_vav1_dis_mflow': None, u'floor3_vav5_dis_T': None, u'floor1_vav4_flow_set': None, u'floor3_vav1_dis_T': None, u'floor1_vav4_heating_set': None, u'floor1_vav2_dis_T': None, u'floor3_vav1_cooling_set': None, u'floor1_vav4_cooling_set': None, u'floor2_ahu_fre_damper_pos': None, u'floor1_vav4_damper_pos_real': None, u'floor3_outdoor_damper': None, u'floor2_ahu_dis_T': None, u'floor1_vav1_damper_pos': None, u'floor3_ahu_dis_T': None, u'floor3_ahu_dis_pre_set': None, u'floor2_zonT': None, u'floor2_vav2_dis_mflow_ratio': None, u'floor1_vav5_dis_mflow': None, u'floor3_vav3_damper_pos': None, u'floor3_ahu_fre_damper_pos_real': None, u'floor2_ahu_dis': None, u'floor1_ahu_ret_T': None, u'floor1_dis_T_set': None, u'floor1_vav5_heating_set': None, u'floor3_ahu_supply_fan_power': None, u'floor1_ahu_supply_fan_power': None, u'floor3_vav1_dis_mflow': None, u'floor2_vav1_cooling_set': None, u'floor3_ahu_dis_mflow': None, u'floor1_ahu_dis_temp_set': None, u'floor2_pressure': None, u'floor1_vav2_rehea_val_pos': None, u'floor3_vav2_rehea_val_pos': None, u'floor1_vav3_damper_pos': None, u'floor2_ahu_dis_temp_set': None, u'floor2_vav5_damper_pos': None, u'floor3_vav4': None, u'floor3_ahu_dis_temp_set': None, u'floor3_vav1_damper_pos_real': None, u'floor1_vav3_flow_set': None, u'floor3_vav5': None, u'floor3_mix_T_set': None, u'floor3_vav2_dis_mflow_ratio': None, u'floor2_vav2_flow_set': None, u'floor3_vav4_rehea_val_pos': None, u'floor2_vav4_dis_mflow_ratio': None, u'floor3_ahu_mix_T': None, u'floor3_vav2_flow_set': None, u'floor3_vav5_dis_mflow': None, u'floor1_vav4_dis_mflow': None, u'floor3_vav2_damper_pos': None, u'outdoor_air_temp': None, u'floor2_vav4_flow_set': None, u'floor2_vav5_dis_T': None, u'floor2_vav1_rehea_val_pos': None, u'floor1_vav3_dis_mflow': None, u'floor3_vav3_damper_pos_real': None, u'floor3_vav5_heating_set': None, u'floor2_vav3_rehea_val_pos': None, u'floor1_ahu_fre_damper_pos_real': None, u'floor2_fan_spe': None, u'floor1_vav4_damper_pos': None, u'floor1_ahu_dis_pre_set': None, u'floor2_ahu_coil_val_pos_real': None, u'floor1_ahu_mix_temp_set': None, u'floor2_vav2_rehea_val_pos': None, u'floor3_vav2_dis_mflow': None, u'floor3_ahu_coil_val_pos_real': None, u'floor3_vav5_dis_mflow_ratio': None, u'floor2_vav2_dis_T': None, u'floor1_vav1_dis_mflow': None, u'floor1_vav5_damper_pos_real': None, u'floor3_vav1_heating_set': None, u'floor2_vaError at line 30, column 41, in file '/home/developer/library/BuildingControlEmulator/Devices/Fault/TwoWayLeak.mo',
jmodelica_1  | In component floor2.duaFanAirHanUnit.mixingBox.mixBox.valFre:
jmodelica_1  |   Cannot find class or component declaration for y_stuck
jmodelica_1  | [2021-11-05 01:31:59,674] ERROR in app: Exception on /fault_scenario [PUT]
jmodelica_1  | Traceback (most recent call last):
jmodelica_1  |   File "/home/developer/.local/lib/python2.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
jmodelica_1  |     rv = self.dispatch_request()
jmodelica_1  |   File "/home/developer/.local/lib/python2.7/site-packages/flask/app.py", line 1936, in dispatch_request
jmodelica_1  |     return self.view_functions[rule.endpoint](**req.view_args)
jmodelica_1  |   File "/home/developer/.local/lib/python2.7/site-packages/flask_restful/__init__.py", line 468, in wrapper
jmodelica_1  |     resp = resource(*args, **kwargs)
jmodelica_1  |   File "/home/developer/.local/lib/python2.7/site-packages/flask/views.py", line 89, in view
jmodelica_1  |     return self.dispatch_request(*args, **kwargs)
jmodelica_1  |   File "/home/developer/.local/lib/python2.7/site-packages/flask_restful/__init__.py", line 583, in dispatch_request
jmodelica_1  |     resp = meth(*args, **kwargs)
jmodelica_1  |   File "web.py", line 107, in put
jmodelica_1  |     self.case.set_scenario(args)
jmodelica_1  |   File "/home/developer/testcase.py", line 577, in set_scenario
jmodelica_1  |     self.__init__(self.con)
jmodelica_1  |   File "/home/developer/testcase.py", line 206, in __init__
jmodelica_1  |     jvm_args='-Xmx5g')
jmodelica_1  |   File "/usr/local/JModelica/Python/pymodelica/compiler.py", line 148, in compile_fmu
jmodelica_1  |     separate_process, jvm_args)
jmodelica_1  |   File "/usr/local/JModelica/Python/pymodelica/compiler.py", line 257, in _compile_unit
jmodelica_1  |     compiler_options, compile_to, compiler_log_level, jvm_args)
jmodelica_1  |   File "/usr/local/JModelica/Python/pymodelica/compiler.py", line 378, in compile_separate_process
jmodelica_1  |     return log.end();
jmodelica_1  |   File "/usr/local/JModelica/Python/pymodelica/compiler_logging.py", line 312, in end
jmodelica_1  |     raise CompilerError(errors, warnings)
jmodelica_1  | CompilerError:
jmodelica_1  | 1 error(s) and 493 warning(s) found:
jmodelica_1  |
jmodelica_1  | Warning at line 5, column 44, in file './fmu/test.mo':
jmodelica_1  |   In the declaration 'redeclare BuildingControlEmulator.Devices.Control.conPIWithOve pI', pI can't be redeclared since it has already been redeclared without 'replaceable'
jmodelica_1  |
SenHuang19 commented 3 years ago

this is resolved by d0731d714f3c689411e9f38f07697b97231d390f