From 595c7340cd2937c8ac3dc805644f5c0cba4de3c6 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Tue, 26 Mar 2019 19:51:18 +0000 Subject: [PATCH] get Stirrer and Plant implementation from config git-svn-id: http://moon:8086/svn/projects/HendiControl@143 fda53097-d464-4ada-af97-ba876c37ca34 --- Control/brewpi/brewpi.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Control/brewpi/brewpi.py b/Control/brewpi/brewpi.py index 8e9e598..241f2a8 100644 --- a/Control/brewpi/brewpi.py +++ b/Control/brewpi/brewpi.py @@ -5,6 +5,8 @@ import json from controller import Controller from mass import Mass from stirrer import Stirrer +from pololu1376 import Pololu1376 + from matplotlib.pyplot import figure, clf, plot, xlabel, ylabel, xlim, ylim, title, grid, axes, show, subplot def results_plot(self): @@ -36,11 +38,13 @@ def results_plot(self): if __name__ == '__main__': - fp = open("brewpi.cfg.json") + fp = open("brewpi.json") configJson = json.load(fp) - plant = Mass(configJson["WaterSim"]) - ruehrer = Stirrer(configJson["Controller"]['dt']) + plant_class = globals()[configJson["Controller"]['plant_name']] + plant = plant_class(configJson["WaterSim"]) + ruehrer_class = globals()[configJson["Controller"]['stirrer_name']] + ruehrer = ruehrer_class(configJson["Controller"]['dt']) ablauf = Controller(configJson["Controller"], plant, ruehrer)