From dafe790599284515c1db8bbf58946aae531bb551 Mon Sep 17 00:00:00 2001 From: pravindalve Date: Wed, 8 Jul 2020 16:39:05 +0530 Subject: Flash bugs fixed --- DockWidgets/DockWidgetFlash.py | 2 +- DockWidgets/__pycache__/DockWidget.cpython-37.pyc | Bin 6107 -> 6125 bytes .../DockWidgetCompoundSeparator.cpython-37.pyc | Bin 3169 -> 3187 bytes .../DockWidgetDistillationColumn.cpython-37.pyc | Bin 4186 -> 4204 bytes .../__pycache__/DockWidgetFlash.cpython-37.pyc | Bin 2895 -> 2914 bytes .../DockWidgetMaterialStream.cpython-37.pyc | Bin 8739 -> 8757 bytes .../__pycache__/DockWidgetMixer.cpython-37.pyc | Bin 2226 -> 2244 bytes .../DockWidgetShortcutColumn.cpython-37.pyc | Bin 3364 -> 3382 bytes .../__pycache__/DockWidgetSplitter.cpython-37.pyc | Bin 2733 -> 2751 bytes Undo.dat | Bin 64907 -> 64377 bytes UnitOperations.py | 33 +++++++++++++++++---- 11 files changed, 29 insertions(+), 6 deletions(-) diff --git a/DockWidgets/DockWidgetFlash.py b/DockWidgets/DockWidgetFlash.py index 6098b27..1634169 100644 --- a/DockWidgets/DockWidgetFlash.py +++ b/DockWidgets/DockWidgetFlash.py @@ -29,7 +29,7 @@ class DockWidgetFlash(QDockWidget,ui_dialog): try: print("input_params_list ", self.input_dict) - self.l1.setText(self.obj.variables['thermoPackage']['name']+":") + self.l1.setText(self.obj.variables['thermo_package']['name']+":") self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')] for j in self.lines: self.cb1.addItem(str(j)) diff --git a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc index f1fa8b5..0733a15 100644 Binary files a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc index ecad97b..a017f6c 100644 Binary files a/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc index e5f9002..9edcc3b 100644 Binary files a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc index c706582..7a0568c 100644 Binary files a/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc index e42b5d7..ad1e8f3 100644 Binary files a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc index ab2fad7..6bfb174 100644 Binary files a/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc index 1c34a04..7e4a733 100644 Binary files a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc differ diff --git a/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc index bcd36dc..045ca3d 100644 Binary files a/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc differ diff --git a/Undo.dat b/Undo.dat index ebae531..ea109b2 100644 Binary files a/Undo.dat and b/Undo.dat differ diff --git a/UnitOperations.py b/UnitOperations.py index 5a67b2f..faf54de 100644 --- a/UnitOperations.py +++ b/UnitOperations.py @@ -38,7 +38,7 @@ class UnitOperation(): self.for_naming = [] self.multidict = [] self.thermo_pack_req = False - self.thermo_package = None + self.thermo_package = 'RaoultsLaw' def param_getter(self,mode=None): params = {} @@ -116,11 +116,18 @@ class UnitOperation(): C = str(self.compounds).strip('[').strip(']') C = C.replace("'", "") self.OM_data_init += ',C = {' + C + '}' - - for k,v in self.parameters.items(): + + # if len(self.parameters) > 0: + # for k,v in self.parameters.items(): + # self.OM_data_init += ', ' + # self.OM_data_init += k + ' = ' + str(v) + + for k in self.parameters: self.OM_data_init += ', ' - self.OM_data_init += k + ' = ' + str(v) - self.OM_data_init += ');\n' + self.OM_data_init += k + ' = ' + (json.dumps(self.variables[k]['value']) if json.dumps(self.variables[k]['value']).replace('"', '').replace('_', '').isalpha() + else json.dumps(self.variables[k]['value']).replace('[', '{').replace(']', '}').replace('"', '')) + + self.OM_data_init += ');\n' else: self.OM_data_init += 'Simulator.UnitOperations.' + self.type + ' ' + self.name + '(Nc = ' + str(len(self.compounds)) @@ -349,11 +356,15 @@ class Flash(UnitOperation): UnitOperation.__init__(self) self.name = name + str(Flash.counter) self.type = 'Flash' + self.extra = ['Flash'] + self.for_naming = ['Flash'] self.no_of_inputs = 1 self.no_of_outputs = 2 self.input_stms = [] self.output_stms = [] self.count = Flash.counter + self.thermo_pack_req = True + self.parameters = ['BTdef', 'Tdef', 'BPdef', 'Pdef'] type(self).counter += 1 self.variables = { @@ -372,6 +383,18 @@ class Flash(UnitOperation): self.variables['Pdef']['value'] = params[4] print(self.variables) + def OM_Flowsheet_Equation(self): + self.OM_data_eqn = '' + + self.OM_data_eqn += ('connect(' + self.name + '.In,' + self.input_stms[0].name + '.Out);\n') + + strcount = 1 + for strm in self.output_stms: + self.OM_data_eqn += ('connect(' + strm.name + '.In,' + self.name + '.Out' + str(strcount) + ');\n') + strcount += 1 + + return self.OM_data_eqn + class Pump(UnitOperation): def __init__(self,name='Pump'): UnitOperation.__init__(self) -- cgit