summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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____________________')