diff options
author | lucaszhao19 | 2020-07-30 21:19:00 +0630 |
---|---|---|
committer | lucaszhao19 | 2020-07-30 21:19:00 +0630 |
commit | 788b7f4bbb7aa51839c0836b1ab163fa831ce8fc (patch) | |
tree | 257d895d6d00cc129375903aed71e6f5fd7628f4 | |
parent | df3ccdd24766f725e11bf41495855b9cd974008f (diff) | |
download | Chemical-Simulator-GUI-788b7f4bbb7aa51839c0836b1ab163fa831ce8fc.tar.gz Chemical-Simulator-GUI-788b7f4bbb7aa51839c0836b1ab163fa831ce8fc.tar.bz2 Chemical-Simulator-GUI-788b7f4bbb7aa51839c0836b1ab163fa831ce8fc.zip |
Fixed populating the wrong simulation results
-rw-r--r-- | Container.py | 10 | ||||
-rw-r--r-- | DockWidgets/DockWidget.py | 3 | ||||
-rw-r--r-- | DockWidgets/DockWidgetMaterialStream.py | 9 | ||||
-rw-r--r-- | DockWidgets/DockWidgetShortcutColumn.py | 5 | ||||
-rw-r--r-- | DockWidgets/__pycache__/DockWidget.cpython-37.pyc | bin | 6155 -> 6306 bytes | |||
-rw-r--r-- | DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc | bin | 8853 -> 9112 bytes | |||
-rw-r--r-- | DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc | bin | 4160 -> 4325 bytes | |||
-rw-r--r-- | OMChem/Flowsheet.py | 29 | ||||
-rw-r--r-- | Undo.dat | bin | 222191 -> 106405 bytes | |||
-rw-r--r-- | UnitOperations.py | 1 |
10 files changed, 41 insertions, 16 deletions
diff --git a/Container.py b/Container.py index f8daaee..25d5176 100644 --- a/Container.py +++ b/Container.py @@ -157,6 +157,14 @@ class Container(): self.msg.append("<span style=\"color:red\">"+stdout+"</span>") def simulate(self,mode): + + for i in self.graphics.scene.items(): + if (isinstance(i, NodeItem)): + try: + i.dock_widget.clear_results() + except AttributeError: + pass + print("SIMULATE") print(mode) self.compounds = compound_selected @@ -166,6 +174,7 @@ class Container(): for i in self.unit_operations : self.flowsheet.add_unit_operations(i) + if mode=='SM': self.msg.append("<span>["+str(self.current_time())+"] Simulating in <b>Sequential</b> mode ... </span>") self.flowsheet.simulate_SM(self.ip,self.op) @@ -178,6 +187,7 @@ class Container(): self.msg_browser() self.result=self.flowsheet.result_data print("under Eqn mode simulation") + DockWidget.show_result(NodeItem.get_dock_widget()) diff --git a/DockWidgets/DockWidget.py b/DockWidgets/DockWidget.py index a32d125..2087910 100644 --- a/DockWidgets/DockWidget.py +++ b/DockWidgets/DockWidget.py @@ -193,6 +193,9 @@ class DockWidget(QDockWidget,ui_dialog): except AttributeError: pass + def clear_results(self): + self.tableWidget.setRowCount(0) + # result data tab def results_category(self,name): flag = True diff --git a/DockWidgets/DockWidgetMaterialStream.py b/DockWidgets/DockWidgetMaterialStream.py index 130b290..f53e331 100644 --- a/DockWidgets/DockWidgetMaterialStream.py +++ b/DockWidgets/DockWidgetMaterialStream.py @@ -168,6 +168,15 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog): i.results_category(i.name) #i.show() + + def clear_results(self): + self.mTreeWidget.clear() + self.mTableWidget.setRowCount(0) + self.lTreeWidget.clear() + self.lTableWidget.setRowCount(0) + self.vTreeWidget.clear() + self.vTableWidget.setRowCount(0) + # result data tab def results_category(self,name): flag = True diff --git a/DockWidgets/DockWidgetShortcutColumn.py b/DockWidgets/DockWidgetShortcutColumn.py index fc5c34f..f3a12b7 100644 --- a/DockWidgets/DockWidgetShortcutColumn.py +++ b/DockWidgets/DockWidgetShortcutColumn.py @@ -92,7 +92,10 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog): i.results_category(i.name) except AttributeError: pass - + + def clear_results(self): + self.tableWidget.setRowCount(0) + # result data tab def results_category(self,name): flag = True diff --git a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc Binary files differindex 81a4e00..1f3821d 100644 --- a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc +++ b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc Binary files differindex 16bd08d..d592243 100644 --- a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc +++ b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc diff --git a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc Binary files differindex 560bdac..3201c35 100644 --- a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc +++ b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc diff --git a/OMChem/Flowsheet.py b/OMChem/Flowsheet.py index ab271af..19f1b8e 100644 --- a/OMChem/Flowsheet.py +++ b/OMChem/Flowsheet.py @@ -60,23 +60,24 @@ class Flowsheet(): #s = subprocess.check_output([self.omc_path, '-s',simpath]) #print(s) #print("############### StdOut ################") - print(self.stdout) + print("stdout ", self.stdout) + print("stderr ", self.stderr) os.chdir(self.root_dir) #os.system(self.omc_path + ' -s ' + simpath) - print("Hello") - if self.sim_method == 'Eqn': - print("hhhh") - csvpath = os.path.join(self.sim_dir_path,'Flowsheet_res.csv') - print("csvPath",csvpath) - with open (csvpath,'r') as resultFile: + if ('timeSimulation = 0.0,\n' in self.stdout.decode("utf-8")): self.result_data = [] - print("opened") - csvreader = csv.reader(resultFile,delimiter=',') - for row in csvreader: - print("124125") - self.result_data.append(row) - print(self.result_data) - #self.ext_data() + else: + csvpath = os.path.join(self.sim_dir_path,'Flowsheet_res.csv') + print("csvPath",csvpath) + with open (csvpath,'r') as resultFile: + self.result_data = [] + print("opened") + csvreader = csv.reader(resultFile,delimiter=',') + for row in csvreader: + print("124125") + self.result_data.append(row) + print(self.result_data) + #self.ext_data() def send_for_simulation_SM(self,unitop): diff --git a/UnitOperations.py b/UnitOperations.py index 0bcff3c..45d4259 100644 --- a/UnitOperations.py +++ b/UnitOperations.py @@ -514,7 +514,6 @@ class Mixer(UnitOperation): self.variables['outPress']['value'] = params[1] print(self.variables) - class Heater(UnitOperation): def __init__(self, name='Heater'): |