Skip to content

Commit

Permalink
allow states to be json
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophGehbauer committed Apr 3, 2024
1 parent 7479d7a commit 74ecd07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions afc/ctrlWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,11 @@ def compute(self):
data['battery_reg'] = 0

# Update SOCs
if isinstance(self.input['temps-initial'], str):
self.input['temps-initial'] = json.loads(self.input['temps-initial'])
self.parameter['zone']['temps_initial'] = self.input['temps-initial']
if isinstance(self.input['facade-initial'], str):
self.input['facade-initial'] = json.loads(self.input['facade-initial'])
self.parameter['facade']['fstate_initial'] = self.input['facade-initial']

# Make sure temp_initial is feasible
Expand Down
8 changes: 6 additions & 2 deletions dev/Development-ControllerWrapper.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
"CO2 Emissions [kg]\t\t0.0\n",
"\n",
"Duration:\n",
" {'duration': {'radiance': 30.761962890625, 'glare': 70.15064311027527, 'varts': 0.13178372383117676, 'optall': 0.5088160037994385, 'outputs': 0.0061244964599609375, 'all': 105.49714946746826}}\n",
" {'duration': {'radiance': 30.463333129882812, 'glare': 69.8858585357666, 'varts': 0.13012290000915527, 'optall': 0.5115549564361572, 'outputs': 0.00562286376953125, 'all': 105.02531147003174}}\n",
"Optimization:\n",
" {'opt-stats': {'duration': 0.20841765403747559, 'termination': 'optimal', 'objective': 20.28974844}}\n"
" {'opt-stats': {'duration': 0.20725703239440918, 'termination': 'optimal', 'objective': 20.28974844}}\n"
]
},
{
Expand Down Expand Up @@ -354,7 +354,11 @@
" data['battery_reg'] = 0\n",
"\n",
" # Update SOCs\n",
" if isinstance(self.input['temps-initial'], str):\n",
" self.input['temps-initial'] = json.loads(self.input['temps-initial'])\n",
" self.parameter['zone']['temps_initial'] = self.input['temps-initial']\n",
" if isinstance(self.input['facade-initial'], str):\n",
" self.input['facade-initial'] = json.loads(self.input['facade-initial'])\n",
" self.parameter['facade']['fstate_initial'] = self.input['facade-initial']\n",
"\n",
" # Make sure temp_initial is feasible\n",
Expand Down

0 comments on commit 74ecd07

Please sign in to comment.