diff --git a/caimira/apps/simulator.py b/caimira/apps/simulator.py index 6f1fd789..1a0b55d0 100644 --- a/caimira/apps/simulator.py +++ b/caimira/apps/simulator.py @@ -10,15 +10,10 @@ import matplotlib.lines as mlines import matplotlib.patches as patches from .expert import collapsible, ipympl_canvas, WidgetGroup, CAIMIRAStateBuilder -# ventilation=models.MultipleVentilation( -# ventilations=[ -# models.AirChange(active=models.PeriodicInterval(period=120, duration=120), air_exch=100), -# ], -# ), baseline_model = models.CO2ConcentrationModel( room=models.Room(volume=75, inside_temp=models.PiecewiseConstant((0., 24.), (293.15,))), ventilation=models.SlidingWindow( - active=models.PeriodicInterval(period=120, duration=15), + active=models.PeriodicInterval(period=120, duration=15, start=8.), outside_temp=models.PiecewiseConstant((0., 24.), (283.15,)), window_height=1.6, opening_length=0.6, ), @@ -496,8 +491,8 @@ class ModelWidgets(View): toggle_window(window_w.value) number_of_windows= widgets.IntText(value= 1, min= 0, max= 5, step=1) - period = widgets.IntSlider(value=node.active.period, min=0, max=240) - interval = widgets.IntSlider(value=node.active.duration, min=0, max=240) + frequency = widgets.IntSlider(value=node.active.period, min=0, max=120) + duration = widgets.IntSlider(value=node.active.duration, min=0, max=frequency.value-1) opening_length = widgets.FloatSlider(value=node.opening_length, min=0, max=3, step=0.1) window_height = widgets.FloatSlider(value=node.window_height, min=0, max=3, step=0.1) @@ -506,8 +501,9 @@ class ModelWidgets(View): def on_period_change(change): node.active.period = change['new'] + duration.max = change['new'] - 1 - def on_interval_change(change): + def on_duration_change(change): node.active.duration = change['new'] def on_opening_length_change(change): @@ -518,8 +514,8 @@ class ModelWidgets(View): # TODO: Link the state back to the widget, not just the other way around. number_of_windows.observe(on_value_change, names=['value']) - period.observe(on_period_change, names=['value']) - interval.observe(on_interval_change, names=['value']) + frequency.observe(on_period_change, names=['value']) + duration.observe(on_duration_change, names=['value']) opening_length.observe(on_opening_length_change, names=['value']) window_height.observe(on_window_height_change, names=['value']) @@ -558,12 +554,12 @@ class ModelWidgets(View): window_height, ), ( - widgets.Label('Interval between openings (minutes)', layout=auto_width), - period, + widgets.Label('Frequency (minutes)', layout=auto_width), + frequency, ), ( - widgets.Label('Duration of opening (minutes)', layout=auto_width), - interval, + widgets.Label('Duration (minutes)', layout=auto_width), + duration, ), ( widgets.Label('Outside temperature scheme', layout=auto_width), diff --git a/caimira/apps/simulator/caimira.ipynb b/caimira/apps/simulator/caimira.ipynb index 13501bfd..259328ac 100644 --- a/caimira/apps/simulator/caimira.ipynb +++ b/caimira/apps/simulator/caimira.ipynb @@ -1,25 +1,35 @@ { "cells": [ + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "
\n", + "
\n", + "

\n", + "Please see the CAiMIRA homepage for details on the methodology, assumptions and limitations of CAiMIRA.

" + ] + }, { "cell_type": "code", "execution_count": 1, - "metadata": { - "pycharm": { - "name": "#%%\n" - }, - "scrolled": false - }, + "metadata": {}, "outputs": [ { - "ename": "AttributeError", - "evalue": "module 'caimira.apps' has no attribute 'CO2Application'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[1], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mcaimira\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mapps\u001b[39;00m\n\u001b[0;32m----> 3\u001b[0m app \u001b[39m=\u001b[39m caimira\u001b[39m.\u001b[39;49mapps\u001b[39m.\u001b[39;49mCO2Application()\n\u001b[1;32m 4\u001b[0m app\u001b[39m.\u001b[39mwidget\n", - "\u001b[0;31mAttributeError\u001b[0m: module 'caimira.apps' has no attribute 'CO2Application'" - ] + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "888611458e044cd3b7cda7dfcf1fdbe4", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "HBox(children=(Tab(children=(VBox(children=(VBox(children=(Button(button_style='success', description='Duplica…" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ diff --git a/caimira/apps/simulator/static/images/header_image.png b/caimira/apps/simulator/static/images/header_image.png new file mode 100644 index 00000000..5f2a2702 Binary files /dev/null and b/caimira/apps/simulator/static/images/header_image.png differ