#!/usr/bin/env python # -*- coding: utf-8 -*- from Process import Process class LoggingProcess(Process): # initialization def __init__(self,FuzzySystem): Process.__init__(self,FuzzySystem) self.l_rltemp=[] self.l_vltemp=[] self.l_inMischer=[] self.target=[] def step(self,time_step): ftime = self.ftime Process.step(self,time_step) # for graphical output self.l_inMischer.append([ftime,self.inMischer]) self.l_vltemp.append([ftime,self.vltemp]) self.l_rltemp.append([ftime,self.rltemp]) self.target.append([ftime,self.FuzzySystem.target]) print (" rltemp: %6.3f °C vltemp: %6.3f °C" % (self.rltemp,self.vltemp)) def plot(self): #try: import Gnuplot # Graphical output g1 = Gnuplot.Gnuplot() g1.clear() g1(' set style data lines') g1.title('Fuzzy value(red), input media temperature(green), outgoing media temperature(blue)') g1("set yrange [0:100]") g1.plot(self.l_inMischer,self.l_vltemp,self.l_rltemp,self.target) g1.hardcopy('Mischer_test.ps',color='yes',mode='landscape') raw_input('Please press return to continue...\n') #except: # pass