From 5cc855cd9a145012382031a5a1e731e297632107 Mon Sep 17 00:00:00 2001 From: SaurabhAgarwala Date: Mon, 23 Dec 2019 17:36:31 +0530 Subject: Terminate function UI created and flowsheet made attribute of class --- container.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'container.py') diff --git a/container.py b/container.py index 89fb897..4211ed9 100644 --- a/container.py +++ b/container.py @@ -13,6 +13,7 @@ class Container(): self.unitOp = [] self.thermoPackage = None self.compounds = None + self.flowsheet = None self.conn = defaultdict(list) self.op=defaultdict(list) self.ip=defaultdict(list) @@ -71,14 +72,14 @@ class Container(): except Exception as e: print(e) - def msgBrowser(self,f): - std = f.stdout.decode("utf-8") + def msgBrowser(self): + std = self.flowsheet.stdout.decode("utf-8") if(std): stdout = str(std) stdout = stdout.replace("\n","
") self.msg.append(""+stdout+"") - stde = f.stderr.decode("utf-8") + stde = self.flowsheet.stderr.decode("utf-8") if(stde): stdout = str(stde) stdout = stdout.replace("\n","
") @@ -88,26 +89,26 @@ class Container(): print(mode) self.compounds = compound_selected self.connection() - f = Flowsheet() - f.add_comp_list(self.compounds) + self.flowsheet = Flowsheet() + self.flowsheet.add_comp_list(self.compounds) print("######## connection master#########\n",self.conn) for i in self.unitOp : if i in self.opl: print("here",i) - f.add_UnitOpn(i,1) + self.flowsheet.add_UnitOpn(i,1) else: - f.add_UnitOpn(i,0) + self.flowsheet.add_UnitOpn(i,0) if mode=='SM': self.msg.append("["+str(self.currentTime())+"] Simulating in Sequential mode ... ") - f.simulateSM(self.ip,self.op) - self.msgBrowser(f) - self.result=f.resdata + self.flowsheet.simulateSM(self.ip,self.op) + self.msgBrowser() + self.result=self.flowsheet.resdata print("under SEQ mode simulation") elif mode=='EQN': self.msg.append("["+str(self.currentTime())+"] Simulating in equation mode ... ") - f.simulateEQN() - self.msgBrowser(f) - self.result=f.resdata + self.flowsheet.simulateEQN() + self.msgBrowser() + self.result=self.flowsheet.resdata print("under Eqn mode simulation") def flatlist(lst): -- cgit