From 637df5484328008d597615cadb0d219ed7be0a0d Mon Sep 17 00:00:00 2001
From: lucaszhao19
Date: Fri, 13 Mar 2020 18:34:06 +0530
Subject: DockWidget folder fixed
---
Bin_Phase_env.py | 10 +-
ComponentSelector.py | 70 +-
DockWidget.txt | 636 ------
DockWidgetCompoundSeparator.py | 99 -
DockWidgetCompoundSeparator.ui | 45 -
DockWidgetDistillationColumn.py | 120 --
DockWidgetDistillationColumn.ui | 270 ---
DockWidgetFlash.py | 74 -
DockWidgetFlash.ui | 161 --
DockWidgetMaterialStream.py | 332 ---
DockWidgetMaterialStream.ui | 458 -----
DockWidgetMixer.py | 61 -
DockWidgetMixer.ui | 137 --
DockWidgetShortcutColumn.py | 97 -
DockWidgetShortcutColumn.ui | 295 ---
DockWidgetSplitter.py | 78 -
DockWidgetSplitter.ui | 200 --
DockWidgets/DockWidget.py | 220 ++
DockWidgets/DockWidget.txt | 636 ++++++
DockWidgets/DockWidget.ui | 169 ++
DockWidgets/DockWidgetCompoundSeparator.py | 99 +
DockWidgets/DockWidgetCompoundSeparator.ui | 45 +
DockWidgets/DockWidgetDistillationColumn.py | 120 ++
DockWidgets/DockWidgetDistillationColumn.ui | 270 +++
DockWidgets/DockWidgetFlash.py | 74 +
DockWidgets/DockWidgetFlash.ui | 161 ++
DockWidgets/DockWidgetMaterialStream.py | 332 +++
DockWidgets/DockWidgetMaterialStream.ui | 458 +++++
DockWidgets/DockWidgetMixer.py | 61 +
DockWidgets/DockWidgetMixer.ui | 137 ++
DockWidgets/DockWidgetShortcutColumn.py | 97 +
DockWidgets/DockWidgetShortcutColumn.ui | 295 +++
DockWidgets/DockWidgetSplitter.py | 78 +
DockWidgets/DockWidgetSplitter.ui | 200 ++
DockWidgets/__pycache__/DockWidget.cpython-36.pyc | Bin 0 -> 6111 bytes
.../DockWidgetCompoundSeparator.cpython-36.pyc | Bin 0 -> 3163 bytes
.../DockWidgetDistillationColumn.cpython-36.pyc | Bin 0 -> 4180 bytes
.../__pycache__/DockWidgetFlash.cpython-36.pyc | Bin 0 -> 2889 bytes
.../DockWidgetMaterialStream.cpython-36.pyc | Bin 0 -> 8766 bytes
.../__pycache__/DockWidgetMixer.cpython-36.pyc | Bin 0 -> 2206 bytes
.../DockWidgetShortcutColumn.cpython-36.pyc | Bin 0 -> 3358 bytes
.../__pycache__/DockWidgetSplitter.cpython-36.pyc | Bin 0 -> 2740 bytes
Graphics.py | 341 ++--
OMChem/Flowsheet.py | 108 +-
Streams.py | 108 +-
Undo.dat | Bin 11013 -> 4784 bytes
UnitOperations.py | 164 +-
class_diagram.pdf | Bin 0 -> 12397 bytes
container.py | 137 +-
dockWidget.py | 220 --
dockWidget.ui | 169 --
main.ui | 1072 +++++++++-
main2.ui | 415 ----
main3.ui | 2112 --------------------
mainApp.py | 159 +-
resDockWidget.py | 92 -
svg/Centrifugal Pump.svg | 104 +
svg/Cooler.svg | 84 +
svg/Heater.svg | 101 +
svg/Pump.svg | 86 +
umlet.uxf | 873 ++++----
61 files changed, 5822 insertions(+), 7118 deletions(-)
delete mode 100644 DockWidget.txt
delete mode 100644 DockWidgetCompoundSeparator.py
delete mode 100644 DockWidgetCompoundSeparator.ui
delete mode 100644 DockWidgetDistillationColumn.py
delete mode 100644 DockWidgetDistillationColumn.ui
delete mode 100644 DockWidgetFlash.py
delete mode 100644 DockWidgetFlash.ui
delete mode 100644 DockWidgetMaterialStream.py
delete mode 100644 DockWidgetMaterialStream.ui
delete mode 100644 DockWidgetMixer.py
delete mode 100644 DockWidgetMixer.ui
delete mode 100644 DockWidgetShortcutColumn.py
delete mode 100644 DockWidgetShortcutColumn.ui
delete mode 100644 DockWidgetSplitter.py
delete mode 100644 DockWidgetSplitter.ui
create mode 100644 DockWidgets/DockWidget.py
create mode 100644 DockWidgets/DockWidget.txt
create mode 100644 DockWidgets/DockWidget.ui
create mode 100644 DockWidgets/DockWidgetCompoundSeparator.py
create mode 100644 DockWidgets/DockWidgetCompoundSeparator.ui
create mode 100644 DockWidgets/DockWidgetDistillationColumn.py
create mode 100644 DockWidgets/DockWidgetDistillationColumn.ui
create mode 100644 DockWidgets/DockWidgetFlash.py
create mode 100644 DockWidgets/DockWidgetFlash.ui
create mode 100644 DockWidgets/DockWidgetMaterialStream.py
create mode 100644 DockWidgets/DockWidgetMaterialStream.ui
create mode 100644 DockWidgets/DockWidgetMixer.py
create mode 100644 DockWidgets/DockWidgetMixer.ui
create mode 100644 DockWidgets/DockWidgetShortcutColumn.py
create mode 100644 DockWidgets/DockWidgetShortcutColumn.ui
create mode 100644 DockWidgets/DockWidgetSplitter.py
create mode 100644 DockWidgets/DockWidgetSplitter.ui
create mode 100644 DockWidgets/__pycache__/DockWidget.cpython-36.pyc
create mode 100644 DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-36.pyc
create mode 100644 DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-36.pyc
create mode 100644 DockWidgets/__pycache__/DockWidgetFlash.cpython-36.pyc
create mode 100644 DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-36.pyc
create mode 100644 DockWidgets/__pycache__/DockWidgetMixer.cpython-36.pyc
create mode 100644 DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-36.pyc
create mode 100644 DockWidgets/__pycache__/DockWidgetSplitter.cpython-36.pyc
create mode 100644 class_diagram.pdf
delete mode 100644 dockWidget.py
delete mode 100644 dockWidget.ui
delete mode 100644 main2.ui
delete mode 100644 main3.ui
delete mode 100644 resDockWidget.py
create mode 100644 svg/Centrifugal Pump.svg
create mode 100644 svg/Cooler.svg
create mode 100644 svg/Heater.svg
create mode 100644 svg/Pump.svg
diff --git a/Bin_Phase_env.py b/Bin_Phase_env.py
index b9228b2..a63ba1c 100644
--- a/Bin_Phase_env.py
+++ b/Bin_Phase_env.py
@@ -19,13 +19,13 @@ import pyqtgraph.exporters
ui_dialog,_ = loadUiType('Binary_Phase_Env.ui')
-class Bin_Phase_env(QWidget,ui_dialog):
+class BinPhaseEnv(QWidget,ui_dialog):
def __init__(self,comp):
QWidget.__init__(self)
self.setupUi(self)
self.comp = comp
- self.compunds = self.comp.getComp()
+ self.compunds = self.comp.get_compounds()
for i in self.compunds:
self.comboBox.addItem(str(i))
@@ -218,7 +218,7 @@ class Bin_Phase_env(QWidget,ui_dialog):
view_box = plt.plotItem.vb
self.tool_tip = ""
- def pressEvent(evt):
+ def press_event(evt):
#print("HELLO")
a = 10
pos = evt
@@ -253,8 +253,8 @@ class Bin_Phase_env(QWidget,ui_dialog):
else:
i.setToolTip(self.tool_tip)
# print(items)
- #proxy = pg.SignalProxy(plt.scene().sigMouseMoved, rateLimit = 60, slot = pressEvent)
- plt.scene().sigMouseMoved.connect(pressEvent)
+ #proxy = pg.SignalProxy(plt.scene().sigMouseMoved, rateLimit = 60, slot = press_event)
+ plt.scene().sigMouseMoved.connect(press_event)
plt.scene().sigMouseHover.connect(entered)
#c1.setAcceptHoverEvents(True)
#c2.setAcceptHoverEvents(True)
diff --git a/ComponentSelector.py b/ComponentSelector.py
index 4860c4c..64ca167 100644
--- a/ComponentSelector.py
+++ b/ComponentSelector.py
@@ -17,14 +17,14 @@ class ComponentSelector(QDialog,ui_dialog):
self.setupUi(self)
- self.Dict1=dict()#empty dictionary which will store the obj and its compound
+ self.dict1=dict()#empty dictionary which will store the obj and its compound
#self.DB1=#instance of Database class in Database.py module
self.instance=[ChemsepDatabase()] #list of all the instances
self.lines=[]
for i in self.instance:
x=i.get_comp_name_list()
- self.Dict1[i]=x
+ self.dict1[i]=x
self.lines+=x
print(self.lines)
@@ -32,7 +32,7 @@ class ComponentSelector(QDialog,ui_dialog):
#self.DB1_list=self.DB1.get_comp_name_list()
#storingchemsep
#database compound list in DB1_list
- #self.Dict1[self.DB1]=self.DB1_list #storing the list as a value and the db as key in dictionary
+ #self.dict1[self.DB1]=self.DB1_list #storing the list as a value and the db as key in dictionary
#self.lines=self.DB1_list #combined list of all the edited compounds
self.model = QStringListModel()
@@ -45,11 +45,11 @@ class ComponentSelector(QDialog,ui_dialog):
#QCompleter completes the text written in lineedit
self.lineEdit.setCompleter(self.completer)
- self.compoundSelectButton.clicked.connect(self.compoundSelection)
+ self.compoundSelectButton.clicked.connect(self.compound_selection)
self.compoundSelectButton.setAutoDefault(False)
self.pushButton.clicked.connect(self.accept)
self.pushButton_2.clicked.connect(self.cancel)
- self.pushButton_3.clicked.connect(self.removeItems)
+ self.pushButton_3.clicked.connect(self.remove_items)
def final_list(self,*list_name):
self.list_final=[]
@@ -58,7 +58,7 @@ class ComponentSelector(QDialog,ui_dialog):
self.list_final+=i
return (self.list_final)
- def isCompSelected(self):
+ def is_compound_selected(self):
if not compound_selected:
return False
else:
@@ -74,8 +74,8 @@ class ComponentSelector(QDialog,ui_dialog):
#of the corresponding database
def get_object(self,component):
- for ele in self.Dict1:
- values=self.Dict1[ele]
+ for ele in self.dict1:
+ values=self.dict1[ele]
for ind in values:
if ind ==component:
return(ele)
@@ -86,10 +86,7 @@ class ComponentSelector(QDialog,ui_dialog):
self.temp_comp= component.replace(removing_attrib,'')
return(self.temp_comp)
-
-
- def compoundSelection(self):
-
+ def compound_selection(self):
self.comp = self.lineEdit.text() #gets entered text
if self.comp in self.lines: #matches with the db
self.obj=self.get_object(self.comp) #obj will store the key of the dictionary
@@ -108,49 +105,52 @@ class ComponentSelector(QDialog,ui_dialog):
print(compound_selected)
self.CAS=self.obj.get_value(self.comp,'CAS')
- self.Name=self.comp
- self.MolecularFormula=self.obj.get_value(self.comp,'Smiles')
- self.MolecularWeight=self.obj.get_value(self.comp,'MolecularWeight')
+ self.name=self.comp
+ self.molecular_formula=self.obj.get_value(self.comp,'Smiles')
+ self.molecular_weight=self.obj.get_value(self.comp,'MolecularWeight')
- Dict={'CAS':self.CAS,'Name':self.Name,'Molecular Formula':self.MolecularFormula,'Molecular Weight':self.MolecularWeight}
+ dict={'CAS':self.CAS,'Name':self.name,'Molecular Formula':self.molecular_formula,'Molecular Weight':self.molecular_weight}
#converted everything to a dictionary which will be passes to addtable
#function as a parameter.
- print(Dict)
- self.addToTable(Dict)
+ print(dict)
+ self.add_to_table(dict)
else:
- self.Show_Error()
+ self.show_error()
@staticmethod
- def setCompounds(compounds):
+ def set_compounds(compounds):
#compound_selected = compounds
for i in compounds:
compound_selected.append(i)
- def addToTable(self,a):
+ def add_to_table(self,a):
try:
- rowPosition = self.tableWidget.rowCount()
- self.tableWidget.insertRow(rowPosition)
- self.tableWidget.setItem(rowPosition , 0, QTableWidgetItem(str(a['CAS'])))
- self.tableWidget.setItem(rowPosition , 1, QTableWidgetItem(str(a['Name'])))
- self.tableWidget.setItem(rowPosition , 2, QTableWidgetItem(str(a['Molecular Formula'])))
- self.tableWidget.setItem(rowPosition , 3, QTableWidgetItem(str(a['Molecular Weight'])))
+ row_position = self.tableWidget.rowCount()
+ self.tableWidget.insertRow(row_position)
+ self.tableWidget.setItem(row_position , 0, QTableWidgetItem(str(a['CAS'])))
+ self.tableWidget.setItem(row_position , 1, QTableWidgetItem(str(a['Name'])))
+ self.tableWidget.setItem(row_position , 2, QTableWidgetItem(str(a['Molecular Formula'])))
+ self.tableWidget.setItem(row_position , 3, QTableWidgetItem(str(a['Molecular Weight'])))
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
print(exc_type, fname, exc_tb.tb_lineno)
- def addCompToList(self,comp): # which list?
+ def add_compounds_to_list(self,comp): # which list?
self.item = QListWidgetItem()
self.item.setText(comp)
self.listWidget.addItem(self.item)
- def removeItems(self):
- item = self.tableWidget.item(self.tableWidget.currentRow(),1).text()
- self.tableWidget.removeRow(self.tableWidget.currentRow())
-
- compound_selected.remove(item)
+ def remove_items(self):
+ try:
+ item = self.tableWidget.item(self.tableWidget.currentRow(),1).text()
+ self.tableWidget.removeRow(self.tableWidget.currentRow())
+
+ compound_selected.remove(item)
+ except Exception as e:
+ print(e)
- def Show_Error(self):
+ def show_error(self):
QMessageBox.about(self, 'Important', "Selected Compound is not Available")
def cancel(self):
@@ -158,7 +158,7 @@ class ComponentSelector(QDialog,ui_dialog):
self.tableWidget.setRowCount(0)
self.reject()
- def getComp(self):
+ def get_compounds(self):
return compound_selected
def final_mo(self):
diff --git a/DockWidget.txt b/DockWidget.txt
deleted file mode 100644
index b14eef8..0000000
--- a/DockWidget.txt
+++ /dev/null
@@ -1,636 +0,0 @@
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5.uic import loadUiType
-import pandas as pd
-from functools import partial
-from component_selector import *
-from collections import defaultdict
-from Graphics import *
-
-ui_dialog,_ = loadUiType('DockWidget.ui')
-
-class DockWidget(QDockWidget,ui_dialog):
-
- def __init__(self,name,comptype,obj,container,parent=None):
- QDockWidget.__init__(self,parent)
- self.setupUi(self)
- self.setWindowTitle(obj.name)
- self.name=name
- self.obj=obj
- self.type = comptype
- self.inputdict = {}
- self.x_pclist = []
- self.modes()
- self.comboBox.currentIndexChanged.connect(self.modeSelection)
-
- print("constructor ", self.inputdict)
- self.pushButton_2.clicked.connect(self.param)
- self.dict = {}
-
- self.nameType = None
- self.container = container
-
- header = QTreeWidgetItem(['Compound','Value','Unit'])
- self.mTreeWidget.setHeaderItem(header)
- self.lTreeWidget.setHeaderItem(header)
- self.vTreeWidget.setHeaderItem(header)
-
- self.mTreeWidget.itemClicked.connect(lambda : self.printer(self.mTreeWidget.currentItem()))
- self.lTreeWidget.itemClicked.connect(lambda : self.printer(self.lTreeWidget.currentItem()))
- self.vTreeWidget.itemClicked.connect(lambda : self.printer(self.vTreeWidget.currentItem()))
-
- def printer(self, treeItem ):
- foldername = treeItem.text(0)
- comment = treeItem.text(1)
- data = treeItem.text(2)
- print(foldername , ': ' , comment , ' (' + data + ')')
-
- # input data tab
- def modes(self):
- modesList = self.obj.modesList
- if(modesList):
- for j in modesList:
- self.comboBox.addItem(str(self.obj.variables[j]['name']))
- self.modeSelection()
- else:
- self.comboBox.setDisabled(True)
- self.inputdict= {}
- self.inputdict = self.obj.paramgetter()
- self.inputparamslist()
-
- def modeSelection(self):
- self.inputdict= {}
- for i in reversed(range(self.formLayout.count())):
- self.formLayout.removeRow(i)
- print(self.comboBox.currentText())
- for i in self.obj.variables:
- if self.obj.variables[i]['name'] == self.comboBox.currentText():
- currentText = i
- break
- self.inputdict = self.obj.paramgetter(currentText)
- print('mode selection ', self.inputdict)
- self.inputparamslist()
-
- def inputparamslist(self):
- try:
- print("inputparamslist ", self.inputdict)
- for c,i in enumerate(self.inputdict):
- if i == None:
- continue
- if(i=="thermoPackage"):
- print("thermo1")
- combo = QComboBox()
- self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
- print("thermo2")
- for j in self.lines:
- combo.addItem(str(j))
- combo.setMinimumContentsLength(15)
- lay = QGridLayout()
- lay.addWidget(QLabel(i+":"), 0,0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(''), 0, 2, alignment = Qt.AlignCenter)
- self.formLayout.addRow(lay)
- self.inputdict[i] = combo
- print("thermo")
- elif(i=="Ctype"):
- combo = QComboBox()
- self.lines = ["Total","Partial"]
- for j in self.lines:
- combo.addItem(str(j))
- combo.setMinimumContentsLength(15)
- lay = QGridLayout()
- lay.addWidget(QLabel("Condensor Type :"), 0, 0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(''), 0, 2, alignment = Qt.AlignCenter)
- self.formLayout.addRow(lay)
- self.inputdict[i] = combo
- elif(i=="x_pc"):
- noc = len(compound_selected)
- print(noc)
- self.x_pclist.clear()
- gp = QGroupBox("Compounds")
- lay = QGridLayout()
- for j in range(noc):
- l = QLineEdit()
- self.inputdict[i] = "x_pc"
- lay.addWidget(QLabel(str(compound_selected[j])+":"),j,0, alignment=Qt.AlignLeft)
- lay.addWidget(l,j,1, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(self.obj.variables[i]['unit']),j,2, alignment=Qt.AlignCenter)
- self.x_pclist.append(l)
- gp.setLayout(lay)
- self.formLayout.addRow(gp)
- elif (self.obj.type == 'Mixer' and i == 'Pout'):
- combo = QComboBox()
- print("Mixer combo")
- for j in self.obj.Pout_modes:
- combo.addItem(str(j))
- combo.setMinimumContentsLength(15)
- lay = QGridLayout()
- lay.addWidget(QLabel(self.obj.variables[i]['name']+":"), 0,0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(self.obj.variables[i]['unit']),0,2, alignment=Qt.AlignCenter)
- self.formLayout.addRow(lay)
- self.inputdict[i] = combo
- elif (self.obj.type == 'Splitter' and i == 'CalcType'):
- combo = QComboBox()
- print("Splitter combo")
- for j in self.obj.CalcType_modes:
- combo.addItem(str(j))
- combo.setMinimumContentsLength(15)
- stream1 = QLineEdit()
- stream2 = QLineEdit()
- unit = QLabel('')
- lay = QGridLayout()
- lay.addWidget(QLabel(self.obj.variables[i]['name']+":"), 0,0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(self.obj.variables[i]['unit']),0,2, alignment=Qt.AlignCenter)
-
- lay.addWidget(QLabel("Stream 1 : "), 1,0, alignment = Qt.AlignLeft)
- lay.addWidget(stream1, 1,1, alignment = Qt.AlignCenter)
- lay.addWidget(unit, 1,2, alignment = Qt.AlignRight)
-
- lay.addWidget(QLabel("Stream 2 : "), 2,0, alignment = Qt.AlignLeft)
- lay.addWidget(stream2, 2,1, alignment = Qt.AlignCenter)
- lay.addWidget(unit, 2,2, alignment = Qt.AlignRight)
- self.formLayout.addRow(lay)
- print("daf ", self.formLayout)
- #combo.currentIndexChanged.connect(lambda:self.SplitterStreams(combo, lay, unit))
- lst = [combo, stream1, stream2]
- #lst = [combo.currentText(), stream1.text(), stream2.text()]
- self.inputdict[i] = lst
- # self.inputdict[i] = stream1
- # self.inputdict[i] = stream2
- print(self.inputdict[i])
- elif i == 'HKey' or i == 'LKey':
- combo = QComboBox()
- print("ShortcutColumn combo")
- for j in self.obj.compounds:
- combo.addItem(str(j))
- combo.setMinimumContentsLength(15)
- lay = QGridLayout()
- lay.addWidget(QLabel(self.obj.variables[i]['name']+":"), 0,0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(self.obj.variables[i]['unit']),0,2, alignment=Qt.AlignCenter)
- self.formLayout.addRow(lay)
- self.inputdict[i] = combo
- elif self.obj.type == 'CompoundSeparator' and i == 'SepStrm':
- print(i)
- rlay = QHBoxLayout()
- r1 = QRadioButton('Stream 1')
- r1.setChecked(True)
- r2 = QRadioButton('Stream 2')
- r2.setChecked(False)
- rlay.addWidget(r1)
- rlay.addWidget(r2)
- self.formLayout.addRow(rlay)
-
- lst = [r1, r2]
-
- lay = QGridLayout()
- for k,val in enumerate(self.obj.compounds):
- combo = QComboBox()
- print("CompoundSeparator combo")
- for j in self.obj.SepFact_modes:
- combo.addItem(str(j))
- l = QLineEdit()
- lay.addWidget(QLabel(val+" :"), k,0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, k, 1, alignment=Qt.AlignCenter)
- lay.addWidget(l,k,2, alignment=Qt.AlignCenter)
- lst.append(combo)
- lst.append(l)
- self.inputdict[i] = lst
- self.formLayout.addRow(lay)
- elif self.obj.type == 'Flash' and i == 'Bdef':
- print(i)
- # rlay = QHBoxLayout()
- r1 = QCheckBox()
- r1.setChecked(False)
- r2 = QCheckBox()
- r2.setChecked(False)
- # rlay.addWidget(r1)
- # rlay.addWidget(r2)
- # self.formLayout.addRow(rlay)
-
- l1 = QLineEdit()
- l1.setText(str(self.obj.variables['Tdef']['value']))
- l2 = QLineEdit()
- l2.setText(str(self.obj.variables['Pdef']['value']))
- lay = QGridLayout()
- lay.addWidget(r1, 0,0, alignment = Qt.AlignLeft)
- lay.addWidget(QLabel(self.obj.variables['Tdef']['name']+":"), 0,1, alignment=Qt.AlignLeft)
- lay.addWidget(l1, 0, 2, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(self.obj.variables['Tdef']['unit']),0,3, alignment=Qt.AlignRight)
- l1.setDisabled(True)
-
- lay.addWidget(r2, 2,0, alignment = Qt.AlignLeft)
- lay.addWidget(QLabel(self.obj.variables['Pdef']['name']+":"), 2,1, alignment=Qt.AlignLeft)
- lay.addWidget(l2, 2, 2, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(self.obj.variables['Pdef']['unit']),2,3, alignment=Qt.AlignRight)
- self.formLayout.addRow(lay)
- l2.setDisabled(True)
- r1.toggled.connect(lambda:l1.setDisabled(not r1.isChecked()))
- r2.toggled.connect(lambda:l2.setDisabled(not r2.isChecked()))
-
- self.inputdict[i] = [r1, r2, l1, l2]
- else:
- print("elseloop")
- print(i)
- if i == None:
- continue
- l = QLineEdit()
- if self.inputdict[i] != None:
- l.setText(str(self.inputdict[i]))
- print('before lay')
- lay = QGridLayout()
- lay.addWidget(QLabel(self.obj.variables[i]['name']+":"),0,0, alignment=Qt.AlignLeft) #self.obj.variables[i]['name']
- lay.addWidget(l,0,1, alignment=Qt.AlignCenter)
- print('after lay')
- if(i != 'MolFlow'):
- lay.addWidget(QLabel(self.obj.variables[i]['unit']),0,2, alignment=Qt.AlignCenter)
- else:
- lay.addWidget(QLabel('mol/s'),0,2, alignment=Qt.AlignCenter)
- print('after all')
- self.formLayout.addRow(lay)
- self.inputdict[i] = l
-
-
- except Exception as e:
- print(e)
-
- def Show_Error(self):
- QMessageBox.about(self, 'Important', "Please fill all fields with data")
-
- def param(self):
- try:
- self.dict={}
- print("param.inputdict ", self.inputdict)
- for i in self.inputdict:
- if (self.inputdict[i] == None):
- continue
-
- if(i=="thermoPackage"):
- if (self.inputdict[i].currentText()):
- self.dict[i] = self.inputdict[i].currentText()
- else:
- self.Show_Error()
- break
- elif(i=="Ctype"):
- if (self.inputdict[i].currentText()):
- self.dict[i] = self.inputdict[i].currentText()
- else:
- self.Show_Error()
- break
- elif(i =="x_pc"):
- l=[]
- mf = []
- total_moles = 0
- for mol_frac in self.x_pclist:
- if (mol_frac.text()):
- l.append(mol_frac.text())
- total_moles += float(l[-1])
- else:
- self.Show_Error()
- break
- for c in range(len(compound_selected)):
- mf.append(str(float(l[c])/total_moles))
- self.x_pclist[c].setText(mf[-1])
- self.dict[i] = ",".join(mf)
- elif(i == 'Pout' and self.obj.type == 'Mixer' or i == '' or i == 'HKey' or i == 'LKey'):
- self.dict[i] = self.inputdict[i].currentText()
- elif i == 'CalcType' and self.obj.type == 'Splitter':
- self.dict[i] = [self.inputdict[i][0].currentText(), self.inputdict[i][1].text(), self.inputdict[i][2].text()]
- elif self.obj.type == 'Flash' and i == 'Bdef':
- self.dict[i] = [self.inputdict[i][0].isChecked(), self.inputdict[i][1].isChecked(), self.inputdict[i][2].text(), self.inputdict[i][3].text()]
- elif self.obj.type == 'CompoundSeparator':
- self.dict[i] = [self.inputdict[i][0].isChecked(),self.inputdict[i][1].isChecked()]
- j = 2
- for comp in self.obj.compounds:
- self.dict[i].append(self.inputdict[i][j].currentText())
- self.dict[i].append(self.inputdict[i][j+1].text())
- j += 2
- else:
- print(self.inputdict[i], i, self.obj.type)
- if (self.inputdict[i].text()):
- self.dict[i] = self.inputdict[i].text()
- else:
- print(self.inputdict[i].text())
- self.Show_Error()
- break
-
- print("param ", self.dict)
- self.obj.paramsetter(self.dict)
- self.hide()
-
- except Exception as e:
- print(e)
-
-
- @staticmethod
- def showResult(lst):
- #DockWidget1.flag = True
- for i in lst:
- i.resultsCategory(i.name)
- #i.show()
-
- # result data tab
- def resultsCategory(self,name):
- flag = True
- try:
- print("Under result category name ", name)
- result=self.container.result
- obj = self.container.fetchObject(name)
-
- d = {"Mole Fraction":"x_pc", "Mass Fraction":"xm_pc", "Mole Flow":"F_pc", "Mass Flow":"Fm_pc"}
- lst = list(d.keys())
- klst = list(d.values())
-
- p = {"Pressure":"P", "Temperature":"T","Vapour Phase Mole Fraction":"xvap", "Phase Molar Enthalpy":"H_p",
- "Phase Molar Entropy":"S_p", "Molar Flow Rate":"F_p"}
-
- # Amounts Tab
- if obj.type == 'MaterialStream':
- l = [] # list for basis names
- for basis in d:
- propertyname = name + '.' + d[basis]
- print("basis ", basis, propertyname)
- for i in result[0]:
- if (propertyname in i):
- l.append(i)
- print(l)
-
- j = 0
- t = 0
- namee = klst[j]
- print("namee ", namee)
-
- for i,k in enumerate(l):
- ind = result[0].index(k)
- print("index ", ind)
- print("str ", k)
- resultval = str(result[-1][ind])
- print("######Resultsfetch####",resultval)
- print(k[k.find(".")+1:k.find("[")])
- obj.variables[k.split('.')[1]]['value'] = resultval
- if namee in k:
- if i%3 == 0:
- if(flag):
- mroot = QTreeWidgetItem(self.mTreeWidget, [lst[j]])
- child = QTreeWidgetItem(mroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
- elif i%3 == 1:
- if(flag):
- lroot = QTreeWidgetItem(self.lTreeWidget, [lst[j]])
- child = QTreeWidgetItem(lroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
- elif i%3 == 2:
- if (flag):
- vroot = QTreeWidgetItem(self.vTreeWidget, [lst[j]])
- child = QTreeWidgetItem(vroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
- t += 1
- flag = False
- else:
- j += 1
- t = 0
- namee = klst[j]
- flag = True
- if i%3 == 0:
- if (flag):
- mroot = QTreeWidgetItem(self.mTreeWidget, [lst[j]])
- child = QTreeWidgetItem(mroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
- elif i%3 == 1:
- if (flag):
- lroot = QTreeWidgetItem(self.lTreeWidget, [lst[j]])
- child = QTreeWidgetItem(lroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
- elif i%3 == 2:
- if (flag):
- vroot = QTreeWidgetItem(self.vTreeWidget, [lst[j]])
- child = QTreeWidgetItem(vroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
- t += 1
- flag = False
- #print(obj.variables)
-
- # Phase Properties Tab
- phaseResLst = []
- for phase in p:
- propertyname = name + '.' + p[phase]
- print("phase ", phase, propertyname)
- for i in result[0]:
- if i.find('['):
- if (propertyname == i[0:i.find('[')]):
- phaseResLst.append(i)
- if propertyname == i:
- phaseResLst.append(i)
- print(phaseResLst)
-
- self.mTableWidget.setRowCount(0)
- self.lTableWidget.setRowCount(0)
- self.vTableWidget.setRowCount(0)
-
- for i,val in enumerate(phaseResLst):
- ind = result[0].index(val)
- resultval = str(result[-1][ind])
- print(resultval, i, val)
- obj.variables[val.split('.')[1]]['value'] = resultval
- if '[' in val:
- print(val)
- temp = val[val.find('.')+1:val.find('[')]
- print(temp)
- if '1' in val.split('.')[1]:
- print(obj.variables[val.split('.')[1]]['name'])
- mrowPosition = self.mTableWidget.rowCount()
- self.mTableWidget.insertRow(mrowPosition)
- self.mTableWidget.setItem(mrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
- self.mTableWidget.setItem(mrowPosition , 1, QTableWidgetItem(resultval))
- self.mTableWidget.setItem(mrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
- self.mTableWidget.resizeColumnsToContents()
-
- if '2' in val.split('.')[1]:
- lrowPosition = self.lTableWidget.rowCount()
- self.lTableWidget.insertRow(lrowPosition)
- self.lTableWidget.setItem(lrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
- self.lTableWidget.setItem(lrowPosition , 1, QTableWidgetItem(resultval))
- self.lTableWidget.setItem(lrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
- self.lTableWidget.resizeColumnsToContents()
- if '3' in val.split('.')[1]:
- vrowPosition = self.vTableWidget.rowCount()
- self.vTableWidget.insertRow(vrowPosition)
- self.vTableWidget.setItem(vrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
- self.vTableWidget.setItem(vrowPosition , 1, QTableWidgetItem(resultval))
- self.vTableWidget.setItem(vrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
- self.vTableWidget.resizeColumnsToContents()
- if not '[' in val:
- #print(p[val.split('.')[1]])
- print(obj.variables[val.split('.')[1]]['name'])
- mrowPosition = self.mTableWidget.rowCount()
- self.mTableWidget.insertRow(mrowPosition)
- self.mTableWidget.setItem(mrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
- self.mTableWidget.setItem(mrowPosition , 1, QTableWidgetItem(resultval))
- self.mTableWidget.setItem(mrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
- self.mTableWidget.resizeColumnsToContents()
-
- print(obj.variables)
-
- except Exception as e:
- print(e)
-
-
-class DockWidgetFlash(DockWidget):
-
- def __init__(self,name,comptype,obj,container,parent=None):
- DockWidget.__init__(self,name,comptype,obj,container,parent=None)
-
- def inputparamslist(self):
- try:
- print("inputparamslist ", self.inputdict)
- for c,i in enumerate(self.inputdict):
- if i == None:
- continue
- if(i=="thermoPackage"):
- print("thermo1")
- combo = QComboBox()
- self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
- print("thermo2")
- for j in self.lines:
- combo.addItem(str(j))
- combo.setMinimumContentsLength(15)
- lay = QGridLayout()
- lay.addWidget(QLabel(i+":"), 0,0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(''), 0, 2, alignment = Qt.AlignCenter)
- self.formLayout.addRow(lay)
- self.inputdict[i] = combo
- print("thermo")
- elif self.obj.type == 'Flash' and i == 'Bdef':
- print(i)
- r1 = QCheckBox()
- r1.setChecked(False)
- r2 = QCheckBox()
- r2.setChecked(False)
-
- l1 = QLineEdit()
- l1.setText(str(self.obj.variables['Tdef']['value']))
- l2 = QLineEdit()
- l2.setText(str(self.obj.variables['Pdef']['value']))
- lay = QGridLayout()
- lay.addWidget(r1, 0,0, alignment = Qt.AlignLeft)
- lay.addWidget(QLabel(self.obj.variables['Tdef']['name']+":"), 0,1, alignment=Qt.AlignLeft)
- lay.addWidget(l1, 0, 2, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(self.obj.variables['Tdef']['unit']),0,3, alignment=Qt.AlignRight)
- l1.setDisabled(True)
-
- lay.addWidget(r2, 2,0, alignment = Qt.AlignLeft)
- lay.addWidget(QLabel(self.obj.variables['Pdef']['name']+":"), 2,1, alignment=Qt.AlignLeft)
- lay.addWidget(l2, 2, 2, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(self.obj.variables['Pdef']['unit']),2,3, alignment=Qt.AlignRight)
- self.formLayout.addRow(lay)
- l2.setDisabled(True)
- r1.toggled.connect(lambda:l1.setDisabled(not r1.isChecked()))
- r2.toggled.connect(lambda:l2.setDisabled(not r2.isChecked()))
-
- self.inputdict[i] = [r1, r2, l1, l2]
- except Exception as e:
- print(e)
-
- def param(self):
- try:
- self.dict={}
- print("param.inputdict ", self.inputdict)
- for i in self.inputdict:
- if (self.inputdict[i] == None):
- continue
-
- if(i=="thermoPackage"):
- if (self.inputdict[i].currentText()):
- self.dict[i] = self.inputdict[i].currentText()
- else:
- self.Show_Error()
- break
- elif self.obj.type == 'Flash' and i == 'Bdef':
- self.dict[i] = [self.inputdict[i][0].isChecked(), self.inputdict[i][1].isChecked(), self.inputdict[i][2].text(), self.inputdict[i][3].text()]
-
- print("param ", self.dict)
- self.obj.paramsetter(self.dict)
- self.hide()
-
- except Exception as e:
- print(e)
-
-class DockWidgetFlash(DockWidget):
-
- def __init__(self,name,comptype,obj,container,parent=None):
- DockWidget.__init__(self,name,comptype,obj,container,parent=None)
-
- def inputparamslist(self):
- try:
- print("inputparamslist ", self.inputdict)
- for c,i in enumerate(self.inputdict):
- if i == None:
- continue
- if(i=="thermoPackage"):
- print("thermo1")
- combo = QComboBox()
- self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
- print("thermo2")
- for j in self.lines:
- combo.addItem(str(j))
- combo.setMinimumContentsLength(15)
- lay = QGridLayout()
- lay.addWidget(QLabel(i+":"), 0,0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(''), 0, 2, alignment = Qt.AlignCenter)
- self.formLayout.addRow(lay)
- self.inputdict[i] = combo
- print("thermo")
- elif self.obj.type == 'Flash' and i == 'Bdef':
- print(i)
- r1 = QCheckBox()
- r1.setChecked(False)
- r2 = QCheckBox()
- r2.setChecked(False)
-
- l1 = QLineEdit()
- l1.setText(str(self.obj.variables['Tdef']['value']))
- l2 = QLineEdit()
- l2.setText(str(self.obj.variables['Pdef']['value']))
- lay = QGridLayout()
- lay.addWidget(r1, 0,0, alignment = Qt.AlignLeft)
- lay.addWidget(QLabel(self.obj.variables['Tdef']['name']+":"), 0,1, alignment=Qt.AlignLeft)
- lay.addWidget(l1, 0, 2, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(self.obj.variables['Tdef']['unit']),0,3, alignment=Qt.AlignRight)
- l1.setDisabled(True)
-
- lay.addWidget(r2, 2,0, alignment = Qt.AlignLeft)
- lay.addWidget(QLabel(self.obj.variables['Pdef']['name']+":"), 2,1, alignment=Qt.AlignLeft)
- lay.addWidget(l2, 2, 2, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(self.obj.variables['Pdef']['unit']),2,3, alignment=Qt.AlignRight)
- self.formLayout.addRow(lay)
- l2.setDisabled(True)
- r1.toggled.connect(lambda:l1.setDisabled(not r1.isChecked()))
- r2.toggled.connect(lambda:l2.setDisabled(not r2.isChecked()))
-
- self.inputdict[i] = [r1, r2, l1, l2]
- except Exception as e:
- print(e)
-
- def param(self):
- try:
- self.dict={}
- print("param.inputdict ", self.inputdict)
- for i in self.inputdict:
- if (self.inputdict[i] == None):
- continue
-
- if(i=="thermoPackage"):
- if (self.inputdict[i].currentText()):
- self.dict[i] = self.inputdict[i].currentText()
- else:
- self.Show_Error()
- break
- elif self.obj.type == 'Flash' and i == 'Bdef':
- self.dict[i] = [self.inputdict[i][0].isChecked(), self.inputdict[i][1].isChecked(), self.inputdict[i][2].text(), self.inputdict[i][3].text()]
-
- print("param ", self.dict)
- self.obj.paramsetter(self.dict)
- self.hide()
-
- except Exception as e:
- print(e)
\ No newline at end of file
diff --git a/DockWidgetCompoundSeparator.py b/DockWidgetCompoundSeparator.py
deleted file mode 100644
index 24cdbc7..0000000
--- a/DockWidgetCompoundSeparator.py
+++ /dev/null
@@ -1,99 +0,0 @@
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5.uic import loadUiType
-import pandas as pd
-from functools import partial
-from ComponentSelector import *
-from collections import defaultdict
-from Graphics import *
-
-ui_dialog,_ = loadUiType('DockWidgetCompoundSeparator.ui')
-
-class DockWidgetCompoundSeparator(QDockWidget,ui_dialog):
-
- def __init__(self,name,comptype,obj,container,parent=None):
- QDockWidget.__init__(self,parent)
- self.setupUi(self)
- self.setWindowTitle(obj.name)
- self.name=name
- self.obj=obj
- self.type = comptype
- self.inputdict = []
-
- print("constructor ", self.inputdict)
- self.inputparamslist()
- self.dict = []
-
- def inputparamslist(self):
- try:
- print("inputparamslist ", self.inputdict)
- if self.type == 'CompoundSeparator':
-
- # self.gridLayout = QGridLayout()
- calculationGroupBox = QGroupBox('Calculation Parameters')
-
- calculationLayout = QGridLayout()
-
- r1 = QRadioButton('Stream 1')
- r1.setChecked(True)
- r1.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
- r2 = QRadioButton('Stream 2')
- r2.setChecked(False)
- r2.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
-
- lst = [r1, r2]
- calculationLayout.addWidget(r1, 0, 1)
- calculationLayout.addWidget(r2, 0, 2)
-
- for k,val in enumerate(self.obj.compounds):
- combo = QComboBox()
- print("CompoundSeparator combo")
- for j in self.obj.SepFact_modes:
- combo.addItem(str(j))
- combo.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
- l = QLineEdit()
- l.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
- calculationLayout.addWidget(QLabel(val+" :"), k+1,0, alignment=Qt.AlignLeft)
- calculationLayout.addWidget(combo, k+1, 1, alignment=Qt.AlignCenter)
- calculationLayout.addWidget(l,k+1,2, alignment=Qt.AlignCenter)
- lst.append(combo)
- lst.append(l)
-
- calculationLayout.setColumnStretch(3, len(self.obj.compounds)+1)
- calculationGroupBox.setLayout(calculationLayout)
-
- btn = QPushButton('Submit')
- btn.clicked.connect(self.param)
-
- self.gridLayout.setVerticalSpacing(5)
- self.gridLayout.addWidget(calculationGroupBox,0,0)
- self.gridLayout.addWidget(btn,1,0)
-
- self.inputdict = lst
-
- except Exception as e:
- print(e)
-
- def Show_Error(self):
- QMessageBox.about(self, 'Important', "Please fill all fields with data")
-
- def param(self):
- try:
- self.dict=[]
- print("param.inputdict ", self.inputdict)
-
- self.dict = [self.inputdict[0].isChecked(), self.inputdict[1].isChecked()]
- j = 2
- for i in range(len(self.obj.compounds)):
- print(j+i)
- self.dict.append(self.inputdict[j+i].currentText())
- self.dict.append(self.inputdict[j+i+1].text())
- j += 1
-
- print("param ", self.dict)
- self.obj.paramsetter(self.dict)
- self.hide()
-
- except Exception as e:
- print(e)
diff --git a/DockWidgetCompoundSeparator.ui b/DockWidgetCompoundSeparator.ui
deleted file mode 100644
index 2d9a4b2..0000000
--- a/DockWidgetCompoundSeparator.ui
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
- form
-
-
- true
-
-
-
- 0
- 0
- 392
- 700
-
-
-
-
- 0
- 0
-
-
-
-
- 3200
- 5000
-
-
-
- Form
-
-
-
-
- 10
- 40
- 331
- 191
-
-
-
-
-
-
-
-
diff --git a/DockWidgetDistillationColumn.py b/DockWidgetDistillationColumn.py
deleted file mode 100644
index ca2da9c..0000000
--- a/DockWidgetDistillationColumn.py
+++ /dev/null
@@ -1,120 +0,0 @@
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5.uic import loadUiType
-import pandas as pd
-from functools import partial
-from ComponentSelector import *
-from collections import defaultdict
-from Graphics import *
-
-ui_dialog,_ = loadUiType('DockWidgetDistillationColumn.ui')
-
-class DockWidgetDistillationColumn(QDockWidget,ui_dialog):
-
- def __init__(self,name,comptype,obj,container,parent=None):
- QDockWidget.__init__(self,parent)
- self.setupUi(self)
- self.setWindowTitle(obj.name)
- self.name=name
- self.obj=obj
- self.type = comptype
- self.inputdict = []
- print("constructor ", self.inputdict)
- self.pushButton_2.clicked.connect(self.param)
- self.dict = []
- self.inputparamslist()
- self.nameType = None
- self.container = container
-
- # input data tab
-
- def inputparamslist(self):
- try:
- print("inputparamslist ", self.inputdict)
-
- # tab 1
- self.l1.setText(self.obj.variables['Nt']['name']+":")
- self.le1.setText(str(self.obj.variables['Nt']['value']))
- self.l2.setText(self.obj.variables['In_s']['name']+":")
- self.l3.setText(self.obj.variables['InT_s']['name']+":")
-
- # tab 2
- self.l4.setText(self.obj.variables['Ctype']['name']+":")
- self.u1.setText(self.obj.variables['Ctype']['unit'])
- self.l5.setText(self.obj.variables['Pcond']['name']+":")
- self.le5.setText(str(self.obj.variables['Pcond']['value']))
- self.u2.setText(self.obj.variables['Pcond']['unit'])
- self.l6.setText(self.obj.variables['C_Spec']['name']+":")
- self.l7.setText("Compounds :")
-
- self.cb5.addItem("Total")
- self.cb5.addItem("Partial")
- for j in self.obj.Cspec_list:
- self.cb1.addItem(str(j))
- for j in self.obj.compounds:
- self.cb2.addItem(str(j))
- self.cb2.setDisabled(True)
- self.cb1.currentIndexChanged.connect(self.fun2)
-
-
- # tab3
- self.l8.setText(self.obj.variables['Preb']['name']+":")
- self.le7.setText(str(self.obj.variables['Preb']['value']))
- self.u3.setText(self.obj.variables['Preb']['unit'])
- self.l9.setText(self.obj.variables['R_Spec']['name']+":")
- self.l10.setText('Compounds')
-
- for j in self.obj.Rspec_list:
- self.cb3.addItem(str(j))
- for j in self.obj.compounds:
- self.cb4.addItem(str(j))
- self.cb4.setDisabled(True)
- self.cb3.currentIndexChanged.connect(self.fun3)
-
- self.inputdict = [self.le1, self.le2, self.le3, self.cb5, self.le5, self.cb1, self.cb2, self.le6, self.le7, self.cb3, self.cb4, self.le8]
-
- except Exception as e:
- print(e)
-
- def fun2(self):
- if self.cb1.currentText() == 'Compound Molar Fraction' or self.cb1.currentText() == 'Compound Molar Flow (mol/s)':
- self.cb2.setDisabled(False)
- else:
- self.cb2.setDisabled(True)
-
- def fun3(self):
- if self.cb3.currentText() == 'Compound Molar Fraction' or self.cb3.currentText() == 'Compound Molar Flow (mol/s)':
- self.cb4.setDisabled(False)
- else:
- self.cb4.setDisabled(True)
-
- def Show_Error(self):
- QMessageBox.about(self, 'Important', "Please fill all fields with data")
-
- def param(self):
- try:
- self.dict= []
- print("param.inputdict ", self.inputdict)
- self.dict = [self.inputdict[0].text(),self.inputdict[1].text(), self.inputdict[2].text(), self.inputdict[3].currentText(),
- self.inputdict[4].text(), self.inputdict[5].currentText(), self.inputdict[6].currentText(), self.inputdict[7].text(),
- self.inputdict[8].text(), self.inputdict[9].currentText(), self.inputdict[10].currentText(), self.inputdict[11].text()]
-
- print("param ", self.dict)
- self.obj.paramsetter(self.dict)
- self.hide()
-
- except Exception as e:
- print(e)
-
-
- @staticmethod
- def showResult(lst):
- #DockWidget1.flag = True
- for i in lst:
- i.resultsCategory(i.name)
- #i.show()
-
- # result data tab
- def resultsCategory(self,name):
- pass
\ No newline at end of file
diff --git a/DockWidgetDistillationColumn.ui b/DockWidgetDistillationColumn.ui
deleted file mode 100644
index 0cb1043..0000000
--- a/DockWidgetDistillationColumn.ui
+++ /dev/null
@@ -1,270 +0,0 @@
-
-
- Form
-
-
- true
-
-
-
- 0
- 0
- 392
- 700
-
-
-
-
- 0
- 0
-
-
-
-
- 3200
- 5000
-
-
-
- Form
-
-
-
-
- 10
- 30
- 361
- 621
-
-
-
- true
-
-
- 0
-
-
-
- Input Data
-
-
-
-
- 10
- 10
- 331
- 204
-
-
-
- Parameter Selection
-
-
- -
-
-
-
- 0
- 0
-
-
-
- 0
-
-
-
- General
-
-
-
-
-
-
-
-
-
- TextLabel
-
-
-
- -
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
-
-
-
-
-
-
- Condensor
-
-
- -
-
-
-
-
-
- TextLabel
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
- -
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
- -
-
-
-
-
-
-
-
-
- Reboiler
-
-
- -
-
-
-
-
-
- TextLabel
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- TextLabel
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 10
- 220
- 331
- 21
-
-
-
- Submit
-
-
-
-
-
- Results
-
-
-
-
-
-
-
-
diff --git a/DockWidgetFlash.py b/DockWidgetFlash.py
deleted file mode 100644
index f0fa511..0000000
--- a/DockWidgetFlash.py
+++ /dev/null
@@ -1,74 +0,0 @@
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5.uic import loadUiType
-import pandas as pd
-from functools import partial
-from ComponentSelector import *
-from collections import defaultdict
-from Graphics import *
-
-ui_dialog,_ = loadUiType('DockWidgetFlash.ui')
-
-class DockWidgetFlash(QDockWidget,ui_dialog):
-
- def __init__(self,name,comptype,obj,container,parent=None):
- QDockWidget.__init__(self,parent)
- self.setupUi(self)
- self.setWindowTitle(obj.name)
- self.name=name
- self.obj=obj
- self.type = comptype
- self.inputdict = []
- print("constructor ", self.inputdict)
- self.inputparamslist()
- self.btn.clicked.connect(self.param)
- self.dict = []
-
- def inputparamslist(self):
- try:
- print("inputparamslist ", self.inputdict)
-
- self.l1.setText(self.obj.variables['thermoPackage']['name']+":")
- self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
- for j in self.lines:
- self.cb1.addItem(str(j))
-
- self.check1.setText(self.obj.variables['Tdef']['name']+":")
- self.le2.setText(str(self.obj.variables['Tdef']['value']))
- self.u2.setText(self.obj.variables['Tdef']['unit'])
- self.check1.toggled.connect(self.fun)
- self.check2.setText(self.obj.variables['Pdef']['name']+":")
- self.le3.setText(str(self.obj.variables['Pdef']['value']))
- self.u3.setText(self.obj.variables['Pdef']['unit'])
- self.check2.toggled.connect(self.fun)
-
- self.inputdict = [self.cb1, self.check1, self.le2, self.check2, self.le3]
-
- except Exception as e:
- print(e)
-
- def fun(self):
- if self.check1.isChecked():
- self.le2.setDisabled(False)
- else:
- self.le2.setDisabled(True)
- if self.check2.isChecked():
- self.le3.setDisabled(False)
- else:
- self.le3.setDisabled(True)
-
- def Show_Error(self):
- QMessageBox.about(self, 'Important', "Please fill all fields with data")
-
- def param(self):
- try:
- self.dict={}
- print("param.inputdict ", self.inputdict)
- self.dict = [self.inputdict[0].currentText(),self.inputdict[1].isChecked(), float(self.inputdict[2].text()), self.inputdict[3].isChecked(), float(self.inputdict[4].text())]
- print("param ", self.dict)
- self.obj.paramsetter(self.dict)
- self.hide()
-
- except Exception as e:
- print(e)
\ No newline at end of file
diff --git a/DockWidgetFlash.ui b/DockWidgetFlash.ui
deleted file mode 100644
index c781aa6..0000000
--- a/DockWidgetFlash.ui
+++ /dev/null
@@ -1,161 +0,0 @@
-
-
- Form
-
-
- true
-
-
-
- 0
- 0
- 392
- 700
-
-
-
-
- 0
- 0
-
-
-
-
- 3200
- 5000
-
-
-
- Form
-
-
-
-
- 10
- 40
- 341
- 141
-
-
-
-
- 0
- 0
-
-
-
- true
-
-
- Q
-
-
- Calculation Parameters
-
-
- -
-
-
-
-
-
- false
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
- CheckBox
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
- CheckBox
-
-
-
-
-
-
-
-
-
-
- 10
- 190
- 341
- 23
-
-
-
-
- 0
- 0
-
-
-
- Submit
-
-
-
-
-
-
diff --git a/DockWidgetMaterialStream.py b/DockWidgetMaterialStream.py
deleted file mode 100644
index 5fd6261..0000000
--- a/DockWidgetMaterialStream.py
+++ /dev/null
@@ -1,332 +0,0 @@
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5.uic import loadUiType
-import pandas as pd
-from functools import partial
-from ComponentSelector import *
-from collections import defaultdict
-from Graphics import *
-
-ui_dialog,_ = loadUiType('DockWidgetMaterialStream.ui')
-
-class DockWidgetMaterialStream(QDockWidget,ui_dialog):
-
- def __init__(self,name,comptype,obj,container,parent=None):
- QDockWidget.__init__(self,parent)
- self.setupUi(self)
- self.setWindowTitle(obj.name)
- self.name=name
- self.obj=obj
- self.type = comptype
- self.inputdict = {}
- self.x_pclist = []
- self.modes()
- self.comboBox.currentIndexChanged.connect(self.modeSelection)
-
- print("constructor ", self.inputdict)
- self.pushButton_2.clicked.connect(self.param)
- self.dict = {}
-
- self.nameType = None
- self.container = container
-
- header = QTreeWidgetItem(['Compound','Value','Unit'])
- self.mTreeWidget.setHeaderItem(header)
- self.lTreeWidget.setHeaderItem(header)
- self.vTreeWidget.setHeaderItem(header)
-
- self.mTreeWidget.itemClicked.connect(lambda : self.printer(self.mTreeWidget.currentItem()))
- self.lTreeWidget.itemClicked.connect(lambda : self.printer(self.lTreeWidget.currentItem()))
- self.vTreeWidget.itemClicked.connect(lambda : self.printer(self.vTreeWidget.currentItem()))
-
-
- # def printer(self, treeItem ):
- # foldername = treeItem.text(0)
- # comment = treeItem.text(1)
- # data = treeItem.text(2)
- # print(foldername , ': ' , comment , ' (' + data + ')')
-
- # input data tab
- def modes(self):
- modesList = self.obj.modesList
- if(modesList):
- for j in modesList:
- self.comboBox.addItem(str(j))
- self.modeSelection()
- else:
- self.inputdict= {}
- self.inputdict = self.obj.paramgetter()
- self.inputparamslist()
-
- def modeSelection(self):
- self.inputdict= {}
- for i in reversed(range(self.formLayout.count())):
- self.formLayout.removeRow(i)
- self.inputdict = self.obj.paramgetter(self.comboBox.currentText())
- self.inputparamslist()
-
- def inputparamslist(self):
- try:
- print("inputparamslist ", self.inputdict)
- for c,i in enumerate(self.inputdict):
- if(i=="thermoPackage"):
- print("thermo1")
- combo = QComboBox()
- self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
- print("thermo2")
- for j in self.lines:
- combo.addItem(str(j))
- lay = QGridLayout()
- lay.addWidget(QLabel(i+":"), 0,0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, 0, 1, alignment=Qt.AlignRight)
- self.formLayout.addRow(lay)
- self.inputdict[i] = combo
- print("thermo")
- elif(i=="condType"):
- combo = QComboBox()
- self.lines = ["Total","Partial"]
- for j in self.lines:
- combo.addItem(str(j))
- lay = QGridLayout()
- lay.addWidget(QLabel("Condensor Type :"+":"), 0, 0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
- self.formLayout.addRow(lay)
- self.inputdict[i] = combo
- elif(i=="x_pc"):
- noc = len(compound_selected)
- print(noc)
- self.x_pclist.clear()
-
- gp = QGroupBox("Mole Fractions")
- lay = QGridLayout()
- for j in range(noc):
- l = QLineEdit()
- if self.inputdict[i] != '':
- l.setText(str(self.obj.variables[compound_selected[j]]['value']))
- self.inputdict[i] = "x_pc"
- lay.addWidget(QLabel(str(compound_selected[j])+":"),j,0, alignment=Qt.AlignLeft)
- lay.addWidget(l,j,1, alignment=Qt.AlignCenter)
- self.x_pclist.append(l)
-
- gp.setLayout(lay)
- self.formLayout.addRow(gp)
- else:
- print("elseloop")
- l = QLineEdit()
- if self.inputdict[i] != None:
- l.setText(str(self.inputdict[i]))
- lay = QGridLayout()
- lay.addWidget(QLabel(i+":"),0,0, alignment=Qt.AlignLeft)
- lay.addWidget(l,0,1, alignment=Qt.AlignCenter)
- if(i != 'MolFlow'):
- lay.addWidget(QLabel(self.obj.variables[i]['unit']),0,2, alignment=Qt.AlignCenter)
- else:
- lay.addWidget(QLabel("mol/s"),0,2, alignment=Qt.AlignCenter)
- self.formLayout.addRow(lay)
- self.inputdict[i] = l
-
- except Exception as e:
- print(e)
-
- def Show_Error(self):
- QMessageBox.about(self, 'Important', "Please fill all fields with data")
-
- def param(self):
- try:
- self.dict={}
-
- print("param.inputdict ", self.inputdict)
- for i in self.inputdict:
- if(i=="thermoPackage"):
- if (self.inputdict[i].currentText()):
- self.dict[i] = self.inputdict[i].currentText()
- else:
- self.Show_Error()
- break
- elif(i=="condType"):
- if (self.inputdict[i].currentText()):
- self.dict[i] = self.inputdict[i].currentText()
- else:
- self.Show_Error()
- break
- elif(i =="x_pc"):
- l=[]
- mf = []
- total_moles = 0
- for mol_frac in self.x_pclist:
- if (mol_frac.text()):
- l.append(mol_frac.text())
- total_moles += float(l[-1])
- else:
- self.Show_Error()
- break
- for c in range(len(compound_selected)):
- mf.append(str(float(l[c])/total_moles))
- self.obj.variables[compound_selected[c]]['value'] = str(float(l[c])/total_moles)
- self.x_pclist[c].setText(mf[-1])
- self.dict[i] = ",".join(mf)
- else:
- if (self.inputdict[i].text()):
- self.dict[i] = self.inputdict[i].text()
- else:
- print(self.inputdict[i].text())
- self.Show_Error()
- break
-
- print("param ", self.dict)
- self.obj.paramsetter(self.dict)
- self.hide()
-
- except Exception as e:
- print(e)
-
-
- @staticmethod
- def showResult(lst):
- #DockWidget1.flag = True
- for i in lst:
- i.resultsCategory(i.name)
- #i.show()
-
- # result data tab
- def resultsCategory(self,name):
- flag = True
- try:
- print("Under result category name ", name)
- result=self.container.result
- obj = self.container.fetchObject(name)
-
- d = {"Mole Fraction":"x_pc", "Mass Fraction":"xm_pc", "Mole Flow":"F_pc", "Mass Flow":"Fm_pc"}
- lst = list(d.keys())
- klst = list(d.values())
-
- p = {"Pressure":"P", "Temperature":"T","Vapour Phase Mole Fraction":"xvap", "Phase Molar Enthalpy":"H_p",
- "Phase Molar Entropy":"S_p", "Molar Flow Rate":"F_p"}
-
- # Amounts Tab
- if obj.type == 'MaterialStream':
- l = [] # list for basis names
- for basis in d:
- propertyname = name + '.' + d[basis]
- print("basis ", basis, propertyname)
- for i in result[0]:
- if (propertyname in i):
- l.append(i)
- print(l)
-
- j = 0
- t = 0
- namee = klst[j]
- print("namee ", namee)
-
- for i,k in enumerate(l):
- ind = result[0].index(k)
- print("index ", ind)
- print("str ", k)
- resultval = str(result[-1][ind])
- print("######Resultsfetch####",resultval)
- print(k[k.find(".")+1:k.find("[")])
- obj.variables[k.split('.')[1]]['value'] = resultval
- if namee in k:
- if i%3 == 0:
- if(flag):
- mroot = QTreeWidgetItem(self.mTreeWidget, [lst[j]])
- child = QTreeWidgetItem(mroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
- elif i%3 == 1:
- if(flag):
- lroot = QTreeWidgetItem(self.lTreeWidget, [lst[j]])
- child = QTreeWidgetItem(lroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
- elif i%3 == 2:
- if (flag):
- vroot = QTreeWidgetItem(self.vTreeWidget, [lst[j]])
- child = QTreeWidgetItem(vroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
- t += 1
- flag = False
- else:
- j += 1
- t = 0
- namee = klst[j]
- flag = True
- if i%3 == 0:
- if (flag):
- mroot = QTreeWidgetItem(self.mTreeWidget, [lst[j]])
- child = QTreeWidgetItem(mroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
- elif i%3 == 1:
- if (flag):
- lroot = QTreeWidgetItem(self.lTreeWidget, [lst[j]])
- child = QTreeWidgetItem(lroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
- elif i%3 == 2:
- if (flag):
- vroot = QTreeWidgetItem(self.vTreeWidget, [lst[j]])
- child = QTreeWidgetItem(vroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
- t += 1
- flag = False
- #print(obj.variables)
-
- # Phase Properties Tab
- phaseResLst = []
- for phase in p:
- propertyname = name + '.' + p[phase]
- print("phase ", phase, propertyname)
- for i in result[0]:
- if i.find('['):
- if (propertyname == i[0:i.find('[')]):
- phaseResLst.append(i)
- if propertyname == i:
- phaseResLst.append(i)
- print(phaseResLst)
-
- self.mTableWidget.setRowCount(0)
- self.lTableWidget.setRowCount(0)
- self.vTableWidget.setRowCount(0)
-
- for i,val in enumerate(phaseResLst):
- ind = result[0].index(val)
- resultval = str(result[-1][ind])
- print(resultval, i, val)
- obj.variables[val.split('.')[1]]['value'] = resultval
- if '[' in val:
- print(val)
- temp = val[val.find('.')+1:val.find('[')]
- print(temp)
- if '1' in val.split('.')[1]:
- print(obj.variables[val.split('.')[1]]['name'])
- mrowPosition = self.mTableWidget.rowCount()
- self.mTableWidget.insertRow(mrowPosition)
- self.mTableWidget.setItem(mrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
- self.mTableWidget.setItem(mrowPosition , 1, QTableWidgetItem(resultval))
- self.mTableWidget.setItem(mrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
- self.mTableWidget.resizeColumnsToContents()
-
- if '2' in val.split('.')[1]:
- lrowPosition = self.lTableWidget.rowCount()
- self.lTableWidget.insertRow(lrowPosition)
- self.lTableWidget.setItem(lrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
- self.lTableWidget.setItem(lrowPosition , 1, QTableWidgetItem(resultval))
- self.lTableWidget.setItem(lrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
- self.lTableWidget.resizeColumnsToContents()
- if '3' in val.split('.')[1]:
- vrowPosition = self.vTableWidget.rowCount()
- self.vTableWidget.insertRow(vrowPosition)
- self.vTableWidget.setItem(vrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
- self.vTableWidget.setItem(vrowPosition , 1, QTableWidgetItem(resultval))
- self.vTableWidget.setItem(vrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
- self.vTableWidget.resizeColumnsToContents()
- if not '[' in val:
- #print(p[val.split('.')[1]])
- print(obj.variables[val.split('.')[1]]['name'])
- mrowPosition = self.mTableWidget.rowCount()
- self.mTableWidget.insertRow(mrowPosition)
- self.mTableWidget.setItem(mrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
- self.mTableWidget.setItem(mrowPosition , 1, QTableWidgetItem(resultval))
- self.mTableWidget.setItem(mrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
- self.mTableWidget.resizeColumnsToContents()
-
- print(obj.variables)
-
- except Exception as e:
- print(e)
-
-
-
\ No newline at end of file
diff --git a/DockWidgetMaterialStream.ui b/DockWidgetMaterialStream.ui
deleted file mode 100644
index 8995ba6..0000000
--- a/DockWidgetMaterialStream.ui
+++ /dev/null
@@ -1,458 +0,0 @@
-
-
- Form
-
-
- true
-
-
-
- 0
- 0
- 392
- 700
-
-
-
-
- 0
- 0
-
-
-
-
- 3200
- 5000
-
-
-
- Form
-
-
-
-
- 10
- 30
- 361
- 621
-
-
-
- true
-
-
- 0
-
-
-
- Input Data
-
-
-
-
- 9
- 9
- 331
- 71
-
-
-
- Mode Selection
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
- Mode :
-
-
-
- -
-
-
- true
-
-
-
- 0
- 0
-
-
-
-
-
-
-
-
-
-
-
- 10
- 100
- 331
- 321
-
-
-
- Parameter Selection
-
-
- -
-
-
-
-
-
-
-
- 10
- 430
- 331
- 21
-
-
-
- Submit
-
-
-
-
-
- Results
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 8
- 75
- true
-
-
-
- QToolBox{
- background: white;
- border: 1px solid gray;
- selection-background-color: rgb(255, 170, 127);
-}
-
-
-
- 0
-
-
-
-
- 0
- 0
- 335
- 494
-
-
-
- QWidget{
- background: white;
-}
-
-
- Mixture
-
-
-
-
-
-
- false
-
-
- QTabWidget{
- background: rgb(240, 240, 240);
-}
-
-
- QTabWidget::North
-
-
- QTabWidget::Triangular
-
-
- 0
-
-
- Qt::ElideNone
-
-
-
- Amounts
-
-
-
-
-
-
- false
-
-
- 150
-
-
- false
-
-
-
- 1
-
-
-
-
-
-
-
-
- Phase Properties
-
-
- -
-
-
- 3
-
-
- false
-
-
- 100
-
-
- false
-
-
- true
-
-
- false
-
-
-
- Attribute
-
-
-
-
- Value
-
-
-
-
- Unit
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0
- 0
- 335
- 494
-
-
-
- QWidget{
- background: white;
-}
-
-
- Liquid
-
-
- -
-
-
- QTabWidget{
- background: rgb(240, 240, 240);
-}
-
-
- QTabWidget::Triangular
-
-
- 0
-
-
-
- Amounts
-
-
-
-
-
-
- 150
-
-
-
- 1
-
-
-
-
-
-
-
-
- Phase Properties
-
-
- -
-
-
- 3
-
-
- 100
-
-
- true
-
-
-
- Attribute
-
-
-
-
- Value
-
-
-
-
- Unit
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0
- 0
- 335
- 494
-
-
-
- QWidget{
- background: white;
-
-}
-
-
- Vapour
-
-
- -
-
-
- QTabWidget{
- background: rgb(240, 240, 240);
-}
-
-
- QTabWidget::Triangular
-
-
- 0
-
-
-
- Amounts
-
-
-
-
-
-
- 150
-
-
-
- 1
-
-
-
-
-
-
-
-
- Phase Properties
-
-
- -
-
-
- 3
-
-
- 100
-
-
- true
-
-
-
- Attribute
-
-
-
-
- Value
-
-
-
-
- Unit
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/DockWidgetMixer.py b/DockWidgetMixer.py
deleted file mode 100644
index 8a00dcd..0000000
--- a/DockWidgetMixer.py
+++ /dev/null
@@ -1,61 +0,0 @@
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5.uic import loadUiType
-import pandas as pd
-from functools import partial
-from ComponentSelector import *
-from collections import defaultdict
-from Graphics import *
-
-ui_dialog,_ = loadUiType('DockWidgetMixer.ui')
-
-class DockWidgetMixer(QDockWidget,ui_dialog):
-
- def __init__(self,name,comptype,obj,container,parent=None):
- QDockWidget.__init__(self,parent)
- self.setupUi(self)
- self.setWindowTitle(obj.name)
- self.name=name
- self.obj=obj
- self.type = comptype
- self.inputdict = []
- self.x_pclist = []
- print("constructor ", self.inputdict)
- self.inputparamslist()
- self.btn.clicked.connect(self.param)
- self.dict = {}
-
- # input data tab
- def inputparamslist(self):
- try:
- print("inputparamslist ", self.inputdict)
-
- self.l1.setText(self.obj.variables['NOI']['name']+":")
- self.le1.setText(str(self.obj.variables['NOI']['value']))
- self.u1.setText(self.obj.variables['NOI']['unit'])
- for i in self.obj.Pout_modes:
- self.cb2.addItem(str(i))
-
- self.l2.setText(self.obj.variables['Pout']['name']+":")
-
-
- self.inputdict = [self.le1, self.cb2]
-
- except Exception as e:
- print(e)
-
- def Show_Error(self):
- QMessageBox.about(self, 'Important', "Please fill all fields with data")
-
- def param(self):
- try:
- self.dict={}
- print("param.inputdict ", self.inputdict)
- self.dict = [int(self.inputdict[0].text()),self.inputdict[1].currentText()]
- print("param ", self.dict)
- self.obj.paramsetter(self.dict)
- self.hide()
-
- except Exception as e:
- print(e)
\ No newline at end of file
diff --git a/DockWidgetMixer.ui b/DockWidgetMixer.ui
deleted file mode 100644
index e039490..0000000
--- a/DockWidgetMixer.ui
+++ /dev/null
@@ -1,137 +0,0 @@
-
-
- Form
-
-
- true
-
-
-
- 0
- 0
- 392
- 700
-
-
-
-
- 0
- 0
-
-
-
-
- 3200
- 5000
-
-
-
- Form
-
-
-
-
- 10
- 40
- 341
- 101
-
-
-
-
- 0
- 0
-
-
-
- true
-
-
- Calculation Parameters
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
-
- -
-
-
- false
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
- TextLabel
-
-
-
-
-
-
-
-
-
-
- 10
- 150
- 341
- 23
-
-
-
-
- 0
- 0
-
-
-
- Submit
-
-
-
-
-
-
diff --git a/DockWidgetShortcutColumn.py b/DockWidgetShortcutColumn.py
deleted file mode 100644
index 570cdd1..0000000
--- a/DockWidgetShortcutColumn.py
+++ /dev/null
@@ -1,97 +0,0 @@
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5.uic import loadUiType
-import pandas as pd
-from functools import partial
-from ComponentSelector import *
-from collections import defaultdict
-from Graphics import *
-
-ui_dialog,_ = loadUiType('DockWidgetShortcutColumn.ui')
-
-class DockWidgetShortcutColumn(QDockWidget,ui_dialog):
-
- def __init__(self,name,comptype,obj,container,parent=None):
- QDockWidget.__init__(self,parent)
- self.setupUi(self)
- self.setWindowTitle(obj.name)
- self.name=name
- self.obj=obj
- self.type = comptype
- self.inputdict = []
- print("constructor ", self.inputdict)
- self.inputparamslist()
- self.btn.clicked.connect(self.param)
- self.dict = []
-
- self.nameType = None
- self.container = container
-
- # input data tab
- def inputparamslist(self):
- try:
- print("inputparamslist ", self.inputdict)
-
- self.l1.setText(self.obj.variables['HKey']['name']+":")
- print(self.obj.compounds)
- for i in self.obj.compounds:
- self.cb1.addItem(str(i))
- self.cb2.addItem(str(i))
-
- self.l2.setText(self.obj.variables['LKey']['name']+":")
-
- self.l3.setText(self.obj.variables['HKey_x_pc']['name']+":")
- self.le3.setText(str(self.obj.variables['HKey_x_pc']['value']))
- self.u3.setText(self.obj.variables['HKey_x_pc']['unit'])
- self.l4.setText(self.obj.variables['LKey_x_pc']['name']+":")
- self.u4.setText(self.obj.variables['LKey_x_pc']['unit'])
- self.le4.setText(str(self.obj.variables['LKey_x_pc']['value']))
-
- self.l5.setText(self.obj.variables['Ctype']['name']+":")
- self.cb5.addItem('Total')
- self.cb5.addItem('Partial')
-
- self.l6.setText(self.obj.variables['Pcond']['name']+":")
- self.le6.setText(str(self.obj.variables['Pcond']['value']))
- self.u6.setText(self.obj.variables['Pcond']['unit'])
- self.l7.setText(self.obj.variables['Preb']['name']+":")
- self.u7.setText(self.obj.variables['Preb']['unit'])
- self.le7.setText(str(self.obj.variables['Preb']['value']))
-
- self.l8.setText(self.obj.variables['RR']['name']+":")
- self.le8.setText(str(self.obj.variables['RR']['value']))
-
- self.inputdict = [self.cb1, self.cb2, self.le3, self.le4, self.cb5, self.le6, self.le7, self.le8]
-
- except Exception as e:
- print(e)
-
- def Show_Error(self):
- QMessageBox.about(self, 'Important', "Please fill all fields with data")
-
- def param(self):
- try:
- self.dict=[]
- print("param.inputdict ", self.inputdict)
- self.dict = [self.inputdict[0].currentText(),self.inputdict[1].currentText(),float(self.inputdict[2].text()), float(self.inputdict[3].text()),
- self.inputdict[4].currentText(), float(self.inputdict[5].text()), float(self.inputdict[6].text()), float(self.inputdict[7].text())]
-
- print("param ", self.dict)
- self.obj.paramsetter(self.dict)
- self.hide()
-
- except Exception as e:
- print(e)
-
-
- @staticmethod
- def showResult(lst):
- #DockWidget1.flag = True
- for i in lst:
- i.resultsCategory(i.name)
- #i.show()
-
- # result data tab
- def resultsCategory(self,name):
- pass
\ No newline at end of file
diff --git a/DockWidgetShortcutColumn.ui b/DockWidgetShortcutColumn.ui
deleted file mode 100644
index c66e699..0000000
--- a/DockWidgetShortcutColumn.ui
+++ /dev/null
@@ -1,295 +0,0 @@
-
-
- Form
-
-
- true
-
-
-
- 0
- 0
- 392
- 700
-
-
-
-
- 0
- 0
-
-
-
-
- 3200
- 5000
-
-
-
- Form
-
-
-
-
- 10
- 40
- 351
- 321
-
-
-
- 0
-
-
-
- Input Data
-
-
-
-
- 8
- 13
- 331
- 237
-
-
-
-
- 0
- 0
-
-
-
- Calculation Parameters
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
-
-
-
-
-
- 10
- 250
- 331
- 23
-
-
-
-
- 0
- 0
-
-
-
- Submit
-
-
-
-
-
- Results
-
-
-
-
-
-
-
diff --git a/DockWidgetSplitter.py b/DockWidgetSplitter.py
deleted file mode 100644
index 9327e16..0000000
--- a/DockWidgetSplitter.py
+++ /dev/null
@@ -1,78 +0,0 @@
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5.uic import loadUiType
-import pandas as pd
-from functools import partial
-from ComponentSelector import *
-from collections import defaultdict
-from Graphics import *
-
-ui_dialog,_ = loadUiType('DockWidgetSplitter.ui')
-
-class DockWidgetSplitter(QDockWidget,ui_dialog):
-
- def __init__(self,name,comptype,obj,container,parent=None):
- QDockWidget.__init__(self,parent)
- self.setupUi(self)
- self.setWindowTitle(obj.name)
- self.name=name
- self.obj=obj
- self.type = comptype
- self.inputdict = []
- print("constructor ", self.inputdict)
- self.inputparamslist()
- self.btn.clicked.connect(self.param)
- self.dict = {}
-
- # input data tab
- def inputparamslist(self):
- try:
- print("inputparamslist ", self.inputdict)
-
- self.l1.setText(self.obj.variables['NOO']['name']+":")
- self.le1.setText(str(self.obj.variables['NOO']['value']))
- self.u1.setText(self.obj.variables['NOO']['unit'])
-
- for i in self.obj.CalcType_modes:
- self.cb2.addItem(str(i))
-
- self.l2.setText(self.obj.variables['CalcType']['name']+":")
-
- self.l3.setText("Stream 1 :")
- self.u3.setText('')
- self.l4.setText("Stream 2 :")
- self.u4.setText('')
- self.cb2.currentIndexChanged.connect(self.fun)
-
-
- self.inputdict = [self.le1, self.cb2, self.le3, self.le4]
-
- except Exception as e:
- print(e)
-
- def fun(self):
- if self.cb2.currentText() == 'Mole Flow Specs':
- self.u3.setText('mol/s')
- self.u4.setText('mol/s')
- elif self.cb2.currentText() == 'Mass Flow Specs':
- self.u3.setText('kg/s')
- self.u4.setText('kg/s')
- else:
- self.u3.setText('')
- self.u4.setText('')
-
- def Show_Error(self):
- QMessageBox.about(self, 'Important', "Please fill all fields with data")
-
- def param(self):
- try:
- self.dict={}
- print("param.inputdict ", self.inputdict)
- self.dict = [int(self.inputdict[0].text()),self.inputdict[1].currentText(), float(self.inputdict[2].text()), float(self.inputdict[3].text())]
- print("param ", self.dict)
- self.obj.paramsetter(self.dict)
- self.hide()
-
- except Exception as e:
- print(e)
diff --git a/DockWidgetSplitter.ui b/DockWidgetSplitter.ui
deleted file mode 100644
index 02a865e..0000000
--- a/DockWidgetSplitter.ui
+++ /dev/null
@@ -1,200 +0,0 @@
-
-
- Form
-
-
- true
-
-
-
- 0
- 0
- 392
- 700
-
-
-
-
- 0
- 0
-
-
-
-
- 3200
- 5000
-
-
-
- Form
-
-
-
-
- 10
- 40
- 341
- 161
-
-
-
-
- 0
- 0
-
-
-
- true
-
-
- Q
-
-
- Calculation Parameters
-
-
- -
-
-
-
-
-
- TextLabel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
-
- -
-
-
- false
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TextLabel
-
-
-
-
-
-
-
-
-
-
- 10
- 210
- 341
- 23
-
-
-
-
- 0
- 0
-
-
-
- Submit
-
-
-
-
-
-
diff --git a/DockWidgets/DockWidget.py b/DockWidgets/DockWidget.py
new file mode 100644
index 0000000..6fc7731
--- /dev/null
+++ b/DockWidgets/DockWidget.py
@@ -0,0 +1,220 @@
+from PyQt5.QtCore import *
+from PyQt5.QtWidgets import *
+from PyQt5.QtGui import *
+from PyQt5.uic import loadUiType
+import pandas as pd
+from functools import partial
+from ComponentSelector import *
+from collections import defaultdict
+from Graphics import *
+
+ui_dialog,_ = loadUiType('DockWidgets/DockWidget.ui')
+
+class DockWidget(QDockWidget,ui_dialog):
+
+ def __init__(self,name,comptype,obj,container, parent=None):
+ QDockWidget.__init__(self,parent)
+ self.setupUi(self)
+ self.setWindowTitle(obj.name)
+ self.name=name
+ self.obj=obj
+ self.type = comptype
+ self.input_dict = {}
+ self.x_pclist = []
+ self.modes()
+ self.comboBox.currentIndexChanged.connect(self.mode_selection)
+
+ print("constructor ", self.input_dict)
+ self.pushButton_2.clicked.connect(self.param)
+ self.dict = {}
+
+ self.name_type = None
+ self.container = container
+
+ # input data tab
+ def modes(self):
+ modes_list = self.obj.modes_list
+ if(modes_list):
+ for j in modes_list:
+ self.comboBox.addItem(str(self.obj.variables[j]['name']))
+ self.mode_selection()
+ else:
+ self.comboBox.setDisabled(True)
+ self.input_dict= {}
+ self.input_dict = self.obj.param_getter()
+ self.input_params_list()
+
+ def mode_selection(self):
+ self.input_dict= {}
+ for i in reversed(range(self.formLayout.count())):
+ self.formLayout.removeRow(i)
+ print(self.comboBox.currentText())
+ for i in self.obj.variables:
+ if self.obj.variables[i]['name'] == self.comboBox.currentText():
+ currentText = i
+ break
+ self.input_dict = self.obj.param_getter(currentText)
+ print('mode selection ', self.input_dict)
+ self.input_params_list()
+
+ def input_params_list(self):
+ try:
+ print("input_params_list ", self.input_dict)
+ for c,i in enumerate(self.input_dict):
+ if i == None:
+ continue
+ if(i=="thermo_package"):
+ print("thermo1")
+ combo = QComboBox()
+ self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
+ print("thermo2")
+ for j in self.lines:
+ combo.addItem(str(j))
+ combo.setMinimumContentsLength(15)
+ lay = QGridLayout()
+ lay.addWidget(QLabel(i+":"), 0,0, alignment=Qt.AlignLeft)
+ lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(''), 0, 2, alignment = Qt.AlignCenter)
+ self.formLayout.addRow(lay)
+ self.input_dict[i] = combo
+ print("thermo")
+ elif(i=="Ctype"):
+ combo = QComboBox()
+ self.lines = ["Total","Partial"]
+ for j in self.lines:
+ combo.addItem(str(j))
+ combo.setMinimumContentsLength(15)
+ lay = QGridLayout()
+ lay.addWidget(QLabel("Condensor Type :"), 0, 0, alignment=Qt.AlignLeft)
+ lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(''), 0, 2, alignment = Qt.AlignCenter)
+ self.formLayout.addRow(lay)
+ self.input_dict[i] = combo
+ elif(i=="x_pc"):
+ noc = len(compound_selected)
+ print(noc)
+ self.x_pclist.clear()
+ gp = QGroupBox("Compounds")
+ lay = QGridLayout()
+ for j in range(noc):
+ l = QLineEdit()
+ self.input_dict[i] = "x_pc"
+ lay.addWidget(QLabel(str(compound_selected[j])+":"),j,0, alignment=Qt.AlignLeft)
+ lay.addWidget(l,j,1, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(self.obj.variables[i]['unit']),j,2, alignment=Qt.AlignCenter)
+ self.x_pclist.append(l)
+ gp.setLayout(lay)
+ self.formLayout.addRow(gp)
+ else:
+ print("elseloop")
+ print(i)
+ if i == None:
+ continue
+ l = QLineEdit()
+ if self.input_dict[i] != None:
+ l.setText(str(self.input_dict[i]))
+ print('before lay')
+ lay = QGridLayout()
+ lay.addWidget(QLabel(self.obj.variables[i]['name']+":"),0,0, alignment=Qt.AlignLeft) #self.obj.variables[i]['name']
+ lay.addWidget(l,0,1, alignment=Qt.AlignCenter)
+ print('after lay')
+ if(i != 'MolFlow'):
+ lay.addWidget(QLabel(self.obj.variables[i]['unit']),0,2, alignment=Qt.AlignCenter)
+ else:
+ lay.addWidget(QLabel('mol/s'),0,2, alignment=Qt.AlignCenter)
+ print('after all')
+ self.formLayout.addRow(lay)
+ self.input_dict[i] = l
+
+
+ except Exception as e:
+ print(e)
+
+ def show_error(self):
+ QMessageBox.about(self, 'Important', "Please fill all fields with data")
+
+ def param(self):
+ try:
+ self.dict={}
+ print("param.input_dict ", self.input_dict)
+ for i in self.input_dict:
+ if (self.input_dict[i] == None):
+ continue
+ if(i=="thermo_package"):
+ if (self.input_dict[i].currentText()):
+ self.dict[i] = self.input_dict[i].currentText()
+ else:
+ self.show_error()
+ break
+ elif(i=="Ctype"):
+ if (self.input_dict[i].currentText()):
+ self.dict[i] = self.input_dict[i].currentText()
+ else:
+ self.show_error()
+ break
+ elif(i =="x_pc"):
+ l=[]
+ mf = []
+ total_moles = 0
+ for mol_frac in self.x_pclist:
+ if (mol_frac.text()):
+ l.append(mol_frac.text())
+ total_moles += float(l[-1])
+ else:
+ self.show_error()
+ break
+ for c in range(len(compound_selected)):
+ mf.append(str(float(l[c])/total_moles))
+ self.x_pclist[c].setText(mf[-1])
+ self.dict[i] = ",".join(mf)
+ elif(i == 'Pout' and self.obj.type == 'Mixer' or i == '' or i == 'HKey' or i == 'LKey'):
+ self.dict[i] = self.input_dict[i].currentText()
+ else:
+ print(self.input_dict[i], i, self.obj.type)
+ if (self.input_dict[i].text()):
+ self.dict[i] = self.input_dict[i].text()
+ else:
+ print(self.input_dict[i].text())
+ self.show_error()
+ break
+
+ print("param ", self.dict)
+ self.obj.param_setter(self.dict)
+ self.hide()
+
+ except Exception as e:
+ print(e)
+
+ @staticmethod
+ def show_result(lst):
+ #DockWidget1.flag = True
+ for i in lst:
+ i.results_category(i.name)
+ #i.show()
+
+ # result data tab
+ def results_category(self,name):
+ flag = True
+ try:
+ print("Under result category name ", name)
+ result=self.container.result
+ obj = self.container.fetch_object(name)
+ self.tableWidget.setRowCount(0)
+ variKeys = list(obj.variables.keys())
+ print(variKeys)
+ for i, val in enumerate(variKeys):
+ propertyname = name + '.' + val
+ print(i,val, propertyname)
+ if propertyname in result[0]:
+ ind = result[0].index(propertyname)
+ resultval = str(result[-1][ind])
+ print("######Resultsfetch####",val,resultval)
+ rowPosition = self.tableWidget.rowCount()
+ self.tableWidget.insertRow(rowPosition)
+ self.tableWidget.setItem(rowPosition , 0, QTableWidgetItem(obj.variables[val]['name']))
+ self.tableWidget.setItem(rowPosition , 1, QTableWidgetItem(resultval))
+ self.tableWidget.setItem(rowPosition , 2, QTableWidgetItem(obj.variables[val]['unit']))
+ self.tableWidget.resizeColumnsToContents()
+
+ except Exception as e:
+ print(e)
\ No newline at end of file
diff --git a/DockWidgets/DockWidget.txt b/DockWidgets/DockWidget.txt
new file mode 100644
index 0000000..b14eef8
--- /dev/null
+++ b/DockWidgets/DockWidget.txt
@@ -0,0 +1,636 @@
+from PyQt5.QtCore import *
+from PyQt5.QtWidgets import *
+from PyQt5.QtGui import *
+from PyQt5.uic import loadUiType
+import pandas as pd
+from functools import partial
+from component_selector import *
+from collections import defaultdict
+from Graphics import *
+
+ui_dialog,_ = loadUiType('DockWidget.ui')
+
+class DockWidget(QDockWidget,ui_dialog):
+
+ def __init__(self,name,comptype,obj,container,parent=None):
+ QDockWidget.__init__(self,parent)
+ self.setupUi(self)
+ self.setWindowTitle(obj.name)
+ self.name=name
+ self.obj=obj
+ self.type = comptype
+ self.inputdict = {}
+ self.x_pclist = []
+ self.modes()
+ self.comboBox.currentIndexChanged.connect(self.modeSelection)
+
+ print("constructor ", self.inputdict)
+ self.pushButton_2.clicked.connect(self.param)
+ self.dict = {}
+
+ self.nameType = None
+ self.container = container
+
+ header = QTreeWidgetItem(['Compound','Value','Unit'])
+ self.mTreeWidget.setHeaderItem(header)
+ self.lTreeWidget.setHeaderItem(header)
+ self.vTreeWidget.setHeaderItem(header)
+
+ self.mTreeWidget.itemClicked.connect(lambda : self.printer(self.mTreeWidget.currentItem()))
+ self.lTreeWidget.itemClicked.connect(lambda : self.printer(self.lTreeWidget.currentItem()))
+ self.vTreeWidget.itemClicked.connect(lambda : self.printer(self.vTreeWidget.currentItem()))
+
+ def printer(self, treeItem ):
+ foldername = treeItem.text(0)
+ comment = treeItem.text(1)
+ data = treeItem.text(2)
+ print(foldername , ': ' , comment , ' (' + data + ')')
+
+ # input data tab
+ def modes(self):
+ modesList = self.obj.modesList
+ if(modesList):
+ for j in modesList:
+ self.comboBox.addItem(str(self.obj.variables[j]['name']))
+ self.modeSelection()
+ else:
+ self.comboBox.setDisabled(True)
+ self.inputdict= {}
+ self.inputdict = self.obj.paramgetter()
+ self.inputparamslist()
+
+ def modeSelection(self):
+ self.inputdict= {}
+ for i in reversed(range(self.formLayout.count())):
+ self.formLayout.removeRow(i)
+ print(self.comboBox.currentText())
+ for i in self.obj.variables:
+ if self.obj.variables[i]['name'] == self.comboBox.currentText():
+ currentText = i
+ break
+ self.inputdict = self.obj.paramgetter(currentText)
+ print('mode selection ', self.inputdict)
+ self.inputparamslist()
+
+ def inputparamslist(self):
+ try:
+ print("inputparamslist ", self.inputdict)
+ for c,i in enumerate(self.inputdict):
+ if i == None:
+ continue
+ if(i=="thermoPackage"):
+ print("thermo1")
+ combo = QComboBox()
+ self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
+ print("thermo2")
+ for j in self.lines:
+ combo.addItem(str(j))
+ combo.setMinimumContentsLength(15)
+ lay = QGridLayout()
+ lay.addWidget(QLabel(i+":"), 0,0, alignment=Qt.AlignLeft)
+ lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(''), 0, 2, alignment = Qt.AlignCenter)
+ self.formLayout.addRow(lay)
+ self.inputdict[i] = combo
+ print("thermo")
+ elif(i=="Ctype"):
+ combo = QComboBox()
+ self.lines = ["Total","Partial"]
+ for j in self.lines:
+ combo.addItem(str(j))
+ combo.setMinimumContentsLength(15)
+ lay = QGridLayout()
+ lay.addWidget(QLabel("Condensor Type :"), 0, 0, alignment=Qt.AlignLeft)
+ lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(''), 0, 2, alignment = Qt.AlignCenter)
+ self.formLayout.addRow(lay)
+ self.inputdict[i] = combo
+ elif(i=="x_pc"):
+ noc = len(compound_selected)
+ print(noc)
+ self.x_pclist.clear()
+ gp = QGroupBox("Compounds")
+ lay = QGridLayout()
+ for j in range(noc):
+ l = QLineEdit()
+ self.inputdict[i] = "x_pc"
+ lay.addWidget(QLabel(str(compound_selected[j])+":"),j,0, alignment=Qt.AlignLeft)
+ lay.addWidget(l,j,1, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(self.obj.variables[i]['unit']),j,2, alignment=Qt.AlignCenter)
+ self.x_pclist.append(l)
+ gp.setLayout(lay)
+ self.formLayout.addRow(gp)
+ elif (self.obj.type == 'Mixer' and i == 'Pout'):
+ combo = QComboBox()
+ print("Mixer combo")
+ for j in self.obj.Pout_modes:
+ combo.addItem(str(j))
+ combo.setMinimumContentsLength(15)
+ lay = QGridLayout()
+ lay.addWidget(QLabel(self.obj.variables[i]['name']+":"), 0,0, alignment=Qt.AlignLeft)
+ lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(self.obj.variables[i]['unit']),0,2, alignment=Qt.AlignCenter)
+ self.formLayout.addRow(lay)
+ self.inputdict[i] = combo
+ elif (self.obj.type == 'Splitter' and i == 'CalcType'):
+ combo = QComboBox()
+ print("Splitter combo")
+ for j in self.obj.CalcType_modes:
+ combo.addItem(str(j))
+ combo.setMinimumContentsLength(15)
+ stream1 = QLineEdit()
+ stream2 = QLineEdit()
+ unit = QLabel('')
+ lay = QGridLayout()
+ lay.addWidget(QLabel(self.obj.variables[i]['name']+":"), 0,0, alignment=Qt.AlignLeft)
+ lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(self.obj.variables[i]['unit']),0,2, alignment=Qt.AlignCenter)
+
+ lay.addWidget(QLabel("Stream 1 : "), 1,0, alignment = Qt.AlignLeft)
+ lay.addWidget(stream1, 1,1, alignment = Qt.AlignCenter)
+ lay.addWidget(unit, 1,2, alignment = Qt.AlignRight)
+
+ lay.addWidget(QLabel("Stream 2 : "), 2,0, alignment = Qt.AlignLeft)
+ lay.addWidget(stream2, 2,1, alignment = Qt.AlignCenter)
+ lay.addWidget(unit, 2,2, alignment = Qt.AlignRight)
+ self.formLayout.addRow(lay)
+ print("daf ", self.formLayout)
+ #combo.currentIndexChanged.connect(lambda:self.SplitterStreams(combo, lay, unit))
+ lst = [combo, stream1, stream2]
+ #lst = [combo.currentText(), stream1.text(), stream2.text()]
+ self.inputdict[i] = lst
+ # self.inputdict[i] = stream1
+ # self.inputdict[i] = stream2
+ print(self.inputdict[i])
+ elif i == 'HKey' or i == 'LKey':
+ combo = QComboBox()
+ print("ShortcutColumn combo")
+ for j in self.obj.compounds:
+ combo.addItem(str(j))
+ combo.setMinimumContentsLength(15)
+ lay = QGridLayout()
+ lay.addWidget(QLabel(self.obj.variables[i]['name']+":"), 0,0, alignment=Qt.AlignLeft)
+ lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(self.obj.variables[i]['unit']),0,2, alignment=Qt.AlignCenter)
+ self.formLayout.addRow(lay)
+ self.inputdict[i] = combo
+ elif self.obj.type == 'CompoundSeparator' and i == 'SepStrm':
+ print(i)
+ rlay = QHBoxLayout()
+ r1 = QRadioButton('Stream 1')
+ r1.setChecked(True)
+ r2 = QRadioButton('Stream 2')
+ r2.setChecked(False)
+ rlay.addWidget(r1)
+ rlay.addWidget(r2)
+ self.formLayout.addRow(rlay)
+
+ lst = [r1, r2]
+
+ lay = QGridLayout()
+ for k,val in enumerate(self.obj.compounds):
+ combo = QComboBox()
+ print("CompoundSeparator combo")
+ for j in self.obj.SepFact_modes:
+ combo.addItem(str(j))
+ l = QLineEdit()
+ lay.addWidget(QLabel(val+" :"), k,0, alignment=Qt.AlignLeft)
+ lay.addWidget(combo, k, 1, alignment=Qt.AlignCenter)
+ lay.addWidget(l,k,2, alignment=Qt.AlignCenter)
+ lst.append(combo)
+ lst.append(l)
+ self.inputdict[i] = lst
+ self.formLayout.addRow(lay)
+ elif self.obj.type == 'Flash' and i == 'Bdef':
+ print(i)
+ # rlay = QHBoxLayout()
+ r1 = QCheckBox()
+ r1.setChecked(False)
+ r2 = QCheckBox()
+ r2.setChecked(False)
+ # rlay.addWidget(r1)
+ # rlay.addWidget(r2)
+ # self.formLayout.addRow(rlay)
+
+ l1 = QLineEdit()
+ l1.setText(str(self.obj.variables['Tdef']['value']))
+ l2 = QLineEdit()
+ l2.setText(str(self.obj.variables['Pdef']['value']))
+ lay = QGridLayout()
+ lay.addWidget(r1, 0,0, alignment = Qt.AlignLeft)
+ lay.addWidget(QLabel(self.obj.variables['Tdef']['name']+":"), 0,1, alignment=Qt.AlignLeft)
+ lay.addWidget(l1, 0, 2, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(self.obj.variables['Tdef']['unit']),0,3, alignment=Qt.AlignRight)
+ l1.setDisabled(True)
+
+ lay.addWidget(r2, 2,0, alignment = Qt.AlignLeft)
+ lay.addWidget(QLabel(self.obj.variables['Pdef']['name']+":"), 2,1, alignment=Qt.AlignLeft)
+ lay.addWidget(l2, 2, 2, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(self.obj.variables['Pdef']['unit']),2,3, alignment=Qt.AlignRight)
+ self.formLayout.addRow(lay)
+ l2.setDisabled(True)
+ r1.toggled.connect(lambda:l1.setDisabled(not r1.isChecked()))
+ r2.toggled.connect(lambda:l2.setDisabled(not r2.isChecked()))
+
+ self.inputdict[i] = [r1, r2, l1, l2]
+ else:
+ print("elseloop")
+ print(i)
+ if i == None:
+ continue
+ l = QLineEdit()
+ if self.inputdict[i] != None:
+ l.setText(str(self.inputdict[i]))
+ print('before lay')
+ lay = QGridLayout()
+ lay.addWidget(QLabel(self.obj.variables[i]['name']+":"),0,0, alignment=Qt.AlignLeft) #self.obj.variables[i]['name']
+ lay.addWidget(l,0,1, alignment=Qt.AlignCenter)
+ print('after lay')
+ if(i != 'MolFlow'):
+ lay.addWidget(QLabel(self.obj.variables[i]['unit']),0,2, alignment=Qt.AlignCenter)
+ else:
+ lay.addWidget(QLabel('mol/s'),0,2, alignment=Qt.AlignCenter)
+ print('after all')
+ self.formLayout.addRow(lay)
+ self.inputdict[i] = l
+
+
+ except Exception as e:
+ print(e)
+
+ def Show_Error(self):
+ QMessageBox.about(self, 'Important', "Please fill all fields with data")
+
+ def param(self):
+ try:
+ self.dict={}
+ print("param.inputdict ", self.inputdict)
+ for i in self.inputdict:
+ if (self.inputdict[i] == None):
+ continue
+
+ if(i=="thermoPackage"):
+ if (self.inputdict[i].currentText()):
+ self.dict[i] = self.inputdict[i].currentText()
+ else:
+ self.Show_Error()
+ break
+ elif(i=="Ctype"):
+ if (self.inputdict[i].currentText()):
+ self.dict[i] = self.inputdict[i].currentText()
+ else:
+ self.Show_Error()
+ break
+ elif(i =="x_pc"):
+ l=[]
+ mf = []
+ total_moles = 0
+ for mol_frac in self.x_pclist:
+ if (mol_frac.text()):
+ l.append(mol_frac.text())
+ total_moles += float(l[-1])
+ else:
+ self.Show_Error()
+ break
+ for c in range(len(compound_selected)):
+ mf.append(str(float(l[c])/total_moles))
+ self.x_pclist[c].setText(mf[-1])
+ self.dict[i] = ",".join(mf)
+ elif(i == 'Pout' and self.obj.type == 'Mixer' or i == '' or i == 'HKey' or i == 'LKey'):
+ self.dict[i] = self.inputdict[i].currentText()
+ elif i == 'CalcType' and self.obj.type == 'Splitter':
+ self.dict[i] = [self.inputdict[i][0].currentText(), self.inputdict[i][1].text(), self.inputdict[i][2].text()]
+ elif self.obj.type == 'Flash' and i == 'Bdef':
+ self.dict[i] = [self.inputdict[i][0].isChecked(), self.inputdict[i][1].isChecked(), self.inputdict[i][2].text(), self.inputdict[i][3].text()]
+ elif self.obj.type == 'CompoundSeparator':
+ self.dict[i] = [self.inputdict[i][0].isChecked(),self.inputdict[i][1].isChecked()]
+ j = 2
+ for comp in self.obj.compounds:
+ self.dict[i].append(self.inputdict[i][j].currentText())
+ self.dict[i].append(self.inputdict[i][j+1].text())
+ j += 2
+ else:
+ print(self.inputdict[i], i, self.obj.type)
+ if (self.inputdict[i].text()):
+ self.dict[i] = self.inputdict[i].text()
+ else:
+ print(self.inputdict[i].text())
+ self.Show_Error()
+ break
+
+ print("param ", self.dict)
+ self.obj.paramsetter(self.dict)
+ self.hide()
+
+ except Exception as e:
+ print(e)
+
+
+ @staticmethod
+ def showResult(lst):
+ #DockWidget1.flag = True
+ for i in lst:
+ i.resultsCategory(i.name)
+ #i.show()
+
+ # result data tab
+ def resultsCategory(self,name):
+ flag = True
+ try:
+ print("Under result category name ", name)
+ result=self.container.result
+ obj = self.container.fetchObject(name)
+
+ d = {"Mole Fraction":"x_pc", "Mass Fraction":"xm_pc", "Mole Flow":"F_pc", "Mass Flow":"Fm_pc"}
+ lst = list(d.keys())
+ klst = list(d.values())
+
+ p = {"Pressure":"P", "Temperature":"T","Vapour Phase Mole Fraction":"xvap", "Phase Molar Enthalpy":"H_p",
+ "Phase Molar Entropy":"S_p", "Molar Flow Rate":"F_p"}
+
+ # Amounts Tab
+ if obj.type == 'MaterialStream':
+ l = [] # list for basis names
+ for basis in d:
+ propertyname = name + '.' + d[basis]
+ print("basis ", basis, propertyname)
+ for i in result[0]:
+ if (propertyname in i):
+ l.append(i)
+ print(l)
+
+ j = 0
+ t = 0
+ namee = klst[j]
+ print("namee ", namee)
+
+ for i,k in enumerate(l):
+ ind = result[0].index(k)
+ print("index ", ind)
+ print("str ", k)
+ resultval = str(result[-1][ind])
+ print("######Resultsfetch####",resultval)
+ print(k[k.find(".")+1:k.find("[")])
+ obj.variables[k.split('.')[1]]['value'] = resultval
+ if namee in k:
+ if i%3 == 0:
+ if(flag):
+ mroot = QTreeWidgetItem(self.mTreeWidget, [lst[j]])
+ child = QTreeWidgetItem(mroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
+ elif i%3 == 1:
+ if(flag):
+ lroot = QTreeWidgetItem(self.lTreeWidget, [lst[j]])
+ child = QTreeWidgetItem(lroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
+ elif i%3 == 2:
+ if (flag):
+ vroot = QTreeWidgetItem(self.vTreeWidget, [lst[j]])
+ child = QTreeWidgetItem(vroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
+ t += 1
+ flag = False
+ else:
+ j += 1
+ t = 0
+ namee = klst[j]
+ flag = True
+ if i%3 == 0:
+ if (flag):
+ mroot = QTreeWidgetItem(self.mTreeWidget, [lst[j]])
+ child = QTreeWidgetItem(mroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
+ elif i%3 == 1:
+ if (flag):
+ lroot = QTreeWidgetItem(self.lTreeWidget, [lst[j]])
+ child = QTreeWidgetItem(lroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
+ elif i%3 == 2:
+ if (flag):
+ vroot = QTreeWidgetItem(self.vTreeWidget, [lst[j]])
+ child = QTreeWidgetItem(vroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
+ t += 1
+ flag = False
+ #print(obj.variables)
+
+ # Phase Properties Tab
+ phaseResLst = []
+ for phase in p:
+ propertyname = name + '.' + p[phase]
+ print("phase ", phase, propertyname)
+ for i in result[0]:
+ if i.find('['):
+ if (propertyname == i[0:i.find('[')]):
+ phaseResLst.append(i)
+ if propertyname == i:
+ phaseResLst.append(i)
+ print(phaseResLst)
+
+ self.mTableWidget.setRowCount(0)
+ self.lTableWidget.setRowCount(0)
+ self.vTableWidget.setRowCount(0)
+
+ for i,val in enumerate(phaseResLst):
+ ind = result[0].index(val)
+ resultval = str(result[-1][ind])
+ print(resultval, i, val)
+ obj.variables[val.split('.')[1]]['value'] = resultval
+ if '[' in val:
+ print(val)
+ temp = val[val.find('.')+1:val.find('[')]
+ print(temp)
+ if '1' in val.split('.')[1]:
+ print(obj.variables[val.split('.')[1]]['name'])
+ mrowPosition = self.mTableWidget.rowCount()
+ self.mTableWidget.insertRow(mrowPosition)
+ self.mTableWidget.setItem(mrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
+ self.mTableWidget.setItem(mrowPosition , 1, QTableWidgetItem(resultval))
+ self.mTableWidget.setItem(mrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
+ self.mTableWidget.resizeColumnsToContents()
+
+ if '2' in val.split('.')[1]:
+ lrowPosition = self.lTableWidget.rowCount()
+ self.lTableWidget.insertRow(lrowPosition)
+ self.lTableWidget.setItem(lrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
+ self.lTableWidget.setItem(lrowPosition , 1, QTableWidgetItem(resultval))
+ self.lTableWidget.setItem(lrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
+ self.lTableWidget.resizeColumnsToContents()
+ if '3' in val.split('.')[1]:
+ vrowPosition = self.vTableWidget.rowCount()
+ self.vTableWidget.insertRow(vrowPosition)
+ self.vTableWidget.setItem(vrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
+ self.vTableWidget.setItem(vrowPosition , 1, QTableWidgetItem(resultval))
+ self.vTableWidget.setItem(vrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
+ self.vTableWidget.resizeColumnsToContents()
+ if not '[' in val:
+ #print(p[val.split('.')[1]])
+ print(obj.variables[val.split('.')[1]]['name'])
+ mrowPosition = self.mTableWidget.rowCount()
+ self.mTableWidget.insertRow(mrowPosition)
+ self.mTableWidget.setItem(mrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
+ self.mTableWidget.setItem(mrowPosition , 1, QTableWidgetItem(resultval))
+ self.mTableWidget.setItem(mrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
+ self.mTableWidget.resizeColumnsToContents()
+
+ print(obj.variables)
+
+ except Exception as e:
+ print(e)
+
+
+class DockWidgetFlash(DockWidget):
+
+ def __init__(self,name,comptype,obj,container,parent=None):
+ DockWidget.__init__(self,name,comptype,obj,container,parent=None)
+
+ def inputparamslist(self):
+ try:
+ print("inputparamslist ", self.inputdict)
+ for c,i in enumerate(self.inputdict):
+ if i == None:
+ continue
+ if(i=="thermoPackage"):
+ print("thermo1")
+ combo = QComboBox()
+ self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
+ print("thermo2")
+ for j in self.lines:
+ combo.addItem(str(j))
+ combo.setMinimumContentsLength(15)
+ lay = QGridLayout()
+ lay.addWidget(QLabel(i+":"), 0,0, alignment=Qt.AlignLeft)
+ lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(''), 0, 2, alignment = Qt.AlignCenter)
+ self.formLayout.addRow(lay)
+ self.inputdict[i] = combo
+ print("thermo")
+ elif self.obj.type == 'Flash' and i == 'Bdef':
+ print(i)
+ r1 = QCheckBox()
+ r1.setChecked(False)
+ r2 = QCheckBox()
+ r2.setChecked(False)
+
+ l1 = QLineEdit()
+ l1.setText(str(self.obj.variables['Tdef']['value']))
+ l2 = QLineEdit()
+ l2.setText(str(self.obj.variables['Pdef']['value']))
+ lay = QGridLayout()
+ lay.addWidget(r1, 0,0, alignment = Qt.AlignLeft)
+ lay.addWidget(QLabel(self.obj.variables['Tdef']['name']+":"), 0,1, alignment=Qt.AlignLeft)
+ lay.addWidget(l1, 0, 2, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(self.obj.variables['Tdef']['unit']),0,3, alignment=Qt.AlignRight)
+ l1.setDisabled(True)
+
+ lay.addWidget(r2, 2,0, alignment = Qt.AlignLeft)
+ lay.addWidget(QLabel(self.obj.variables['Pdef']['name']+":"), 2,1, alignment=Qt.AlignLeft)
+ lay.addWidget(l2, 2, 2, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(self.obj.variables['Pdef']['unit']),2,3, alignment=Qt.AlignRight)
+ self.formLayout.addRow(lay)
+ l2.setDisabled(True)
+ r1.toggled.connect(lambda:l1.setDisabled(not r1.isChecked()))
+ r2.toggled.connect(lambda:l2.setDisabled(not r2.isChecked()))
+
+ self.inputdict[i] = [r1, r2, l1, l2]
+ except Exception as e:
+ print(e)
+
+ def param(self):
+ try:
+ self.dict={}
+ print("param.inputdict ", self.inputdict)
+ for i in self.inputdict:
+ if (self.inputdict[i] == None):
+ continue
+
+ if(i=="thermoPackage"):
+ if (self.inputdict[i].currentText()):
+ self.dict[i] = self.inputdict[i].currentText()
+ else:
+ self.Show_Error()
+ break
+ elif self.obj.type == 'Flash' and i == 'Bdef':
+ self.dict[i] = [self.inputdict[i][0].isChecked(), self.inputdict[i][1].isChecked(), self.inputdict[i][2].text(), self.inputdict[i][3].text()]
+
+ print("param ", self.dict)
+ self.obj.paramsetter(self.dict)
+ self.hide()
+
+ except Exception as e:
+ print(e)
+
+class DockWidgetFlash(DockWidget):
+
+ def __init__(self,name,comptype,obj,container,parent=None):
+ DockWidget.__init__(self,name,comptype,obj,container,parent=None)
+
+ def inputparamslist(self):
+ try:
+ print("inputparamslist ", self.inputdict)
+ for c,i in enumerate(self.inputdict):
+ if i == None:
+ continue
+ if(i=="thermoPackage"):
+ print("thermo1")
+ combo = QComboBox()
+ self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
+ print("thermo2")
+ for j in self.lines:
+ combo.addItem(str(j))
+ combo.setMinimumContentsLength(15)
+ lay = QGridLayout()
+ lay.addWidget(QLabel(i+":"), 0,0, alignment=Qt.AlignLeft)
+ lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(''), 0, 2, alignment = Qt.AlignCenter)
+ self.formLayout.addRow(lay)
+ self.inputdict[i] = combo
+ print("thermo")
+ elif self.obj.type == 'Flash' and i == 'Bdef':
+ print(i)
+ r1 = QCheckBox()
+ r1.setChecked(False)
+ r2 = QCheckBox()
+ r2.setChecked(False)
+
+ l1 = QLineEdit()
+ l1.setText(str(self.obj.variables['Tdef']['value']))
+ l2 = QLineEdit()
+ l2.setText(str(self.obj.variables['Pdef']['value']))
+ lay = QGridLayout()
+ lay.addWidget(r1, 0,0, alignment = Qt.AlignLeft)
+ lay.addWidget(QLabel(self.obj.variables['Tdef']['name']+":"), 0,1, alignment=Qt.AlignLeft)
+ lay.addWidget(l1, 0, 2, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(self.obj.variables['Tdef']['unit']),0,3, alignment=Qt.AlignRight)
+ l1.setDisabled(True)
+
+ lay.addWidget(r2, 2,0, alignment = Qt.AlignLeft)
+ lay.addWidget(QLabel(self.obj.variables['Pdef']['name']+":"), 2,1, alignment=Qt.AlignLeft)
+ lay.addWidget(l2, 2, 2, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(self.obj.variables['Pdef']['unit']),2,3, alignment=Qt.AlignRight)
+ self.formLayout.addRow(lay)
+ l2.setDisabled(True)
+ r1.toggled.connect(lambda:l1.setDisabled(not r1.isChecked()))
+ r2.toggled.connect(lambda:l2.setDisabled(not r2.isChecked()))
+
+ self.inputdict[i] = [r1, r2, l1, l2]
+ except Exception as e:
+ print(e)
+
+ def param(self):
+ try:
+ self.dict={}
+ print("param.inputdict ", self.inputdict)
+ for i in self.inputdict:
+ if (self.inputdict[i] == None):
+ continue
+
+ if(i=="thermoPackage"):
+ if (self.inputdict[i].currentText()):
+ self.dict[i] = self.inputdict[i].currentText()
+ else:
+ self.Show_Error()
+ break
+ elif self.obj.type == 'Flash' and i == 'Bdef':
+ self.dict[i] = [self.inputdict[i][0].isChecked(), self.inputdict[i][1].isChecked(), self.inputdict[i][2].text(), self.inputdict[i][3].text()]
+
+ print("param ", self.dict)
+ self.obj.paramsetter(self.dict)
+ self.hide()
+
+ except Exception as e:
+ print(e)
\ No newline at end of file
diff --git a/DockWidgets/DockWidget.ui b/DockWidgets/DockWidget.ui
new file mode 100644
index 0000000..5851d71
--- /dev/null
+++ b/DockWidgets/DockWidget.ui
@@ -0,0 +1,169 @@
+
+
+ Form
+
+
+ true
+
+
+
+ 0
+ 0
+ 392
+ 700
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 3200
+ 5000
+
+
+
+ Form
+
+
+ false
+
+
+
+
+ 10
+ 30
+ 361
+ 621
+
+
+
+ false
+
+
+ 0
+
+
+
+ Input Data
+
+
+
+
+ 9
+ 9
+ 331
+ 71
+
+
+
+ Mode Selection
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Mode :
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ 10
+ 100
+ 331
+ 321
+
+
+
+ Parameter Selection
+
+
+ -
+
+
+
+
+
+
+
+ 10
+ 430
+ 331
+ 21
+
+
+
+ Submit
+
+
+
+
+
+ Results
+
+
+ -
+
+
+ 3
+
+
+ 110
+
+
+ true
+
+
+
+ Attribute
+
+
+
+
+ Value
+
+
+
+
+ Unit
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DockWidgets/DockWidgetCompoundSeparator.py b/DockWidgets/DockWidgetCompoundSeparator.py
new file mode 100644
index 0000000..1818290
--- /dev/null
+++ b/DockWidgets/DockWidgetCompoundSeparator.py
@@ -0,0 +1,99 @@
+from PyQt5.QtCore import *
+from PyQt5.QtWidgets import *
+from PyQt5.QtGui import *
+from PyQt5.uic import loadUiType
+import pandas as pd
+from functools import partial
+from ComponentSelector import *
+from collections import defaultdict
+from Graphics import *
+
+ui_dialog,_ = loadUiType('DockWidgets/DockWidgetCompoundSeparator.ui')
+
+class DockWidgetCompoundSeparator(QDockWidget,ui_dialog):
+
+ def __init__(self,name,comptype,obj,container,parent=None):
+ QDockWidget.__init__(self,parent)
+ self.setupUi(self)
+ self.setWindowTitle(obj.name)
+ self.name=name
+ self.obj=obj
+ self.type = comptype
+ self.input_dict = []
+
+ print("constructor ", self.input_dict)
+ self.input_params_list()
+ self.dict = []
+
+ def input_params_list(self):
+ try:
+ print("input_params_list ", self.input_dict)
+ if self.type == 'CompoundSeparator':
+
+ # self.gridLayout = QGridLayout()
+ calculationGroupBox = QGroupBox('Calculation Parameters')
+
+ calculationLayout = QGridLayout()
+
+ r1 = QRadioButton('Stream 1')
+ r1.setChecked(True)
+ r1.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
+ r2 = QRadioButton('Stream 2')
+ r2.setChecked(False)
+ r2.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
+
+ lst = [r1, r2]
+ calculationLayout.addWidget(r1, 0, 1)
+ calculationLayout.addWidget(r2, 0, 2)
+
+ for k,val in enumerate(self.obj.compounds):
+ combo = QComboBox()
+ print("CompoundSeparator combo")
+ for j in self.obj.SepFact_modes:
+ combo.addItem(str(j))
+ combo.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
+ l = QLineEdit()
+ l.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
+ calculationLayout.addWidget(QLabel(val+" :"), k+1,0, alignment=Qt.AlignLeft)
+ calculationLayout.addWidget(combo, k+1, 1, alignment=Qt.AlignCenter)
+ calculationLayout.addWidget(l,k+1,2, alignment=Qt.AlignCenter)
+ lst.append(combo)
+ lst.append(l)
+
+ calculationLayout.setColumnStretch(3, len(self.obj.compounds)+1)
+ calculationGroupBox.setLayout(calculationLayout)
+
+ btn = QPushButton('Submit')
+ btn.clicked.connect(self.param)
+
+ self.gridLayout.setVerticalSpacing(5)
+ self.gridLayout.addWidget(calculationGroupBox,0,0)
+ self.gridLayout.addWidget(btn,1,0)
+
+ self.input_dict = lst
+
+ except Exception as e:
+ print(e)
+
+ def show_error(self):
+ QMessageBox.about(self, 'Important', "Please fill all fields with data")
+
+ def param(self):
+ try:
+ self.dict=[]
+ print("param.input_dict ", self.input_dict)
+
+ self.dict = [self.input_dict[0].isChecked(), self.input_dict[1].isChecked()]
+ j = 2
+ for i in range(len(self.obj.compounds)):
+ print(j+i)
+ self.dict.append(self.input_dict[j+i].currentText())
+ self.dict.append(self.input_dict[j+i+1].text())
+ j += 1
+
+ print("param ", self.dict)
+ self.obj.param_setter(self.dict)
+ self.hide()
+
+ except Exception as e:
+ print(e)
diff --git a/DockWidgets/DockWidgetCompoundSeparator.ui b/DockWidgets/DockWidgetCompoundSeparator.ui
new file mode 100644
index 0000000..2d9a4b2
--- /dev/null
+++ b/DockWidgets/DockWidgetCompoundSeparator.ui
@@ -0,0 +1,45 @@
+
+
+ form
+
+
+ true
+
+
+
+ 0
+ 0
+ 392
+ 700
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 3200
+ 5000
+
+
+
+ Form
+
+
+
+
+ 10
+ 40
+ 331
+ 191
+
+
+
+
+
+
+
+
diff --git a/DockWidgets/DockWidgetDistillationColumn.py b/DockWidgets/DockWidgetDistillationColumn.py
new file mode 100644
index 0000000..65e9932
--- /dev/null
+++ b/DockWidgets/DockWidgetDistillationColumn.py
@@ -0,0 +1,120 @@
+from PyQt5.QtCore import *
+from PyQt5.QtWidgets import *
+from PyQt5.QtGui import *
+from PyQt5.uic import loadUiType
+import pandas as pd
+from functools import partial
+from ComponentSelector import *
+from collections import defaultdict
+from Graphics import *
+
+ui_dialog,_ = loadUiType('DockWidgets/DockWidgetDistillationColumn.ui')
+
+class DockWidgetDistillationColumn(QDockWidget,ui_dialog):
+
+ def __init__(self,name,comptype,obj,container,parent=None):
+ QDockWidget.__init__(self,parent)
+ self.setupUi(self)
+ self.setWindowTitle(obj.name)
+ self.name=name
+ self.obj=obj
+ self.type = comptype
+ self.input_dict = []
+ print("constructor ", self.input_dict)
+ self.pushButton_2.clicked.connect(self.param)
+ self.dict = []
+ self.input_params_list()
+ self.name_type = None
+ self.container = container
+
+ # input data tab
+
+ def input_params_list(self):
+ try:
+ print("input_params_list ", self.input_dict)
+
+ # tab 1
+ self.l1.setText(self.obj.variables['Nt']['name']+":")
+ self.le1.setText(str(self.obj.variables['Nt']['value']))
+ self.l2.setText(self.obj.variables['In_s']['name']+":")
+ self.l3.setText(self.obj.variables['InT_s']['name']+":")
+
+ # tab 2
+ self.l4.setText(self.obj.variables['Ctype']['name']+":")
+ self.u1.setText(self.obj.variables['Ctype']['unit'])
+ self.l5.setText(self.obj.variables['Pcond']['name']+":")
+ self.le5.setText(str(self.obj.variables['Pcond']['value']))
+ self.u2.setText(self.obj.variables['Pcond']['unit'])
+ self.l6.setText(self.obj.variables['C_Spec']['name']+":")
+ self.l7.setText("Compounds :")
+
+ self.cb5.addItem("Total")
+ self.cb5.addItem("Partial")
+ for j in self.obj.Cspec_list:
+ self.cb1.addItem(str(j))
+ for j in self.obj.compounds:
+ self.cb2.addItem(str(j))
+ self.cb2.setDisabled(True)
+ self.cb1.currentIndexChanged.connect(self.fun2)
+
+
+ # tab3
+ self.l8.setText(self.obj.variables['Preb']['name']+":")
+ self.le7.setText(str(self.obj.variables['Preb']['value']))
+ self.u3.setText(self.obj.variables['Preb']['unit'])
+ self.l9.setText(self.obj.variables['R_Spec']['name']+":")
+ self.l10.setText('Compounds')
+
+ for j in self.obj.Rspec_list:
+ self.cb3.addItem(str(j))
+ for j in self.obj.compounds:
+ self.cb4.addItem(str(j))
+ self.cb4.setDisabled(True)
+ self.cb3.currentIndexChanged.connect(self.fun3)
+
+ self.input_dict = [self.le1, self.le2, self.le3, self.cb5, self.le5, self.cb1, self.cb2, self.le6, self.le7, self.cb3, self.cb4, self.le8]
+
+ except Exception as e:
+ print(e)
+
+ def fun2(self):
+ if self.cb1.currentText() == 'Compound Molar Fraction' or self.cb1.currentText() == 'Compound Molar Flow (mol/s)':
+ self.cb2.setDisabled(False)
+ else:
+ self.cb2.setDisabled(True)
+
+ def fun3(self):
+ if self.cb3.currentText() == 'Compound Molar Fraction' or self.cb3.currentText() == 'Compound Molar Flow (mol/s)':
+ self.cb4.setDisabled(False)
+ else:
+ self.cb4.setDisabled(True)
+
+ def Show_Error(self):
+ QMessageBox.about(self, 'Important', "Please fill all fields with data")
+
+ def param(self):
+ try:
+ self.dict= []
+ print("param.input_dict ", self.input_dict)
+ self.dict = [self.input_dict[0].text(),self.input_dict[1].text(), self.input_dict[2].text(), self.input_dict[3].currentText(),
+ self.input_dict[4].text(), self.input_dict[5].currentText(), self.input_dict[6].currentText(), self.input_dict[7].text(),
+ self.input_dict[8].text(), self.input_dict[9].currentText(), self.input_dict[10].currentText(), self.input_dict[11].text()]
+
+ print("param ", self.dict)
+ self.obj.param_setter(self.dict)
+ self.hide()
+
+ except Exception as e:
+ print(e)
+
+
+ @staticmethod
+ def showResult(lst):
+ #DockWidget1.flag = True
+ for i in lst:
+ i.resultsCategory(i.name)
+ #i.show()
+
+ # result data tab
+ def resultsCategory(self,name):
+ pass
\ No newline at end of file
diff --git a/DockWidgets/DockWidgetDistillationColumn.ui b/DockWidgets/DockWidgetDistillationColumn.ui
new file mode 100644
index 0000000..0cb1043
--- /dev/null
+++ b/DockWidgets/DockWidgetDistillationColumn.ui
@@ -0,0 +1,270 @@
+
+
+ Form
+
+
+ true
+
+
+
+ 0
+ 0
+ 392
+ 700
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 3200
+ 5000
+
+
+
+ Form
+
+
+
+
+ 10
+ 30
+ 361
+ 621
+
+
+
+ true
+
+
+ 0
+
+
+
+ Input Data
+
+
+
+
+ 10
+ 10
+ 331
+ 204
+
+
+
+ Parameter Selection
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ 0
+
+
+
+ General
+
+
+
-
+
+
-
+
+
+ TextLabel
+
+
+
+ -
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+
+
+
+
+
+ Condensor
+
+
+ -
+
+
-
+
+
+ TextLabel
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+ false
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
+
+
+ Reboiler
+
+
+ -
+
+
-
+
+
+ TextLabel
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+ false
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ TextLabel
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 10
+ 220
+ 331
+ 21
+
+
+
+ Submit
+
+
+
+
+
+ Results
+
+
+
+
+
+
+
+
diff --git a/DockWidgets/DockWidgetFlash.py b/DockWidgets/DockWidgetFlash.py
new file mode 100644
index 0000000..6098b27
--- /dev/null
+++ b/DockWidgets/DockWidgetFlash.py
@@ -0,0 +1,74 @@
+from PyQt5.QtCore import *
+from PyQt5.QtWidgets import *
+from PyQt5.QtGui import *
+from PyQt5.uic import loadUiType
+import pandas as pd
+from functools import partial
+from ComponentSelector import *
+from collections import defaultdict
+from Graphics import *
+
+ui_dialog,_ = loadUiType('DockWidgets/DockWidgetFlash.ui')
+
+class DockWidgetFlash(QDockWidget,ui_dialog):
+
+ def __init__(self,name,comptype,obj,container,parent=None):
+ QDockWidget.__init__(self,parent)
+ self.setupUi(self)
+ self.setWindowTitle(obj.name)
+ self.name=name
+ self.obj=obj
+ self.type = comptype
+ self.input_dict = []
+ print("constructor ", self.input_dict)
+ self.input_params_list()
+ self.btn.clicked.connect(self.param)
+ self.dict = []
+
+ def input_params_list(self):
+ try:
+ print("input_params_list ", self.input_dict)
+
+ self.l1.setText(self.obj.variables['thermoPackage']['name']+":")
+ self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
+ for j in self.lines:
+ self.cb1.addItem(str(j))
+
+ self.check1.setText(self.obj.variables['Tdef']['name']+":")
+ self.le2.setText(str(self.obj.variables['Tdef']['value']))
+ self.u2.setText(self.obj.variables['Tdef']['unit'])
+ self.check1.toggled.connect(self.fun)
+ self.check2.setText(self.obj.variables['Pdef']['name']+":")
+ self.le3.setText(str(self.obj.variables['Pdef']['value']))
+ self.u3.setText(self.obj.variables['Pdef']['unit'])
+ self.check2.toggled.connect(self.fun)
+
+ self.input_dict = [self.cb1, self.check1, self.le2, self.check2, self.le3]
+
+ except Exception as e:
+ print(e)
+
+ def fun(self):
+ if self.check1.isChecked():
+ self.le2.setDisabled(False)
+ else:
+ self.le2.setDisabled(True)
+ if self.check2.isChecked():
+ self.le3.setDisabled(False)
+ else:
+ self.le3.setDisabled(True)
+
+ def show_error(self):
+ QMessageBox.about(self, 'Important', "Please fill all fields with data")
+
+ def param(self):
+ try:
+ self.dict={}
+ print("param.input_dict ", self.input_dict)
+ self.dict = [self.input_dict[0].currentText(),self.input_dict[1].isChecked(), float(self.input_dict[2].text()), self.input_dict[3].isChecked(), float(self.input_dict[4].text())]
+ print("param ", self.dict)
+ self.obj.param_setter(self.dict)
+ self.hide()
+
+ except Exception as e:
+ print(e)
\ No newline at end of file
diff --git a/DockWidgets/DockWidgetFlash.ui b/DockWidgets/DockWidgetFlash.ui
new file mode 100644
index 0000000..c781aa6
--- /dev/null
+++ b/DockWidgets/DockWidgetFlash.ui
@@ -0,0 +1,161 @@
+
+
+ Form
+
+
+ true
+
+
+
+ 0
+ 0
+ 392
+ 700
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 3200
+ 5000
+
+
+
+ Form
+
+
+
+
+ 10
+ 40
+ 341
+ 141
+
+
+
+
+ 0
+ 0
+
+
+
+ true
+
+
+ Q
+
+
+ Calculation Parameters
+
+
+ -
+
+
-
+
+
+ false
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+
+ -
+
+
+ false
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+ CheckBox
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ CheckBox
+
+
+
+
+
+
+
+
+
+
+ 10
+ 190
+ 341
+ 23
+
+
+
+
+ 0
+ 0
+
+
+
+ Submit
+
+
+
+
+
+
diff --git a/DockWidgets/DockWidgetMaterialStream.py b/DockWidgets/DockWidgetMaterialStream.py
new file mode 100644
index 0000000..78959fc
--- /dev/null
+++ b/DockWidgets/DockWidgetMaterialStream.py
@@ -0,0 +1,332 @@
+from PyQt5.QtCore import *
+from PyQt5.QtWidgets import *
+from PyQt5.QtGui import *
+from PyQt5.uic import loadUiType
+import pandas as pd
+from functools import partial
+from ComponentSelector import *
+from collections import defaultdict
+from Graphics import *
+
+ui_dialog,_ = loadUiType('DockWidgets/DockWidgetMaterialStream.ui')
+
+class DockWidgetMaterialStream(QDockWidget,ui_dialog):
+
+ def __init__(self,name,comptype,obj,container,parent=None):
+ QDockWidget.__init__(self,parent)
+ self.setupUi(self)
+ self.setWindowTitle(obj.name)
+ self.name=name
+ self.obj=obj
+ self.type = comptype
+ self.input_dict = {}
+ self.x_pclist = []
+ self.modes()
+ self.comboBox.currentIndexChanged.connect(self.mode_selection)
+
+ print("constructor ", self.input_dict)
+ self.pushButton_2.clicked.connect(self.param)
+ self.dict = {}
+
+ self.name_type = None
+ self.container = container
+
+ header = QTreeWidgetItem(['Compound','Value','Unit'])
+ self.mTreeWidget.setHeaderItem(header)
+ self.lTreeWidget.setHeaderItem(header)
+ self.vTreeWidget.setHeaderItem(header)
+
+ self.mTreeWidget.itemClicked.connect(lambda : self.printer(self.mTreeWidget.currentItem()))
+ self.lTreeWidget.itemClicked.connect(lambda : self.printer(self.lTreeWidget.currentItem()))
+ self.vTreeWidget.itemClicked.connect(lambda : self.printer(self.vTreeWidget.currentItem()))
+
+
+ # def printer(self, treeItem ):
+ # foldername = treeItem.text(0)
+ # comment = treeItem.text(1)
+ # data = treeItem.text(2)
+ # print(foldername , ': ' , comment , ' (' + data + ')')
+
+ # input data tab
+ def modes(self):
+ modes_list = self.obj.modes_list
+ if(modes_list):
+ for j in modes_list:
+ self.comboBox.addItem(str(j))
+ self.mode_selection()
+ else:
+ self.input_dict= {}
+ self.input_dict = self.obj.param_getter()
+ self.input_params_list()
+
+ def mode_selection(self):
+ self.input_dict= {}
+ for i in reversed(range(self.formLayout.count())):
+ self.formLayout.removeRow(i)
+ self.input_dict = self.obj.param_getter(self.comboBox.currentText())
+ self.input_params_list()
+
+ def input_params_list(self):
+ try:
+ print("input_params_list ", self.input_dict)
+ for c,i in enumerate(self.input_dict):
+ if(i=="thermo_package"):
+ print("thermo1")
+ combo = QComboBox()
+ self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
+ print("thermo2")
+ for j in self.lines:
+ combo.addItem(str(j))
+ lay = QGridLayout()
+ lay.addWidget(QLabel(i+":"), 0,0, alignment=Qt.AlignLeft)
+ lay.addWidget(combo, 0, 1, alignment=Qt.AlignRight)
+ self.formLayout.addRow(lay)
+ self.input_dict[i] = combo
+ print("thermo")
+ elif(i=="condType"):
+ combo = QComboBox()
+ self.lines = ["Total","Partial"]
+ for j in self.lines:
+ combo.addItem(str(j))
+ lay = QGridLayout()
+ lay.addWidget(QLabel("Condensor Type :"+":"), 0, 0, alignment=Qt.AlignLeft)
+ lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
+ self.formLayout.addRow(lay)
+ self.input_dict[i] = combo
+ elif(i=="x_pc"):
+ noc = len(compound_selected)
+ print(noc)
+ self.x_pclist.clear()
+
+ gp = QGroupBox("Mole Fractions")
+ lay = QGridLayout()
+ for j in range(noc):
+ l = QLineEdit()
+ if self.input_dict[i] != '':
+ l.setText(str(self.obj.variables[compound_selected[j]]['value']))
+ self.input_dict[i] = "x_pc"
+ lay.addWidget(QLabel(str(compound_selected[j])+":"),j,0, alignment=Qt.AlignLeft)
+ lay.addWidget(l,j,1, alignment=Qt.AlignCenter)
+ self.x_pclist.append(l)
+
+ gp.setLayout(lay)
+ self.formLayout.addRow(gp)
+ else:
+ print("elseloop")
+ l = QLineEdit()
+ if self.input_dict[i] != None:
+ l.setText(str(self.input_dict[i]))
+ lay = QGridLayout()
+ lay.addWidget(QLabel(i+":"),0,0, alignment=Qt.AlignLeft)
+ lay.addWidget(l,0,1, alignment=Qt.AlignCenter)
+ if(i != 'MolFlow'):
+ lay.addWidget(QLabel(self.obj.variables[i]['unit']),0,2, alignment=Qt.AlignCenter)
+ else:
+ lay.addWidget(QLabel("mol/s"),0,2, alignment=Qt.AlignCenter)
+ self.formLayout.addRow(lay)
+ self.input_dict[i] = l
+
+ except Exception as e:
+ print(e)
+
+ def show_error(self):
+ QMessageBox.about(self, 'Important', "Please fill all fields with data")
+
+ def param(self):
+ try:
+ self.dict={}
+
+ print("param.input_dict ", self.input_dict)
+ for i in self.input_dict:
+ if(i=="thermo_package"):
+ if (self.input_dict[i].currentText()):
+ self.dict[i] = self.input_dict[i].currentText()
+ else:
+ self.show_error()
+ break
+ elif(i=="condType"):
+ if (self.input_dict[i].currentText()):
+ self.dict[i] = self.input_dict[i].currentText()
+ else:
+ self.show_error()
+ break
+ elif(i =="x_pc"):
+ l=[]
+ mf = []
+ total_moles = 0
+ for mol_frac in self.x_pclist:
+ if (mol_frac.text()):
+ l.append(mol_frac.text())
+ total_moles += float(l[-1])
+ else:
+ self.show_error()
+ break
+ for c in range(len(compound_selected)):
+ mf.append(str(float(l[c])/total_moles))
+ self.obj.variables[compound_selected[c]]['value'] = str(float(l[c])/total_moles)
+ self.x_pclist[c].setText(mf[-1])
+ self.dict[i] = ",".join(mf)
+ else:
+ if (self.input_dict[i].text()):
+ self.dict[i] = self.input_dict[i].text()
+ else:
+ print(self.input_dict[i].text())
+ self.show_error()
+ break
+
+ print("param ", self.dict)
+ self.obj.param_setter(self.dict)
+ self.hide()
+
+ except Exception as e:
+ print(e)
+
+
+ @staticmethod
+ def show_result(lst):
+ #DockWidget1.flag = True
+ for i in lst:
+ i.results_category(i.name)
+ #i.show()
+
+ # result data tab
+ def results_category(self,name):
+ flag = True
+ try:
+ print("Under result category name ", name)
+ result=self.container.result
+ obj = self.container.fetch_object(name)
+
+ d = {"Mole Fraction":"x_pc", "Mass Fraction":"xm_pc", "Mole Flow":"F_pc", "Mass Flow":"Fm_pc"}
+ lst = list(d.keys())
+ klst = list(d.values())
+
+ p = {"Pressure":"P", "Temperature":"T","Vapour Phase Mole Fraction":"xvap", "Phase Molar Enthalpy":"H_p",
+ "Phase Molar Entropy":"S_p", "Molar Flow Rate":"F_p"}
+
+ # Amounts Tab
+ if obj.type == 'MaterialStream':
+ l = [] # list for basis names
+ for basis in d:
+ propertyname = name + '.' + d[basis]
+ print("basis ", basis, propertyname)
+ for i in result[0]:
+ if (propertyname in i):
+ l.append(i)
+ print(l)
+
+ j = 0
+ t = 0
+ namee = klst[j]
+ print("namee ", namee)
+
+ for i,k in enumerate(l):
+ ind = result[0].index(k)
+ print("index ", ind)
+ print("str ", k)
+ resultval = str(result[-1][ind])
+ print("######Resultsfetch####",resultval)
+ print(k[k.find(".")+1:k.find("[")])
+ obj.variables[k.split('.')[1]]['value'] = resultval
+ if namee in k:
+ if i%3 == 0:
+ if(flag):
+ mroot = QTreeWidgetItem(self.mTreeWidget, [lst[j]])
+ child = QTreeWidgetItem(mroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
+ elif i%3 == 1:
+ if(flag):
+ lroot = QTreeWidgetItem(self.lTreeWidget, [lst[j]])
+ child = QTreeWidgetItem(lroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
+ elif i%3 == 2:
+ if (flag):
+ vroot = QTreeWidgetItem(self.vTreeWidget, [lst[j]])
+ child = QTreeWidgetItem(vroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
+ t += 1
+ flag = False
+ else:
+ j += 1
+ t = 0
+ namee = klst[j]
+ flag = True
+ if i%3 == 0:
+ if (flag):
+ mroot = QTreeWidgetItem(self.mTreeWidget, [lst[j]])
+ child = QTreeWidgetItem(mroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
+ elif i%3 == 1:
+ if (flag):
+ lroot = QTreeWidgetItem(self.lTreeWidget, [lst[j]])
+ child = QTreeWidgetItem(lroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
+ elif i%3 == 2:
+ if (flag):
+ vroot = QTreeWidgetItem(self.vTreeWidget, [lst[j]])
+ child = QTreeWidgetItem(vroot, [compound_selected[t], str(resultval),obj.variables[k.split('.')[1]]['unit']])
+ t += 1
+ flag = False
+ #print(obj.variables)
+
+ # Phase Properties Tab
+ phaseResLst = []
+ for phase in p:
+ propertyname = name + '.' + p[phase]
+ print("phase ", phase, propertyname)
+ for i in result[0]:
+ if i.find('['):
+ if (propertyname == i[0:i.find('[')]):
+ phaseResLst.append(i)
+ if propertyname == i:
+ phaseResLst.append(i)
+ print(phaseResLst)
+
+ self.mTableWidget.setRowCount(0)
+ self.lTableWidget.setRowCount(0)
+ self.vTableWidget.setRowCount(0)
+
+ for i,val in enumerate(phaseResLst):
+ ind = result[0].index(val)
+ resultval = str(result[-1][ind])
+ print(resultval, i, val)
+ obj.variables[val.split('.')[1]]['value'] = resultval
+ if '[' in val:
+ print(val)
+ temp = val[val.find('.')+1:val.find('[')]
+ print(temp)
+ if '1' in val.split('.')[1]:
+ print(obj.variables[val.split('.')[1]]['name'])
+ mrowPosition = self.mTableWidget.rowCount()
+ self.mTableWidget.insertRow(mrowPosition)
+ self.mTableWidget.setItem(mrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
+ self.mTableWidget.setItem(mrowPosition , 1, QTableWidgetItem(resultval))
+ self.mTableWidget.setItem(mrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
+ self.mTableWidget.resizeColumnsToContents()
+
+ if '2' in val.split('.')[1]:
+ lrowPosition = self.lTableWidget.rowCount()
+ self.lTableWidget.insertRow(lrowPosition)
+ self.lTableWidget.setItem(lrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
+ self.lTableWidget.setItem(lrowPosition , 1, QTableWidgetItem(resultval))
+ self.lTableWidget.setItem(lrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
+ self.lTableWidget.resizeColumnsToContents()
+ if '3' in val.split('.')[1]:
+ vrowPosition = self.vTableWidget.rowCount()
+ self.vTableWidget.insertRow(vrowPosition)
+ self.vTableWidget.setItem(vrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
+ self.vTableWidget.setItem(vrowPosition , 1, QTableWidgetItem(resultval))
+ self.vTableWidget.setItem(vrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
+ self.vTableWidget.resizeColumnsToContents()
+ if not '[' in val:
+ #print(p[val.split('.')[1]])
+ print(obj.variables[val.split('.')[1]]['name'])
+ mrowPosition = self.mTableWidget.rowCount()
+ self.mTableWidget.insertRow(mrowPosition)
+ self.mTableWidget.setItem(mrowPosition , 0, QTableWidgetItem(obj.variables[val.split('.')[1]]['name']))
+ self.mTableWidget.setItem(mrowPosition , 1, QTableWidgetItem(resultval))
+ self.mTableWidget.setItem(mrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
+ self.mTableWidget.resizeColumnsToContents()
+
+ print(obj.variables)
+
+ except Exception as e:
+ print(e)
+
+
+
\ No newline at end of file
diff --git a/DockWidgets/DockWidgetMaterialStream.ui b/DockWidgets/DockWidgetMaterialStream.ui
new file mode 100644
index 0000000..8995ba6
--- /dev/null
+++ b/DockWidgets/DockWidgetMaterialStream.ui
@@ -0,0 +1,458 @@
+
+
+ Form
+
+
+ true
+
+
+
+ 0
+ 0
+ 392
+ 700
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 3200
+ 5000
+
+
+
+ Form
+
+
+
+
+ 10
+ 30
+ 361
+ 621
+
+
+
+ true
+
+
+ 0
+
+
+
+ Input Data
+
+
+
+
+ 9
+ 9
+ 331
+ 71
+
+
+
+ Mode Selection
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Mode :
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ 10
+ 100
+ 331
+ 321
+
+
+
+ Parameter Selection
+
+
+ -
+
+
+
+
+
+
+
+ 10
+ 430
+ 331
+ 21
+
+
+
+ Submit
+
+
+
+
+
+ Results
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 8
+ 75
+ true
+
+
+
+ QToolBox{
+ background: white;
+ border: 1px solid gray;
+ selection-background-color: rgb(255, 170, 127);
+}
+
+
+
+ 0
+
+
+
+
+ 0
+ 0
+ 335
+ 494
+
+
+
+ QWidget{
+ background: white;
+}
+
+
+ Mixture
+
+
+
-
+
+
+ false
+
+
+ QTabWidget{
+ background: rgb(240, 240, 240);
+}
+
+
+ QTabWidget::North
+
+
+ QTabWidget::Triangular
+
+
+ 0
+
+
+ Qt::ElideNone
+
+
+
+ Amounts
+
+
+
-
+
+
+ false
+
+
+ 150
+
+
+ false
+
+
+
+ 1
+
+
+
+
+
+
+
+
+ Phase Properties
+
+
+ -
+
+
+ 3
+
+
+ false
+
+
+ 100
+
+
+ false
+
+
+ true
+
+
+ false
+
+
+
+ Attribute
+
+
+
+
+ Value
+
+
+
+
+ Unit
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 335
+ 494
+
+
+
+ QWidget{
+ background: white;
+}
+
+
+ Liquid
+
+
+ -
+
+
+ QTabWidget{
+ background: rgb(240, 240, 240);
+}
+
+
+ QTabWidget::Triangular
+
+
+ 0
+
+
+
+ Amounts
+
+
+
-
+
+
+ 150
+
+
+
+ 1
+
+
+
+
+
+
+
+
+ Phase Properties
+
+
+ -
+
+
+ 3
+
+
+ 100
+
+
+ true
+
+
+
+ Attribute
+
+
+
+
+ Value
+
+
+
+
+ Unit
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 335
+ 494
+
+
+
+ QWidget{
+ background: white;
+
+}
+
+
+ Vapour
+
+
+ -
+
+
+ QTabWidget{
+ background: rgb(240, 240, 240);
+}
+
+
+ QTabWidget::Triangular
+
+
+ 0
+
+
+
+ Amounts
+
+
+
-
+
+
+ 150
+
+
+
+ 1
+
+
+
+
+
+
+
+
+ Phase Properties
+
+
+ -
+
+
+ 3
+
+
+ 100
+
+
+ true
+
+
+
+ Attribute
+
+
+
+
+ Value
+
+
+
+
+ Unit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DockWidgets/DockWidgetMixer.py b/DockWidgets/DockWidgetMixer.py
new file mode 100644
index 0000000..47fc2c7
--- /dev/null
+++ b/DockWidgets/DockWidgetMixer.py
@@ -0,0 +1,61 @@
+from PyQt5.QtCore import *
+from PyQt5.QtWidgets import *
+from PyQt5.QtGui import *
+from PyQt5.uic import loadUiType
+import pandas as pd
+from functools import partial
+from ComponentSelector import *
+from collections import defaultdict
+from Graphics import *
+
+ui_dialog,_ = loadUiType('DockWidgets/DockWidgetMixer.ui')
+
+class DockWidgetMixer(QDockWidget,ui_dialog):
+
+ def __init__(self,name,comptype,obj,container,parent=None):
+ QDockWidget.__init__(self,parent)
+ self.setupUi(self)
+ self.setWindowTitle(obj.name)
+ self.name=name
+ self.obj=obj
+ self.type = comptype
+ self.input_dict = []
+ self.x_pclist = []
+ print("constructor ", self.input_dict)
+ self.input_params_list()
+ self.btn.clicked.connect(self.param)
+ self.dict = {}
+
+ # input data tab
+ def input_params_list(self):
+ try:
+ print("input_params_list ", self.input_dict)
+
+ self.l1.setText(self.obj.variables['NOI']['name']+":")
+ self.le1.setText(str(self.obj.variables['NOI']['value']))
+ self.u1.setText(self.obj.variables['NOI']['unit'])
+ for i in self.obj.Pout_modes:
+ self.cb2.addItem(str(i))
+
+ self.l2.setText(self.obj.variables['Pout']['name']+":")
+
+
+ self.input_dict = [self.le1, self.cb2]
+
+ except Exception as e:
+ print(e)
+
+ def show_error(self):
+ QMessageBox.about(self, 'Important', "Please fill all fields with data")
+
+ def param(self):
+ try:
+ self.dict={}
+ print("param.input_dict ", self.input_dict)
+ self.dict = [int(self.input_dict[0].text()),self.input_dict[1].currentText()]
+ print("param ", self.dict)
+ self.obj.param_setter(self.dict)
+ self.hide()
+
+ except Exception as e:
+ print(e)
\ No newline at end of file
diff --git a/DockWidgets/DockWidgetMixer.ui b/DockWidgets/DockWidgetMixer.ui
new file mode 100644
index 0000000..e039490
--- /dev/null
+++ b/DockWidgets/DockWidgetMixer.ui
@@ -0,0 +1,137 @@
+
+
+ Form
+
+
+ true
+
+
+
+ 0
+ 0
+ 392
+ 700
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 3200
+ 5000
+
+
+
+ Form
+
+
+
+
+ 10
+ 40
+ 341
+ 101
+
+
+
+
+ 0
+ 0
+
+
+
+ true
+
+
+ Calculation Parameters
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+
+ -
+
+
+ false
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+
+
+
+
+
+
+
+ 10
+ 150
+ 341
+ 23
+
+
+
+
+ 0
+ 0
+
+
+
+ Submit
+
+
+
+
+
+
diff --git a/DockWidgets/DockWidgetShortcutColumn.py b/DockWidgets/DockWidgetShortcutColumn.py
new file mode 100644
index 0000000..af81441
--- /dev/null
+++ b/DockWidgets/DockWidgetShortcutColumn.py
@@ -0,0 +1,97 @@
+from PyQt5.QtCore import *
+from PyQt5.QtWidgets import *
+from PyQt5.QtGui import *
+from PyQt5.uic import loadUiType
+import pandas as pd
+from functools import partial
+from ComponentSelector import *
+from collections import defaultdict
+from Graphics import *
+
+ui_dialog,_ = loadUiType('DockWidgets/DockWidgetShortcutColumn.ui')
+
+class DockWidgetShortcutColumn(QDockWidget,ui_dialog):
+
+ def __init__(self,name,comptype,obj,container,parent=None):
+ QDockWidget.__init__(self,parent)
+ self.setupUi(self)
+ self.setWindowTitle(obj.name)
+ self.name=name
+ self.obj=obj
+ self.type = comptype
+ self.input_dict = []
+ print("constructor ", self.input_dict)
+ self.input_params_list()
+ self.btn.clicked.connect(self.param)
+ self.dict = []
+
+ self.name_type = None
+ self.container = container
+
+ # input data tab
+ def input_params_list(self):
+ try:
+ print("input_params_list ", self.input_dict)
+
+ self.l1.setText(self.obj.variables['HKey']['name']+":")
+ print(self.obj.compounds)
+ for i in self.obj.compounds:
+ self.cb1.addItem(str(i))
+ self.cb2.addItem(str(i))
+
+ self.l2.setText(self.obj.variables['LKey']['name']+":")
+
+ self.l3.setText(self.obj.variables['HKey_x_pc']['name']+":")
+ self.le3.setText(str(self.obj.variables['HKey_x_pc']['value']))
+ self.u3.setText(self.obj.variables['HKey_x_pc']['unit'])
+ self.l4.setText(self.obj.variables['LKey_x_pc']['name']+":")
+ self.u4.setText(self.obj.variables['LKey_x_pc']['unit'])
+ self.le4.setText(str(self.obj.variables['LKey_x_pc']['value']))
+
+ self.l5.setText(self.obj.variables['Ctype']['name']+":")
+ self.cb5.addItem('Total')
+ self.cb5.addItem('Partial')
+
+ self.l6.setText(self.obj.variables['Pcond']['name']+":")
+ self.le6.setText(str(self.obj.variables['Pcond']['value']))
+ self.u6.setText(self.obj.variables['Pcond']['unit'])
+ self.l7.setText(self.obj.variables['Preb']['name']+":")
+ self.u7.setText(self.obj.variables['Preb']['unit'])
+ self.le7.setText(str(self.obj.variables['Preb']['value']))
+
+ self.l8.setText(self.obj.variables['RR']['name']+":")
+ self.le8.setText(str(self.obj.variables['RR']['value']))
+
+ self.input_dict = [self.cb1, self.cb2, self.le3, self.le4, self.cb5, self.le6, self.le7, self.le8]
+
+ except Exception as e:
+ print(e)
+
+ def show_error(self):
+ QMessageBox.about(self, 'Important', "Please fill all fields with data")
+
+ def param(self):
+ try:
+ self.dict=[]
+ print("param.input_dict ", self.input_dict)
+ self.dict = [self.input_dict[0].currentText(),self.input_dict[1].currentText(),float(self.input_dict[2].text()), float(self.input_dict[3].text()),
+ self.input_dict[4].currentText(), float(self.input_dict[5].text()), float(self.input_dict[6].text()), float(self.input_dict[7].text())]
+
+ print("param ", self.dict)
+ self.obj.param_setter(self.dict)
+ self.hide()
+
+ except Exception as e:
+ print(e)
+
+
+ @staticmethod
+ def show_result(lst):
+ #DockWidget1.flag = True
+ for i in lst:
+ i.resultsCategory(i.name)
+ #i.show()
+
+ # result data tab
+ def results_category(self,name):
+ pass
\ No newline at end of file
diff --git a/DockWidgets/DockWidgetShortcutColumn.ui b/DockWidgets/DockWidgetShortcutColumn.ui
new file mode 100644
index 0000000..c66e699
--- /dev/null
+++ b/DockWidgets/DockWidgetShortcutColumn.ui
@@ -0,0 +1,295 @@
+
+
+ Form
+
+
+ true
+
+
+
+ 0
+ 0
+ 392
+ 700
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 3200
+ 5000
+
+
+
+ Form
+
+
+
+
+ 10
+ 40
+ 351
+ 321
+
+
+
+ 0
+
+
+
+ Input Data
+
+
+
+
+ 8
+ 13
+ 331
+ 237
+
+
+
+
+ 0
+ 0
+
+
+
+ Calculation Parameters
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ 10
+ 250
+ 331
+ 23
+
+
+
+
+ 0
+ 0
+
+
+
+ Submit
+
+
+
+
+
+ Results
+
+
+
+
+
+
+
diff --git a/DockWidgets/DockWidgetSplitter.py b/DockWidgets/DockWidgetSplitter.py
new file mode 100644
index 0000000..262bd45
--- /dev/null
+++ b/DockWidgets/DockWidgetSplitter.py
@@ -0,0 +1,78 @@
+from PyQt5.QtCore import *
+from PyQt5.QtWidgets import *
+from PyQt5.QtGui import *
+from PyQt5.uic import loadUiType
+import pandas as pd
+from functools import partial
+from ComponentSelector import *
+from collections import defaultdict
+from Graphics import *
+
+ui_dialog,_ = loadUiType('DockWidgets/DockWidgetSplitter.ui')
+
+class DockWidgetSplitter(QDockWidget,ui_dialog):
+
+ def __init__(self,name,comptype,obj,container,parent=None):
+ QDockWidget.__init__(self,parent)
+ self.setupUi(self)
+ self.setWindowTitle(obj.name)
+ self.name=name
+ self.obj=obj
+ self.type = comptype
+ self.input_dict = []
+ print("constructor ", self.input_dict)
+ self.input_params_list()
+ self.btn.clicked.connect(self.param)
+ self.dict = {}
+
+ # input data tab
+ def input_params_list(self):
+ try:
+ print("input_params_list ", self.input_dict)
+
+ self.l1.setText(self.obj.variables['NOO']['name']+":")
+ self.le1.setText(str(self.obj.variables['NOO']['value']))
+ self.u1.setText(self.obj.variables['NOO']['unit'])
+
+ for i in self.obj.CalcType_modes:
+ self.cb2.addItem(str(i))
+
+ self.l2.setText(self.obj.variables['CalcType']['name']+":")
+
+ self.l3.setText("Stream 1 :")
+ self.u3.setText('')
+ self.l4.setText("Stream 2 :")
+ self.u4.setText('')
+ self.cb2.currentIndexChanged.connect(self.fun)
+
+
+ self.input_dict = [self.le1, self.cb2, self.le3, self.le4]
+
+ except Exception as e:
+ print(e)
+
+ def fun(self):
+ if self.cb2.currentText() == 'Mole Flow Specs':
+ self.u3.setText('mol/s')
+ self.u4.setText('mol/s')
+ elif self.cb2.currentText() == 'Mass Flow Specs':
+ self.u3.setText('kg/s')
+ self.u4.setText('kg/s')
+ else:
+ self.u3.setText('')
+ self.u4.setText('')
+
+ def show_error(self):
+ QMessageBox.about(self, 'Important', "Please fill all fields with data")
+
+ def param(self):
+ try:
+ self.dict={}
+ print("param.input_dict ", self.input_dict)
+ self.dict = [int(self.input_dict[0].text()),self.input_dict[1].currentText(), float(self.input_dict[2].text()), float(self.input_dict[3].text())]
+ print("param ", self.dict)
+ self.obj.param_setter(self.dict)
+ self.hide()
+
+ except Exception as e:
+ print(e)
diff --git a/DockWidgets/DockWidgetSplitter.ui b/DockWidgets/DockWidgetSplitter.ui
new file mode 100644
index 0000000..02a865e
--- /dev/null
+++ b/DockWidgets/DockWidgetSplitter.ui
@@ -0,0 +1,200 @@
+
+
+ Form
+
+
+ true
+
+
+
+ 0
+ 0
+ 392
+ 700
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 3200
+ 5000
+
+
+
+ Form
+
+
+
+
+ 10
+ 40
+ 341
+ 161
+
+
+
+
+ 0
+ 0
+
+
+
+ true
+
+
+ Q
+
+
+ Calculation Parameters
+
+
+ -
+
+
-
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+
+ -
+
+
+ false
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ TextLabel
+
+
+
+
+
+
+
+
+
+
+ 10
+ 210
+ 341
+ 23
+
+
+
+
+ 0
+ 0
+
+
+
+ Submit
+
+
+
+
+
+
diff --git a/DockWidgets/__pycache__/DockWidget.cpython-36.pyc b/DockWidgets/__pycache__/DockWidget.cpython-36.pyc
new file mode 100644
index 0000000..1d47765
Binary files /dev/null and b/DockWidgets/__pycache__/DockWidget.cpython-36.pyc differ
diff --git a/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-36.pyc b/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-36.pyc
new file mode 100644
index 0000000..1101a8e
Binary files /dev/null and b/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-36.pyc differ
diff --git a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-36.pyc b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-36.pyc
new file mode 100644
index 0000000..ec04f1f
Binary files /dev/null and b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-36.pyc differ
diff --git a/DockWidgets/__pycache__/DockWidgetFlash.cpython-36.pyc b/DockWidgets/__pycache__/DockWidgetFlash.cpython-36.pyc
new file mode 100644
index 0000000..387b27b
Binary files /dev/null and b/DockWidgets/__pycache__/DockWidgetFlash.cpython-36.pyc differ
diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-36.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-36.pyc
new file mode 100644
index 0000000..90799f7
Binary files /dev/null and b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-36.pyc differ
diff --git a/DockWidgets/__pycache__/DockWidgetMixer.cpython-36.pyc b/DockWidgets/__pycache__/DockWidgetMixer.cpython-36.pyc
new file mode 100644
index 0000000..f3fd8b1
Binary files /dev/null and b/DockWidgets/__pycache__/DockWidgetMixer.cpython-36.pyc differ
diff --git a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-36.pyc b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-36.pyc
new file mode 100644
index 0000000..a56884a
Binary files /dev/null and b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-36.pyc differ
diff --git a/DockWidgets/__pycache__/DockWidgetSplitter.cpython-36.pyc b/DockWidgets/__pycache__/DockWidgetSplitter.cpython-36.pyc
new file mode 100644
index 0000000..b0983a0
Binary files /dev/null and b/DockWidgets/__pycache__/DockWidgetSplitter.cpython-36.pyc differ
diff --git a/Graphics.py b/Graphics.py
index 07dd43e..861b2f0 100644
--- a/Graphics.py
+++ b/Graphics.py
@@ -10,21 +10,19 @@ from PyQt5.QtGui import QTextDocument ,QTextCursor ,QTextCharFormat ,QFont ,QPix
from PyQt5.uic import loadUiType
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QGraphicsProxyWidget, QGraphicsObject, QGraphicsEllipseItem ,QGraphicsPixmapItem,QApplication, QGraphicsView, QGraphicsScene, QHBoxLayout, QWidget, QLabel
-from PyQt5.QtGui import QBrush ,QTransform ,QMouseEvent
+from PyQt5.QtGui import QBrush ,QTransform ,QMouseEvent, QIcon
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import PyQt5.QtWidgets as QtWidgets
from ComponentSelector import *
-from DockWidget import *
-from DockWidgetMaterialStream import *
-from DockWidgetDistillationColumn import *
-from DockWidgetShortcutColumn import *
-from DockWidgetMixer import *
-from DockWidgetSplitter import *
-from DockWidgetFlash import *
-from DockWidgetCompoundSeparator import *
-
-
+from DockWidgets.DockWidget import *
+from DockWidgets.DockWidgetMaterialStream import *
+from DockWidgets.DockWidgetDistillationColumn import *
+from DockWidgets.DockWidgetShortcutColumn import *
+from DockWidgets.DockWidgetMixer import *
+from DockWidgets.DockWidgetSplitter import *
+from DockWidgets.DockWidgetFlash import *
+from DockWidgets.DockWidgetCompoundSeparator import *
import datetime
@@ -35,83 +33,98 @@ from UnitOperations import *
class Graphics(QDialog, QtWidgets.QGraphicsItem):
- def __init__(self, unitOp):
+ def __init__(self, unit_operations, graphicsView):
QDialog.__init__(self)
QtWidgets.QGraphicsItem.__init__(self)
self.scene = QGraphicsScene()
self.scene.setItemIndexMethod(QGraphicsScene.BspTreeIndex)
+ self.graphicsView = graphicsView
self.pos = None
- self.unitOp = unitOp
+ self.unit_operations = unit_operations
- def getScene(self):
+ def get_scene(self):
return self.scene
- def getComponentSelector(self):
+ def get_component_selector(self):
return ComponentSelector(self)
- def createNodeItem(self,unitOpr, container, graphicsView):
- return NodeItem(unitOpr, container, graphicsView)
+ def create_node_item(self,unit_operation, container):
+ print("in create node item function")
+ return NodeItem(unit_operation, container, self.graphicsView)
- def boundingRect(self):
- return QtCore.QRectF(self.rect)
+ # def boundingRect(self):
+ # return QtCore.QRectF(self.rect)
- def loadCanvas(self, obj):
+ def load_canvas(self, obj, container):
stm = ['MaterialStream','EngStm']
-
+ print('in load canvas')
compounds = obj[-1]
obj.pop()
- ComponentSelector.setCompounds(compounds)
+ ComponentSelector.set_compounds(compounds)
for i in obj:
- if(i in self.unitOp):
+ print("in for loop", i)
+ if(i in self.unit_operations):
pass
else:
- self.unitOp.append(i)
- new_box = self.createNodeItem(i, self.grphicsView)
+ self.unit_operations.append(i)
+ print(self.unit_operations)
+ new_box = self.create_node_item(i, container)
+ print('after createing node item')
new_box.setPos(i.pos.toPoint().x(), i.pos.toPoint().y())
self.scene.addItem(new_box)
for i in obj:
+ print('in i obj line')
if i.type == "MaterialStream":
- eval(i.type).counter += 1
+ print('in i obj line in if')
+ # print(eval(i.type))
+ # eval(i.type).counter += 1
+ # print(eval(i.type).counter)
elif i.type not in stm:
- eval(i.type).counter += 1
- ip = i.InputStms
- op = i.OutputStms
+ print('in i obj line in else')
+ ip = i.input_stms
+ op = i.output_stms
+ print(ip)
+ print(op)
+ # print(eval(i.type))
+ # eval(i.type).counter += 1
+ # print(eval(i.type).counter)
for j in ip:
- pointA = NodeItem.getInstances(j.name)
- pointB = NodeItem.getInstances(i.name)
- rect = pointA.Output[0].boundingRect()
+ print('in j in ip')
+ pointA = NodeItem.get_instances(j.name)
+ pointB = NodeItem.get_instances(i.name)
+ rect = pointA.output[0].boundingRect()
pointAA = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2)
- pointAA = pointA.Output[0].mapToScene(pointAA)
- rectB = pointB.Input[0].boundingRect()
+ pointAA = pointA.output[0].mapToScene(pointAA)
+ rectB = pointB.input[0].boundingRect()
pointBB = QtCore.QPointF(rectB.x() + rectB.width()/2, rectB.y() + rectB.height()/2)
- pointBB = pointB.Input[0].mapToScene(pointBB)
+ pointBB = pointB.input[0].mapToScene(pointBB)
self.new_line = NodeLine(pointAA, pointBB, 'in')
- self.new_line.source = pointA.Output[0]
- self.new_line.target = pointB.Input[0]
- pointA.Output[0].outLines.append(self.new_line)
- pointB.Input[0].inLines.append(self.new_line)
- pointA.Output[0].otherLine = self.new_line
- pointB.Input[0].otherLine = self.new_line
+ self.new_line.source = pointA.output[0]
+ self.new_line.target = pointB.input[0]
+ pointA.output[0].out_lines.append(self.new_line)
+ pointB.input[0].in_lines.append(self.new_line)
+ pointA.output[0].other_line = self.new_line
+ pointB.input[0].other_line = self.new_line
self.scene.addItem(self.new_line)
self.new_line.updatePath()
for k in op:
- pointA = NodeItem.getInstances(i.name)
- pointB = NodeItem.getInstances(k.name)
- rect = pointA.Output[0].boundingRect()
+ pointA = NodeItem.get_instances(i.name)
+ pointB = NodeItem.get_instances(k.name)
+ rect = pointA.output[0].boundingRect()
pointAA = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2)
- pointAA = pointA.Output[0].mapToScene(pointAA)
- rectB = pointB.Input[0].boundingRect()
+ pointAA = pointA.output[0].mapToScene(pointAA)
+ rectB = pointB.input[0].boundingRect()
pointBB = QtCore.QPointF(rectB.x() + rectB.width()/2, rectB.y() + rectB.height()/2)
- pointBB = pointB.Input[0].mapToScene(pointBB)
+ pointBB = pointB.input[0].mapToScene(pointBB)
self.new_line = NodeLine(pointAA, pointBB, 'out')
- self.new_line.source = pointA.Output[0]
- self.new_line.target = pointB.Input[0]
- pointA.Output[0].outLines.append(self.new_line)
- pointB.Input[0].inLines.append(self.new_line)
- pointA.Output[0].otherLine = self.new_line
- pointB.Input[0].otherLine = self.new_line
+ self.new_line.source = pointA.output[0]
+ self.new_line.target = pointB.input[0]
+ pointA.output[0].out_lines.append(self.new_line)
+ pointB.input[0].in_lines.append(self.new_line)
+ pointA.output[0].other_line = self.new_line
+ pointB.input[0].other_line = self.new_line
self.scene.addItem(self.new_line)
self.new_line.updatePath()
@@ -271,8 +284,9 @@ class NodeSocket(QtWidgets.QGraphicsItem):
self.rect = rect
self.type = socketType
self.parent=parent
- self.newLine=None
- self.otherLine=None
+ self.setAcceptHoverEvents(True)
+ self.new_line=None
+ self.other_line=None
# Brush.
self.brush = QtGui.QBrush()
@@ -285,8 +299,8 @@ class NodeSocket(QtWidgets.QGraphicsItem):
self.pen.setColor(QtGui.QColor(0,70,70,255)) #20,20,20,255
# Lines.
- self.outLines = []
- self.inLines = []
+ self.out_lines = []
+ self.in_lines = []
def shape(self):
path = QtGui.QPainterPath()
@@ -310,17 +324,17 @@ class NodeSocket(QtWidgets.QGraphicsItem):
pointA = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2)
pointA = self.mapToScene(pointA)
pointB = self.mapToScene(event.pos())
- self.newLine = NodeLine(pointA, pointB ,'op')
- self.outLines.append(self.newLine)
- self.scene().addItem(self.newLine)
+ self.new_line = NodeLine(pointA, pointB ,'op')
+ self.out_lines.append(self.new_line)
+ self.scene().addItem(self.new_line)
elif self.type == 'in':
rect = self.boundingRect()
pointA = self.mapToScene(event.pos())
pointB = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2)
pointB = self.mapToScene(pointB)
- self.newLine = NodeLine(pointA, pointB, 'in')
- self.inLines.append(self.newLine)
- self.scene().addItem(self.newLine)
+ self.new_line = NodeLine(pointA, pointB, 'in')
+ self.in_lines.append(self.new_line)
+ self.scene().addItem(self.new_line)
else:
super(NodeSocket, self).mousePressEvent(event)
@@ -328,14 +342,14 @@ class NodeSocket(QtWidgets.QGraphicsItem):
if self.type == 'op':
pointB = self.mapToScene(event.pos())
- self.newLine.pointB = pointB
- if self.otherLine:
- self.otherLine.pointB=pointB
+ self.new_line.pointB = pointB
+ if self.other_line:
+ self.other_line.pointB=pointB
elif self.type == 'in':
pointA = self.mapToScene(event.pos())
- self.newLine.pointA = pointA
- if self.otherLine:
- self.otherLine.pointA=pointA
+ self.new_line.pointA = pointA
+ if self.other_line:
+ self.other_line.pointA=pointA
else:
super(NodeSocket, self).mouseMoveEvent(event)
@@ -345,52 +359,52 @@ class NodeSocket(QtWidgets.QGraphicsItem):
item = self.scene().itemAt(event.scenePos().toPoint(),QtGui.QTransform())
stm = ['MaterialStream','EngStm']
- item.otherLine=self.newLine
+ item.other_line=self.new_line
if (self.type == 'op') and (item.type == 'in'):
- self.newLine.source = self
- self.newLine.target = item
- item.inLines.append(self.newLine)
- self.newLine.pointB = item.getCenter()
- if self.newLine.source.parent.obj.type not in stm:
- self.newLine.source.parent.obj.add_connection(0,self.newLine.target.parent.obj)
- if self.newLine.target.parent.obj.type not in stm:
- self.newLine.target.parent.obj.add_connection(1,self.newLine.source.parent.obj) # Input stream if flag is 1
+ self.new_line.source = self
+ self.new_line.target = item
+ item.in_lines.append(self.new_line)
+ self.new_line.pointB = item.get_center()
+ if self.new_line.source.parent.obj.type not in stm:
+ self.new_line.source.parent.obj.add_connection(0,self.new_line.target.parent.obj)
+ if self.new_line.target.parent.obj.type not in stm:
+ self.new_line.target.parent.obj.add_connection(1,self.new_line.source.parent.obj) # Input stream if flag is 1
elif (self.type =='in') and (item.type == 'op'):
- self.newLine.source = item
- self.newLine.target = self
- item.outLines.append(self.newLine)
- self.newLine.pointA = item.getCenter()
- if self.newLine.source.parent.obj.type not in stm:
- self.newLine.source.parent.obj.add_connection(0,self.newLine.target.parent.obj)
- if self.newLine.target.parent.obj.type not in stm:
- self.newLine.target.parent.obj.add_connection(1,self.newLine.source.parent.obj)
+ self.new_line.source = item
+ self.new_line.target = self
+ item.out_lines.append(self.new_line)
+ self.new_line.pointA = item.get_center()
+ if self.new_line.source.parent.obj.type not in stm:
+ self.new_line.source.parent.obj.add_connection(0,self.new_line.target.parent.obj)
+ if self.new_line.target.parent.obj.type not in stm:
+ self.new_line.target.parent.obj.add_connection(1,self.new_line.source.parent.obj)
else:
- self.scene().removeItem(self.newLine)
- if(self.newLine in self.inLines):
- self.inLines.remove(self.newLine)
- if(self.newLine in self.outLines):
- self.outLines.remove(self.newLine)
- del self.newLine
+ self.scene().removeItem(self.new_line)
+ if(self.new_line in self.in_lines):
+ self.in_lines.remove(self.new_line)
+ if(self.new_line in self.out_lines):
+ self.out_lines.remove(self.new_line)
+ del self.new_line
super(NodeSocket, self).mouseReleaseEvent(event)
try:
- data = container.get_last_list('Undo')
+ data = Container.get_last_list('Undo')
comp_selected = data[-1]
data.remove(comp_selected)
for i in range(len(data)):
- if data[i].name == self.newLine.source.parent.obj.name:
- data[i] = self.newLine.source.parent.obj
- elif data[i].name == self.newLine.target.parent.obj.name:
- data[i] = self.newLine.target.parent.obj
+ if data[i].name == self.new_line.source.parent.obj.name:
+ data[i] = self.new_line.source.parent.obj
+ elif data[i].name == self.new_line.target.parent.obj.name:
+ data[i] = self.new_line.target.parent.obj
data.append(comp_selected)
- container.PUSH('Undo', data)
+ Container.push('Undo', data)
except Exception as e:
print(e)
- def getCenter(self):
+ def get_center(self):
rect = self.boundingRect()
center = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2)
center = self.mapToScene(center)
@@ -408,36 +422,37 @@ class NodeSocket(QtWidgets.QGraphicsItem):
# all created node items will be put inside this list
# it is used for recreating the node lines by returning the node item object based on unit operation object's name
lst = []
-dockWidgetLst = []
+dock_widget_lst = []
stack = []
class NodeItem(QtWidgets.QGraphicsItem):
@staticmethod
- def getInstances(namee):
+ def get_instances(namee):
for i in lst:
if i.name == namee:
return i
@staticmethod
- def getDockWidget():
- return dockWidgetLst
+ def get_dock_widget():
+ return dock_widget_lst
- def __init__(self,unitOpr, container, graphicsView):
+ def __init__(self,unit_operation, container, graphicsView):
l = ['Splitter','Mixer', 'DistillationColumn', 'Flash', 'CompoundSeparator', 'ShortcutColumn']
stm = ['MaterialStream', 'EnergyStream']
super(NodeItem, self).__init__()
-
- self.obj = unitOpr
+ print("in node item")
+ self.obj = unit_operation
self.container = container
self.graphicsView = graphicsView
self.name = self.obj.name
self.type = self.obj.type
+ print('Before obj.modes_list')
- if (self.obj.modesList):
+ if (self.obj.modes_list):
default_tooltip = f"{self.name}\n\n"
- default_tooltip_dict = self.obj.paramgetter(self.obj.modesList[0])
+ default_tooltip_dict = self.obj.param_getter(self.obj.modes_list[0])
for i, j in default_tooltip_dict.items():
if j is not None:
default_tooltip = default_tooltip + f" {i} : {j}\n"
@@ -445,7 +460,7 @@ class NodeItem(QtWidgets.QGraphicsItem):
self.nin = self.obj.no_of_inputs
self.nop = self.obj.no_of_outputs
-
+ print('Before mixer')
if self.obj.type == 'Mixer':
text, ok = QInputDialog.getText(self.container.graphicsView, 'Mixer', 'Enter number of input:')
if ok and text:
@@ -459,27 +474,30 @@ class NodeItem(QtWidgets.QGraphicsItem):
self.obj.no_of_outputs = self.nop
self.obj.variables['NOO']['value'] = self.nop
- self.dockWidget = None
+ self.dock_widget = None
lst.append(self)
-
+ print("before DockWidget")
if self.obj.type in l:
- self.dockWidget = eval("DockWidget"+self.obj.type)(self.obj.name,self.obj.type,self.obj,self.container)
+ self.dock_widget = eval("DockWidget"+self.obj.type)(self.obj.name,self.obj.type,self.obj,self.container)
elif self.obj.type in stm:
- self.dockWidget = eval("DockWidget"+self.obj.type)(self.obj.name,self.obj.type,self.obj,self.container)
+ self.dock_widget = eval("DockWidget"+self.obj.type)(self.obj.name,self.obj.type,self.obj,self.container)
else:
- self.dockWidget = DockWidget(self.obj.name,self.obj.type,self.obj,self.container)
-
- dockWidgetLst.append(self.dockWidget)
- self.mainwindow= findMainWindow(self)
- self.dockWidget.setFixedWidth(360)
- self.dockWidget.setFixedHeight(640)
- self.dockWidget.DockWidgetFeature(QDockWidget.AllDockWidgetFeatures)
- self.mainwindow.addDockWidget(Qt.LeftDockWidgetArea, self.dockWidget)
- self.dockWidget.hide()
+ self.dock_widget = DockWidget(self.obj.name,self.obj.type,self.obj,self.container)
+ print('in dockwidget')
+ dock_widget_lst.append(self.dock_widget)
+ self.main_window= findMainWindow(self)
+ self.dock_widget.setFixedWidth(360)
+ self.dock_widget.setFixedHeight(640)
+ self.dock_widget.DockWidgetFeature(QDockWidget.AllDockWidgetFeatures)
+ self.main_window.addDockWidget(Qt.LeftDockWidgetArea, self.dock_widget)
+ self.dock_widget.hide()
+ print("after dockwidget")
self.pic=QtGui.QPixmap("Icons/"+self.type+".png")
+ # self.pic = QIcon("svg/Cooler.svg")
self.rect = QtCore.QRect(0,0,self.pic.width(),self.pic.height())
+ # self.rect = QtCore.QRect(0,0,100,100)
self.text = QGraphicsTextItem(self)
f = QFont()
f.setPointSize(8)
@@ -502,13 +520,15 @@ class NodeItem(QtWidgets.QGraphicsItem):
self.pen.setWidth(1)
self.pen.setColor(QtGui.QColor(20,20,20,255))
- self.selPen = QtGui.QPen()
- self.selPen.setStyle(QtCore.Qt.SolidLine)
- self.selPen.setWidth(1)
- self.selPen.setColor(QtGui.QColor(220,220,220,255))
+ self.sel_pen = QtGui.QPen()
+ self.sel_pen.setStyle(QtCore.Qt.SolidLine)
+ self.sel_pen.setWidth(1)
+ self.sel_pen.setColor(QtGui.QColor(220,220,220,255))
# initializing the node sockets
- self.Input , self.Output = self.initializeSockets(self.type)
+ self.input , self.output = self.initialize_sockets(self.type)
+
+ print('after ndoe item')
def shape(self):
path = QtGui.QPainterPath()
@@ -520,51 +540,52 @@ class NodeItem(QtWidgets.QGraphicsItem):
def paint(self, painter, option, widget):
if self.isSelected():
- painter.setPen(self.selPen)
+ painter.setPen(self.sel_pen)
painter.drawRect(QtCore.QRectF(self.rect))
else:
painter.setPen(self.pen)
- painter.drawPixmap(self.rect,self.pic)
-
- def initializeSockets(self,type):
+ # painter.drawPixmap(self.rect,self.pic)
+ painter.drawPixmap(self.rect, self.pic.pixmap(QSize(1000,1000)))
+
+ def initialize_sockets(self,type):
print("inside initialization")
if(self.type=="Flash" or self.type=="CompoundSeparator"):
- Input = [NodeSocket(QtCore.QRect(5,(self.rect.height()*x/(self.nin+1)-2),4,4), self, 'in') for x in range(1,self.nin+1) ]
- Output = [NodeSocket(QtCore.QRect(self.rect.width()-9,(self.rect.height()*x*1/(self.nop+1)),4,4), self, 'op') for x in range(1,self.nop+1)]
- return Input,Output
+ input = [NodeSocket(QtCore.QRect(5,(self.rect.height()*x/(self.nin+1)-2),4,4), self, 'in') for x in range(1,self.nin+1) ]
+ output = [NodeSocket(QtCore.QRect(self.rect.width()-9,(self.rect.height()*x*1/(self.nop+1)),4,4), self, 'op') for x in range(1,self.nop+1)]
+ return input,output
elif(self.type=="AdiabaticCompressor" or self.type=="AdiabaticExpander" or self.type =="Mixer" or self.type =="Splitter" or self.type =="Valve" ):
- Input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1))-2,4,4), self, 'in') for x in range(1,self.nin+1) ]
- Output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,(self.rect.height()*x/(self.nop+1))-2,4,4), self, 'op') for x in range(1,self.nop+1)]
- return Input,Output
+ input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1))-2,4,4), self, 'in') for x in range(1,self.nin+1) ]
+ output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,(self.rect.height()*x/(self.nop+1))-2,4,4), self, 'op') for x in range(1,self.nop+1)]
+ return input,output
elif(self.type=="Cooler" or self.type=="Heater"):
- Input = [NodeSocket(QtCore.QRect(3.5,(self.rect.height()*x/(self.nin+1))-2,4,4), self, 'in') for x in range(1,self.nin+1) ]
- Output = [NodeSocket(QtCore.QRect(self.rect.width()-8.0,(self.rect.height()*x/(self.nop+1))-2,4,4), self, 'op') for x in range(1,self.nop+1)]
- return Input,Output
+ input = [NodeSocket(QtCore.QRect(3.5,(self.rect.height()*x/(self.nin+1))-2,4,4), self, 'in') for x in range(1,self.nin+1) ]
+ output = [NodeSocket(QtCore.QRect(self.rect.width()-8.0,(self.rect.height()*x/(self.nop+1))-2,4,4), self, 'op') for x in range(1,self.nop+1)]
+ return input,output
elif(self.type=="Pump"):
- Input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1))-7, 4,4), self, 'in') for x in range(1,self.nin+1) ]
- Output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,-1.5,4,4), self, 'op') for x in range(1,self.nop+1)]
- return Input,Output
+ input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1))-7, 4,4), self, 'in') for x in range(1,self.nin+1) ]
+ output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,-1.5,4,4), self, 'op') for x in range(1,self.nop+1)]
+ return input,output
elif(self.type=="DistillationColumn" or self.type=="ShortcutColumn"):
- Input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1)),5,5), self, 'in') for x in range(1,self.nin+1) ]
- Output = [NodeSocket(QtCore.QRect(self.rect.width()-5.5,(self.rect.height()*1.44*x/(self.nop+1))-55,5,5), self, 'op') for x in range(1,self.nop+1)]
- return Input,Output
+ input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1)),5,5), self, 'in') for x in range(1,self.nin+1) ]
+ output = [NodeSocket(QtCore.QRect(self.rect.width()-5.5,(self.rect.height()*1.44*x/(self.nop+1))-55,5,5), self, 'op') for x in range(1,self.nop+1)]
+ return input,output
elif(self.type=="MaterialStream"):
- Input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1)-2),4,4), self, 'in') for x in range(1,self.nin+1) ]
- Output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,(self.rect.height()*x/(self.nin+1)-2),4,4), self, 'op') for x in range(1,self.nop+1)]
- return Input,Output
+ input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1)-2),4,4), self, 'in') for x in range(1,self.nin+1) ]
+ output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,(self.rect.height()*x/(self.nin+1)-2),4,4), self, 'op') for x in range(1,self.nop+1)]
+ return input,output
def mouseMoveEvent(self, event):
super(NodeItem, self).mouseMoveEvent(event)
- for output in self.Output:
- for line in output.outLines:
- line.pointA = line.source.getCenter()
- line.pointB = line.target.getCenter()
- for input in self.Input:
- for line in input.inLines:
- line.pointA = line.source.getCenter()
- line.pointB = line.target.getCenter()
+ for op in self.output:
+ for line in op.out_lines:
+ line.pointA = line.source.get_center()
+ line.pointB = line.target.get_center()
+ for ip in self.input:
+ for line in ip.in_lines:
+ line.pointA = line.source.get_center()
+ line.pointB = line.target.get_center()
self.pos = event.scenePos()
- self.obj.setPos(self.pos)
+ self.obj.set_pos(self.pos)
#print(self.name, self.pos)
def mouseDoubleClickEvent(self, event):
@@ -573,8 +594,8 @@ class NodeItem(QtWidgets.QGraphicsItem):
if len(stack):
print(stack)
stack[-1].hide()
- self.dockWidget.show()
- stack.append(self.dockWidget)
+ self.dock_widget.show()
+ stack.append(self.dock_widget)
self.graphicsView.setInteractive(True)
diff --git a/OMChem/Flowsheet.py b/OMChem/Flowsheet.py
index 25143ce..ab271af 100644
--- a/OMChem/Flowsheet.py
+++ b/OMChem/Flowsheet.py
@@ -9,7 +9,7 @@ class Flowsheet():
def __init__(self):
self.sim_name = 'Simulator'
self.sim_method = ''
- self.UnitOpn = []
+ self.unit_operations = []
self.data = []
self.compounds = []
self.interface = ''
@@ -19,7 +19,7 @@ class Flowsheet():
self.Flomo_path = os.path.join(self.sim_dir_path,'Flowsheet.mo')
self.eqn_mos_path = os.path.join(self.sim_dir_path,'simulateEQN.mos')
self.sm_mos_path = os.path.join(self.sim_dir_path,'simulateSM.mos')
- self.resdata = []
+ self.result_data = []
self.stdout=None
self.stderr=None
@@ -37,17 +37,17 @@ class Flowsheet():
print("The OpenModelica compiler is missing in the System path please install it" )
raise
- def add_UnitOpn(self,unitop):
- self.UnitOpn.append(unitop)
+ def add_unit_operations(self,unitop):
+ self.unit_operations.append(unitop)
- def remove_UnitOpn(self,unitop):
- self.UnitOpn.remove(unitop)
+ def remove_unit_operations(self,unitop):
+ self.unit_operations.remove(unitop)
- def add_comp_list(self,C):
+ def add_compound_list(self,C):
self.compounds = C
- def send_for_simulationEqn(self):
- self.resdata = []
+ def send_for_simulation_Eqn(self):
+ self.result_data = []
self.omc_path = self.get_omc_path()
print(self.omc_path)
@@ -69,18 +69,18 @@ class Flowsheet():
csvpath = os.path.join(self.sim_dir_path,'Flowsheet_res.csv')
print("csvPath",csvpath)
with open (csvpath,'r') as resultFile:
- self.resdata = []
+ self.result_data = []
print("opened")
csvreader = csv.reader(resultFile,delimiter=',')
for row in csvreader:
print("124125")
- self.resdata.append(row)
- print(self.resdata)
- #self.ExtData()
+ self.result_data.append(row)
+ print(self.result_data)
+ #self.ext_data()
- def send_for_simulationSM(self,unitop):
+ def send_for_simulation_SM(self,unitop):
- self.resdata = []
+ self.result_data = []
self.omc_path = self.get_omc_path()
os.chdir(self.sim_dir_path)
#os.system(self.omc_path + ' -s ' + unitop.name+'.mos')
@@ -90,28 +90,28 @@ class Flowsheet():
#print(s)
print("############### StdOut ################")
print(stdout)
- self.resdata = []
+ self.result_data = []
print('Simulating '+unitop.name+'...')
csvpath = os.path.join(self.sim_dir_path,unitop.name+'_res.csv')
with open(csvpath,'r') as resultFile:
csvreader = csv.reader(resultFile,delimiter=',')
for row in csvreader:
- self.resdata.append(row)
- self.ExtData()
+ self.result_data.append(row)
+ self.ext_data()
- def ExtData(self):
- for unit in self.UnitOpn:
+ def ext_data(self):
+ for unit in self.unit_operations:
if unit[0].type == 'MaterialStream':
for key, value in unit[0].Prop.items():
- propertyname = unit[0].name + '.' + key
- if propertyname in self.resdata[0]:
- ind = self.resdata[0].index(propertyname)
- resultval = str(self.resdata[-1][ind])
+ property_name = unit[0].name + '.' + key
+ if property_name in self.result_data[0]:
+ ind = self.result_data[0].index(property_name)
+ resultval = str(self.result_data[-1][ind])
#resultval = str(omc.sendExpression("val("+unit.name+ "." + value + ", 0.5)"))
print(resultval)
unit[0].Prop[key] = resultval
- def simulateEQN(self):
+ def simulate_EQN(self):
self.data = []
print("##################################################")
print("##################################################")
@@ -123,7 +123,7 @@ class Flowsheet():
lcase = c.lower()
self.data.append("parameter database." + ucase +' '+ ucase + "; \n")
- for unitop in self.UnitOpn:
+ for unitop in self.unit_operations:
if unitop.type != 'MaterialStream':
self.data.append(unitop.OM_Flowsheet_Initialize())
else:
@@ -134,13 +134,13 @@ class Flowsheet():
self.outlist = []
self.stm = ['MaterialStream','EngStm']
- for unitop in self.UnitOpn:
+ for unitop in self.unit_operations:
if unitop.type not in self.stm:
- for j in unitop.OutputStms:
+ for j in unitop.output_stms:
self.outlist.append(j)
print(j.name)
- for unitop in self.UnitOpn:
+ for unitop in self.unit_operations:
if unitop not in self.outlist:
if unitop.type == 'MaterialStream':
@@ -163,14 +163,14 @@ class Flowsheet():
print('Initiating Simulation in Equation Oriented Mode')
- self.send_for_simulationEqn()
+ self.send_for_simulation_Eqn()
- def simulateSM(self,ip,op):
+ def simulate_SM(self,ip,op):
print("ip op = ", ip, op)
self.sim_method = 'SM'
self.data = []
- self.resdata = []
+ self.result_data = []
self.unit = []
self.csvlist = []
print("op list",op)
@@ -204,8 +204,8 @@ class Flowsheet():
os.chdir(self.root_dir)
self.data = []
if unitop.type not in ['MaterialStream','EngStm']:
- inpstms = unitop.InputStms
- outstms = unitop.OutputStms
+ inpstms = unitop.input_stms
+ outstms = unitop.output_stms
try:
engstms = unitop.EngStms
@@ -267,7 +267,7 @@ class Flowsheet():
mosFile.write("simulate("+unitop.name.lower()+", outputFormat=\"csv\", stopTime=1.0, numberOfIntervals=1);\n")
print("Initiating simulation in Sequential Modular Mode")
- #self.resdata = []
+ #self.result_data = []
self.omc_path = self.get_omc_path()
os.chdir(self.sim_dir_path)
#os.system(self.omc_path + ' -s ' + unitop[0].name.lower()+"SEQ"+'.mos')
@@ -290,43 +290,43 @@ class Flowsheet():
with open(csvpath,'r') as resultFile:
csvreader = csv.reader(resultFile,delimiter=',')
for row in csvreader:
- self.resdata.append(row)
+ self.result_data.append(row)
os.chdir(self.root_dir)
if type(inpstms) is list:
for stm in inpstms:
for key,value in stm.Prop.items():
- propertyname = stm.name + '.' + key
- if propertyname in self.resdata[0]:
- ind = self.resdata[0].index(propertyname)
- resultval = str(self.resdata[-1][ind])
+ property_name = stm.name + '.' + key
+ if property_name in self.result_data[0]:
+ ind = self.result_data[0].index(property_name)
+ resultval = str(self.result_data[-1][ind])
stm.Prop[key] = resultval
#print("input",stm.Prop[key])
else:
for key, value in inpstms.Prop.items():
- propertyname = inpstms.name + '.' + key
- if propertyname in self.resdata[0]:
- ind = self.resdata[0].index(propertyname)
- resultval = str(self.resdata[-1][ind])
+ property_name = inpstms.name + '.' + key
+ if property_name in self.result_data[0]:
+ ind = self.result_data[0].index(property_name)
+ resultval = str(self.result_data[-1][ind])
inpstms.Prop[key] = resultval
#print("input",inpstms.Prop[key])
if type(outstms) is list:
for stm in outstms:
for key, value in stm.Prop.items():
- propertyname = stm.name + '.' + key
- if propertyname in self.resdata[0]:
- ind = self.resdata[0].index(propertyname)
- resultval = str(self.resdata[-1][ind])
+ property_name = stm.name + '.' + key
+ if property_name in self.result_data[0]:
+ ind = self.result_data[0].index(property_name)
+ resultval = str(self.result_data[-1][ind])
stm.Prop[key] = resultval
print("output key:",key,"value:",stm.Prop[key])
else:
for key, value in outstms.Prop.items():
- propertyname = outstms.name + '.' + key
- if propertyname in self.resdata[0]:
- ind = self.resdata[0].index(propertyname)
- resultval = str(self.resdata[-1][ind])
+ property_name = outstms.name + '.' + key
+ if property_name in self.result_data[0]:
+ ind = self.result_data[0].index(property_name)
+ resultval = str(self.result_data[-1][ind])
outstms.Prop[key] = resultval
print("output key:",key,"value:",outstms.Prop[key])
@@ -334,8 +334,8 @@ class Flowsheet():
os.chdir(self.sim_dir_path)
dffinal = pd.concat(self.dataframes,axis=1)
dffinal.to_csv('FlowsheetSEQ.csv',index=False)
- self.resdata.clear()
+ self.result_data.clear()
with open(os.path.join(self.sim_dir_path+'/FlowsheetSEQ.csv'),'r') as resultFile:
csvreader = csv.reader(resultFile,delimiter=',')
for row in csvreader:
- self.resdata.append(row)
+ self.result_data.append(row)
diff --git a/Streams.py b/Streams.py
index 1b76247..835abe5 100644
--- a/Streams.py
+++ b/Streams.py
@@ -6,19 +6,19 @@ from collections import defaultdict
class MaterialStream():
counter = 1
- def __init__(self, CompNames = []):
+ def __init__(self, compound_names = []):
self.name = 'MaterialStream' + str(MaterialStream.counter)
self.type = 'MaterialStream'
- self.CompNames = CompNames
+ self.compound_names = compound_names
self.count = MaterialStream.counter
- self.thermoPackage ="RaoultsLaw"
+ self.thermo_package ="RaoultsLaw"
self.mode1 = "P"
self.mode2 = "T"
- self.mode1val = ""
- self.mode2val = ""
+ self.mode1_val = ""
+ self.mode2_val = ""
self.OM_data_init = ''
self.OM_data_eqn = ''
self.no_of_inputs = 1
@@ -27,9 +27,9 @@ class MaterialStream():
self.y = 2500-30
self.pos = QPointF(self.x, self.y)
MaterialStream.counter+=1
- self.startDict = {}
- self.eqnDict = {}
- self.modesList = ["PT","PH","PVF","TVF","PS"]
+ self.start_dict = {}
+ self.eqn_dict = {}
+ self.modes_list = ["PT","PH","PVF","TVF","PS"]
self.variables = {
'P' : {'name':'Pressure', 'value':101325, 'unit':'Pa'}, # {'Pa':1, 'mmHg':0, 'N/m^2':0}},
@@ -54,10 +54,10 @@ class MaterialStream():
'F_pc' : {'name':'Mole Flow', 'value':100, 'unit':'mol/s'},
'Fm_pc' : {'name':'Mass Flow', 'value':None, 'unit':'g/s'},
}
- self.initVariables()
+ self.init_variables()
- def initVariables(self):
- for i, val in enumerate(self.CompNames):
+ def init_variables(self):
+ for i, val in enumerate(self.compound_names):
self.variables['x_pc[1,'+ str(i+1)+']'] = {'name':val + ' Mixture Mole Fraction', 'value':None, 'unit':'mol/s'}
self.variables['xm_pc[1,'+ str(i+1)+']'] = {'name':val + ' Mixture Mass Fraction', 'value':None, 'unit':'g/s'}
self.variables['F_pc[1,'+ str(i+1)+']'] = {'name':val + ' Mixture Mole Flow', 'value':None, 'unit':'mol/s'}
@@ -73,46 +73,46 @@ class MaterialStream():
self.variables['F_pc[3,'+ str(i+1)+']'] = {'name':[val + ' Vapour Mole Flow'], 'value':None, 'unit':'mol/s'}
self.variables['Fm_pc[3,'+ str(i+1)+']'] = {'name':[val + ' Vapour Mass Flow'], 'value':None, 'unit':'g/s'}
- for i in self.CompNames:
+ for i in self.compound_names:
self.variables[i] = {'value':''}
- def paramgetter(self,mode):
+ def param_getter(self,mode):
dict = {}
if(mode=="PT"):
self.mode1 = 'P'
self.mode2 = 'T'
dict = {self.mode1:self.variables['P']['value'], self.mode2:self.variables['T']['value'],
- "MolFlow":self.variables['F_pc']['value'],"x_pc":self.variables['x_pc']['value'], "thermoPackage":self.thermoPackage}
+ "MolFlow":self.variables['F_pc']['value'],"x_pc":self.variables['x_pc']['value'], "thermo_package":self.thermo_package}
elif(mode=="PH"):
self.mode1 = 'P'
self.mode2 = 'H_p[1]'
dict = {self.mode1:self.variables['P']['value'], self.mode2:self.variables['H_p[1]']['value'],
- "MolFlow":self.variables['F_pc']['value'], "x_pc":self.variables['x_pc']['value'], "thermoPackage":self.thermoPackage}
+ "MolFlow":self.variables['F_pc']['value'], "x_pc":self.variables['x_pc']['value'], "thermo_package":self.thermo_package}
elif(mode=="PVF"):
self.mode1 = 'P'
self.mode2 = 'xvap'
dict = {self.mode1:self.variables['P']['value'], self.mode2:self.variables['xvap']['value'],
- "MolFlow":self.variables['F_pc']['value'], "x_pc":self.variables['x_pc']['value'], "thermoPackage":self.thermoPackage}
+ "MolFlow":self.variables['F_pc']['value'], "x_pc":self.variables['x_pc']['value'], "thermo_package":self.thermo_package}
elif(mode=="TVF"):
self.mode1 = 'T'
self.mode2 = 'xvap'
dict = {self.mode1:self.variables['T']['value'], self.mode2:self.variables['xvap']['value'],
- "MolFlow":self.variables['F_pc']['value'], "x_pc":self.variables['x_pc']['value'], "thermoPackage":self.thermoPackage}
+ "MolFlow":self.variables['F_pc']['value'], "x_pc":self.variables['x_pc']['value'], "thermo_package":self.thermo_package}
elif(mode=="PS"):
self.mode1 = 'P'
self.mode2 = 'S_p[1]'
dict = {self.mode1:self.variables['P']['value'], self.mode2: self.variables['S_p[1]']['value'],
- "MolFlow":self.variables['F_pc']['value'], "x_pc":self.variables['x_pc']['value'], "thermoPackage":self.thermoPackage}
+ "MolFlow":self.variables['F_pc']['value'], "x_pc":self.variables['x_pc']['value'], "thermo_package":self.thermo_package}
return dict
- def paramsetter(self,dict):
+ def param_setter(self,dict):
print("inside paramsetter ", dict)
self.variables['x_pc']['value'] = dict['x_pc'].split(",")
- self.thermoPackage = dict['thermoPackage']
+ self.thermo_package = dict['thermo_package']
self.variables['F_p[1]']['value'] = dict['MolFlow']
print("inside")
# self.Prop[self.mode2] = dict[self.mode2]
@@ -122,7 +122,7 @@ class MaterialStream():
print(self.variables)
print(self.variables['x_pc']['value'])
- for i in range(len(self.CompNames)):
+ for i in range(len(self.compound_names)):
print('####### x_pc #########\n',self.variables['x_pc']['value'][i])
print('x_pc')
if self.variables['x_pc']['value'][i]:
@@ -141,7 +141,7 @@ class MaterialStream():
self.variables['Fm_pc[1,'+str(i+1)+']']['value'] = None
print('first for')
print('secnod for')
- for i in range(0,len(self.CompNames)):
+ for i in range(0,len(self.compound_names)):
self.variables['x_pc[2,'+str(i+1)+']']['value'] = None
self.variables['xm_pc[2,'+str(i+1)+']']['value'] = None
self.variables['F_pc[2,'+str(i+1)+']']['value'] = None
@@ -152,12 +152,12 @@ class MaterialStream():
self.variables['F_pc[3,'+str(i+1)+']']['value'] = None
self.variables['Fm_pc[3,'+str(i+1)+']']['value'] = None
- def setPos(self,pos):
+ def set_pos(self,pos):
self.pos = pos
- def GetMinEqnValues(self):
+ def get_min_eqn_values(self):
x_pclist = []
- for i in range(0,len(self.CompNames)):
+ for i in range(0,len(self.compound_names)):
#print(self.Prop['x_pc[1,'+str(i+1)+']'])
#x_pclist.append(self.Prop['x_pc[1,'+str(i+1)+']'])
x_pclist.append(self.variables['x_pc[1,'+str(i+1)+']']['value'])
@@ -175,13 +175,13 @@ class MaterialStream():
x_pcstr = x_pcstr.replace('"','')
'''
if self.variables[self.mode1]['value']:
- self.eqnDict[self.mode1] = self.variables[self.mode1]['value']
+ self.eqn_dict[self.mode1] = self.variables[self.mode1]['value']
if self.variables[self.mode2]['value']:
- self.eqnDict[self.mode2] = self.variables[self.mode2]['value']
+ self.eqn_dict[self.mode2] = self.variables[self.mode2]['value']
if self.variables['x_pc']['value']:
- self.eqnDict['x_pc[1,:]'] = x_pc
+ self.eqn_dict['x_pc[1,:]'] = x_pc
if self.variables['F_pc']['value']:
- self.eqnDict['F_p[1]'] = self.variables['F_pc']['value']
+ self.eqn_dict['F_p[1]'] = self.variables['F_pc']['value']
print("##############$GetMinVEqnValuesStart$##################")
print("P:",self.variables[self.mode1]['value'])
@@ -190,66 +190,66 @@ class MaterialStream():
print("F_p",self.variables['F_p[1]']['value'])
print("##############$GetMinVEqnValuesEnd$##################")
- def GetStartValues(self):
+ def get_start_values(self):
try:
if self.variables[self.mode1]['value']:
- self.startDict[self.mode1] = self.variables[self.mode1]['value']
+ self.start_dict[self.mode1] = self.variables[self.mode1]['value']
if self.variables[self.mode2]['value']:
- self.startDict[self.mode2] = self.variables[self.mode2]['value']
+ self.start_dict[self.mode2] = self.variables[self.mode2]['value']
if self.variables['x_pc[2,1]']['value'] != None:
x_pcarr = []
for i in range(1,4):
cmf = []
- for j in range(1,len(self.CompNames)+1):
+ for j in range(1,len(self.compound_names)+1):
cmf.append(str(self.variables['x_pc['+str(i)+','+str(j)+']']['value']))
x_pcarr.append(cmf)
x_pcstr = json.dumps(x_pcarr)
x_pcstr = x_pcstr.replace('[','{')
x_pcstr = x_pcstr.replace(']','}')
x_pcstr = x_pcstr.replace('"','')
- self.startDict['x_pc'] = x_pcstr
+ self.start_dict['x_pc'] = x_pcstr
if self.variables['xm_pc[2,1]']['value'] != None:
xm_pcarr = []
for i in range(1,4):
cmf = []
- for j in range(1,len(self.CompNames)+1):
+ for j in range(1,len(self.compound_names)+1):
cmf.append(str(self.variables['xm_pc['+str(i)+','+str(j)+']']['value']))
xm_pcarr.append(cmf)
xm_pcstr = json.dumps(x_pcarr)
xm_pcstr = xm_pcstr.replace('[','{')
xm_pcstr = xm_pcstr.replace(']','}')
xm_pcstr = xm_pcstr.replace('"','')
- self.startDict['xm_pc'] = xm_pcstr
+ self.start_dict['xm_pc'] = xm_pcstr
if self.variables['Fm_pc[2,1]']['value'] != None:
Fm_pcarr = []
for i in range(1,4):
cmf = []
- for j in range(1,len(self.CompNames)+1):
+ for j in range(1,len(self.compound_names)+1):
cmf.append(str(self.variables['Fm_pc['+str(i)+','+str(j)+']']['value']))
Fm_pcarr.append(cmf)
Fm_pcstr = json.dumps(x_pcarr)
Fm_pcstr = Fm_pcstr.replace('[','{')
Fm_pcstr = Fm_pcstr.replace(']','}')
Fm_pcstr = Fm_pcstr.replace('"','')
- self.startDict['Fm_pc'] = Fm_pcstr
+ self.start_dict['Fm_pc'] = Fm_pcstr
if self.variables['F_pc[2,1]']['value'] != None:
F_pcarr = []
for i in range(1,4):
cmf = []
- for j in range(1,len(self.CompNames)+1):
+ for j in range(1,len(self.compound_names)+1):
cmf.append(str(self.variables['F_pc['+str(i)+','+str(j)+']']['value']))
F_pcarr.append(cmf)
F_pcstr = json.dumps(F_pcarr)
F_pcstr = F_pcstr.replace('[','{')
F_pcstr = F_pcstr.replace(']','}')
F_pcstr = F_pcstr.replace('"','')
- self.startDict['F_pc'] = F_pcstr
+ self.start_dict['F_pc'] = F_pcstr
if self.variables['MW_p[2]']['value'] != None:
MW_pArr = []
@@ -259,7 +259,7 @@ class MaterialStream():
MW_pStr = MW_pStr.replace('[','{')
MW_pStr = MW_pStr.replace(']','}')
MW_pStr = MW_pStr.replace('"','')
- self.startDict['MW_p'] = MW_pStr
+ self.start_dict['MW_p'] = MW_pStr
if self.variables['F_p[2]']['value'] != None:
F_pArr = []
@@ -269,7 +269,7 @@ class MaterialStream():
F_pStr = F_pStr.replace('[','{')
F_pStr = F_pStr.replace(']','}')
F_pStr = F_pStr.replace('"','')
- self.startDict['F_p'] = F_pStr
+ self.start_dict['F_p'] = F_pStr
if self.variables['Cp_p[2]']['value'] != None:
Cp_pArr = []
@@ -279,7 +279,7 @@ class MaterialStream():
Cp_pStr = Cp_pStr.replace('[','{')
Cp_pStr = Cp_pStr.replace(']','}')
Cp_pStr = Cp_pStr.replace('"','')
- self.startDict['Cp_p'] = Cp_pStr
+ self.start_dict['Cp_p'] = Cp_pStr
if self.variables['H_p[2]']['value'] != None:
H_pArr = []
@@ -289,7 +289,7 @@ class MaterialStream():
H_pStr = H_pStr.replace('[','{')
H_pStr = H_pStr.replace(']','}')
H_pStr = H_pStr.replace('"','')
- self.startDict['H_p'] = H_pStr
+ self.start_dict['H_p'] = H_pStr
if self.variables['S_p[2]']['value'] != None:
@@ -300,7 +300,7 @@ class MaterialStream():
S_pStr = S_pStr.replace('[','{')
S_pStr = S_pStr.replace(']','}')
S_pStr = S_pStr.replace('"','')
- self.startDict['S_p'] = S_pStr
+ self.start_dict['S_p'] = S_pStr
if self.variables['Fm_p[2]']['value'] != None:
Fm_pArr = []
@@ -310,7 +310,7 @@ class MaterialStream():
Fm_pStr = Fm_pStr.replace('[','{')
Fm_pStr = Fm_pStr.replace(']','}')
Fm_pStr = Fm_pStr.replace('"','')
- self.startDict['Fm_p'] = Fm_pStr
+ self.start_dict['Fm_p'] = Fm_pStr
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
@@ -322,10 +322,10 @@ class MaterialStream():
self.OM_data_init = ''
self.OM_data_init = self.OM_data_init + ("model ms"+str(self.count)+"\n")
self.OM_data_init = self.OM_data_init + ("extends Simulator.Streams.MaterialStream;\n" )
- self.OM_data_init = self.OM_data_init + ("extends Simulator.Files.ThermodynamicPackages."+self.thermoPackage+";\n")
+ self.OM_data_init = self.OM_data_init + ("extends Simulator.Files.ThermodynamicPackages."+self.thermo_package+";\n")
self.OM_data_init = self.OM_data_init + ("end ms"+str(self.count)+";\n")
comp_count = len(addedcomp)
- # self.GetStartValues()
+ # self.get_start_values()
#self.OM_data_init = "Simulator.Streams.Mat_Stm_RL " + self.name +"(Nc = " + str(comp_count)
self.OM_data_init = self.OM_data_init + "ms"+str(self.count) +" " + self.name +"(Nc = " + str(comp_count)
@@ -333,7 +333,7 @@ class MaterialStream():
C = str(addedcomp).strip('[').strip(']')
C = C.replace("'","")
self.OM_data_init = self.OM_data_init + C + "},"
- #for key, value in self.startDict.items():
+ #for key, value in self.start_dict.items():
# self.OM_data_init = self.OM_data_init + key + '(start = ' + str(value) + '),'
self.OM_data_init = self.OM_data_init[:-1]
self.OM_data_init = self.OM_data_init + ');\n'
@@ -344,14 +344,14 @@ class MaterialStream():
self.OM_data_eqn = ''
self.comp_count = len(addedcomp)
if method == 'Eqn':
- self.eqnDict = {}
- self.GetMinEqnValues()
+ self.eqn_dict = {}
+ self.get_min_eqn_values()
if method == 'SM':
- self.eqnDict = {}
- self.GetMinEqnValues()
+ self.eqn_dict = {}
+ self.get_min_eqn_values()
#self.GetEquationValues()
#self.GetEquationValues()
- for key,value in self.eqnDict.items():
+ for key,value in self.eqn_dict.items():
self.OM_data_eqn = self.OM_data_eqn + self.name + '.'+ key + ' = ' + str(value) + ';\n'
return self.OM_data_eqn
diff --git a/Undo.dat b/Undo.dat
index df0bd43..f20d64d 100644
Binary files a/Undo.dat and b/Undo.dat differ
diff --git a/UnitOperations.py b/UnitOperations.py
index 9591dc2..0b3f664 100644
--- a/UnitOperations.py
+++ b/UnitOperations.py
@@ -18,12 +18,12 @@ class UnitOperation():
def __init__(self):
self.OM_data_eqn = ''
self.OM_data_init = ''
- self.InputStms = []
- self.OutputStms = []
+ self.input_stms = []
+ self.output_stms = []
self.compounds = compound_selected
self.name = ''
self.mode = None
- self.modeVal = None
+ self.mode_val = None
self.type = ''
self.no_of_inputs = 1
self.no_of_outputs = 1
@@ -32,18 +32,18 @@ class UnitOperation():
self.pos = QPointF(self.x, self.y)
self.count = UnitOperation.counter
self.variables = {}
- self.modesList = []
+ self.modes_list = []
self.parameters = []
self.extra = []
- self.ForNaming = []
+ self.for_naming = []
self.multidict = []
- self.ThermoPackReq = False
- self.thermoPackage = None
+ self.thermo_pack_req = False
+ self.thermo_package = None
- def paramgetter(self,mode=None):
+ def param_getter(self,mode=None):
params = {}
- if mode == None and self.modesList:
- self.mode = self.modesList[0]
+ if mode == None and self.modes_list:
+ self.mode = self.modes_list[0]
else:
self.mode = mode
params[self.mode] = None
@@ -52,8 +52,8 @@ class UnitOperation():
return params
- def paramsetter(self,params):
- print("paramsetter ", params)
+ def param_setter(self,params):
+ print("param_setter ", params)
for k,v in params.items():
print(k,v)
if k != self.mode:
@@ -61,57 +61,57 @@ class UnitOperation():
self.variables[k]['value'] = v
else:
self.variables[k]['value'] = v
- self.modeVal = params[self.mode]
+ self.mode_val = params[self.mode]
print(self.variables)
def add_connection(self,flag,UnitOpr):
if flag==1: # Input stream if flag is 1
print("INPUT CONNECTION")
- self.InputStms.append(UnitOpr)
+ self.input_stms.append(UnitOpr)
else :
print("OUTPUT CONNECTION")
- self.OutputStms.append(UnitOpr)
+ self.output_stms.append(UnitOpr)
- def setPos(self,pos):
+ def set_pos(self,pos):
self.pos = pos
def OM_Flowsheet_Initialize(self):
self.OM_data_init = ''
- if(self.ThermoPackReq):
+ if(self.thermo_pack_req):
if len(self.extra)>1:
for i in range(len(self.extra)):
latest = ''
for j in range(self.extra[i]):
if self.extra[i][j]!='.':
latest += self.extra[i][j]
- self.ForNaming[i] = latest
+ self.for_naming[i] = latest
- if(self.ThermoPackReq):
+ if(self.thermo_pack_req):
if len(self.extra)==1:
for i in self.extra:
self.OM_data_init += ('model '+i+str(self.counter)+'\n')
self.OM_data_init += ('extends Simulator.UnitOperations.'+i+';\n')
- self.OM_data_init += ('extends Simulator.Files.ThermodynamicPackages.'+self.thermoPackage+';\n')
+ self.OM_data_init += ('extends Simulator.Files.ThermodynamicPackages.'+self.thermo_package+';\n')
self.OM_data_init += ('end '+i+str(self.counter)+';\n')
self.OM_data_init += i+str(self.counter) + ' ' + self.name + '(Nc = ' + str(len(self.compounds))
else:
for i in range(len(self.extra)):
if i!=(len(self.extra)-1):
- self.OM_data_init += ('model '+self.ForNaming[i]+str(self.counter)+'\n')
+ self.OM_data_init += ('model '+self.for_naming[i]+str(self.counter)+'\n')
self.OM_data_init += ('extends Simulator.UnitOperations.'+self.extra[i]+';\n')
- self.OM_data_init += ('extends Simulator.Files.ThermodynamicPackages.'+self.thermoPackage+';\n')
- self.OM_data_init += ('end '+self.ForNaming[i]+str(self.counter)+';\n')
+ self.OM_data_init += ('extends Simulator.Files.ThermodynamicPackages.'+self.thermo_package+';\n')
+ self.OM_data_init += ('end '+self.for_naming[i]+str(self.counter)+';\n')
else:
- self.OM_data_init += ('model '+self.ForNaming[i]+str(self.counter)+'\n')
+ self.OM_data_init += ('model '+self.for_naming[i]+str(self.counter)+'\n')
self.OM_data_init += ('extends Simulator.UnitOperations.'+self.extra[i]+';\n')
for j in range(len(self.extra)-1):
- self.OM_data_init += (self.ForNaming[j] + str(self.counter) +' ' + self.ForNaming[j] + '#' + self.multidict[j] + ';\n')
+ self.OM_data_init += (self.for_naming[j] + str(self.counter) +' ' + self.for_naming[j] + '#' + self.multidict[j] + ';\n')
- self.OM_data_init += ('end '+self.ForNaming[i]+str(self.counter)+';\n')
+ self.OM_data_init += ('end '+self.for_naming[i]+str(self.counter)+';\n')
- self.OM_data_init += self.ForNaming[i] + str(self.counter) + ' ' + self.ForNaming + '(Nc = ' + str(len(self.compounds))
+ self.OM_data_init += self.for_naming[i] + str(self.counter) + ' ' + self.for_naming + '(Nc = ' + str(len(self.compounds))
C = str(self.compounds).strip('[').strip(']')
C = C.replace("'", "")
@@ -138,24 +138,24 @@ class UnitOperation():
def OM_Flowsheet_Equation(self):
self.OM_data_eqn = ''
- if len(self.InputStms)>1:
+ if len(self.input_stms)>1:
strcount = 1
- for strm in self.InputStms:
+ for strm in self.input_stms:
self.OM_data_eqn += ('connect(' + strm.name + '.Out,' + self.name + '.In[' + str(strcount) + ']);\n')
strcount += 1
else:
- self.OM_data_eqn += ('connect(' + self.name + '.In,' + self.InputStms[0].name + '.Out);\n')
+ self.OM_data_eqn += ('connect(' + self.name + '.In,' + self.input_stms[0].name + '.Out);\n')
- if len(self.OutputStms)>1:
+ if len(self.output_stms)>1:
strcount = 1
- for strm in self.OutputStms:
+ for strm in self.output_stms:
self.OM_data_eqn += ('connect(' + strm.name + '.In,' + self.name + '.Out[' + str(strcount) + ']);\n')
strcount += 1
else:
- self.OM_data_eqn += ('connect(' + self.name + '.Out,' + self.OutputStms[0].name + '.In);\n')
+ self.OM_data_eqn += ('connect(' + self.name + '.Out,' + self.output_stms[0].name + '.In);\n')
if self.mode:
- self.OM_data_eqn += (self.name + '.' + self.mode + '=' + self.modeVal + ';\n')
+ self.OM_data_eqn += (self.name + '.' + self.mode + '=' + self.mode_val + ';\n')
return self.OM_data_eqn
@@ -166,8 +166,8 @@ class ShortcutColumn(UnitOperation):
self.type = 'ShortcutColumn'
self.no_of_inputs = 1
self.no_of_outputs = 2
- self.InputStms = None
- self.OutputStms = None
+ self.input_stms = None
+ self.output_stms = None
self.EngStm1 = EngStm(name='EngStm1'+self.name)
self.EngStm2 = EngStm(name='EngStm2'+self.name)
self.count = ShortcutColumn.counter
@@ -181,14 +181,14 @@ class ShortcutColumn(UnitOperation):
'HKey_x_pc' : {'name':'Heavy Key Mole Fraction', 'value':0.01, 'unit':'mol/s'},
'LKey_x_pc' : {'name':'Light Key Mole Fraction', 'value':0.01, 'unit':'mol/s'},
'Ctype' : {'name':'Condensor Type', 'value':None, 'unit':''},
- 'thermoPackage' : {'name':'Thermo Package', 'value':'Raoults_Law', 'unit':''},
+ 'thermo_package' : {'name':'Thermo Package', 'value':'Raoults_Law', 'unit':''},
'Pcond' : {'name':'Condensor Pressure', 'value':101325, 'unit':'Pa'},
'Preb' : {'name':'Reboiler Pressure', 'value':101325, 'unit':'Pa'},
'RR' : {'name':'Reflux Ratio', 'value':1.5, 'unit':''},
}
- def paramsetter(self,params):
- print("paramsetter ", params)
+ def param_setter(self,params):
+ print("param_setter ", params)
self.variables['HKey']['value'] = params[0]
self.variables['LKey']['value'] = params[1]
self.variables['HKey_x_pc']['value'] = params[2]
@@ -214,12 +214,12 @@ class DistillationColumn(UnitOperation):
self.EngStm2 = EngStm(name='EngStm2'+self.name)
self.count = DistillationColumn.counter
- self.InputStms = None
- self.OutputStms = None
- # self.modesList = ['RR', 'Nout', 'T']
- self.modesList = []
+ self.input_stms = None
+ self.output_stms = None
+ # self.modes_list = ['RR', 'Nout', 'T']
+ self.modes_list = []
self.parameters = ['']
- #self.parameters = ['Nt', 'InT_s', 'In_s', 'thermoPackage', 'Ctype', 'Pcond', 'Preb']
+ #self.parameters = ['Nt', 'InT_s', 'In_s', 'thermo_package', 'Ctype', 'Pcond', 'Preb']
self.Cspec_list = ['Reflux Ratio','Product Molar Flow (mol/s)', 'Temperature (K)', 'Compound Molar Fraction', 'Compound Molar Flow (mol/s)']
self.Rspec_list = ['Product Molar Flow (mol/s)', 'Temperature (K)', 'Compound Molar Fraction', 'Compound Molar Flow (mol/s)']
@@ -231,15 +231,15 @@ class DistillationColumn(UnitOperation):
'Nt' : {'name':'No of Stages', 'value':12, 'unit':''},
'InT_s' : {'name':'No of Feed Stages', 'value':None, 'unit':''},
'In_s' : {'name':'No of Feeds', 'value':None, 'unit':''},
- 'thermoPackage' : {'name':'Thermo Package', 'value':'Raoults_Law', 'unit':''},
+ 'thermo_package' : {'name':'Thermo Package', 'value':'Raoults_Law', 'unit':''},
'Ctype' : {'name':'Condensor Type', 'value':'', 'unit':''},
'Pcond' : {'name':'Condensor Pressure', 'value':101325, 'unit':'Pa'},
'Preb' : {'name':'Reboiler Pressure', 'value':101325, 'unit':'Pa'},
'C_Spec': {'name':'Condensor Specification', 'type':'Reflux Ratio', 'value':'', 'comp':'', 'unit':''},
'R_Spec': {'name':'Reboiler Specification', 'type':'', 'value':'', 'comp':'', 'unit':''},
}
- def paramsetter(self,params):
- print("paramsetter ", params)
+ def param_setter(self,params):
+ print("param_setter ", params)
self.variables['Nt']['value'] = params[0]
self.variables['In_s']['value'] = params[1]
self.variables['InT_s']['value'] = params[2]
@@ -293,8 +293,8 @@ class CompoundSeparator(UnitOperation):
# self.SepFact = json.dumps(self.variables['SepFact']['value']).replace('[','{').replace(']','}')
# self.SepStrm = str(self.variables['SepStrm']['value'])
# self.SepVal = json.dumps(self.variables['SepVal']['value']).replace('[','{').replace(']','}')
- def paramsetter(self,params):
- print("paramsetter ", params)
+ def param_setter(self,params):
+ print("param_setter ", params)
if params[0]:
self.variables['SepStrm']['value'] = 1
elif params[1]:
@@ -314,21 +314,21 @@ class Flash(UnitOperation):
self.type = 'Flash'
self.no_of_inputs = 1
self.no_of_outputs = 2
- self.InputStms = None
- self.OutputStms = None
+ self.input_stms = []
+ self.output_stms = []
self.count = Flash.counter
type(self).counter += 1
self.variables = {
- 'thermoPackage' : {'name':'Thermo Package', 'value':None, 'unit':''},
+ 'thermo_package' : {'name':'Thermo Package', 'value':None, 'unit':''},
'BTdef' : {'name':'Separation Temperature Boolean', 'value':False, 'unit':''},
'BPdef' : {'name':'Separation Pressure Boolean', 'value':False, 'unit':''},
'Tdef' : {'name':'Separation Temperature', 'value':298.15, 'unit':'K'},
'Pdef' : {'name':'Separation Pressure', 'value':101325, 'unit':'Pa'}
}
- def paramsetter(self,params):
- print("paramsetter ", params)
- self.variables['thermoPackage']['value'] = params[0]
+ def param_setter(self,params):
+ print("param_setter ", params)
+ self.variables['thermo_package']['value'] = params[0]
self.variables['BTdef']['value'] = params[1]
self.variables['Tdef']['value'] = params[2]
self.variables['BPdef']['value'] = params[3]
@@ -340,9 +340,9 @@ class Pump(UnitOperation):
UnitOperation.__init__(self)
self.name = name + str(Pump.counter)
self.type = 'Pump'
- self.InputStms = None
- self.OutputStms = None
- self.modesList = ['Pdel', 'Pout', 'Q'] #"enFlo"
+ self.input_stms = None
+ self.output_stms = None
+ self.modes_list = ['Pdel', 'Pout', 'Q'] #"enFlo"
self.parameters = ['Eff']
type(self).counter += 1
@@ -358,9 +358,9 @@ class Valve(UnitOperation):
UnitOperation.__init__(self)
self.name = name + str(Valve.counter)
self.type = 'Valve'
- self.InputStms = None
- self.OutputStms = None
- self.modesList = ['Pdel', 'Pout']
+ self.input_stms = None
+ self.output_stms = None
+ self.modes_list = ['Pdel', 'Pout']
type(self).counter += 1
self.variables = {
@@ -375,7 +375,7 @@ class Splitter(UnitOperation):
self.type = 'Splitter'
self.no_of_outputs = 3
- # self.InputStms = None
+ # self.input_stms = None
self.CalcType_modes = ['Split Ratios', 'Mole Flow Specs', 'Mass Flow Specs']
self.parameters = ['NOO', 'CalcType']#, 'SpecVal_s'
@@ -390,8 +390,8 @@ class Splitter(UnitOperation):
specval = self.variables['SpecVal_s']['value'] # [50,50]
self.specval = json.dumps(specval).replace('[','{').replace(']','}')
- def paramsetter(self,params):
- print("paramsetter ", params)
+ def param_setter(self,params):
+ print("param_setter ", params)
self.variables['NOO']['value'] = int(params[0])
self.variables['CalcType']['value'] = params[1]
self.variables['SpecVal_s']['value'] = [float(params[2]), float(params[3])]
@@ -411,18 +411,18 @@ class Mixer(UnitOperation):
self.Pout_modes = ['Inlet Minimum', 'Inlet Average', 'Inlet Maximum']
self.parameters = ['NOI', 'Pout']
- # self.OutputStms = None
+ # self.output_stms = None
type(self).counter += 1
self.variables = {
'NOI' : {'name':'Number of Input', 'value':6, 'unit':''},
'Pout' : {'name':'Outlet Pressure', 'value':'Inlet_Average', 'unit':''},
}
- def paramsetter(self, params):
- print(self.InputStms, self.OutputStms)
- self.OutputStms = []
- print(self.InputStms, self.OutputStms)
- print("paramsetter ", params)
+ def param_setter(self, params):
+ print(self.input_stms, self.output_stms)
+ self.output_stms = []
+ print(self.input_stms, self.output_stms)
+ print("param_setter ", params)
self.variables['NOI']['value'] = int(params[0])
self.variables['Pout']['value'] = params[1]
print(self.variables)
@@ -436,10 +436,10 @@ class Heater(UnitOperation):
self.type = 'Heater'
self.no_of_inputs = 1
self.no_of_outputs = 1
- self.modesList = ['Q','Tout','xvapout','Tdel']
+ self.modes_list = ['Q','Tout','xvapout','Tdel']
self.parameters = ['Pdel', 'Eff']
self.extra = None
- self.ForNaming = None
+ self.for_naming = None
type(self).counter += 1
self.variables = {
@@ -459,9 +459,9 @@ class Cooler(UnitOperation):
self.type = 'Cooler'
self.no_of_inputs = 1
self.no_of_outputs = 1
- self.modesList = ['Q','Tout','Tdel','xvap']
+ self.modes_list = ['Q','Tout','Tdel','xvap']
self.extra = None
- self.ForNaming = None
+ self.for_naming = None
self.parameters = ['Pdel', 'Eff']
type(self).counter += 1
@@ -482,11 +482,11 @@ class AdiabaticCompressor(UnitOperation):
self.type = 'AdiabaticCompressor'
self.no_of_inputs = 1
self.no_of_outputs = 1
- self.modesList = ["Pdel","Pout","Q"]
+ self.modes_list = ["Pdel","Pout","Q"]
self.extra = ['AdiabaticCompressor']
- self.ForNaming = ['AdiabaticCompressor']
- self.ThermoPackReq = True
- self.thermoPackage ="RaoultsLaw"
+ self.for_naming = ['AdiabaticCompressor']
+ self.thermo_pack_req = True
+ self.thermo_package ="RaoultsLaw"
self.parameters = ['Eff']
type(self).counter += 1
self.variables = {
@@ -506,11 +506,11 @@ class AdiabaticExpander(UnitOperation):
self.type = 'AdiabaticExpander'
self.no_of_inputs = 1
self.no_of_outputs = 1
- self.modesList = ["Pdel","Pout","Q"]
+ self.modes_list = ["Pdel","Pout","Q"]
self.extra = ['AdiabaticExpander']
- self.ForNaming = ['AdiabaticExpander']
- self.ThermoPackReq = True
- self.thermoPackage ="RaoultsLaw"
+ self.for_naming = ['AdiabaticExpander']
+ self.thermo_pack_req = True
+ self.thermo_package ="RaoultsLaw"
self.parameters = ['Eff']
type(self).counter += 1
self.variables = {
diff --git a/class_diagram.pdf b/class_diagram.pdf
new file mode 100644
index 0000000..c2c1134
Binary files /dev/null and b/class_diagram.pdf differ
diff --git a/container.py b/container.py
index 6f9b0cd..14e3bf0 100644
--- a/container.py
+++ b/container.py
@@ -19,29 +19,30 @@ import sys
from Graphics import *
class Container():
- def __init__(self,msgbrowser):
- self.unitOp = []
- self.thermoPackage = None
+ def __init__(self,msgbrowser, graphicsView):
+ self.unit_operations = []
+ self.thermo_package = None
self.compounds = None
self.flowsheet = None
self.conn = defaultdict(list)
self.op=defaultdict(list)
self.ip=defaultdict(list)
self.msg = msgbrowser
+ self.graphicsView = graphicsView
self.msg.setText("")
self.opl=[]
self.result=[]
- self.graphics = Graphics(self.unitOp)
- self.scene = self.graphics.getScene()
+ self.graphics = Graphics(self.unit_operations, self.graphicsView)
+ self.scene = self.graphics.get_scene()
- def currentTime(self):
+ def current_time(self):
now = datetime.datetime.now()
time = str(now.hour) + ":" + str(now.minute) + ":" +str(now.second)
return time
# def updateConn(self,key,value):
# self.conn[key].append(value)
- # self.msg.append("["+str(self.currentTime())+"] "+key.name+" output is connected to input of "+value.name +" ")
+ # self.msg.append("["+str(self.current_time())+"] "+key.name+" output is connected to input of "+value.name +" ")
#
# def connection(self):
# try:
@@ -61,31 +62,31 @@ class Container():
# i.connect(InputStms=self.ip[i],OutputStms=self.op[i])
#
# self.opl.append([self.op[i] for i in self.op])
- # self.opl=flatlist(flatlist(self.opl))
+ # self.opl=flat_list(flat_list(self.opl))
# except Exception as e:
# print(e)
# @staticmethod
# def addUnitOpObj(obj):
- # self.unitOp.append(obj)
+ # self.unit_operations.append(obj)
- def addUnitOp(self,obj, graphicsView):
+ def add_unit_operation(self, obj):
box = None
self.obj = obj
- self.scene = self.graphics.getScene()
- self.graphicsView = graphicsView
- box = self.graphics.createNodeItem(self.obj, self, self.graphicsView)
+ self.scene = self.graphics.get_scene()
+ #self.graphicsView = graphicsView
+ box = self.graphics.create_node_item(self.obj, self)
self.scene.addItem(box)
box.setPos(2500-30, 2500-30)
- if(obj in self.unitOp):
+ if(obj in self.unit_operations):
pass
else:
- self.unitOp.append(obj)
- data = self.unitOp[:]
+ self.unit_operations.append(obj)
+ data = self.unit_operations[:]
data.append(compound_selected)
- PUSH('Undo', data)
- self.msg.append("["+str(self.currentTime())+"] "+obj.name+" is instantiated .""")
+ push('Undo', data)
+ self.msg.append("["+str(self.current_time())+"] "+obj.name+" is instantiated .""")
'''
Deletes the selected item from the canvas and also the objects created for that type.
@@ -93,58 +94,58 @@ class Container():
def delete(self,l):
for item in l:
self.scene.removeItem(item)
- for i in dockWidgetLst:
+ for i in dock_widget_lst:
if i.name == item.name:
i.hide()
del i
break
- for i in dockWidgetLst:
+ for i in dock_widget_lst:
print(i.name)
- print("delete ", dockWidgetLst)
+ print("delete ", dock_widget_lst)
if hasattr(item,'Input'):
- for x in item.Input:
- if x.newLine:
- self.scene.removeItem(x.newLine)
- del x.newLine
+ for x in item.input:
+ if x.new_line:
+ self.scene.removeItem(x.new_line)
+ del x.new_line
if x.otherLine:
self.scene.removeItem(x.otherLine)
del x.otherLine
if hasattr(item,'Output'):
- for x in item.Output:
- if x.newLine:
- self.scene.removeItem(x.newLine)
- del x.newLine
+ for x in item.output:
+ if x.new_line:
+ self.scene.removeItem(x.new_line)
+ del x.new_line
if x.otherLine:
self.scene.removeItem(x.otherLine)
del x.otherLine
if hasattr(item,'obj'):
- self.unitOp.remove(item.obj)
+ self.unit_operations.remove(item.obj)
for k in list(self.conn):
if item.obj==k:
del self.conn[k]
elif item.obj in self.conn[k]:
self.conn[k].remove(item.obj)
- self.msg.append("["+str(self.currentTime())+"] "+item.obj.name+" is deleted .""")
+ self.msg.append("["+str(self.current_time())+"] "+item.obj.name+" is deleted .""")
del item.obj
del item
- CLEAN_FILE('Redo')
- data = self.unitOp[:]
+ clean_file('Redo')
+ data = self.unit_operations[:]
data.append(compound_selected)
- PUSH('Undo', data)
+ push('Undo', data)
- def fetchObject(self,name):
- for i in self.unitOp:
+ def fetch_object(self,name):
+ for i in self.unit_operations:
if(i.name==name):
return i
- def addCompounds(self,comp):
+ def add_aompounds(self,comp):
self.compounds = comp
- def add_thermoPackage(self,thermo):
- self.thermoPackage = thermo
+ def add_thermo_package(self,thermo):
+ self.thermo_package = thermo
- def msgBrowser(self):
+ def msg_browser(self):
std = self.flowsheet.stdout.decode("utf-8")
if(std):
stdout = str(std)
@@ -162,47 +163,47 @@ class Container():
print(mode)
self.compounds = compound_selected
self.flowsheet = Flowsheet()
- self.flowsheet.add_comp_list(self.compounds)
+ self.flowsheet.add_compound_list(self.compounds)
print("######## connection master#########\n",self.conn)
- for i in self.unitOp :
+ for i in self.unit_operations :
print("here",i)
- self.flowsheet.add_UnitOpn(i)
+ self.flowsheet.add_unit_operations(i)
if mode=='SM':
- self.msg.append("["+str(self.currentTime())+"] Simulating in Sequential mode ... ")
- self.flowsheet.simulateSM(self.ip,self.op)
- self.msgBrowser()
- self.result=self.flowsheet.resdata
+ self.msg.append("["+str(self.current_time())+"] Simulating in Sequential mode ... ")
+ self.flowsheet.simulate_SM(self.ip,self.op)
+ self.msg_browser()
+ self.result=self.flowsheet.result_data
print("under SEQ mode simulation")
elif mode=='EQN':
- self.msg.append("["+str(self.currentTime())+"] Simulating in equation mode ... ")
- self.flowsheet.simulateEQN()
- self.msgBrowser()
- self.result=self.flowsheet.resdata
+ self.msg.append("["+str(self.current_time())+"] Simulating in equation mode ... ")
+ self.flowsheet.simulate_EQN()
+ self.msg_browser()
+ self.result=self.flowsheet.result_data
print("under Eqn mode simulation")
- DockWidget.showResult(NodeItem.getDockWidget())
+ DockWidget.show_result(NodeItem.get_dock_widget())
-def flatlist(lst):
- flat_list=[]
+def flat_list(lst):
+ flat_lst=[]
for sublist in lst:
for item in sublist:
- flat_list.append(item)
- return flat_list
+ flat_lst.append(item)
+ return flat_lst
-def PUSH(fileName, data):
- with open(f"{fileName}.dat", "ab") as obj:
+def push(file_name, data):
+ with open(f"{file_name}.dat", "ab") as obj:
pickle.dump(data, obj)
-def CLEAN_FILE(fileName):
- with open(f"{fileName}.dat", "wb") as clean:
+def clean_file(file_name):
+ with open(f"{file_name}.dat", "wb") as clean:
pass
-def POP(fileName):
+def pop(file_name):
last_command = None
- if os.stat(f"{fileName}.dat").st_size != 0:
+ if os.stat(f"{file_name}.dat").st_size != 0:
commands = []
- with open(f"{fileName}.dat", "rb") as objs:
+ with open(f"{file_name}.dat", "rb") as objs:
while True:
try:
command = pickle.load(objs)
@@ -213,18 +214,18 @@ def POP(fileName):
last_command = commands[-1]
commands.remove(commands[-1])
if len(commands) != 0:
- with open(f"{fileName}.dat", "wb") as updated_data:
+ with open(f"{file_name}.dat", "wb") as updated_data:
for i in range(len(commands)):
pickle.dump(commands[i], updated_data)
else:
- CLEAN_FILE(fileName)
+ clean_file(file_name)
return last_command
-def get_last_list(fileName):
+def get_last_list(file_name):
commands = []
- if os.stat(f"{fileName}.dat").st_size != 0:
- with open(f"{fileName}.dat", "rb") as objs:
+ if os.stat(f"{file_name}.dat").st_size != 0:
+ with open(f"{file_name}.dat", "rb") as objs:
while True:
try:
command = pickle.load(objs)
diff --git a/dockWidget.py b/dockWidget.py
deleted file mode 100644
index 8eeff51..0000000
--- a/dockWidget.py
+++ /dev/null
@@ -1,220 +0,0 @@
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5.uic import loadUiType
-import pandas as pd
-from functools import partial
-from ComponentSelector import *
-from collections import defaultdict
-from Graphics import *
-
-ui_dialog,_ = loadUiType('DockWidget.ui')
-
-class DockWidget(QDockWidget,ui_dialog):
-
- def __init__(self,name,comptype,obj,container, parent=None):
- QDockWidget.__init__(self,parent)
- self.setupUi(self)
- self.setWindowTitle(obj.name)
- self.name=name
- self.obj=obj
- self.type = comptype
- self.inputdict = {}
- self.x_pclist = []
- self.modes()
- self.comboBox.currentIndexChanged.connect(self.modeSelection)
-
- print("constructor ", self.inputdict)
- self.pushButton_2.clicked.connect(self.param)
- self.dict = {}
-
- self.nameType = None
- self.container = container
-
- # input data tab
- def modes(self):
- modesList = self.obj.modesList
- if(modesList):
- for j in modesList:
- self.comboBox.addItem(str(self.obj.variables[j]['name']))
- self.modeSelection()
- else:
- self.comboBox.setDisabled(True)
- self.inputdict= {}
- self.inputdict = self.obj.paramgetter()
- self.inputparamslist()
-
- def modeSelection(self):
- self.inputdict= {}
- for i in reversed(range(self.formLayout.count())):
- self.formLayout.removeRow(i)
- print(self.comboBox.currentText())
- for i in self.obj.variables:
- if self.obj.variables[i]['name'] == self.comboBox.currentText():
- currentText = i
- break
- self.inputdict = self.obj.paramgetter(currentText)
- print('mode selection ', self.inputdict)
- self.inputparamslist()
-
- def inputparamslist(self):
- try:
- print("inputparamslist ", self.inputdict)
- for c,i in enumerate(self.inputdict):
- if i == None:
- continue
- if(i=="thermoPackage"):
- print("thermo1")
- combo = QComboBox()
- self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
- print("thermo2")
- for j in self.lines:
- combo.addItem(str(j))
- combo.setMinimumContentsLength(15)
- lay = QGridLayout()
- lay.addWidget(QLabel(i+":"), 0,0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(''), 0, 2, alignment = Qt.AlignCenter)
- self.formLayout.addRow(lay)
- self.inputdict[i] = combo
- print("thermo")
- elif(i=="Ctype"):
- combo = QComboBox()
- self.lines = ["Total","Partial"]
- for j in self.lines:
- combo.addItem(str(j))
- combo.setMinimumContentsLength(15)
- lay = QGridLayout()
- lay.addWidget(QLabel("Condensor Type :"), 0, 0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(''), 0, 2, alignment = Qt.AlignCenter)
- self.formLayout.addRow(lay)
- self.inputdict[i] = combo
- elif(i=="x_pc"):
- noc = len(compound_selected)
- print(noc)
- self.x_pclist.clear()
- gp = QGroupBox("Compounds")
- lay = QGridLayout()
- for j in range(noc):
- l = QLineEdit()
- self.inputdict[i] = "x_pc"
- lay.addWidget(QLabel(str(compound_selected[j])+":"),j,0, alignment=Qt.AlignLeft)
- lay.addWidget(l,j,1, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(self.obj.variables[i]['unit']),j,2, alignment=Qt.AlignCenter)
- self.x_pclist.append(l)
- gp.setLayout(lay)
- self.formLayout.addRow(gp)
- else:
- print("elseloop")
- print(i)
- if i == None:
- continue
- l = QLineEdit()
- if self.inputdict[i] != None:
- l.setText(str(self.inputdict[i]))
- print('before lay')
- lay = QGridLayout()
- lay.addWidget(QLabel(self.obj.variables[i]['name']+":"),0,0, alignment=Qt.AlignLeft) #self.obj.variables[i]['name']
- lay.addWidget(l,0,1, alignment=Qt.AlignCenter)
- print('after lay')
- if(i != 'MolFlow'):
- lay.addWidget(QLabel(self.obj.variables[i]['unit']),0,2, alignment=Qt.AlignCenter)
- else:
- lay.addWidget(QLabel('mol/s'),0,2, alignment=Qt.AlignCenter)
- print('after all')
- self.formLayout.addRow(lay)
- self.inputdict[i] = l
-
-
- except Exception as e:
- print(e)
-
- def Show_Error(self):
- QMessageBox.about(self, 'Important', "Please fill all fields with data")
-
- def param(self):
- try:
- self.dict={}
- print("param.inputdict ", self.inputdict)
- for i in self.inputdict:
- if (self.inputdict[i] == None):
- continue
- if(i=="thermoPackage"):
- if (self.inputdict[i].currentText()):
- self.dict[i] = self.inputdict[i].currentText()
- else:
- self.Show_Error()
- break
- elif(i=="Ctype"):
- if (self.inputdict[i].currentText()):
- self.dict[i] = self.inputdict[i].currentText()
- else:
- self.Show_Error()
- break
- elif(i =="x_pc"):
- l=[]
- mf = []
- total_moles = 0
- for mol_frac in self.x_pclist:
- if (mol_frac.text()):
- l.append(mol_frac.text())
- total_moles += float(l[-1])
- else:
- self.Show_Error()
- break
- for c in range(len(compound_selected)):
- mf.append(str(float(l[c])/total_moles))
- self.x_pclist[c].setText(mf[-1])
- self.dict[i] = ",".join(mf)
- elif(i == 'Pout' and self.obj.type == 'Mixer' or i == '' or i == 'HKey' or i == 'LKey'):
- self.dict[i] = self.inputdict[i].currentText()
- else:
- print(self.inputdict[i], i, self.obj.type)
- if (self.inputdict[i].text()):
- self.dict[i] = self.inputdict[i].text()
- else:
- print(self.inputdict[i].text())
- self.Show_Error()
- break
-
- print("param ", self.dict)
- self.obj.paramsetter(self.dict)
- self.hide()
-
- except Exception as e:
- print(e)
-
- @staticmethod
- def showResult(lst):
- #DockWidget1.flag = True
- for i in lst:
- i.resultsCategory(i.name)
- #i.show()
-
- # result data tab
- def resultsCategory(self,name):
- flag = True
- try:
- print("Under result category name ", name)
- result=self.container.result
- obj = self.container.fetchObject(name)
- self.tableWidget.setRowCount(0)
- variKeys = list(obj.variables.keys())
- print(variKeys)
- for i, val in enumerate(variKeys):
- propertyname = name + '.' + val
- print(i,val, propertyname)
- if propertyname in result[0]:
- ind = result[0].index(propertyname)
- resultval = str(result[-1][ind])
- print("######Resultsfetch####",val,resultval)
- rowPosition = self.tableWidget.rowCount()
- self.tableWidget.insertRow(rowPosition)
- self.tableWidget.setItem(rowPosition , 0, QTableWidgetItem(obj.variables[val]['name']))
- self.tableWidget.setItem(rowPosition , 1, QTableWidgetItem(resultval))
- self.tableWidget.setItem(rowPosition , 2, QTableWidgetItem(obj.variables[val]['unit']))
- self.tableWidget.resizeColumnsToContents()
-
- except Exception as e:
- print(e)
\ No newline at end of file
diff --git a/dockWidget.ui b/dockWidget.ui
deleted file mode 100644
index 5851d71..0000000
--- a/dockWidget.ui
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
- Form
-
-
- true
-
-
-
- 0
- 0
- 392
- 700
-
-
-
-
- 0
- 0
-
-
-
-
- 3200
- 5000
-
-
-
- Form
-
-
- false
-
-
-
-
- 10
- 30
- 361
- 621
-
-
-
- false
-
-
- 0
-
-
-
- Input Data
-
-
-
-
- 9
- 9
- 331
- 71
-
-
-
- Mode Selection
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
- Mode :
-
-
-
- -
-
-
- true
-
-
-
- 0
- 0
-
-
-
-
-
-
-
-
-
-
-
- 10
- 100
- 331
- 321
-
-
-
- Parameter Selection
-
-
- -
-
-
-
-
-
-
-
- 10
- 430
- 331
- 21
-
-
-
- Submit
-
-
-
-
-
- Results
-
-
- -
-
-
- 3
-
-
- 110
-
-
- true
-
-
-
- Attribute
-
-
-
-
- Value
-
-
-
-
- Unit
-
-
-
-
-
-
-
-
-
-
-
diff --git a/main.ui b/main.ui
index 7974d9d..06367ea 100644
--- a/main.ui
+++ b/main.ui
@@ -155,8 +155,8 @@
File
-
-
+
+
@@ -187,7 +187,7 @@
Compounds
-
+
@@ -228,6 +228,13 @@
524287
+
+
+ Microsoft JhengHei
+ 75
+ true
+
+
Component Selector
@@ -266,7 +273,7 @@
0
- -246
+ 0
221
956
@@ -294,7 +301,8 @@
- 18
+ Microsoft JhengHei UI
+ 14
75
true
@@ -335,9 +343,11 @@
- Comic Sans MS
- 11
- true
+ Microsoft JhengHei
+ 10
+ 75
+ false
+ true
@@ -347,7 +357,7 @@
Text-align:left;
- MaterialStream
+ MaterialStream
@@ -355,8 +365,8 @@
- 50
- 50
+ 30
+ 30
@@ -381,9 +391,425 @@
16777215
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 0
+ 46
+ 46
+
+
+
+
+
+
+ 0
+ 69
+ 69
+
+
+
+
+
+
+ 0
+ 57
+ 57
+
+
+
+
+
+
+ 0
+ 23
+ 23
+
+
+
+
+
+
+ 0
+ 30
+ 30
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 46
+ 46
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 23
+ 23
+
+
+
+
+
+
+ 255
+ 255
+ 220
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 0
+ 46
+ 46
+
+
+
+
+
+
+ 0
+ 69
+ 69
+
+
+
+
+
+
+ 0
+ 57
+ 57
+
+
+
+
+
+
+ 0
+ 23
+ 23
+
+
+
+
+
+
+ 0
+ 30
+ 30
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 46
+ 46
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 23
+ 23
+
+
+
+
+
+
+ 255
+ 255
+ 220
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 0
+ 46
+ 46
+
+
+
+
+
+
+ 0
+ 69
+ 69
+
+
+
+
+
+
+ 0
+ 57
+ 57
+
+
+
+
+
+
+ 0
+ 23
+ 23
+
+
+
+
+
+
+ 0
+ 30
+ 30
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 0
+ 46
+ 46
+
+
+
+
+
+
+ 0
+ 46
+ 46
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 46
+ 46
+
+
+
+
+
+
+ 255
+ 255
+ 220
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
- 18
+ Microsoft JhengHei UI
+ 14
75
true
@@ -424,15 +850,17 @@
- Comic Sans MS
- 11
+ Microsoft JhengHei
+ 10
+ 75
+ true
Text-align:left
- Mixer
+ Mixer
@@ -440,8 +868,8 @@
- 50
- 50
+ 30
+ 30
@@ -468,15 +896,17 @@
- Comic Sans MS
- 11
+ Microsoft JhengHei
+ 10
+ 75
+ true
Text-align:left
- Splitter
+ Splitter
@@ -484,8 +914,8 @@
- 50
- 50
+ 30
+ 30
@@ -510,9 +940,425 @@
16777215
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 0
+ 70
+ 70
+
+
+
+
+
+
+ 0
+ 105
+ 105
+
+
+
+
+
+
+ 0
+ 87
+ 87
+
+
+
+
+
+
+ 0
+ 35
+ 35
+
+
+
+
+
+
+ 0
+ 46
+ 46
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 70
+ 70
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 35
+ 35
+
+
+
+
+
+
+ 255
+ 255
+ 220
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 0
+ 70
+ 70
+
+
+
+
+
+
+ 0
+ 105
+ 105
+
+
+
+
+
+
+ 0
+ 87
+ 87
+
+
+
+
+
+
+ 0
+ 35
+ 35
+
+
+
+
+
+
+ 0
+ 46
+ 46
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 70
+ 70
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 35
+ 35
+
+
+
+
+
+
+ 255
+ 255
+ 220
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 0
+ 70
+ 70
+
+
+
+
+
+
+ 0
+ 105
+ 105
+
+
+
+
+
+
+ 0
+ 87
+ 87
+
+
+
+
+
+
+ 0
+ 35
+ 35
+
+
+
+
+
+
+ 0
+ 46
+ 46
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 73
+ 36
+ 73
+
+
+
+
+
+
+ 0
+ 70
+ 70
+
+
+
+
+
+
+ 0
+ 70
+ 70
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 70
+ 70
+
+
+
+
+
+
+ 255
+ 255
+ 220
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
- 18
+ Microsoft JhengHei UI
+ 14
75
true
@@ -553,15 +1399,17 @@
- Comic Sans MS
- 11
+ Microsoft JhengHei
+ 10
+ 75
+ true
Text-align:left
- Heater
+ Heater
@@ -569,10 +1417,19 @@
- 50
- 50
+ 40
+ 40
+
+ false
+
+
+ false
+
+
+ false
+
-
@@ -597,15 +1454,17 @@
- Comic Sans MS
- 11
+ Microsoft JhengHei
+ 10
+ 75
+ true
Text-align:left
- Cooler
+ Cooler
@@ -613,10 +1472,13 @@
- 50
- 50
+ 40
+ 40
+
+ false
+
-
@@ -641,7 +1503,8 @@
- 18
+ Microsoft JhengHei UI
+ 14
75
true
@@ -682,15 +1545,17 @@
- Comic Sans MS
- 11
+ Microsoft JhengHei
+ 10
+ 75
+ true
Text-align:left
- Flash
+ Flash
@@ -698,8 +1563,8 @@
- 50
- 50
+ 40
+ 40
@@ -726,15 +1591,17 @@
- Comic Sans MS
- 11
+ Microsoft JhengHei
+ 10
+ 75
+ true
Text-align:left
- Compound Seperator
+ Compound Seperator
@@ -742,8 +1609,8 @@
- 50
- 50
+ 40
+ 40
@@ -770,7 +1637,8 @@
- 15
+ Microsoft JhengHei UI
+ 14
75
true
@@ -808,15 +1676,17 @@
- Comic Sans MS
- 11
+ Microsoft JhengHei
+ 10
+ 75
+ true
Text-align:left
- Valve
+ Valve
@@ -824,8 +1694,8 @@
- 50
- 50
+ 30
+ 30
@@ -852,15 +1722,17 @@
- Comic Sans MS
- 11
+ Microsoft JhengHei
+ 10
+ 75
+ true
Text-align:left
- Centrifugal Pump
+ Centrifugal Pump
@@ -868,8 +1740,8 @@
- 50
- 50
+ 30
+ 30
@@ -896,15 +1768,17 @@
- Comic Sans MS
- 11
+ Microsoft JhengHei
+ 10
+ 75
+ true
Text-align:left
- Adiabatic Compressor
+ Adiabatic Compressor
@@ -912,8 +1786,8 @@
- 50
- 50
+ 30
+ 30
@@ -940,8 +1814,10 @@
- Comic Sans MS
- 11
+ Microsoft JhengHei
+ 10
+ 75
+ true
@@ -951,7 +1827,7 @@
Text-align:left
- Adiabatic Expander
+ Adiabatic Expander
@@ -959,8 +1835,8 @@
- 50
- 50
+ 30
+ 30
@@ -987,7 +1863,8 @@
- 18
+ Microsoft JhengHei UI
+ 14
75
true
@@ -1025,19 +1902,21 @@
- Comic Sans MS
- 11
+ Microsoft JhengHei
+ 10
+ 75
+ true
Text-align:left
- Distillation Column
+ Distillation Column
- icons/DistillationColumn.pngicons/DistillationColumn.png
+ Icons/Column.pngIcons/Column.png
@@ -1069,19 +1948,21 @@
- Comic Sans MS
- 11
+ Microsoft JhengHei
+ 10
+ 75
+ true
Text-align:left
- Shortcut Column
+ Shortcut Column
- icons/ShortcutColumn.pngicons/ShortcutColumn.png
+ Icons/Column.pngIcons/Column.png
@@ -1111,21 +1992,21 @@
false
-
+
-
-
+
+
-
+
- icons/zoomIn.pngicons/zoomIn.png
+ Icons/zoom_in.pngIcons/zoom_in.png
ZoomIn
@@ -1134,7 +2015,7 @@
- icons/zoomOut.pngicons/zoomOut.png
+ Icons/zoom_out.pngIcons/zoom_out.png
ZoomOut
@@ -1143,43 +2024,43 @@
- icons/zoomReset.pngicons/zoomReset.png
+ Icons/zoom_reset.pngIcons/zoom_reset.png
ResetZoom
-
+
- icons/Equation.pngicons/Equation.png
+ Icons/eq.pngIcons/eq.png
Equation oriented
-
+
- icons/Sequential.pngicons/Sequential.png
+ Icons/sq.pngIcons/sq.png
Sequential mode
-
+
- icons/compoundSelector.pngicons/compoundSelector.png
+ Icons/compound.pngIcons/compound.png
Select Compounds
-
+
- icons/new.svgicons/new.svg
+ Icons/new.pngIcons/new.png
New
@@ -1191,11 +2072,6 @@
-
- save
-
-
-
Save
@@ -1205,7 +2081,7 @@
Open
-
+
Binary Phase Envelope
diff --git a/main2.ui b/main2.ui
deleted file mode 100644
index 49b29e6..0000000
--- a/main2.ui
+++ /dev/null
@@ -1,415 +0,0 @@
-
-
- MainWindow
-
-
-
- 0
- 0
- 1068
- 829
-
-
-
- MainWindow
-
-
-
- icons/logo.pngicons/logo.png
-
-
-
- 24
- 24
-
-
-
-
-
- 0
- 0
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 12
-
-
-
- true
-
-
- true
-
-
- true
-
-
-
-
-
- Qt::ScrollBarAsNeeded
-
-
- Qt::ScrollBarAsNeeded
-
-
-
-
- 170
- 170
- 127
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
- 0.000000000000000
- 0.000000000000000
- 5000.000000000000000
- 5000.000000000000000
-
-
-
- QGraphicsView::RubberBandDrag
-
-
- QGraphicsView::AnchorUnderMouse
-
-
- QGraphicsView::AnchorUnderMouse
-
-
- QGraphicsView::FullViewportUpdate
-
-
- QGraphicsView::DontClipPainter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 109
- 150
-
-
-
-
- 524287
- 150
-
-
-
- Qt::BottomDockWidgetArea
-
-
- Message Browser
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 270
- 548
-
-
-
-
- 270
- 524287
-
-
-
- Component Selector
-
-
- 2
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 100
- 430
-
-
-
-
- 240
- 1000
-
-
-
- Qt::ScrollBarAlwaysOn
-
-
- true
-
-
-
-
- 0
- 0
- 221
- 732
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- toolBar
-
-
-
-
-
- TopToolBarArea
-
-
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- icons/zoomIn.pngicons/zoomIn.png
-
-
- ZoomIn
-
-
-
-
-
- icons/zoomOut.pngicons/zoomOut.png
-
-
- ZoomOut
-
-
-
-
-
- icons/zoomReset.pngicons/zoomReset.png
-
-
- ResetZoom
-
-
-
-
-
- icons/Equation.pngicons/Equation.png
-
-
- Equation oriented
-
-
-
-
-
- icons/Sequential.pngicons/Sequential.png
-
-
- Sequential mode
-
-
-
-
-
- icons/compoundSelector.pngicons/compoundSelector.png
-
-
- Select Compounds
-
-
-
-
-
- icons/new.svgicons/new.svg
-
-
- New
-
-
-
-
- Help
-
-
-
-
- save
-
-
-
-
- Save
-
-
-
-
- Open
-
-
-
-
- Binary Phase Envelope
-
-
-
-
- Terminate
-
-
-
-
- Undo
-
-
-
-
- Redo
-
-
-
-
-
-
diff --git a/main3.ui b/main3.ui
deleted file mode 100644
index 9d30a8e..0000000
--- a/main3.ui
+++ /dev/null
@@ -1,2112 +0,0 @@
-
-
- MainWindow
-
-
-
- 0
- 0
- 1068
- 803
-
-
-
- MainWindow
-
-
-
- icons/logo.pngicons/logo.png
-
-
-
- 24
- 24
-
-
-
-
-
- 0
- 0
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 12
-
-
-
- true
-
-
- true
-
-
- true
-
-
-
-
-
- Qt::ScrollBarAsNeeded
-
-
- Qt::ScrollBarAsNeeded
-
-
-
-
- 170
- 170
- 127
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
- 0.000000000000000
- 0.000000000000000
- 5000.000000000000000
- 5000.000000000000000
-
-
-
- QGraphicsView::RubberBandDrag
-
-
- QGraphicsView::AnchorUnderMouse
-
-
- QGraphicsView::AnchorUnderMouse
-
-
- QGraphicsView::FullViewportUpdate
-
-
- QGraphicsView::DontClipPainter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 109
- 150
-
-
-
-
- 524287
- 150
-
-
-
- Qt::BottomDockWidgetArea
-
-
- Message Browser
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 270
- 548
-
-
-
-
- 270
- 524287
-
-
-
-
- Microsoft JhengHei
- 75
- true
-
-
-
- Component Selector
-
-
- 2
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 100
- 430
-
-
-
-
- 240
- 1000
-
-
-
- Qt::ScrollBarAlwaysOn
-
-
- true
-
-
-
-
- 0
- -251
- 221
- 956
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 30
-
-
-
-
- 200
- 16777215
-
-
-
-
- Microsoft JhengHei UI
- 14
- 75
- true
-
-
-
- Qt::LeftToRight
-
-
- color:rgb(73,36,73,255)
-
-
- Streams
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
-
- 200
- 50
-
-
-
-
- Microsoft JhengHei
- 10
- 75
- false
- true
-
-
-
- true
-
-
- Text-align:left;
-
-
- MaterialStream
-
-
-
- icons/MaterialStream.pngicons/MaterialStream.png
-
-
-
- 30
- 30
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 30
-
-
-
-
- 200
- 16777215
-
-
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 0
- 46
- 46
-
-
-
-
-
-
- 0
- 69
- 69
-
-
-
-
-
-
- 0
- 57
- 57
-
-
-
-
-
-
- 0
- 23
- 23
-
-
-
-
-
-
- 0
- 30
- 30
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
- 0
- 46
- 46
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
- 0
- 23
- 23
-
-
-
-
-
-
- 255
- 255
- 220
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 0
- 46
- 46
-
-
-
-
-
-
- 0
- 69
- 69
-
-
-
-
-
-
- 0
- 57
- 57
-
-
-
-
-
-
- 0
- 23
- 23
-
-
-
-
-
-
- 0
- 30
- 30
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
- 0
- 46
- 46
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
- 0
- 23
- 23
-
-
-
-
-
-
- 255
- 255
- 220
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 0
- 46
- 46
-
-
-
-
-
-
- 0
- 69
- 69
-
-
-
-
-
-
- 0
- 57
- 57
-
-
-
-
-
-
- 0
- 23
- 23
-
-
-
-
-
-
- 0
- 30
- 30
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 0
- 46
- 46
-
-
-
-
-
-
- 0
- 46
- 46
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
- 0
- 46
- 46
-
-
-
-
-
-
- 255
- 255
- 220
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
-
-
- Microsoft JhengHei UI
- 14
- 75
- true
-
-
-
- Qt::LeftToRight
-
-
- color:rgb(73,36,73,255)
-
-
- Mixer/Splitter
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
-
- 200
- 50
-
-
-
-
- Microsoft JhengHei
- 10
- 75
- true
-
-
-
- Text-align:left
-
-
- Mixer
-
-
-
- icons/Mixer.pngicons/Mixer.png
-
-
-
- 30
- 30
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
-
- 200
- 50
-
-
-
-
- Microsoft JhengHei
- 10
- 75
- true
-
-
-
- Text-align:left
-
-
- Splitter
-
-
-
- icons/Splitter.pngicons/Splitter.png
-
-
-
- 30
- 30
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 30
-
-
-
-
- 200
- 16777215
-
-
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 0
- 70
- 70
-
-
-
-
-
-
- 0
- 105
- 105
-
-
-
-
-
-
- 0
- 87
- 87
-
-
-
-
-
-
- 0
- 35
- 35
-
-
-
-
-
-
- 0
- 46
- 46
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
- 0
- 70
- 70
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
- 0
- 35
- 35
-
-
-
-
-
-
- 255
- 255
- 220
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 0
- 70
- 70
-
-
-
-
-
-
- 0
- 105
- 105
-
-
-
-
-
-
- 0
- 87
- 87
-
-
-
-
-
-
- 0
- 35
- 35
-
-
-
-
-
-
- 0
- 46
- 46
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
- 0
- 70
- 70
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
- 0
- 35
- 35
-
-
-
-
-
-
- 255
- 255
- 220
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 0
- 70
- 70
-
-
-
-
-
-
- 0
- 105
- 105
-
-
-
-
-
-
- 0
- 87
- 87
-
-
-
-
-
-
- 0
- 35
- 35
-
-
-
-
-
-
- 0
- 46
- 46
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 73
- 36
- 73
-
-
-
-
-
-
- 0
- 70
- 70
-
-
-
-
-
-
- 0
- 70
- 70
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
- 0
- 70
- 70
-
-
-
-
-
-
- 255
- 255
- 220
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
-
-
- Microsoft JhengHei UI
- 14
- 75
- true
-
-
-
- Qt::LeftToRight
-
-
- color:rgb(73,36,73,255)
-
-
- Exchangers
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
-
- 200
- 50
-
-
-
-
- Microsoft JhengHei
- 10
- 75
- true
-
-
-
- Text-align:left
-
-
- Heater
-
-
-
- icons/Heater.pngicons/Heater.png
-
-
-
- 40
- 40
-
-
-
- false
-
-
- false
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
-
- 200
- 50
-
-
-
-
- Microsoft JhengHei
- 10
- 75
- true
-
-
-
- Text-align:left
-
-
- Cooler
-
-
-
- icons/Cooler.pngicons/Cooler.png
-
-
-
- 40
- 40
-
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 30
-
-
-
-
- 200
- 16777215
-
-
-
-
- Microsoft JhengHei UI
- 14
- 75
- true
-
-
-
- Qt::LeftToRight
-
-
- color:rgb(73,36,73,255)
-
-
- Separator
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
-
- 200
- 50
-
-
-
-
- Microsoft JhengHei
- 10
- 75
- true
-
-
-
- Text-align:left
-
-
- Flash
-
-
-
- icons/Flash.pngicons/Flash.png
-
-
-
- 40
- 40
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
-
- 200
- 50
-
-
-
-
- Microsoft JhengHei
- 10
- 75
- true
-
-
-
- Text-align:left
-
-
- Compound Seperator
-
-
-
- icons/CompoundSeparator.pngicons/CompoundSeparator.png
-
-
-
- 40
- 40
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 30
-
-
-
-
- 200
- 16777215
-
-
-
-
- Microsoft JhengHei UI
- 14
- 75
- true
-
-
-
- color:rgb(73,36,73,255)
-
-
- Pressure Changers
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
-
- 200
- 50
-
-
-
-
- Microsoft JhengHei
- 10
- 75
- true
-
-
-
- Text-align:left
-
-
- Valve
-
-
-
- icons/Valve.pngicons/Valve.png
-
-
-
- 30
- 30
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
-
- 200
- 50
-
-
-
-
- Microsoft JhengHei
- 10
- 75
- true
-
-
-
- Text-align:left
-
-
- Centrifugal Pump
-
-
-
- icons/Pump.pngicons/Pump.png
-
-
-
- 30
- 30
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
-
- 200
- 50
-
-
-
-
- Microsoft JhengHei
- 10
- 75
- true
-
-
-
- Text-align:left
-
-
- Adiabatic Compressor
-
-
-
- icons/AdiabaticCompressor.pngicons/AdiabaticCompressor.png
-
-
-
- 30
- 30
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
-
- 200
- 50
-
-
-
-
- Microsoft JhengHei
- 10
- 75
- true
-
-
-
- false
-
-
- Text-align:left
-
-
- Adiabatic Expander
-
-
-
- icons/AdiabaticExpander.pngicons/AdiabaticExpander.png
-
-
-
- 30
- 30
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 30
-
-
-
-
- 200
- 16777215
-
-
-
-
- Microsoft JhengHei UI
- 14
- 75
- true
-
-
-
- color:rgb(73,36,73,255)
-
-
- Columns
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
-
- 200
- 50
-
-
-
-
- Microsoft JhengHei
- 10
- 75
- true
-
-
-
- Text-align:left
-
-
- Distillation Column
-
-
-
- Icons/Column.pngIcons/Column.png
-
-
-
- 50
- 50
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
-
- 200
- 16777215
-
-
-
-
- Microsoft JhengHei
- 10
- 75
- true
-
-
-
- Text-align:left
-
-
- Shortcut Column
-
-
-
- Icons/Column.pngIcons/Column.png
-
-
-
- 50
- 50
-
-
-
-
-
-
-
-
-
-
-
-
-
- toolBar
-
-
-
-
-
- TopToolBarArea
-
-
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Icons/zoom_in.pngIcons/zoom_in.png
-
-
- ZoomIn
-
-
-
-
-
- Icons/zoom_out.pngIcons/zoom_out.png
-
-
- ZoomOut
-
-
-
-
-
- Icons/zoom_reset.pngIcons/zoom_reset.png
-
-
- ResetZoom
-
-
-
-
-
- Icons/eq.pngIcons/eq.png
-
-
- Equation oriented
-
-
-
-
-
- Icons/sq.pngIcons/sq.png
-
-
- Sequential mode
-
-
-
-
-
- Icons/compound.pngIcons/compound.png
-
-
- Select Compounds
-
-
-
-
-
- Icons/new.pngIcons/new.png
-
-
- New
-
-
-
-
- Help
-
-
-
-
- save
-
-
-
-
- Save
-
-
-
-
- Open
-
-
-
-
- Binary Phase Envelope
-
-
-
-
- Terminate
-
-
-
-
- Undo
-
-
-
-
- Redo
-
-
-
-
-
-
diff --git a/mainApp.py b/mainApp.py
index 240becb..5de9baa 100644
--- a/mainApp.py
+++ b/mainApp.py
@@ -27,7 +27,7 @@ import os
import ctypes
import sys
-ui,_ = loadUiType('main3.ui')
+ui,_ = loadUiType('main.ui')
'''
MainApp class is responsible for all the main App Ui operations
@@ -46,68 +46,66 @@ class MainApp(QMainWindow,ui):
# self.setStyleSheet(style)
# Initializing attributes
- self.zoomcount = 0
+ self.zoom_count = 0
self.thrd = None
# Creating instances of classes for the main app
- self.container = Container.Container(self.textBrowser)
+ self.container = Container.Container(self.textBrowser, self.graphicsView)
self.comp = ComponentSelector(self)
# Setting up interactive canvas
- self.scene = self.container.graphics.getScene() ###
+ self.scene = self.container.graphics.get_scene() ###
self.graphicsView.setScene(self.scene)
self.graphicsView.setMouseTracking(True)
- self.graphicsView.keyPressEvent=self.deleteCall
+ self.graphicsView.keyPressEvent=self.delete_call
self.setDockNestingEnabled(True)
self.setCorner(Qt.BottomRightCorner, Qt.RightDockWidgetArea)
self.setCorner(Qt.BottomLeftCorner, Qt.LeftDockWidgetArea)
self.addDockWidget(Qt.BottomDockWidgetArea,self.dockWidget_2)
- # Calling initialisation functions
- self.buttonHandler()
- self.menuBar()
+ # Calling initialisation
+ self.menu_bar()
+ self.button_handler()
self.comp.show()
'''
MenuBar function handels all the all the operations of
menu bar like new,zoom,comounds selector, simulation options.
'''
- def menuBar(self):
- self.actionSelect_compounds.triggered.connect(self.selectCompounds)
- self.actionSelect_compounds.setShortcut('Ctrl+C')
- self.actionZoomIn.triggered.connect(self.zoomIn)
+ def menu_bar(self):
+ self.actionSelectCompounds.triggered.connect(self.select_compounds)
+ self.actionSelectCompounds.setShortcut('Ctrl+C')
+ self.actionZoomIn.triggered.connect(self.zoom_in)
self.actionZoomIn.setShortcut('Ctrl++')
self.actionNew.triggered.connect(self.new)
self.actionNew.setShortcut('Ctrl+N')
- self.actionZoomOut.triggered.connect(self.zoomOut)
+ self.actionZoomOut.triggered.connect(self.zoom_out)
self.actionZoomOut.setShortcut('Ctrl+-')
- self.actionResetZoom.triggered.connect(self.zoomReset)
+ self.actionResetZoom.triggered.connect(self.zoom_reset)
self.actionResetZoom.setShortcut('Ctrl+R')
self.actionHelp.triggered.connect(self.help)
self.actionHelp.setShortcut('Ctrl+H')
- self.actionSequential_mode.triggered.connect(partial(self.simulate,'SM'))
- self.actionSequential_mode.setShortcut('Ctrl+M')
- self.actionEquation_oriented.triggered.connect(partial(self.simulate,'EQN'))
- self.actionEquation_oriented.setShortcut('Ctrl+E')
+ self.actionSequentialMode.triggered.connect(partial(self.simulate,'SM'))
+ self.actionSequentialMode.setShortcut('Ctrl+M')
+ self.actionEquationOriented.triggered.connect(partial(self.simulate,'EQN'))
+ self.actionEquationOriented.setShortcut('Ctrl+E')
self.actionUndo.triggered.connect(self.undo)
self.actionUndo.setShortcut('Ctrl+Z')
self.actionRedo.triggered.connect(self.redo)
self.actionRedo.setShortcut('Ctrl+Y')
- # self.actionUndo_2.triggered.connect(self.undoStack.undo)
- # self.actionRedo.triggered.connect(self.undoStack.redo)
- self.actionSave_2.triggered.connect(self.save)
- self.actionSave_2.setShortcut('Ctrl+S')
+ self.actionSave.triggered.connect(self.save)
+ self.actionSave.setShortcut('Ctrl+S')
self.actionOpen.triggered.connect(self.open)
self.actionOpen.setShortcut('Ctrl+O')
self.actionTerminate.triggered.connect(self.terminate)
self.actionTerminate.setShortcut('Ctrl+T')
- self.actionBinary_Phase_Envelope.triggered.connect(self.BinPhaseEnv)
+ self.actionBinaryPhaseEnvelope.triggered.connect(self.bin_phase_env)
'''
Handles all the buttons of different components.
'''
- def buttonHandler(self):
+ def button_handler(self):
self.pushButton.clicked.connect(partial(self.component,'MaterialStream'))
self.pushButton_7.clicked.connect(partial(self.component,'Mixer'))
self.pushButton_14.clicked.connect(partial(self.component,'Pump'))
@@ -133,27 +131,27 @@ class MainApp(QMainWindow,ui):
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec_()
- def BinPhaseEnv(self):
+ def bin_phase_env(self):
#compounds = self.comp.getComp()
- if len(self.comp.getComp())<2:
+ if len(self.comp.get_compounds())<2:
QMessageBox.about(self, 'Important', "Please select at least 2 Compounds first")
self.comp.show()
#compunds = self.comp.getComp()
else:
- self.bin_phase = Bin_Phase_env(self.comp)
+ self.bin_phase = BinPhaseEnv(self.comp)
self.bin_phase.show()
'''
Shows Compounds Selector Dialog
'''
- def selectCompounds(self):
+ def select_compounds(self):
self.comp.show()
'''
- Returns currenttime in a required particular format
+ Returns current time in a required particular format
'''
- def currentTime(self):
+ def current_time(self):
now = datetime.datetime.now()
time = str(now.hour) + ":" + str(now.minute) + ":" +str(now.second)
return time
@@ -176,7 +174,7 @@ class MainApp(QMainWindow,ui):
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("["+str(self.currentTime())+"] Terminating the simulation ")
+ self.textBrowser.append("["+str(self.current_time())+"] Terminating the simulation ")
print('____________________Simulation thread terminated____________________')
if res > 1:
ctypes.pythonapi.PyThreadState_SetAsyncExc(thread_id, 0)
@@ -185,40 +183,40 @@ class MainApp(QMainWindow,ui):
'''
Resets the zoom level to default scaling
'''
- def zoomReset(self):
- if(self.zoomcount>0):
- for i in range(self.zoomcount):
+ def zoom_reset(self):
+ if(self.zoom_count>0):
+ for i in range(self.zoom_count):
self.zoomout()
- elif(self.zoomcount<0):
- for i in range(abs(self.zoomcount)):
+ elif(self.zoom_count<0):
+ for i in range(abs(self.zoom_count)):
self.zoomin()
'''
ZoomOut the canvas
'''
- def zoomOut(self):
+ def zoom_out(self):
self.graphicsView.scale(1.0/1.15,1.0/1.15)
- self.zoomcount -=1
+ self.zoom_count -=1
'''
ZoomIn the canvas
'''
- def zoomIn(self):
+ def zoom_in(self):
self.graphicsView.scale(1.15,1.15)
- self.zoomcount +=1
+ self.zoom_count +=1
'''
Instantiate a NodeItem object for selected type of
component and added that on canvas/flowsheeting area.
'''
- def component(self,unitOpType):
- if(self.comp.isCompSelected()):
- self.type = unitOpType
+ def component(self,unit_operation_type):
+ if(self.comp.is_compound_selected()):
+ self.type = unit_operation_type
if(self.type=="MaterialStream"):
- self.obj = MaterialStream(CompNames=compound_selected)
+ self.obj = MaterialStream(compound_names = compound_selected)
else:
self.obj = eval(self.type)()
- self.container.addUnitOp(self.obj, self.graphicsView)
+ self.container.add_unit_operation(self.obj)
else:
QMessageBox.about(self, 'Important', "Please Select Compounds first")
@@ -230,13 +228,13 @@ class MainApp(QMainWindow,ui):
def new(self):
self.undo_redo_helper()
self.comp.tableWidget.setRowCount(0)
- self.textBrowser.append("[" + str(self.currentTime()) + "] New flowsheet is created ... ")
- dockWidgetLst.clear()
+ self.textBrowser.append("[" + str(self.current_time()) + "] New flowsheet is created ... ")
+ dock_widget_lst.clear()
'''
Handels all the operations which will happen when delete button is pressed.
'''
- def deleteCall(self,event):
+ def delete_call(self,event):
try:
if event.key() == QtCore.Qt.Key_Delete:
l=self.scene.selectedItems()
@@ -250,19 +248,19 @@ class MainApp(QMainWindow,ui):
It helps by clearing screen and loading the objects by undo redo methods
'''
def undo_redo_helper(self):
- for i in self.container.unitOp:
+ for i in self.container.unit_operations:
type(i).counter = 1
del self.container
- for i in dockWidgetLst:
+ for i in dock_widget_lst:
i.hide()
del i
lst.clear()
- self.container = Container.Container(self.textBrowser)
+ self.container = Container.Container(self.textBrowser, self.graphicsView)
compound_selected.clear()
- self.scene = self.container.graphics.getScene()
+ self.scene = self.container.graphics.get_scene()
self.graphicsView.setScene(self.scene)
self.graphicsView.setMouseTracking(True)
- self.graphicsView.keyPressEvent=self.deleteCall
+ self.graphicsView.keyPressEvent=self.delete_call
@@ -270,14 +268,14 @@ class MainApp(QMainWindow,ui):
Function for undo
'''
def undo(self):
- redo_data = POP('Undo')
+ redo_data = pop('Undo')
if redo_data is not None:
- PUSH('Redo', redo_data)
+ push('Redo', redo_data)
undo_data = get_last_list('Undo')
messages = self.textBrowser.toPlainText()
try:
self.undo_redo_helper()
- self.container.graphics.loadCanvas(undo_data)
+ self.container.graphics.load_canvas(undo_data, self.container)
self.textBrowser.setText(messages)
except Exception as e:
print(e)
@@ -285,72 +283,75 @@ class MainApp(QMainWindow,ui):
else:
messages = self.textBrowser.toPlainText()
self.textBrowser.setText(messages)
- self.textBrowser.append("[" + str(self.currentTime()) + "] No more undo can be done!... ")
+ self.textBrowser.append("[" + str(self.current_time()) + "] No more undo can be done!... ")
'''
Function for redo
'''
def redo(self):
- redo_data = POP('Redo')
+ redo_data = pop('Redo')
if redo_data is not None:
- PUSH('Undo', redo_data)
+ push('Undo', redo_data)
messages = self.textBrowser.toPlainText()
self.undo_redo_helper()
- self.container.graphics.loadCanvas(redo_data)
+ self.container.graphics.load_canvas(redo_data, self.container)
self.textBrowser.setText(messages)
else:
messages = self.textBrowser.toPlainText()
self.textBrowser.setText(messages)
- self.textBrowser.append("[" + str(self.currentTime()) + "] No more redo can be done!... ")
+ self.textBrowser.append("[" + str(self.current_time()) + "] No more redo can be done!... ")
'''
Function for saving the current canvas items and compound_selected
'''
def save(self):
data = []
- for i in self.container.unitOp:
+ for i in self.container.unit_operations:
data.append(i)
print(i.pos)
data.append(compound_selected)
print(data)
- fileFormat = 'sim'
- initialPath = QDir.currentPath() + 'untitled.' + fileFormat
- fileName, _ = QFileDialog.getSaveFileName(self, "Save As",
- initialPath, "%s Files (*.%s);; All Files (*)" %
- (fileFormat.upper(), fileFormat))
- if fileName != "":
- with open(fileName, 'wb') as f: #'saved_file.sim'
+ file_format = 'sim'
+ initial_path = QDir.currentPath() + 'untitled.' + file_format
+ file_name, _ = QFileDialog.getSaveFileName(self, "Save As",
+ initial_path, "%s Files (*.%s);; All Files (*)" %
+ (file_format.upper(), file_format))
+ #if file_name != "":
+ try:
+ with open(file_name, 'wb') as f: #'saved_file.sim'
pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)
+ except Exception as e:
+ pass
'''
Function for loading previous saved canvas and simulation
'''
def open(self):
try:
- fileFormat = 'sim'
- initialPath = QDir.currentPath() + 'untitled.' + fileFormat
+ file_format = 'sim'
+ initial_path = QDir.currentPath() + 'untitled.' + file_format
- fileName, _ = QFileDialog.getOpenFileName(self, "Open As",
- initialPath, "%s Files (*.%s);; All Files (*)" %
- (fileFormat.upper(), fileFormat))
+ file_name, _ = QFileDialog.getOpenFileName(self, "Open As",
+ initial_path, "%s Files (*.%s);; All Files (*)" %
+ (file_format.upper(), file_format))
# if fileName != "":
# self.new()
self.undo_redo_helper()
- with open(fileName, 'rb') as f:
+ with open(file_name, 'rb') as f:
obj = pickle.load(f)
-
- self.container.graphics.loadCanvas(obj)
+ print(obj)
+ self.container.graphics.load_canvas(obj, self.container)
except Exception as e:
pass
def main():
- CLEAN_FILE('Undo')
- CLEAN_FILE('Redo')
+ clean_file('Undo')
+ clean_file('Redo')
app = QApplication(sys.argv)
window = MainApp()
diff --git a/resDockWidget.py b/resDockWidget.py
deleted file mode 100644
index 9466b4e..0000000
--- a/resDockWidget.py
+++ /dev/null
@@ -1,92 +0,0 @@
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5.uic import loadUiType
-import pandas as pd
-from functools import partial
-from component_selector import *
-from collections import defaultdict
-from container import *
-
-ui_dialog,_ = loadUiType('resDock.ui')
-
-class resdockWidget(QDockWidget,ui_dialog):
-
- def __init__(self,containerobj,parent=None):
- QDockWidget.__init__(self,parent)
- self.setupUi(self)
- self.setWindowTitle("Results")
- self.nameType = None
- self.Container = containerobj
- self.results()
-
- self.pushButton_3.clicked.connect(self.resultTree)
-
- def abriveation(self,key):
- d ={"P":"Pressure","T":"Temperature",
- "xliq":"Liquid Phase Mol Fraction","xmliq":"Liquid Pase Mass Fraction",
- "xvap":"Vapour Phase Mol Fracrion","xmvap":"Vapour Phase Mass Fracrion",
- "F_p[1]":"Molar Flow","Fm_p[1]":"Mass Flow","MW_p[1]":"Mixer Phase Molecular Weight",
- "MW_p[2]":"Liquid Phase Molecular Weight","MW_p[3]":"Vapour Phase Molecular Weight",
- "Cp_p[1]":"Mixer Phase molar Heat Capacity","Cp_p[2]":"Liquid Phase molar Heat Capacity",
- "Cp_p[3]":"Vapour Phase molar Heat Capacity","H_p[1]":"Mixer Phase Molar Enthalpy",
- "H_p[2]":"Liquid Phase Molar Enthalpy","H_p[3]":"Vapour Phase Molar Enthalpy",
- "S_p[1]":"Mixer Phase Molar Entropy","S_p[2]":"Liquid Phase Molar Entropy",
- "S_p[3]":"Vapour Phase Molar Entropy","F_p[2]":"Liquid Phase Molar Flow Rate",
- "F_p[3]":"Vapour Phase Molar Flow Rate","Fm_p[2]":"Liquid Phase Mass Flow Rate",
- "F_p[3]":"Liquid Phase Mass Flow Rate",
- }
-
- for i in range(len(compound_selected)):
- d["compMolFrac[1,"+str(i+1)+"]"] = str(compound_selected[i]) +" Mixer mole fraction"
- d["compMolFrac[2,"+str(i+1)+"]"] = str(compound_selected[i]) +" Liquid mole fraction"
- d["compMolFrac[3,"+str(i+1)+"]"] = str(compound_selected[i]) +" Vapour mole fraction"
-
- d["compMasFrac[1,"+str(i+1)+"]"] = str(compound_selected[i]) +" Mixer mass fraction"
- d["compMasFrac[2,"+str(i+1)+"]"] = str(compound_selected[i]) +" Liquid mass fraction"
- d["compMasFrac[3,"+str(i+1)+"]"] = str(compound_selected[i]) +" Vapour mass fraction"
-
- d["compMasFlo[1,"+str(i+1)+"]"] = str(compound_selected[i]) +" Mixer mass flo"
- d["compMasFlo[2,"+str(i+1)+"]"] = str(compound_selected[i]) +" Liquid mass flo"
- d["compMasFlo[3,"+str(i+1)+"]"] = str(compound_selected[i]) +" Vapour mass flo"
-
- d["compMolFlo[1,"+str(i+1)+"]"] = str(compound_selected[i]) +" Mixer mole flo"
- d["compMolFlo[2,"+str(i+1)+"]"] = str(compound_selected[i]) +" Liquid mole flo"
- d["compMolFlo[3,"+str(i+1)+"]"] = str(compound_selected[i]) +" Vapour mole flo"
- if key in d.keys():
- return d[key]
- else:
- return key
-
- def resultsCategory(self,name):
- try:
- print("Under result category")
- result=self.Container.result
- obj = self.Container.fetchObject(name)
- self.tableWidget.setRowCount(0)
- for key, value in obj.Prop.items():
- propertyname = name + '.' + key
- print(key,value)
- if propertyname in result[0]:
- ind = result[0].index(propertyname)
- resultval = str(result[-1][ind])
- #stm.Prop[key] = resultval
- print("######Resultsfetch####",key,resultval)
- rowPosition = self.tableWidget.rowCount()
- self.tableWidget.insertRow(rowPosition)
- self.tableWidget.setItem(rowPosition , 0, QTableWidgetItem(str(self.abriveation(key))))
- self.tableWidget.setItem(rowPosition , 1, QTableWidgetItem(str(resultval)))
- self.tableWidget.resizeColumnsToContents()
- except Exception as e:
- print(e)
-
-
- def resultTree(self):
- self.resultsCategory(self.comboBox.currentText())
-
- def results(self): # Should be named as selecting object whose result is to be displayed
- self.nameType={}
- for i in Container.unitOp:
- #nameslist.append(i.name)
- self.nameType[i.name] = i.type
- self.comboBox.addItem(str(i.name))
\ No newline at end of file
diff --git a/svg/Centrifugal Pump.svg b/svg/Centrifugal Pump.svg
new file mode 100644
index 0000000..5b60256
--- /dev/null
+++ b/svg/Centrifugal Pump.svg
@@ -0,0 +1,104 @@
+
+
+
+
diff --git a/svg/Cooler.svg b/svg/Cooler.svg
new file mode 100644
index 0000000..fd7a4a8
--- /dev/null
+++ b/svg/Cooler.svg
@@ -0,0 +1,84 @@
+
+
+
+
diff --git a/svg/Heater.svg b/svg/Heater.svg
new file mode 100644
index 0000000..7d21cf7
--- /dev/null
+++ b/svg/Heater.svg
@@ -0,0 +1,101 @@
+
+
+
+
diff --git a/svg/Pump.svg b/svg/Pump.svg
new file mode 100644
index 0000000..dd573ee
--- /dev/null
+++ b/svg/Pump.svg
@@ -0,0 +1,86 @@
+
+
+
+
diff --git a/umlet.uxf b/umlet.uxf
index ed90e4f..89f794e 100644
--- a/umlet.uxf
+++ b/umlet.uxf
@@ -1,13 +1,37 @@
- 11
+ // Uncomment the following line to change the fontsize and font:
+fontsize=10
+// fontfamily=SansSerif //possible: SansSerif,Serif,Monospaced
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Welcome to UMLet!
+//
+// Double-click on elements to add them to the diagram, or to copy them
+// Edit elements by modifying the text in this panel
+// Hold Ctrl to select multiple elements
+// Use Ctrl+mouse to select via lasso
+//
+// Use +/- or Ctrl+mouse wheel to zoom
+// Drag a whole relation at its central square icon
+//
+// Press Ctrl+C to copy the whole diagram to the system clipboard (then just paste it to, eg, Word)
+// Edit the files in the "palettes" directory to create your own element palettes
+//
+// Select "Custom Elements > New..." to create new element types
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+
+// This text will be stored with each diagram; use it for notes.
+ 7
UMLClass
- 341
- 759
- 286
- 462
+ 217
+ 385
+ 182
+ 245
MainApp
--
@@ -43,10 +67,10 @@
UMLClass
- 363
- 484
- 242
- 187
+ 231
+ 210
+ 154
+ 119
QMainWindow
--
@@ -64,21 +88,21 @@ addDockWidget()
Relation
- 473
- 660
- 33
- 121
+ 301
+ 322
+ 21
+ 77
- lt=<<<-
+ lt=<<.
10.0;10.0;10.0;90.0
UMLClass
- 385
- 330
- 187
- 66
+ 245
+ 112
+ 119
+ 42
UC1 (textBrowserClass)
--
@@ -88,10 +112,10 @@ setText()
Relation
- 462
- 385
- 33
- 121
+ 294
+ 147
+ 21
+ 77
lt=<<.
10.0;10.0;10.0;90.0
@@ -99,10 +123,10 @@ setText()
UMLClass
- 715
- 352
- 352
- 363
+ 455
+ 126
+ 224
+ 189
ComponentSelector
--
@@ -136,10 +160,10 @@ _+ setCompounds(compounds)_
UMLClass
- 737
- 748
- 253
- 462
+ 469
+ 378
+ 161
+ 252
Container
--
@@ -174,10 +198,10 @@ _+ setCompounds(compounds)_
UMLClass
- 1078
- 836
- 374
- 187
+ 686
+ 434
+ 238
+ 119
Graphics
--
@@ -196,10 +220,10 @@ _+ setCompounds(compounds)_
UMLClass
- 1144
- 528
- 231
- 165
+ 728
+ 238
+ 147
+ 105
QDialog
--
@@ -216,10 +240,10 @@ show()
UMLClass
- 1144
- 220
- 231
- 55
+ 728
+ 42
+ 147
+ 35
QStringListModel
--
@@ -229,10 +253,10 @@ setStringList()
UMLClass
- 1430
- 517
- 231
- 77
+ 910
+ 231
+ 147
+ 49
UC3 (selectButtonClass)
--
@@ -244,10 +268,10 @@ setAutoDefault()
UMLClass
- 1144
- 297
- 231
- 77
+ 728
+ 98
+ 147
+ 49
QCompleter
--
@@ -258,10 +282,10 @@ setModel()
UMLClass
- 1144
- 407
- 231
- 55
+ 728
+ 175
+ 147
+ 35
UC2 (lineEditClass)
--
@@ -271,10 +295,10 @@ setCompleter()
UMLClass
- 1430
- 616
- 231
- 55
+ 910
+ 294
+ 147
+ 35
UC4 (pushButtonClass)
--
@@ -284,10 +308,10 @@ clicked.connect()
UMLClass
- 1045
- 1089
- 440
- 583
+ 665
+ 595
+ 259
+ 315
NodeItem
--
@@ -330,10 +354,10 @@ mouseDoubleClickEvent(event)
UMLClass
- 1012
- 1705
- 187
- 77
+ 644
+ 987
+ 119
+ 49
QtWidgets.QGraphicsItem
--
@@ -346,10 +370,10 @@ setFlag
UMLClass
- 1331
- 1782
- 231
- 55
+ 847
+ 1036
+ 147
+ 35
QtWidgets.QInputDialog
--
@@ -361,10 +385,10 @@ getText()
UMLClass
- 1254
- 1870
- 231
- 55
+ 798
+ 1092
+ 147
+ 35
QtGui.QFont
--
@@ -376,10 +400,10 @@ setPointSize()
UMLClass
- 1012
- 1826
- 231
- 121
+ 644
+ 1064
+ 147
+ 77
QtWidgets.QGraphicTextItem
--
@@ -395,10 +419,10 @@ setPlainText()
UMLClass
- 759
- 1265
- 176
- 66
+ 483
+ 707
+ 112
+ 42
QtGui.QBrush
--
@@ -411,10 +435,10 @@ setColor()
UMLClass
- 462
- 1265
- 231
- 88
+ 294
+ 707
+ 147
+ 56
QtGui.QPen
--
@@ -428,10 +452,10 @@ setWidth()
UMLClass
- 737
- 1419
- 231
- 363
+ 469
+ 805
+ 147
+ 189
NodeSocket
--
@@ -460,10 +484,10 @@ hoverLeaveEvent(event)
UMLClass
- 385
- 1419
- 231
- 418
+ 245
+ 805
+ 147
+ 161
NodeLine
--
@@ -489,10 +513,10 @@ __delete__(instance)
UMLClass
- 220
- 1265
- 231
- 88
+ 140
+ 707
+ 147
+ 56
QtWigets.QGraphicsPathItem
--
@@ -505,39 +529,39 @@ setPen()
UMLClass
- 2101
- 396
- 264
- 330
+ 1337
+ 154
+ 168
+ 210
DockWidgetMaterialStream
--
+ name: string = name
+ obj: UnitOperations = obj
+ type: string = comptype
-+ inputdict: dictionary = {}
++ input_dict: dictionary = {}
+ dict: dictionary = {}
+ x_pclist: list = []
-+ nameType: string = None
++ name_type: string = None
+ container: Container = container
+ header: QTreeWidgetItem()
--
+ modes()
-+ modeSelection()
-+ inputparamslist()
++ mode_selection()
++ input_params_list()
+ param()
-+ resultsCategory(name)
-+ _showResult(lst)_
-+ Show_Error()
++ results_category(name)
++ _show_result(lst)_
++ show_error()
UMLClass
- 1430
- 704
- 231
- 55
+ 910
+ 350
+ 147
+ 35
UC5 (comboBoxClass)
--
@@ -547,38 +571,38 @@ currentIndexChanged.connect()
UMLClass
- 1716
- 616
- 264
- 308
+ 1092
+ 294
+ 168
+ 182
DockWidget
--
+ name: string = name
+ obj: UnitOperations = obj
+ type: string = comptype
-+ inputdict: dictionary = {}
++ input_dict: dictionary = {}
+ dict: dictionary = {}
+ x_pclist: list = []
-+ nameType: string = None
++ name_type: string = None
+ container: Container = container
--
+ modes()
-+ modeSelection()
-+ inputparamslist()
++ mode_selection()
++ input_params_list()
+ param()
-+ resultsCategory(name)
-_+ showResult(lst)_
-+ Show_Error()
++ show_error()
+_+ show_result(lst)_
++ result_category(name)
UMLClass
- 1760
- 385
- 231
- 176
+ 1120
+ 147
+ 147
+ 112
QDockWidget
--
@@ -595,36 +619,36 @@ hide()
UMLClass
- 2101
- 1232
- 264
- 275
+ 1337
+ 686
+ 168
+ 161
DockWidgetShortcutColumn
--
+ name: string = name
+ obj: UnitOperations = obj
+ type: string = comptype
-+ inputdict: list = []
++ input_dict: list = []
+ dict: list = []
-+ nameType: string = None
++ name_yype: string = None
+ container: Container = container
--
-+ inputparamslist()
++ input_params_list()
+ fun()
+ param()
-+ Show_Error()
-_+ showResult(lst)_
-+ resultCategory(name)
++ show_error()
+_+ show_result(lst)_
++ result_category(name)
UMLClass
- 2101
- 1012
- 264
- 198
+ 1337
+ 546
+ 168
+ 126
DockWidgetMixer
DockWidgetCompoundSeparator
@@ -632,21 +656,21 @@ DockWidgetCompoundSeparator
+ name: string = name
+ obj: UnitOperations = obj
+ type: string = comptype
-+ inputdict: list = []
++ input_dict: list = []
+ dict: list = []
--
-+ inputparamslist()
++ input_params_list()
+ param()
-+ Show_Error()
++ show_error()
UMLClass
- 2101
- 770
- 264
- 220
+ 1337
+ 392
+ 168
+ 140
DockWidgetSplitter
DockWidgetFlash
@@ -654,22 +678,22 @@ DockWidgetFlash
+ name: string = name
+ obj: UnitOperations = obj
+ type: string = comptype
-+ inputdict: list = []
++ input_dict: list = []
+ dict: list = []
--
-+ inputparamslist()
++ input_params_list()
+ fun()
+ param()
-+ Show_Error()
++ show_error()
UMLClass
- 1606
- 957
- 451
- 473
+ 1022
+ 511
+ 231
+ 231
Flowsheet
--
@@ -703,10 +727,10 @@ DockWidgetFlash
UMLClass
- 1650
- 1694
- 297
- 517
+ 1050
+ 980
+ 189
+ 280
MaterialStream
--
@@ -743,10 +767,10 @@ _+ counter: int = 1_
UMLClass
- 2068
- 1694
- 297
- 572
+ 1316
+ 980
+ 189
+ 350
UnitOperations
--
@@ -787,9 +811,9 @@ _+ counter: int = 1_
UMLClass
0
- 935
- 275
- 264
+ 497
+ 175
+ 168
Bin_Phase_env
--
@@ -811,10 +835,10 @@ setupUi()
UMLClass
- 770
- 154
- 231
- 154
+ 490
+ 0
+ 147
+ 98
ChemsepDatabase
--
@@ -830,21 +854,21 @@ setupUi()
Relation
- 616
- 704
- 132
- 132
+ 392
+ 308
+ 84
+ 126
lt=<-
- 100.0;10.0;100.0;100.0;10.0;100.0
+ 100.0;10.0;100.0;160.0;10.0;160.0
Relation
- 616
- 902
- 143
- 33
+ 392
+ 476
+ 91
+ 21
lt=<-
110.0;10.0;10.0;10.0
@@ -852,65 +876,65 @@ setupUi()
Relation
- 869
- 297
- 33
- 77
+ 553
+ 91
+ 21
+ 49
- lt=<<<-
+ lt=<<.
10.0;10.0;10.0;50.0
Relation
- 1056
- 594
- 110
- 33
+ 672
+ 280
+ 70
+ 21
- lt=<<<-
+ lt=<<.
80.0;10.0;10.0;10.0
Relation
- 1243
- 451
- 33
- 99
+ 791
+ 203
+ 21
+ 49
lt=<<.
- 10.0;10.0;10.0;70.0
+ 10.0;10.0;10.0;50.0
Relation
- 1243
- 363
- 33
- 66
+ 791
+ 140
+ 21
+ 49
-
- 10.0;10.0;10.0;40.0
+ lt=<<.
+ 10.0;10.0;10.0;50.0
Relation
- 1243
- 264
- 33
- 55
+ 791
+ 70
+ 21
+ 42
-
- 10.0;10.0;10.0;30.0
+ lt=<<.
+ 10.0;10.0;10.0;40.0
Relation
- 1364
- 550
- 88
- 33
+ 868
+ 252
+ 56
+ 21
lt=<<.
60.0;10.0;10.0;10.0
@@ -918,10 +942,10 @@ setupUi()
Relation
- 1364
- 627
- 88
- 33
+ 868
+ 301
+ 56
+ 21
lt=<<.
60.0;10.0;10.0;10.0
@@ -929,10 +953,10 @@ setupUi()
Relation
- 979
- 935
- 121
- 33
+ 623
+ 497
+ 77
+ 21
lt=<-
90.0;10.0;10.0;10.0
@@ -940,10 +964,10 @@ setupUi()
Relation
- 1243
- 1012
- 33
- 99
+ 791
+ 546
+ 21
+ 63
lt=<-
10.0;70.0;10.0;10.0
@@ -951,10 +975,10 @@ setupUi()
Relation
- 957
- 1529
- 110
- 33
+ 609
+ 875
+ 70
+ 21
lt=<-
10.0;10.0;80.0;10.0
@@ -962,10 +986,10 @@ setupUi()
Relation
- 605
- 1529
- 154
- 33
+ 385
+ 875
+ 98
+ 21
lt=<-
10.0;10.0;120.0;10.0
@@ -973,10 +997,10 @@ setupUi()
Relation
- 341
- 1342
- 165
- 99
+ 217
+ 756
+ 105
+ 63
lt=<<.
10.0;10.0;130.0;70.0
@@ -984,10 +1008,10 @@ setupUi()
Relation
- 495
- 1342
- 99
- 99
+ 315
+ 756
+ 63
+ 63
lt=<<.
70.0;10.0;10.0;70.0
@@ -995,10 +1019,10 @@ setupUi()
Relation
- 847
- 1320
- 33
- 121
+ 539
+ 742
+ 21
+ 77
lt=<<.
10.0;10.0;10.0;90.0
@@ -1006,10 +1030,10 @@ setupUi()
Relation
- 924
- 1298
- 143
- 33
+ 588
+ 728
+ 91
+ 21
lt=<<.
10.0;10.0;110.0;10.0
@@ -1017,54 +1041,54 @@ setupUi()
Relation
- 1100
- 1661
- 33
- 66
+ 700
+ 903
+ 21
+ 98
lt=<<.
- 10.0;40.0;10.0;10.0
+ 10.0;120.0;10.0;10.0
Relation
- 1441
- 1661
- 33
- 143
+ 917
+ 903
+ 21
+ 147
lt=<<.
- 10.0;110.0;10.0;10.0
+ 10.0;190.0;10.0;10.0
Relation
- 1287
- 1661
- 33
- 231
+ 819
+ 903
+ 21
+ 203
lt=<<.
- 10.0;190.0;10.0;10.0
+ 10.0;270.0;10.0;10.0
Relation
- 1210
- 1661
- 33
- 187
+ 770
+ 903
+ 21
+ 175
lt=<<.
- 10.0;150.0;10.0;10.0
+ 10.0;230.0;10.0;10.0
Relation
- 979
- 1034
- 649
- 33
+ 623
+ 560
+ 413
+ 21
lt=<-
570.0;10.0;10.0;10.0
@@ -1072,10 +1096,10 @@ setupUi()
Relation
- 1529
- 1034
- 704
- 682
+ 973
+ 560
+ 448
+ 434
lt=<-
620.0;600.0;620.0;520.0;10.0;520.0;10.0;10.0
@@ -1083,10 +1107,10 @@ setupUi()
Relation
- 1782
- 1595
- 33
- 121
+ 1134
+ 917
+ 21
+ 77
lt=<-
10.0;90.0;10.0;10.0
@@ -1094,21 +1118,21 @@ setupUi()
Relation
- 1474
- 539
- 1023
- 1023
+ 917
+ 245
+ 672
+ 651
lt=<-
- 810.0;10.0;910.0;10.0;910.0;910.0;10.0;910.0
+ 840.0;10.0;940.0;10.0;940.0;910.0;10.0;910.0
Relation
- 2354
- 858
- 143
- 33
+ 1498
+ 448
+ 91
+ 21
lt=<-
10.0;10.0;110.0;10.0
@@ -1116,10 +1140,10 @@ setupUi()
Relation
- 2354
- 1100
- 143
- 33
+ 1498
+ 602
+ 91
+ 21
lt=<-
10.0;10.0;110.0;10.0
@@ -1127,10 +1151,10 @@ setupUi()
Relation
- 2354
- 1353
- 143
- 33
+ 1498
+ 763
+ 91
+ 21
lt=<-
10.0;10.0;110.0;10.0
@@ -1138,10 +1162,10 @@ setupUi()
Relation
- 1969
- 737
- 528
- 33
+ 1253
+ 371
+ 336
+ 21
lt=<-
10.0;10.0;460.0;10.0
@@ -1149,10 +1173,10 @@ setupUi()
Relation
- 1826
- 550
- 33
- 88
+ 1162
+ 252
+ 21
+ 56
lt=<<.
10.0;10.0;10.0;60.0
@@ -1160,10 +1184,10 @@ setupUi()
Relation
- 1980
- 429
- 143
- 33
+ 1260
+ 175
+ 91
+ 21
lt=<<.
10.0;10.0;110.0;10.0
@@ -1171,10 +1195,10 @@ setupUi()
Relation
- 1980
- 462
- 154
- 330
+ 1260
+ 196
+ 98
+ 210
lt=<<.
10.0;10.0;120.0;280.0
@@ -1182,10 +1206,10 @@ setupUi()
Relation
- 1980
- 506
- 143
- 528
+ 1260
+ 224
+ 91
+ 336
lt=<<.
10.0;10.0;110.0;460.0
@@ -1193,10 +1217,10 @@ setupUi()
Relation
- 1980
- 550
- 143
- 715
+ 1260
+ 252
+ 91
+ 455
lt=<<.
10.0;10.0;110.0;630.0
@@ -1204,21 +1228,21 @@ setupUi()
Relation
- 264
- 1012
- 99
- 33
+ 168
+ 546
+ 63
+ 21
- lt=<<<-
+ lt=<<.
10.0;10.0;70.0;10.0
Relation
- 1650
- 638
- 88
- 33
+ 1050
+ 308
+ 56
+ 21
lt=<<.
10.0;10.0;60.0;10.0
@@ -1226,10 +1250,10 @@ setupUi()
Relation
- 1650
- 726
- 88
- 33
+ 1050
+ 364
+ 56
+ 21
lt=<<.
10.0;10.0;60.0;10.0
@@ -1237,10 +1261,10 @@ setupUi()
UMLNote
- 1804
- 165
- 176
- 55
+ 14
+ 1008
+ 112
+ 35
UC is the abbreviation
for unknown class.
@@ -1251,46 +1275,23 @@ bg=white
UMLClass
- 1793
- 242
- 231
- 77
+ 1141
+ 56
+ 147
+ 49
Graphics.py
--
findMainWindow()
-
- UMLNote
-
- 1100
- 0
- 341
- 187
-
- OMCS Class Diagram
---
-Initial version :
- Author - Saurabh Agarwala
- Date - 7th December 2019
- Contact - saur.agarwala@gmail.com
---
-Current final version :
- Author - Thiha Min Maung
- Date - 19th February 2020
- Contact - lucaszhao999@gmail.com
-bg=white
-
-
-
UMLClass
- 2442
- 2145
- 231
- 187
+ 1554
+ 1267
+ 147
+ 119
Heater
Cooler
@@ -1306,10 +1307,10 @@ Flash
UMLClass
- 2442
- 1925
- 231
- 55
+ 1554
+ 1127
+ 147
+ 35
Mixer
--
@@ -1320,10 +1321,10 @@ Flash
UMLClass
- 2442
- 1991
- 231
- 55
+ 1554
+ 1169
+ 147
+ 35
Splitter
--
@@ -1334,10 +1335,10 @@ Flash
UMLClass
- 2442
- 2068
- 231
- 55
+ 1554
+ 1218
+ 147
+ 35
CompoundSeparator
--
@@ -1348,10 +1349,10 @@ Flash
UMLClass
- 2442
- 1716
- 275
- 110
+ 1554
+ 994
+ 175
+ 70
DistillationColumn
--
@@ -1366,10 +1367,10 @@ Flash
UMLClass
- 2442
- 1837
- 275
- 77
+ 1554
+ 1071
+ 175
+ 49
ShortcutColumn
--
@@ -1382,10 +1383,10 @@ Flash
Relation
- 2354
- 1760
- 110
- 33
+ 1498
+ 1022
+ 70
+ 21
lt=<<-
10.0;10.0;80.0;10.0
@@ -1393,10 +1394,10 @@ Flash
Relation
- 2354
- 1859
- 110
- 33
+ 1498
+ 1085
+ 70
+ 21
lt=<<-
10.0;10.0;80.0;10.0
@@ -1404,10 +1405,10 @@ Flash
Relation
- 2354
- 1947
- 110
- 33
+ 1498
+ 1141
+ 70
+ 21
lt=<<-
10.0;10.0;80.0;10.0
@@ -1415,10 +1416,10 @@ Flash
Relation
- 2354
- 2024
- 110
- 33
+ 1498
+ 1190
+ 70
+ 21
lt=<<-
10.0;10.0;80.0;10.0
@@ -1426,10 +1427,10 @@ Flash
Relation
- 2354
- 2090
- 110
- 33
+ 1498
+ 1232
+ 70
+ 21
lt=<<-
10.0;10.0;80.0;10.0
@@ -1437,12 +1438,60 @@ Flash
Relation
- 2354
- 2211
- 110
- 33
+ 1498
+ 1309
+ 70
+ 21
lt=<<-
10.0;10.0;80.0;10.0
+
+ Relation
+
+ 7
+ 1064
+ 133
+ 28
+
+ lt=<-
+Association
+ 10.0;20.0;170.0;20.0
+
+
+ Relation
+
+ 7
+ 1106
+ 133
+ 28
+
+ lt=<<.
+Implements
+ 10.0;20.0;170.0;20.0
+
+
+ Relation
+
+ 7
+ 1141
+ 133
+ 28
+
+ lt=<<-
+Inherits
+ 10.0;20.0;170.0;20.0
+
+
+ Relation
+
+ 7
+ 1169
+ 147
+ 28
+
+ +'s are user-defined variables and methods
+Qt's methods does not have any symbols
+ 80.0;20.0;120.0;20.0
+
--
cgit