Merge branch 'develop/hinged_window' of https://gitlab.cern.ch/cara/cara into develop/hinged_window
This commit is contained in:
commit
7fdb6c6001
2 changed files with 11 additions and 2 deletions
|
|
@ -76,7 +76,12 @@ class FormData:
|
|||
if form_data[key] not in valid_set:
|
||||
raise ValueError(f"{form_data[key]} is not a valid value for {key}")
|
||||
|
||||
# Don't let arbirtrary unescaped HTML through the net.
|
||||
if (form_data['ventilation_type'] == 'natural' and
|
||||
form_data['window_type'] == 'not-applicable'):
|
||||
raise ValueError("window_type cannot be ''not-applicable'' if "
|
||||
"ventilation_type is ''natural''")
|
||||
|
||||
# Don't let arbitrary unescaped HTML through the net.
|
||||
for key, value in form_data.items():
|
||||
if isinstance(value, str):
|
||||
form_data[key] = html.escape(value)
|
||||
|
|
|
|||
|
|
@ -260,6 +260,10 @@ class HingedWindow(WindowOpening):
|
|||
#: Window width (m).
|
||||
window_width: float = None
|
||||
|
||||
def __post_init__(self):
|
||||
if self.window_width is None:
|
||||
raise ValueError('window_width must be set')
|
||||
|
||||
@property
|
||||
def discharge_coefficient(self) -> float:
|
||||
"""
|
||||
|
|
@ -284,7 +288,7 @@ class HingedWindow(WindowOpening):
|
|||
else:
|
||||
M = 0.038
|
||||
cd_max = 0.548
|
||||
window_angle = 2.*np.arcsin(self.opening_length/(2.*self.window_height))*180/np.pi
|
||||
window_angle = 2.*np.rad2deg(np.arcsin(self.opening_length/(2.*self.window_height)))
|
||||
return cd_max*(1-np.exp(-M*window_angle))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue