summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaurabhAgarwala2019-12-23 18:43:41 +0530
committerSaurabhAgarwala2019-12-23 18:43:41 +0530
commite9b132bbfe89334e4656c2bb3a63693bf85c3ec5 (patch)
tree76bebe117bc7a2469c3e504470a782e14548a3f7
parent4b03a7461678d78b65bfd04452a20ffd69aed3f4 (diff)
downloadChemical-Simulator-GUI-e9b132bbfe89334e4656c2bb3a63693bf85c3ec5.tar.gz
Chemical-Simulator-GUI-e9b132bbfe89334e4656c2bb3a63693bf85c3ec5.tar.bz2
Chemical-Simulator-GUI-e9b132bbfe89334e4656c2bb3a63693bf85c3ec5.zip
Termination function implemented
-rw-r--r--OMChem/Flowsheet.py12
-rw-r--r--mainApp.py6
2 files changed, 9 insertions, 9 deletions
diff --git a/OMChem/Flowsheet.py b/OMChem/Flowsheet.py
index 0cf870a..f223ede 100644
--- a/OMChem/Flowsheet.py
+++ b/OMChem/Flowsheet.py
@@ -55,8 +55,8 @@ class Flowsheet():
simpath = self.eqn_mos_path
os.chdir(self.sim_dir_path)
- process = Popen([self.omc_path, '-s',simpath], stdout=PIPE, stderr=PIPE)
- self.stdout, self.stderr = process.communicate()
+ self.process = Popen([self.omc_path, '-s',simpath], stdout=PIPE, stderr=PIPE)
+ self.stdout, self.stderr = self.process.communicate()
#s = subprocess.check_output([self.omc_path, '-s',simpath])
#print(s)
#print("############### StdOut ################")
@@ -84,8 +84,8 @@ class Flowsheet():
self.omc_path = self.get_omc_path()
os.chdir(self.sim_dir_path)
#os.system(self.omc_path + ' -s ' + unitop.name+'.mos')
- process = Popen([self.omc_path, '-s',unitop.name,'.mos'], stdout=PIPE, stderr=PIPE)
- stdout, stderr = process.communicate()
+ self.process = Popen([self.omc_path, '-s',unitop.name,'.mos'], stdout=PIPE, stderr=PIPE)
+ stdout, stderr = self.process.communicate()
#s = subprocess.check_output([self.omc_path, '-s',simpath])
#print(s)
print("############### StdOut ################")
@@ -377,8 +377,8 @@ class Flowsheet():
#os.system(self.omc_path + ' -s ' + unitop[0].name.lower()+"SEQ"+'.mos')
print("SIM directory Path 1 ###",self.sim_dir_path)
sim = os.path.join(self.sim_dir_path,unitop.name.lower()+'.mos')
- process = Popen([self.omc_path, '-s',sim], stdout=PIPE, stderr=PIPE)
- self.stdout, self.stderr = process.communicate()
+ self.process = Popen([self.omc_path, '-s',sim], stdout=PIPE, stderr=PIPE)
+ self.stdout, self.stderr = self.process.communicate()
os.chdir(self.root_dir)
#s = subprocess.check_output([self.omc_path, '-s',simpath])
#print(s)
diff --git a/mainApp.py b/mainApp.py
index be8c3de..139b23c 100644
--- a/mainApp.py
+++ b/mainApp.py
@@ -170,9 +170,9 @@ class MainApp(QMainWindow,ui):
if self.thrd:
thread_id = self.thrd.ident
print('____________________Going to terminate simulation thread with Thread ID:',thread_id,'____________________')
- # print('____________________Going to terminate the new process created for omc____________________')
- # self.Container.flowsheet.process.terminate()
- # print('____________________New process created for omc is terminated.____________________')
+ print('____________________Going to terminate the new process created for omc____________________')
+ self.Container.flowsheet.process.terminate()
+ print('____________________New process created for omc is terminated.____________________')
res = ctypes.pythonapi.PyThreadState_SetAsyncExc(thread_id, ctypes.py_object(SystemExit))
self.textBrowser.append("<span style=\"color:red\">["+str(self.currentTime())+"]<b> Terminating the simulation </b></span>")
print('____________________Simulation thread terminated____________________')