From 62a224defa51f66eb86341ba3a6936c8af62c453 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Sat, 2 Mar 2019 20:46:22 +0000 Subject: [PATCH] - added brewpi git-svn-id: http://moon:8086/svn/projects/HendiControl@46 fda53097-d464-4ada-af97-ba876c37ca34 --- Control/brewpi/brewpi.cfg | 25 +++++++++++++++++++++++++ Control/brewpi/brewpi.cfg.json | 32 ++++++++++++++++++++++++++++++++ Control/brewpi/brewpi.py | 6 ++++++ Control/brewpi/main.py | 31 +++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+) create mode 100644 Control/brewpi/brewpi.cfg create mode 100644 Control/brewpi/brewpi.cfg.json create mode 100644 Control/brewpi/brewpi.py create mode 100644 Control/brewpi/main.py diff --git a/Control/brewpi/brewpi.cfg b/Control/brewpi/brewpi.cfg new file mode 100644 index 0000000..3c70e93 --- /dev/null +++ b/Control/brewpi/brewpi.cfg @@ -0,0 +1,25 @@ +[Global] +samplerate = 1 Hz + +[Controller] +cont_ctrl = True +P_min = 0 W +P_max = 3000 W +P_q = 100 W +theta_lock = 0.5 °C +kp = 2 +ki = 0.02 +kd = 400 +pid_rho = 0.999 +heatrate = 0.5 °C/min + +[Simulation] +theta_amb = 20 °C +C = 4190 J/(kg*K) +M = 20 kg +mass_kleak = 0.5 +mass_delay = 60 s +Td = 10 s +k_noise = 0 + + diff --git a/Control/brewpi/brewpi.cfg.json b/Control/brewpi/brewpi.cfg.json new file mode 100644 index 0000000..d7cc0dd --- /dev/null +++ b/Control/brewpi/brewpi.cfg.json @@ -0,0 +1,32 @@ +{ + "Global" : + { + "samplerate_Hz" : 1.0 + }, + + "Controller" : + { + "cont_ctrl" : true, + "P_min_W" : 0, + "P_max_W" : 3000, + "P_q_W" : 100, + "theta_lock_K" : 0.5, + "kp" : 2, + "ki" : 0.02, + "kd" : 400, + "pid_rho" : 0.999, + "heatrate_KPerMin" : 0.5 + }, + + "Simulation" : + { + "theta_amb_degC" : 20, + "C_joulePerKperkg" : 4190, + "M_kg" : 20, + "mass_kleak" : 0.5, + "mass_delay_s" : 60, + "Td_s" : 10, + "k_noise" : 0 + } +} + diff --git a/Control/brewpi/brewpi.py b/Control/brewpi/brewpi.py new file mode 100644 index 0000000..fb7d739 --- /dev/null +++ b/Control/brewpi/brewpi.py @@ -0,0 +1,6 @@ +#!/usr/bin/python3 + +if __name__ == '__main__': + + print ("End of program.") + diff --git a/Control/brewpi/main.py b/Control/brewpi/main.py new file mode 100644 index 0000000..4630e75 --- /dev/null +++ b/Control/brewpi/main.py @@ -0,0 +1,31 @@ +#!/usr/bin/python3 + +import time +import json +import configparser + +def getValue(s): + + v = s.split(' ')[0] + + return v + +def getUnit(s): + + u = s.split(' ')[1] + + return u + +if __name__ == '__main__': + config = configparser.RawConfigParser() + config.read('brewpi.cfg') + print (getValue(config.get('Global', 'samplerate'))) + print (getValue(config.get('Controller', 'cont_ctrl'))) + print (getValue(config.get('Controller', 'heatrate'))) + + fp = open("brewpi.cfg.json") + configJson = json.load(fp) + print (json.dumps({'config' : configJson}, indent=4, sort_keys=True)) + + print ("End of program.") +