Commit 92fd8726 authored by pajotca's avatar pajotca Committed by Camille Pajot
Browse files


parent fc2bbbf0
......@@ -27,7 +27,7 @@ from pulp import LpContinuous, LpBinary
from import VariableConsumptionUnit
from ...general.optimisation.elements import Quantity, Constraint, \
DynamicConstraint, Objective
DynamicConstraint, Objective, ExtDynConstraint
from ...general.optimisation.core import OptObject
from ...general.utils import def_abs_value
......@@ -107,7 +107,7 @@ class RCNetwork_1(OptObject):
:param e_win: Emissivity of windows [-]
:param e_roof: Emissivity of the roof [-]
:param a_wall: Absorptivity of the walls [-]
:param a_roof: AAbsorptivity of the roof [-]
:param a_roof: Absorptivity of the roof [-]
:param A_wall: Walls area [m2]
:param A_win: Windows area [m2]
:param A_roof: Roof area [m2]
......@@ -128,15 +128,10 @@ class RCNetwork_1(OptObject):
self.AB_DICT = {'WALL': a_wall, 'ROOF': a_roof}
# Calculation simplifications
# TODO : Check
h_1 = 1 / (1 / h_ea + 1 / h_ac)
except ZeroDivisionError:
h_1 = 0
# if h_ea == 0:
# h_1 = h_ac
# else:
# h_1 = h_ea
h_2 = h_1 + h_ec
h_3 = 1 / (1 / h_2 + 1 / h_mc)
......@@ -184,32 +179,30 @@ class ZEA_RCNetwork_1(RCNetwork_1):
e_win=0.9, e_roof=0.9, a_wall=0.6, a_roof=0.6,
construction='heavy', height_bg=0, perimeter=0, f_hc_cv=1,
void=0, hvac_prop=None, T_int_min=0, T_int_max=50):
Copyright 2015, Architecture and Building Systems - ETH Zurich
:param time:
:param name:
:param T_ext:
:param A_f:
:param A_win:
:param Aext_v:
:param A_roof:
:param footprint:
:param U_win:
:param U_wall:
:param U_roof:
:param U_base:
:param floors:
:param construction:
:param height_bg:
:param perimeter:
:param f_hc_cv:
:param time: TimeUnit defining the time dynamic of the model
:param name: Name of the RC model
:param T_ext: External air temperature [°C]
:param A_f: Total heated area [m2]
:param A_win: Windows area [m2]
:param Aext_v: Opaque vertical external areas [m2]
:param A_roof: Roof area [m2]
:param footprint: Base area (footprint) [m2]
:param U_wall: U value of walls construction [W/(K.m2)]
:param U_win: U value of windows construction [W/(K.m2)]
:param U_roof: U value of roof construction [W/(K.m2)]
:param U_base: U value of base construction [W/(K.m2)]
:param floors: Number of floors [-]
:param construction: Construction type [heavy/medium/light]
:param height_bg: Height of building below ground [m]
:param perimeter: Perimeter of the building [m]
:param f_hc_cv: Convection factor for heating/cooling system [-]
:param void:
:param hvac_prop:
:param T_int_min:
:param T_int_max:
:param owner:
:param T_int_min: Minimal ambient air temperature [°C]
:param T_int_max: Maximal ambient air temperature [°C]
# Import functions from City Energy Analyst - ETH Zurich
......@@ -285,35 +278,34 @@ class ThermalZone(OptObject):
description='Thermal zone with power flows')
self.time = rc_network.time
self.owner = rc_network.owner
self.prop = rc_network
rc_network.parent = self
# ++ Creation of energy flows ++
self.phi_a = Quantity(name='phi_a', vlen=self.time.LEN,
vtype=LpContinuous, parent=self)
vtype=LpContinuous, parent=self, unit='W')
self.phi_c = Quantity(name='phi_c', vlen=self.time.LEN,
vtype=LpContinuous, parent=self)
vtype=LpContinuous, parent=self, unit='W')
self.phi_m = Quantity(name='phi_m', vlen=self.time.LEN,
vtype=LpContinuous, parent=self)
vtype=LpContinuous, parent=self, unit='W')
self.phi_m_tot = Quantity(name='phi_m_tot', vlen=self.time.LEN,
vtype=LpContinuous, parent=self)
vtype=LpContinuous, parent=self, unit='W')
# Internal gains
self.phi_i_l = Quantity(name='phi_i_l', value=phi_i_l,
vlen=self.time.LEN, vtype=LpContinuous,
parent=self, unit='W')
self.phi_i_p = Quantity(name='phi_i_p', value=phi_i_p,
vlen=self.time.LEN, vtype=LpContinuous,
parent=self, unit='W')
self.phi_i_a = Quantity(name='phi_i_a', value=phi_i_a,
vlen=self.time.LEN, vtype=LpContinuous,
parent=self, unit='W')
# Solar gains
I_sol = calc_I_sol(I_sol_average=I_sol_av,
......@@ -327,7 +319,7 @@ class ThermalZone(OptObject):
self.I_sol = Quantity(name='I_sol', value=I_sol,
vlen=self.time.LEN, vtype=LpContinuous,
parent=self, unit='kW')
parent=self, unit='W')
# Re-irradiated flows
self.I_rad = Quantity(name='I_rad', vlen=self.time.LEN,
......@@ -552,7 +544,7 @@ class ThermalZone(OptObject):
self.theta_v_sys = Quantity(name='theta_v_sys', value=theta_v_sys,
lb=0, ub=50,
vlen=self.time.LEN, vtype=LpContinuous,
parent=self, unit='degC')
self.calc_theta_ea = DynamicConstraint(
name='calc_theta_ea', t_range='for t in time.I[72:]',
......@@ -577,14 +569,14 @@ class ThermalZone(OptObject):
self.phi_heating = Quantity(name='phi_heating', lb=0, ub=p_max_heating,
vtype=LpContinuous, parent=self)
vtype=LpContinuous, parent=self, unit='W')
self.phi_cooling = Quantity(name='phi_cooling', lb=0, ub=p_max_cooling,
vtype=LpContinuous, parent=self)
vtype=LpContinuous, parent=self, unit='W')
self.heating_on = Quantity(name='heating_on', vlen=self.time.LEN,
vtype=LpBinary, parent=self)
vtype=LpBinary, parent=self, unit='W')
self.split_heat_cool = DynamicConstraint(
exp_t='{0}_phi_hc[t] == {0}_phi_heating[t] - {0}_phi_cooling[t]'
......@@ -606,7 +598,7 @@ class HeatingLoad(VariableConsumptionUnit):
def __init__(self, time, name, tz, p_max=10e+12, T_set=19, temp_margin=1,
no_cooling=True, operator=None): = tz
self.T_set = T_set
self.temp_margin = temp_margin
......@@ -621,15 +613,15 @@ class HeatingLoad(VariableConsumptionUnit): = T_set + temp_margin
if no_cooling:
p_max_cooling = 1e5
p_max_cooling = 1
p_max_cooling = 1e9, # p_max
p_max_cooling=p_max_cooling) # kW
VariableConsumptionUnit.__init__(self, time, name, energy_type='Heat',
operator=tz.owner, pmax=p_max,
operator=operator, pmax=p_max,
e_max=10e9, pmin=1)
self.calc_e_tot = None
self.e_tot = None
......@@ -652,7 +644,7 @@ class HeatingLoad(VariableConsumptionUnit):
self.diff_Top_opt = Quantity(name='diff_Top_opt', opt=True,
vlen=self.time.LEN, parent=self)
vlen=self.time.LEN, parent=self, unit='K')
if isinstance(T_op, (int, float)):
self.def_diff_Top_opt = DynamicConstraint(
......@@ -674,6 +666,12 @@ class HeatingLoad(VariableConsumptionUnit):,
def add_max_temp_ramp_down(self, max_temp_ramp_down):
self.set_max_temp_ramp_down = ExtDynConstraint(
exp_t='{0}_T_op[t] - {0}_T_op[t+1] <= {1}'.format(, max_temp_ramp_down),
t_range='for t in time.I[:-1]', name='set_max_ramp_down')
def calc_Am(Cm_Af, Af):
# Am: Effective mass area in [m2]
......@@ -788,7 +786,7 @@ def calc_I_sol(I_sol_average, Aop_sup, Aroof, Awin, a_wall, a_roof, U_wall,
:param U_wall:
:param U_roof:
:param Fsh_win: Shading factor for windows
:return: I_sol [kW]
:return: I_sol [W]
from cea.demand.constants import RSE, F_F
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment