Heating controller with neural thermal model written in Python
Jacek Kowalski
2018-06-24 66a9fb40efe1311b34a3cee3f83f10c6990759af
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/python3
 
import functools
 
from lib.ArgParser import get_config, get_model_from_config
from lib.Controller import simulate, ReplayController
from lib.Cost import DeviationCost, NegativeCost
from lib.Env import CentralHeatingHistoryEnv
 
# ARGS
config = get_config()
 
# MODEL
model = get_model_from_config(config)
print(repr(model.model))
 
# PLOT
config['plot_fields'] = ['time', 'temp_in', 'temp_in_calc', 'temp_out', 'temperature', 'mode', 'humidity']
config['past_fields'] = ['mode']
config['past_values'] = 1
config['future_values'] = 0
 
# ENV
env = CentralHeatingHistoryEnv()
#env.cost_class = DeviationCost
env.cost_class = functools.partial(NegativeCost, 19.5, 22)
env.model = model
env.config = config
env.reset()
 
# MAIN
controller = ReplayController()
simulate(env, controller)