Skip to content

Commit

Permalink
* Adapt Init and introduce separate init files for separate use cases,
Browse files Browse the repository at this point in the history
  • Loading branch information
MBaranskiEBC committed Mar 29, 2019
1 parent 95c64aa commit 7ebdd17
Show file tree
Hide file tree
Showing 2 changed files with 306 additions and 67 deletions.
161 changes: 94 additions & 67 deletions pyDMPC/ControlFramework/Init.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,19 @@
amount_generator = 1

"""Data point IDs in the controlled system"""
measurements_IDs = ['outdoorTemperatureOutput', 'outdoorHumidityOutput', 'outgoingAirOutletTemperatureCOutput',
'outgoingAirOutletHumidityOutput', 'roomTemperatureOutput', 'roomHumidityOutput',
'supplyAirTemperatureCOutput', 'supplyHumidityOutput', 'preHeaterTemperatureCOutput',
'coolerTemperatureCOutput', 'heaterTemperatureCOutput', 'highTemperatureCircuitOutput',
'coolingCircuitOutput', 'highTemperatureCircuitOutput', 'preHeaterReturnTemperatureOutput',
'heaterReturnTemperatureOutput', 'outgoingAirOutletTemperatureCOutput','outgoingAirOutletHumidityOutput','outgoingAirOutletHumidityOutput']
measurements_IDs = ['AHUTemperature', 'AHUHumidity']

""" General algorithm settings """
algorithm = 'NC_DMPC' #choices: 'NC_DMPC', 'BExMoC'
algorithm = 'BExMoC' #choices: 'NC_DMPC', 'BExMoC'
parallelization = False #run calculations in parallel if possible
realtime = False #Choose True for a real-life experiment

""" Settings for BExMoC algorithm """
# So far: For all subsystems the same settings
factors_BCs = [1.5, 0.03] # order: BC1, BC2, ...
factors_BCs = [6, 0.03] # order: BC1, BC2, ...
center_vals_BCs = [30, 0.001]
amount_lower_vals = [9, 0]
amount_upper_vals = [9, 1]
amount_lower_vals = [1, 0]
amount_upper_vals = [1, 1]
exp_BCs = [1, 1]
amount_vals_BCs = [1, 1]

Expand Down Expand Up @@ -65,7 +60,7 @@
path_fmu = r'ModelicaModels.ControlledSystems.ControlledSystemBoundaries'

# Name of the FMU file to be created
name_fmu = 'pyDMPCFMU'
name_fmu = 'ModelicaModels_ControlledSystems_TestHall'

# Path to the *.egg file containing the Python-Dymola-Interface
path_dymola = r'C:\Program Files\Dymola 2019\Modelica\Library\python_interface\dymola.egg'
Expand Down Expand Up @@ -103,10 +98,12 @@
bounds_DVs_global = None
names_BCs_global = names_SPs = ['temperature', 'humidity']
output_vars_global = None
amount_subsystems = 5
amount_subsystems = amount_consumer+amount_generator

name = []
position = []
no_parallel = [] #number of this this system in the holon of parallel subsystems
holon = [] # Number of identical subsystems in this holon
type_subSyst = []
num_DecVars = []
num_VarsOut = []
Expand All @@ -116,97 +113,127 @@
bounds_DVs = []
model_path = []
names_DVs = []
start_DVs = []
factor_DVs = []
names_BCs = []
output_vars = []
initial_names= [] #for simulation
IDs_initial_values= [] #for simulation
cost_par = [] #for MassFlowRate
variation = []
IDs_inputs = []
cost_factor = []
model_type = []

""" Subsystems """
# Heat recovery system
name.append('Heat_recovery_system')
position.append(5)


# AHU
name.append('AHU')
position.append(3)
type_subSyst.append('generator')
no_parallel.append(0)
holon.append(0)
num_DecVars.append(1)
num_VarsOut.append(2)
bounds_DVs.append([10,100])
model_path.append('ModelicaModels.SubsystemModels.DetailedModels.HeatRecovery')
names_DVs.append('valveHRS')
bounds_DVs.append([0,100])
start_DVs.append(280)
factor_DVs.append(30)
model_path.append('')
names_DVs.append('suppyAirTemperature')
output_vars.append(["supplyAirTemperature.T","supplyAirHumidity.phi"])
initial_names.append(["hex.ele[1].mas.T","hex.ele[2].mas.T","hex.ele[3].mas.T","hex.ele[4].mas.T"])
IDs_initial_values.append(["inOutletsOutgoingHexele1masT","inOutletsOutgoingHexele2masT","inOutletsOutgoingHexele3masT","inOutletsOutgoingHexele4masT"])
IDs_inputs.append(['outdoorHumidityOutput','outdoorTemperatureOutput','roomHumidityOutput','roomTemperatureOutput'])
initial_names.append(None)
IDs_initial_values.append(None)
IDs_inputs.append(["AHUHumidity","AHUTemperature"])
cost_par.append(None)
cost_factor.append(0)
model_type.append("MLP")
variation.append(False)
cost_factor.append(0.5)
model_type.append("lin")

# Pre-heater
name.append('Pre_heater')
position.append(4)
type_subSyst.append('distributor')
# Hall
name.append('Hall-short')
position.append(2)
no_parallel.append(2)
holon.append(2)
type_subSyst.append('consumer')
num_DecVars.append(1)
num_VarsOut.append(2)
bounds_DVs.append([0,100])
model_path.append('ModelicaModels.SubsystemModels.DetailedModels.PreHeater')
names_DVs.append('valvePreHeater')
start_DVs.append(280)
factor_DVs.append(300)
model_path.append('ModelicaModels.SubsystemModels.DetailedModels.Hall')
names_DVs.append('CCAValve')
output_vars.append(["supplyAirTemperature.T","supplyAirHumidity.phi"])
initial_names.append(["hex.ele[1].mas.T","hex.ele[2].mas.T","hex.ele[3].mas.T","hex.ele[4].mas.T"])
IDs_initial_values.append(["preHeaterhexele1masT","preHeaterhexele2masT","preHeaterhexele3masT","preHeaterhexele4masT"])
IDs_inputs.append(["hRCHumidityOutput","hRCTemperatureCOutput"])
cost_par.append('val.port_1.m_flow')
initial_names.append(None)
IDs_initial_values.append(None)
IDs_inputs.append(["AHUHumidity","AHUTemperature"])
cost_par.append(None)
variation.append(True)
cost_factor.append(0.5)
model_type.append("MLP")
model_type.append("lin")

# Cooler
name.append('Cooler')
position.append(3)
type_subSyst.append('distributor')
# Steam_humidifier
name.append('Room_1')
position.append(2)
no_parallel.append(0)
holon.append(2)
type_subSyst.append('consumer')
num_DecVars.append(1)
num_VarsOut.append(2)
bounds_DVs.append([0,100])
model_path.append('ModelicaModels.SubsystemModels.DetailedModels.Cooler')
names_DVs.append('valveCooler')
bounds_DVs.append([0,0])
start_DVs.append(0)
factor_DVs.append(1)
model_path.append('')
names_DVs.append('Room1Set')
output_vars.append(["supplyAirTemperature.T","supplyAirHumidity.phi"])
initial_names.append(["hex.ele[1].mas.T","hex.ele[2].mas.T","hex.ele[3].mas.T","hex.ele[4].mas.T"])
IDs_initial_values.append(["coolerhexele1masT","coolerhexele2masT","coolerhexele3masT","coolerhexele4masT"])
IDs_inputs.append(["preHeaterHumidityOutput","preHeaterTemperatureCOutput"])
cost_par.append('CoolerValve.port_b.m_flow')
initial_names.append(None)
IDs_initial_values.append(["Room1T","Room1del"])
IDs_inputs.append(["AHUHumidity","AHUTemperature"])
cost_par.append('None')
variation.append(True)
cost_factor.append(0.5)
model_type.append("MLP")
model_type.append("fuzzy")

# Heater
name.append('Heater')
# Steam_humidifier
name.append('Room_2')
position.append(2)
type_subSyst.append('distributor')
no_parallel.append(1)
holon.append(2)
type_subSyst.append('consumer')
num_DecVars.append(1)
num_VarsOut.append(2)
bounds_DVs.append([0,100])
model_path.append('ModelicaModels.SubsystemModels.DetailedModels.Heater')
names_DVs.append('valveHeater')
bounds_DVs.append([0,0])
start_DVs.append(0)
factor_DVs.append(1)
model_path.append('')
names_DVs.append('Room2Set')
output_vars.append(["supplyAirTemperature.T","supplyAirHumidity.phi"])
initial_names.append(["hex.ele[1].mas.T","hex.ele[2].mas.T","hex.ele[3].mas.T","hex.ele[4].mas.T"])
IDs_initial_values.append(["heaterhexele1masT","heaterhexele2masT","heaterhexele3masT","heaterhexele4masT"])
IDs_inputs.append(["coolerHumidityOutput","coolerTemperatureCOutput"])
cost_par.append('val.port_1.m_flow')
initial_names.append(None)
IDs_initial_values.append(["Room2T","Room2del"])
IDs_inputs.append(["AHUHumidity","AHUTemperature"])
cost_par.append(None)
variation.append(True)
cost_factor.append(0.5)
model_type.append("MLP")
model_type.append("fuzzy")

# Steam_humidifier
name.append('Steam_humidifier')
# Hall
name.append('Hall-long')
position.append(1)
no_parallel.append(0)
holon.append(0)
type_subSyst.append('consumer')
num_DecVars.append(1)
num_VarsOut.append(2)
bounds_DVs.append([0,0])
model_path.append('ModelicaModels.SubsystemModels.DetailedModels.Humidifier')
names_DVs.append('humidifierWSP1')
bounds_DVs.append([0,100])
start_DVs.append(0)
factor_DVs.append(1)
model_path.append('ModelicaModels.SubsystemModels.DetailedModels.Hall')
names_DVs.append('CCAValve')
output_vars.append(["supplyAirTemperature.T","supplyAirHumidity.phi"])
initial_names.append(["hex.ele[1].mas.T","hex.ele[2].mas.T","hex.ele[3].mas.T","hex.ele[4].mas.T"])
IDs_initial_values.append(["heaterhexele1masT","heaterhexele2masT","heaterhexele3masT","heaterhexele4masT"])
IDs_inputs.append(["heaterHumidityOutput","heaterTemperatureCOutput"])
cost_par.append('product3.y')
initial_names.append(None)
IDs_initial_values.append(None)
IDs_inputs.append(["AHUHumidity","AHUTemperature"])
cost_par.append(None)
variation.append(False)
cost_factor.append(0.5)
model_type.append("MLP")
model_type.append("Modelica")
Loading

0 comments on commit 7ebdd17

Please sign in to comment.