Daniel Varga commited on
Commit
07d9d06
·
1 Parent(s): 6ae2b2a

left-right pane

Browse files
Files changed (1) hide show
  1. v2/app.py +19 -15
v2/app.py CHANGED
@@ -22,7 +22,7 @@ met_2021_data, cons_2021_data = read_datasets()
22
 
23
 
24
  # TODO move out everything that should not be recalculated.
25
- # TODO actually use uiParameters.
26
  # TODO ui_refresh spawns its own Supplier, which is just dumb.
27
  def recalculate(**uiParameters):
28
  fixed_consumption = uiParameters['fixed_consumption']
@@ -114,20 +114,24 @@ def ui_refresh(solar_cell_num, bess_nominal_capacity, fixed_consumption, base_pr
114
 
115
  with gr.Blocks() as ui:
116
  with gr.Row():
117
- solar_slider = gr.Slider(0, 2000, 114, label="Solar cell number")
118
- bess_slider = gr.Slider(0, 2000, 330, label="BESS nominal capacity in [Ah]")
119
- fixed_consumption = gr.Checkbox(value=False, label="Use fixed consumption (10 kW)")
120
-
121
- with gr.Accordion("Advanced Pricing Settings", open=False):
122
- base_price = gr.Number(value=0.1, label="Base energy price [€/kWh]")
123
- peak_price = gr.Number(value=0.3, label="Peak energy price [€/kWh]")
124
-
125
- run_btn = gr.Button("Run Simulation")
126
-
127
- html_out = gr.HTML()
128
- plot1 = gr.Plot()
129
- plot2 = gr.Plot()
130
- plot3 = gr.Plot()
 
 
 
 
131
 
132
  run_btn.click(
133
  ui_refresh,
 
22
 
23
 
24
  # TODO move out everything that should not be recalculated.
25
+ # TODO actually use uiParameters. (base_price and peak_price were just to mock up the Accordion gui.)
26
  # TODO ui_refresh spawns its own Supplier, which is just dumb.
27
  def recalculate(**uiParameters):
28
  fixed_consumption = uiParameters['fixed_consumption']
 
114
 
115
  with gr.Blocks() as ui:
116
  with gr.Row():
117
+ # LEFT: Input controls
118
+ with gr.Column(scale=1): # narrower column
119
+ solar_slider = gr.Slider(0, 2000, 114, label="Solar cell number")
120
+ bess_slider = gr.Slider(0, 2000, 330, label="BESS nominal capacity in [Ah]")
121
+ fixed_consumption = gr.Checkbox(value=False, label="Use fixed consumption (10 kW)")
122
+
123
+ with gr.Accordion("Advanced Pricing Settings", open=False):
124
+ base_price = gr.Number(value=0.1, label="Base energy price [€/kWh]")
125
+ peak_price = gr.Number(value=0.3, label="Peak energy price [€/kWh]")
126
+
127
+ run_btn = gr.Button("Run Simulation")
128
+
129
+ # RIGHT: Output display
130
+ with gr.Column(scale=2): # wider column
131
+ html_out = gr.HTML()
132
+ plot1 = gr.Plot()
133
+ plot2 = gr.Plot()
134
+ plot3 = gr.Plot()
135
 
136
  run_btn.click(
137
  ui_refresh,