Skip to content

Commit

Permalink
fixed merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
lrdossan committed Aug 30, 2024
1 parent e98d5f6 commit 24062ff
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions caimira/apps/calculator/co2_model_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def population_present_changes(self, infected_presence: models.Interval, exposed
state_change_times.update(exposed_presence.transition_times())
return sorted(state_change_times)

def ventilation_transition_times(self) -> typing.List[float]:
def ventilation_transition_times(self) -> typing.Tuple[float]:
'''
Check if the last time from the input data is
included in the ventilation ventilations state.
Expand All @@ -189,7 +189,7 @@ def ventilation_transition_times(self) -> typing.List[float]:
last_time_from_input = self.CO2_data['times'][-1]
if (vent_states and last_time_from_input != vent_states[-1]): # The last time value is always needed for the last ACH interval.
vent_states.append(last_time_from_input)
return vent_states
return tuple(vent_states)

def build_model(self, size=None) -> models.CO2DataModel: # type: ignore
size = size or self.data_registry.monte_carlo['sample_size']
Expand Down
5 changes: 1 addition & 4 deletions caimira/apps/calculator/co2_report_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ def build_initial_plot(
'''
CO2model: CO2DataModel = form.build_model()

if isinstance(CO2model.number, int) and isinstance(CO2model.presence, Interval):
occupancy_transition_times = list(CO2model.presence.transition_times())
elif isinstance(CO2model.number, IntPiecewiseConstant):
occupancy_transition_times = list(CO2model.number.transition_times)
occupancy_transition_times = list(CO2model.occupancy.transition_times)

ventilation_transition_times: list = form.find_change_points()
# The entire ventilation changes consider the initial and final occupancy state change
Expand Down
5 changes: 5 additions & 0 deletions caimira/apps/calculator/static/js/co2_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,11 @@ function plotCO2Data(url) {

function submitFittingAlgorithm(url) {
if (validateCO2Form()) {
// Disable all the ventilation inputs
$("#fitting_ventilation_states, [name=fitting_ventilation_type]").prop(
"disabled",
true
);
// Disable room capacity input
$("#room_capacity").prop(
"disabled",
Expand Down
2 changes: 1 addition & 1 deletion caimira/apps/templates/base/calculator.form.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@

<div id="DIVCO2_fitting_to_submit" style="display: none">
<img id="CO2_data_plot"/><br>
<p id="suggestion_lines_txt" class="text-danger text-center">
<p id="suggestion_lines_txt" class="text-danger text-center mb-1">
The dashed lines are suggestions for the ventilation transition times<br>
</p>
<div id="DIVfitting_ventilation" class="form-group mb-0">
Expand Down
5 changes: 2 additions & 3 deletions caimira/tests/models/test_co2_concentration_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,11 @@ def test_predictive_model_accuracy(data_registry, scenario_data, room_volume, oc

fitting_model: models.CO2DataModel = models.CO2DataModel(
data_registry=data_registry,
room_volume=room_volume,
number=models.IntPiecewiseConstant(
room=models.Room(volume=room_volume),
occupancy=models.IntPiecewiseConstant(
transition_times=presence_interval,
values=occupancy
),
presence=None,
ventilation_transition_times=all_state_changes,
times=input_fitting_data['times'],
CO2_concentrations=input_fitting_data['CO2'],
Expand Down

0 comments on commit 24062ff

Please sign in to comment.