From bb1f0b5823a2792b65600505934979367c8a6028 Mon Sep 17 00:00:00 2001 From: lucaszhao19 Date: Thu, 20 Feb 2020 15:07:10 +0530 Subject: DockWidgets and NodeItems positioning fixed --- Bin_Phase_env.py | 63 +- Chemical-Simulator-GUI | 1 - ComponentSelector.py | 172 ++++ ComponentSelector.ui | 130 +++ DockWidget.txt | 636 ++++++++++++ DockWidgetCompoundSeparator.py | 99 ++ DockWidgetCompoundSeparator.ui | 45 + DockWidgetDistillationColumn.py | 120 +++ DockWidgetDistillationColumn.ui | 270 +++++ DockWidgetFlash.py | 74 ++ DockWidgetFlash.ui | 161 +++ DockWidgetMatStm.py | 332 ------ DockWidgetMatStm.ui | 458 --------- DockWidgetMaterialStream.py | 332 ++++++ DockWidgetMaterialStream.ui | 458 +++++++++ DockWidgetMixer.py | 61 ++ DockWidgetMixer.ui | 137 +++ DockWidgetShortcutColumn.py | 97 ++ DockWidgetShortcutColumn.ui | 295 ++++++ DockWidgetSplitter.py | 78 ++ DockWidgetSplitter.ui | 200 ++++ Graphics.py | 164 +-- OMChem/ConvReactor.py | 4 +- Simulator/Databases/Databases.py | 29 +- Streams.py | 388 ------- Undo.dat | Bin 39600 -> 11013 bytes UnitOperations.py | 314 +++++- comp_selector.ui | 139 --- component_selector.py | 181 ---- container.py | 15 +- dockWidget.py | 62 +- dockWidget.ui | 5 +- icon/AdiabaticCompressor.png | Bin 0 -> 643 bytes icon/AdiabaticExpander.png | Bin 0 -> 565 bytes icon/CompoundSeparator.png | Bin 0 -> 1521 bytes icon/Cooler.png | Bin 0 -> 2334 bytes icon/DistillationColumn.png | Bin 0 -> 6006 bytes icon/Equation.png | Bin 0 -> 3889 bytes icon/Flash.png | Bin 0 -> 2079 bytes icon/Heater.png | Bin 0 -> 2088 bytes icon/MaterialStream.png | Bin 0 -> 452 bytes icon/Mixer.png | Bin 0 -> 911 bytes icon/Pump.png | Bin 0 -> 1348 bytes icon/Sequential.png | Bin 0 -> 5827 bytes icon/ShortcutColumn.png | Bin 0 -> 6006 bytes icon/Splitter.png | Bin 0 -> 937 bytes icon/Valve.png | Bin 0 -> 1195 bytes icon/compoundSelector.png | Bin 0 -> 1249 bytes icon/icon_1.svg | 732 +++++++++++++ icon/logo.png | Bin 0 -> 9457 bytes icon/new.svg | 83 ++ icon/package-icon.svg | 80 ++ icon/plus.png | Bin 0 -> 3337 bytes icon/zoomIn.png | Bin 0 -> 32456 bytes icon/zoomOut.png | Bin 0 -> 31836 bytes icon/zoomReset.png | Bin 0 -> 48307 bytes icons/AdiabaticCompressor.png | Bin 643 -> 740 bytes icons/AdiabaticExpander.png | Bin 565 -> 741 bytes icons/Column.png | Bin 0 -> 4681 bytes icons/CompSep.png | Bin 1521 -> 0 bytes icons/CompoundSeparator.png | Bin 0 -> 1708 bytes icons/Cooler.png | Bin 2334 -> 3042 bytes icons/DistCol.png | Bin 6006 -> 0 bytes icons/DistillationColumn.png | Bin 0 -> 4361 bytes icons/Equation.png | Bin 3889 -> 0 bytes icons/Flash.png | Bin 2079 -> 2431 bytes icons/Heater.png | Bin 2088 -> 2750 bytes icons/MaterialStream.png | Bin 452 -> 527 bytes icons/Mixer.png | Bin 911 -> 1008 bytes icons/Pump.png | Bin 1348 -> 1620 bytes icons/Sequential.png | Bin 5827 -> 0 bytes icons/ShortCol.png | Bin 6006 -> 0 bytes icons/ShortcutColumn.png | Bin 0 -> 4361 bytes icons/Splitter.png | Bin 937 -> 1068 bytes icons/Valve.png | Bin 1195 -> 1498 bytes icons/compound.png | Bin 0 -> 4849 bytes icons/compoundSelector.png | Bin 1249 -> 0 bytes icons/eq.png | Bin 0 -> 5162 bytes icons/icon_1.svg | 868 ++++++++++++++++ icons/images.png | Bin 0 -> 2938 bytes icons/logo.png | Bin 9457 -> 1391 bytes icons/new.png | Bin 0 -> 2812 bytes icons/new.svg | 83 -- icons/package-icon.svg | 80 -- icons/plus.png | Bin 3337 -> 0 bytes icons/sq.png | Bin 0 -> 8725 bytes icons/zoo.png | Bin 0 -> 6707 bytes icons/zoomIn.png | Bin 32456 -> 0 bytes icons/zoomOut.png | Bin 31836 -> 0 bytes icons/zoomReset.png | Bin 48307 -> 0 bytes icons/zoom_in.png | Bin 0 -> 4908 bytes icons/zoom_out.png | Bin 0 -> 4865 bytes icons/zoom_reset.png | Bin 0 -> 5052 bytes main.ui | 10 +- main2.ui | 415 ++++++++ main3.ui | 2112 ++++++++++++++++++++++++++++++++++++++ mainApp.py | 90 +- umlet.uxf | 1448 ++++++++++++++++++++++++++ 98 files changed, 9624 insertions(+), 1897 deletions(-) delete mode 160000 Chemical-Simulator-GUI create mode 100644 ComponentSelector.py create mode 100644 ComponentSelector.ui create mode 100644 DockWidget.txt create mode 100644 DockWidgetCompoundSeparator.py create mode 100644 DockWidgetCompoundSeparator.ui create mode 100644 DockWidgetDistillationColumn.py create mode 100644 DockWidgetDistillationColumn.ui create mode 100644 DockWidgetFlash.py create mode 100644 DockWidgetFlash.ui delete mode 100644 DockWidgetMatStm.py delete mode 100644 DockWidgetMatStm.ui create mode 100644 DockWidgetMaterialStream.py create mode 100644 DockWidgetMaterialStream.ui create mode 100644 DockWidgetMixer.py create mode 100644 DockWidgetMixer.ui create mode 100644 DockWidgetShortcutColumn.py create mode 100644 DockWidgetShortcutColumn.ui create mode 100644 DockWidgetSplitter.py create mode 100644 DockWidgetSplitter.ui delete mode 100644 comp_selector.ui delete mode 100644 component_selector.py create mode 100644 icon/AdiabaticCompressor.png create mode 100644 icon/AdiabaticExpander.png create mode 100644 icon/CompoundSeparator.png create mode 100644 icon/Cooler.png create mode 100644 icon/DistillationColumn.png create mode 100644 icon/Equation.png create mode 100644 icon/Flash.png create mode 100644 icon/Heater.png create mode 100644 icon/MaterialStream.png create mode 100644 icon/Mixer.png create mode 100644 icon/Pump.png create mode 100644 icon/Sequential.png create mode 100644 icon/ShortcutColumn.png create mode 100644 icon/Splitter.png create mode 100644 icon/Valve.png create mode 100644 icon/compoundSelector.png create mode 100644 icon/icon_1.svg create mode 100644 icon/logo.png create mode 100644 icon/new.svg create mode 100644 icon/package-icon.svg create mode 100644 icon/plus.png create mode 100644 icon/zoomIn.png create mode 100644 icon/zoomOut.png create mode 100644 icon/zoomReset.png create mode 100644 icons/Column.png delete mode 100644 icons/CompSep.png create mode 100644 icons/CompoundSeparator.png delete mode 100644 icons/DistCol.png create mode 100644 icons/DistillationColumn.png delete mode 100644 icons/Equation.png delete mode 100644 icons/Sequential.png delete mode 100644 icons/ShortCol.png create mode 100644 icons/ShortcutColumn.png create mode 100644 icons/compound.png delete mode 100644 icons/compoundSelector.png create mode 100644 icons/eq.png create mode 100644 icons/icon_1.svg create mode 100644 icons/images.png create mode 100644 icons/new.png delete mode 100644 icons/new.svg delete mode 100644 icons/package-icon.svg delete mode 100644 icons/plus.png create mode 100644 icons/sq.png create mode 100644 icons/zoo.png delete mode 100644 icons/zoomIn.png delete mode 100644 icons/zoomOut.png delete mode 100644 icons/zoomReset.png create mode 100644 icons/zoom_in.png create mode 100644 icons/zoom_out.png create mode 100644 icons/zoom_reset.png create mode 100644 main2.ui create mode 100644 main3.ui create mode 100644 umlet.uxf diff --git a/Bin_Phase_env.py b/Bin_Phase_env.py index a02c0e2..b9228b2 100644 --- a/Bin_Phase_env.py +++ b/Bin_Phase_env.py @@ -17,8 +17,6 @@ import PyQt5.QtWidgets as QtWidgets import pyqtgraph as pg import pyqtgraph.exporters - - ui_dialog,_ = loadUiType('Binary_Phase_Env.ui') class Bin_Phase_env(QWidget,ui_dialog): @@ -46,18 +44,12 @@ class Bin_Phase_env(QWidget,ui_dialog): self.radioButton_2.setChecked(False) self.button_handler() - self.counter = 1 - - - - def button_handler(self): self.radioButton.clicked.connect(lambda:self.T_xy()) self.radioButton_2.clicked.connect(lambda:self.P_xy()) self.pushButton_2.clicked.connect(lambda:self.plot()) - def T_xy(self): self.radioButton.setChecked(True) @@ -90,6 +82,7 @@ class Bin_Phase_env(QWidget,ui_dialog): self.formLayout.addRow(QLabel("T(K)"),self.first) self.formLayout.addRow(QLabel("Number of data points"),self.points) #print("") + def get_omc_path(self): try: self.omhome = os.environ.get('OPENMODELICAHOME') @@ -104,8 +97,6 @@ class Bin_Phase_env(QWidget,ui_dialog): print("The OpenModelica compiler is missing in the System path please install it" ) raise - - def plot(self): #print(self.type) @@ -153,10 +144,8 @@ class Bin_Phase_env(QWidget,ui_dialog): mosFile.write("loadFile(\"Graph.mo\");\n") mosFile.write("simulate(Graph, outputFormat=\"csv\", stopTime=1.0, numberOfIntervals=1);\n") - print(self.data) - self.resdata = [] self.omc_path = self.get_omc_path() simpath = self.plot_mos_path @@ -185,34 +174,24 @@ class Bin_Phase_env(QWidget,ui_dialog): print("SIMULATION DONE") - - - - if self.type=='T': for k in range(len(self.rows[0])): if self.rows[0][k][0]=='P': self.datay.append(float(self.rows[1][k])) #print(col) length = len(self.rows[0][k]) - if self.rows[0][k][0]=='x' and self.rows[0][k][length-2]=='1': self.datax1.append(float(self.rows[1][k])) # k+=1 - if self.rows[0][k][0]=='y' and self.rows[0][k][length-2]=='1': self.datax2.append(float(self.rows[1][k])) #k+=1 - #k+=1 - - else: - + else: for k in range(len(self.rows[0])): if self.rows[0][k][0]=='T': self.datay.append(float(self.rows[1][k])) #print(col) - #print(self.rows[0][k]) length = len(self.rows[0][k]) if self.rows[0][k][0]=='x' and self.rows[0][k][length-2]=='1': @@ -229,28 +208,20 @@ class Bin_Phase_env(QWidget,ui_dialog): plt.addLegend() plt.setXRange(0,1) - # print("SIZE UP AHEAD") # print(len(self.datay)) # print(len(self.datax1)) # print(len(self.datax2)) # print("SIZES DONE") - c1 = plt.plot(self.datax1, self.datay,pen=pg.mkPen('b',width = 1), name='dew points') c2 = plt.plot(self.datax2, self.datay,pen=pg.mkPen('r',width = 1), name='bubble points') - - view_box = plt.plotItem.vb - self.tool_tip = "" - def pressEvent(evt): #print("HELLO") a = 10 pos = evt - - mousepoint = view_box.mapSceneToView(pos) roi = pg.ROI(pos) find_color = plt.mapToGlobal(pos.toPoint()) @@ -270,9 +241,7 @@ class Bin_Phase_env(QWidget,ui_dialog): self.lineEdit_y.setText("") self.tool_tip = "" QApplication.setOverrideCursor(QCursor(QtCore.Qt.ArrowCursor)) - - - + #self.prev = None def entered(items): for i in items: @@ -283,20 +252,13 @@ class Bin_Phase_env(QWidget,ui_dialog): QApplication.setOverrideCursor(QCursor(QtCore.Qt.ArrowCursor)) else: i.setToolTip(self.tool_tip) - - - # print(items) - + # print(items) #proxy = pg.SignalProxy(plt.scene().sigMouseMoved, rateLimit = 60, slot = pressEvent) plt.scene().sigMouseMoved.connect(pressEvent) plt.scene().sigMouseHover.connect(entered) #c1.setAcceptHoverEvents(True) #c2.setAcceptHoverEvents(True) - - - - # def hoverEnterEvent(c1,event): # print("Object ZONE") @@ -306,7 +268,6 @@ class Bin_Phase_env(QWidget,ui_dialog): #c1.hoverMoveEvent.connect(item) #c2.hoverMoveEvent.connect(item) - plt.setLabel('left',self.other+self.otherunit,units = '') plt.setLabel('bottom',self.comp1+'(mol. frac.)',units = '') @@ -315,19 +276,3 @@ class Bin_Phase_env(QWidget,ui_dialog): self.tabWidget.addTab(self.new_tab,"Plot "+str(self.counter)) self.counter+=1 - - - - - - - - - - - - - - - - diff --git a/Chemical-Simulator-GUI b/Chemical-Simulator-GUI deleted file mode 160000 index 79c81ea..0000000 --- a/Chemical-Simulator-GUI +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 79c81eaa67a545db570c083c3852e09b26e5bf87 diff --git a/ComponentSelector.py b/ComponentSelector.py new file mode 100644 index 0000000..4860c4c --- /dev/null +++ b/ComponentSelector.py @@ -0,0 +1,172 @@ +from PyQt5.QtCore import * +from PyQt5.QtWidgets import * +from PyQt5.QtGui import * +from PyQt5.uic import loadUiType +import pandas as pd +from Simulator.Databases.Databases import ChemsepDatabase +ui_dialog,_ = loadUiType('ComponentSelector.ui') + + +#df = pd.read_csv("compoundsDatabase.csv") + +compound_selected = [] #list storing components that are selected inintialised as empty + +class ComponentSelector(QDialog,ui_dialog): + def __init__(self,parent=None): + QDialog.__init__(self,parent) + + self.setupUi(self) + + 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.lines+=x + print(self.lines) + + + #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.lines=self.DB1_list #combined list of all the edited compounds + + self.model = QStringListModel() + self.model.setStringList(self.lines) + + self.completer = QCompleter() + self.completer.setCaseSensitivity(Qt.CaseInsensitive) + self.completer.setModel(self.model) + + #QCompleter completes the text written in lineedit + self.lineEdit.setCompleter(self.completer) + + self.compoundSelectButton.clicked.connect(self.compoundSelection) + self.compoundSelectButton.setAutoDefault(False) + self.pushButton.clicked.connect(self.accept) + self.pushButton_2.clicked.connect(self.cancel) + self.pushButton_3.clicked.connect(self.removeItems) + + def final_list(self,*list_name): + self.list_final=[] + #add multiple lists + for i in list_name: + self.list_final+=i + return (self.list_final) + + def isCompSelected(self): + if not compound_selected: + return False + else: + return True + + #attrib: + #CAS fro CAS Number + #CompoundID for Name + #Smiles for Molecular Formula + #MolecularWeight for Molecular Weight + +#the below function will match the entered compound and get the database obj + #of the corresponding database + + def get_object(self,component): + for ele in self.Dict1: + values=self.Dict1[ele] + for ind in values: + if ind ==component: + return(ele) + + +#the below finction removes the before added extra string from the cmpounds + def get_original_name(self,component,removing_attrib): + self.temp_comp= component.replace(removing_attrib,'') + return(self.temp_comp) + + + + def compoundSelection(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 + #and thus store the instance of the class to which the component belongs + self.removing_attrib='(' + self.obj.name + ')' #getting the attribute that is to be removed + self.comp=self.get_original_name(self.comp,self.removing_attrib) + #getting only air, water etc from air chemsep etc + compound_selected.append(self.comp) #appending that in the list + + self.prop_list=self.obj.get_comp_prop(self.comp) #getting prop of the comp + #obj is the required class object + # self.creating_mo_file() + self.final_mo() + + self.lineEdit.clear() + 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') + + Dict={'CAS':self.CAS,'Name':self.Name,'Molecular Formula':self.MolecularFormula,'Molecular Weight':self.MolecularWeight} + #converted everything to a dictionary which will be passes to addtable + #function as a parameter. + print(Dict) + self.addToTable(Dict) + else: + self.Show_Error() + + @staticmethod + def setCompounds(compounds): + #compound_selected = compounds + for i in compounds: + compound_selected.append(i) + + def addToTable(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']))) + 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? + 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 Show_Error(self): + QMessageBox.about(self, 'Important', "Selected Compound is not Available") + + def cancel(self): + compound_selected.clear() + self.tableWidget.setRowCount(0) + self.reject() + + def getComp(self): + return compound_selected + + def final_mo(self): + self.f_mo=open('Simulator/database.mo','w+') + self.f_mo.write('package database\n') + for line in self.prop_list: + self.f_mo.write(line) + self.f_mo.write('\n') + self.f_mo.write('\nend database;') + self.f_mo.close() + \ No newline at end of file diff --git a/ComponentSelector.ui b/ComponentSelector.ui new file mode 100644 index 0000000..7a43206 --- /dev/null +++ b/ComponentSelector.ui @@ -0,0 +1,130 @@ + + + Dialog + + + + 0 + 0 + 461 + 289 + + + + Compound Selector + + + + + 10 + 20 + 441 + 256 + + + + + + + + 9 + 75 + true + + + + Search For Compounds : + + + + + + + + + + + + Select + + + true + + + + + + + Remove + + + false + + + + + + + + + 110 + + + true + + + + CAS Number + + + + + Name + + + + + Molecular Formula + + + + + Molecular Weight + + + + + + + + + + + Comic Sans MS + + + + Submit + + + + + + + + Comic Sans MS + + + + Cancel + + + + + + + + + + + diff --git a/DockWidget.txt b/DockWidget.txt new file mode 100644 index 0000000..b14eef8 --- /dev/null +++ b/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/DockWidgetCompoundSeparator.py b/DockWidgetCompoundSeparator.py new file mode 100644 index 0000000..24cdbc7 --- /dev/null +++ b/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('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 new file mode 100644 index 0000000..2d9a4b2 --- /dev/null +++ b/DockWidgetCompoundSeparator.ui @@ -0,0 +1,45 @@ + + + form + + + true + + + + 0 + 0 + 392 + 700 + + + + + 0 + 0 + + + + + 3200 + 5000 + + + + Form + + + + + 10 + 40 + 331 + 191 + + + + + + + + diff --git a/DockWidgetDistillationColumn.py b/DockWidgetDistillationColumn.py new file mode 100644 index 0000000..ca2da9c --- /dev/null +++ b/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('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 new file mode 100644 index 0000000..0cb1043 --- /dev/null +++ b/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/DockWidgetFlash.py b/DockWidgetFlash.py new file mode 100644 index 0000000..f0fa511 --- /dev/null +++ b/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('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 new file mode 100644 index 0000000..c781aa6 --- /dev/null +++ b/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/DockWidgetMatStm.py b/DockWidgetMatStm.py deleted file mode 100644 index 76ecb11..0000000 --- a/DockWidgetMatStm.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 component_selector import * -from collections import defaultdict -from Graphics import * - -ui_dialog,_ = loadUiType('DockWidgetMatStm.ui') - -class DockWidgetMatStm(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/DockWidgetMatStm.ui b/DockWidgetMatStm.ui deleted file mode 100644 index 8995ba6..0000000 --- a/DockWidgetMatStm.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/DockWidgetMaterialStream.py b/DockWidgetMaterialStream.py new file mode 100644 index 0000000..5fd6261 --- /dev/null +++ b/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('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 new file mode 100644 index 0000000..8995ba6 --- /dev/null +++ b/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/DockWidgetMixer.py b/DockWidgetMixer.py new file mode 100644 index 0000000..8a00dcd --- /dev/null +++ b/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('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 new file mode 100644 index 0000000..e039490 --- /dev/null +++ b/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/DockWidgetShortcutColumn.py b/DockWidgetShortcutColumn.py new file mode 100644 index 0000000..570cdd1 --- /dev/null +++ b/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('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 new file mode 100644 index 0000000..c66e699 --- /dev/null +++ b/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/DockWidgetSplitter.py b/DockWidgetSplitter.py new file mode 100644 index 0000000..9327e16 --- /dev/null +++ b/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('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 new file mode 100644 index 0000000..02a865e --- /dev/null +++ b/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/Graphics.py b/Graphics.py index 467b628..07dd43e 100644 --- a/Graphics.py +++ b/Graphics.py @@ -14,15 +14,22 @@ from PyQt5.QtGui import QBrush ,QTransform ,QMouseEvent import PyQt5.QtGui as QtGui import PyQt5.QtCore as QtCore import PyQt5.QtWidgets as QtWidgets -from component_selector import * +from ComponentSelector import * from DockWidget import * -from DockWidgetMatStm import * +from DockWidgetMaterialStream import * +from DockWidgetDistillationColumn import * +from DockWidgetShortcutColumn import * +from DockWidgetMixer import * +from DockWidgetSplitter import * +from DockWidgetFlash import * +from DockWidgetCompoundSeparator import * + import datetime -from container import * -import container +from Container import * +import Container from Streams import * from UnitOperations import * @@ -40,10 +47,10 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem): return self.scene def getComponentSelector(self): - return componentSelector(self) + return ComponentSelector(self) - def createNodeItem(self,unitOpr, container): - return NodeItem(unitOpr, container) + def createNodeItem(self,unitOpr, container, graphicsView): + return NodeItem(unitOpr, container, graphicsView) def boundingRect(self): return QtCore.QRectF(self.rect) @@ -53,14 +60,14 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem): compounds = obj[-1] obj.pop() - componentSelector.setCompounds(compounds) + ComponentSelector.setCompounds(compounds) for i in obj: if(i in self.unitOp): pass else: self.unitOp.append(i) - new_box = self.createNodeItem(i, self) + new_box = self.createNodeItem(i, self.grphicsView) new_box.setPos(i.pos.toPoint().x(), i.pos.toPoint().y()) self.scene.addItem(new_box) @@ -118,11 +125,11 @@ class NodeLine(QtWidgets.QGraphicsPathItem): self._source = None self._target = None self.setZValue(-1) - self.setBrush(QtGui.QColor(0,0,255,255)) + self.setBrush(QtGui.QColor(0,70,70,120)) self.pen = QtGui.QPen() self.pen.setStyle(QtCore.Qt.SolidLine) self.pen.setWidth(1) - self.pen.setColor(QtGui.QColor(0,0,255,255)) + self.pen.setColor(QtGui.QColor(0,70,70,220)) self.setPen(self.pen) def updatePath(self): @@ -270,12 +277,12 @@ class NodeSocket(QtWidgets.QGraphicsItem): # Brush. self.brush = QtGui.QBrush() self.brush.setStyle(QtCore.Qt.SolidPattern) - self.brush.setColor(QtGui.QColor(180,20,90,255)) + self.brush.setColor(QtGui.QColor(220,220,220,220)) #180,20,90,255 # Pen. self.pen = QtGui.QPen() self.pen.setStyle(QtCore.Qt.SolidLine) self.pen.setWidth(1) - self.pen.setColor(QtGui.QColor(20,20,20,255)) + self.pen.setColor(QtGui.QColor(0,70,70,255)) #20,20,20,255 # Lines. self.outLines = [] @@ -295,6 +302,9 @@ class NodeSocket(QtWidgets.QGraphicsItem): painter.drawEllipse(self.rect) def mousePressEvent(self, event): + cursor = QCursor( Qt.PointingHandCursor ) + QApplication.instance().setOverrideCursor(cursor) + if self.type == 'op': rect = self.boundingRect() pointA = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2) @@ -315,6 +325,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): super(NodeSocket, self).mousePressEvent(event) def mouseMoveEvent(self, event): + if self.type == 'op': pointB = self.mapToScene(event.pos()) self.newLine.pointB = pointB @@ -329,6 +340,9 @@ class NodeSocket(QtWidgets.QGraphicsItem): super(NodeSocket, self).mouseMoveEvent(event) def mouseReleaseEvent(self, event): + cursor = QCursor( Qt.ArrowCursor ) + QApplication.instance().setOverrideCursor(cursor) + item = self.scene().itemAt(event.scenePos().toPoint(),QtGui.QTransform()) stm = ['MaterialStream','EngStm'] item.otherLine=self.newLine @@ -341,6 +355,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): 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 + elif (self.type =='in') and (item.type == 'op'): self.newLine.source = item self.newLine.target = self @@ -351,6 +366,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): if self.newLine.target.parent.obj.type not in stm: self.newLine.target.parent.obj.add_connection(1,self.newLine.source.parent.obj) + else: self.scene().removeItem(self.newLine) if(self.newLine in self.inLines): @@ -379,11 +395,21 @@ class NodeSocket(QtWidgets.QGraphicsItem): center = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2) center = self.mapToScene(center) return center + + def hoverEnterEvent(self, event): + print("in hover enter") + cursor = QCursor( Qt.CrossCursor ) + QApplication.instance().setOverrideCursor(cursor) + + def hoverLeaveEvent(self, event): + cursor = QCursor( Qt.ArrowCursor ) + QApplication.instance().setOverrideCursor(cursor) # 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 = [] +stack = [] class NodeItem(QtWidgets.QGraphicsItem): @@ -397,57 +423,74 @@ class NodeItem(QtWidgets.QGraphicsItem): def getDockWidget(): return dockWidgetLst - def __init__(self,unitOpr, container): - l = ['Mixer','Splitter'] + def __init__(self,unitOpr, container, graphicsView): + l = ['Splitter','Mixer', 'DistillationColumn', 'Flash', 'CompoundSeparator', 'ShortcutColumn'] stm = ['MaterialStream', 'EnergyStream'] super(NodeItem, self).__init__() self.obj = unitOpr self.container = container + self.graphicsView = graphicsView self.name = self.obj.name self.type = self.obj.type - default_tooltip = f"{self.name}\n\n" - default_tooltip_dict = self.obj.paramgetter(self.obj.modesList[0]) - for i, j in default_tooltip_dict.items(): - if j is not None: - default_tooltip = default_tooltip + f" {i} : {j}\n" - self.setToolTip(default_tooltip) + if (self.obj.modesList): + default_tooltip = f"{self.name}\n\n" + default_tooltip_dict = self.obj.paramgetter(self.obj.modesList[0]) + for i, j in default_tooltip_dict.items(): + if j is not None: + default_tooltip = default_tooltip + f" {i} : {j}\n" + self.setToolTip(default_tooltip) self.nin = self.obj.no_of_inputs self.nop = self.obj.no_of_outputs + if self.obj.type == 'Mixer': + text, ok = QInputDialog.getText(self.container.graphicsView, 'Mixer', 'Enter number of input:') + if ok and text: + self.nin = int(text) + self.obj.no_of_inputs = self.nin + self.obj.variables['NOI']['value'] = self.nin + elif self.obj.type == 'Splitter': + text, ok = QInputDialog.getText(self.container.graphicsView, 'Splitter', 'Enter number of output:') + if ok and text: + self.nop = int(text) + self.obj.no_of_outputs = self.nop + self.obj.variables['NOO']['value'] = self.nop + self.dockWidget = None lst.append(self) - if(self.obj.type not in l): - if (self.obj.type in stm): - self.dockWidget = DockWidgetMatStm(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.pic=QtGui.QPixmap("icons/"+self.type+".png") + if self.obj.type in l: + self.dockWidget = 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) + 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.pic=QtGui.QPixmap("Icons/"+self.type+".png") self.rect = QtCore.QRect(0,0,self.pic.width(),self.pic.height()) self.text = QGraphicsTextItem(self) f = QFont() f.setPointSize(8) self.text.setFont(f) - self.text.setDefaultTextColor(QtGui.QColor(73,36,73,255)) + self.text.setDefaultTextColor(QtGui.QColor(0,70,70,220)) self.text.setParentItem(self) - self.text.setPos(-2.5, self.rect.height()-15) + self.text.setPos(self.rect.width()-(self.rect.width()*0.9), self.rect.height()) self.text.setPlainText(self.name) self.setFlag(QtWidgets.QGraphicsPixmapItem.ItemIsMovable) self.setFlag(QtWidgets.QGraphicsPixmapItem.ItemIsSelectable) - self.initUi() # Brush self.brush = QtGui.QBrush() @@ -461,10 +504,10 @@ class NodeItem(QtWidgets.QGraphicsItem): self.selPen = QtGui.QPen() self.selPen.setStyle(QtCore.Qt.SolidLine) - self.selPen.setWidth(2) - self.selPen.setColor(QtGui.QColor(222,192,222)) + self.selPen.setWidth(1) + self.selPen.setColor(QtGui.QColor(220,220,220,255)) - def initUi(self): + # initializing the node sockets self.Input , self.Output = self.initializeSockets(self.type) def shape(self): @@ -484,29 +527,30 @@ class NodeItem(QtWidgets.QGraphicsItem): painter.drawPixmap(self.rect,self.pic) def initializeSockets(self,type): - if(self.type=="Flash" or self.type=="CompSep"): - Input = [NodeSocket(QtCore.QRect(-2.5+5.5,(self.rect.height()*x/(self.nin+1))-8,4,4), self, 'in') for x in range(1,self.nin+1) ] - Output = [NodeSocket(QtCore.QRect(self.rect.width()-7.5,(self.rect.height()*x*0.90/(self.nop+1))-4,4,4), self, 'op') for x in range(1,self.nop+1)] + 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 elif(self.type=="AdiabaticCompressor" or self.type=="AdiabaticExpander" or self.type =="Mixer" or self.type =="Splitter" or self.type =="Valve" ): - Input = [NodeSocket(QtCore.QRect(-3.5,(self.rect.height()*x/(self.nin+1))-6,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))-6,4,4), self, 'op') for x in range(1,self.nop+1)] + 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))-4,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))-4,4,4), self, 'op') for x in range(1,self.nop+1)] + 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))-10,4,4), self, 'in') for x in range(1,self.nin+1) ] - Output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,-2.5,4,4), self, 'op') for x in range(1,self.nop+1)] + 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=="DistCol" or self.type=="ShortCol"): - Input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1))-12,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))-67,5,5), self, 'op') for x in range(1,self.nop+1)] + 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 elif(self.type=="MaterialStream"): - Input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1))-1,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))-1,4,4), self, 'op') for x in range(1,self.nop+1)] + 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): @@ -524,10 +568,14 @@ class NodeItem(QtWidgets.QGraphicsItem): #print(self.name, self.pos) def mouseDoubleClickEvent(self, event): - self.setPos(event.scenePos().x()-250,event.scenePos().y()) - temp = self.obj.pos + + self.graphicsView.setInteractive(False) + if len(stack): + print(stack) + stack[-1].hide() self.dockWidget.show() - self.setPos(temp) + stack.append(self.dockWidget) + self.graphicsView.setInteractive(True) def findMainWindow(self): diff --git a/OMChem/ConvReactor.py b/OMChem/ConvReactor.py index 9ad35da..9061294 100644 --- a/OMChem/ConvReactor.py +++ b/OMChem/ConvReactor.py @@ -8,12 +8,12 @@ class ConvReactor(): self.Z = str(Z) self.a = json.dumps(a).replace('[','{').replace(']','}') self.operation = str(operation) - self.Tdef = str(Tdef) self.name = name self.OM_data_eqn = '' self.OM_data_init = '' self.InputStms = [] - self.OutputStms = [] + self.OutputStms = [] self.Tdef = str(Tdef) + self.type = 'ConvReactor' self.EngStms = EngStms(name="EngStm") diff --git a/Simulator/Databases/Databases.py b/Simulator/Databases/Databases.py index d7dc797..4b3a4c6 100644 --- a/Simulator/Databases/Databases.py +++ b/Simulator/Databases/Databases.py @@ -17,16 +17,12 @@ class ChemsepDatabase(): self.name = 'chemsep' for comp in compound: self.compName=comp.getElementsByTagName('CompoundID')[0].getAttribute('value') - self.comp_name_list.append(self.compName+'(' + self.name + ')') - - self.comp_prop_list=list() - + self.comp_name_list.append(self.compName+'(' + self.name + ')') + self.comp_prop_list=list() def get_comp_name_list(self): return self.comp_name_list - - #attrib: #CAS fro CAS Number #CompoundID for Name @@ -35,9 +31,7 @@ class ChemsepDatabase(): #GETTING 'ATTRIBUTE''S VALUE OF THE COMPOUND 'COMPS' -#COMP IS AN ITERATING VALUE IN THE XML TAG COMPOUND - - +#COMP IS AN ITERATING VALUE IN THE XML TAG COMPOUND def get_value(self,comps,attrib): self.comps=comps self.x='' @@ -47,8 +41,7 @@ class ChemsepDatabase(): try: self.x=comp.getElementsByTagName(attrib)[0].getAttribute("value") except IndexError: - self.x = "-" - + self.x = "-" return (self.x) #CREATING comp_prop_list LIST OF THE COMPOUND SELECTED @@ -58,9 +51,7 @@ class ChemsepDatabase(): self.comps = comps for comp in compound: compName = comp.getElementsByTagName("CompoundID")[0].getAttribute("value") - if compName==self.comps: - - + if compName==self.comps: CompName = compName.replace(" ","") CompName = CompName.replace("-","") CompName = CompName.replace(",","") @@ -140,8 +131,7 @@ class ChemsepDatabase(): RacketParam = comp.getElementsByTagName("RacketParameter")[0].getAttribute("value") except IndexError: RacketParam = "0" - - + try: LiqDen = comp.getElementsByTagName("LiquidDensity")[0] LiqDenEqn = LiqDen.getElementsByTagName("eqno")[0].getAttribute("value") @@ -358,8 +348,6 @@ class ChemsepDatabase(): except IndexError: ChaoSeadLV = 0 - - #f.write('Package database') self.comp_prop_list.append('model '+CompName) #f.write('\n') @@ -440,7 +428,4 @@ class ChemsepDatabase(): #return self.comp_prop_list return self.comp_prop_list - - - - \ No newline at end of file + \ No newline at end of file diff --git a/Streams.py b/Streams.py index f35a056..1b76247 100644 --- a/Streams.py +++ b/Streams.py @@ -355,391 +355,3 @@ class MaterialStream(): for key,value in self.eqnDict.items(): self.OM_data_eqn = self.OM_data_eqn + self.name + '.'+ key + ' = ' + str(value) + ';\n' return self.OM_data_eqn - - -''' -from OMPython import OMCSession -from PyQt5.QtCore import * -import json -import sys -from collections import defaultdict - -class MaterialStream(): - counter = 1 - def __init__(self,CompNames = [],Temperature=300,Pressure=101325,xvap=None,xmvap=None,xliq=None,xmliq=None,x_pc = [1.0], xm_pc = [], MolFlow=100, MasFlow=None,**kwargs): - self.name = 'MaterialStream' + str(MaterialStream.counter) - self.type = 'MaterialStream' - self.T = Temperature - self.P = Pressure - self.xvap = xvap - self.xmvap = xmvap - self.xliq = xliq - self.xmliq = xmliq - self.CompNames = CompNames - self.x_pc = x_pc - self.xm_pc = xm_pc - self.MolFlow = MolFlow - self.MasFlow = MasFlow - self.OM_data_init = '' - self.OM_data_eqn = '' - self.count = MaterialStream.counter - self.thermoPackage ="RaoultsLaw" - self.mode1 = "P" - self.mode1val = "" - self.mode2 = "T" - self.mode2val = "" - self.no_of_inputs = 1 - self.no_of_outputs = 1 - self.x = 2500-30 - 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.Prop = { - - self.mode1:self.mode1val, - self.mode2:self.mode2val, - 'xliq':xliq, - 'xmliq':xmliq, - 'xvap':xvap, - 'xmvap':xmvap, - 'F_p[1]':MolFlow, - 'Fm_p[1]':MasFlow, - 'MW_p[1]':None, - 'MW_p[2]':None, - 'MW_p[3]':None, - 'Cp_p[1]':None, - 'H_p[1]':None, - 'S_p[1]':None, - 'Cp_p[2]':None, - 'H_p[2]':None, - 'S_p[2]':None, - 'Cp_p[3]':None, - 'H_p[3]':None, - 'S_p[3]':None, - 'F_p[2]':None, - 'Fm_p[2]':None, - 'F_p[3]':None, - 'Fm_p[3]':None - - } - - self.Prop1 = { - self.mode1:self.mode1val, - self.mode2:self.mode2val, - 'xliq':xliq, - 'xmliq':xmliq, - 'xvap':xvap, - 'xmvap':xmvap, - 'F_p[1]':MolFlow, - 'Fm_p[1]':MasFlow, - 'MW_p[1]':None, - 'MW_p[2]':None, - 'MW_p[3]':None, - 'Cp_p[1]':None, - 'H_p[1]':None, - 'S_p[1]':None, - 'Cp_p[2]':None, - 'H_p[2]':None, - 'S_p[2]':None, - 'Cp_p[3]':None, - 'H_p[3]':None, - 'S_p[3]':None, - 'F_p[2]':None, - 'Fm_p[2]':None, - 'F_p[3]':None, - 'Fm_p[3]':None - - } - - def paramgetter(self,mode): - dict = {} - # print("Hello hello ", mode) - # if(mode == None): - # mode = self.modesList[0] - if(mode=="PT"): - self.mode1 = 'P' - self.mode2 = 'T' - dict = {self.mode2:self.T,self.mode1:self.P,"x_pc":self.x_pc,"MolFlow":self.MolFlow,"thermoPackage":self.thermoPackage} - elif(mode=="PH"): - self.mode1 = 'P' - self.mode2 = 'H_p[1]' - dict = {self.mode1:self.P,self.mode2:self.Prop['H_p[1]'],"x_pc":self.x_pc,"MolFlow":self.MolFlow,"thermoPackage":self.thermoPackage} - elif(mode=="PVF"): - self.mode1 = 'P' - self.mode2 = 'xvap' - dict = {self.mode1:self.P,self.mode2:self.xvap,"x_pc":self.x_pc,"MolFlow":self.MolFlow,"thermoPackage":self.thermoPackage} - elif(mode=="TVF"): - self.mode1 = 'T' - self.mode2 = 'xvap' - dict = {self.mode1:self.T,self.mode2:self.xvap,"x_pc":self.x_pc,"MolFlow":self.MolFlow,"thermoPackage":self.thermoPackage} - elif(mode=="PS"): - self.mode1 = 'P' - self.mode2 = 'S_p[1]' - dict = {self.mode1:self.P,self.mode2:self.Prop['S_p[1]'],"x_pc":self.x_pc,"MolFlow":self.MolFlow,"thermoPackage":self.thermoPackage} - - return dict - - def paramsetter(self,dict): - self.mode1val = dict[self.mode1] - self.mode2val = dict[self.mode2] - self.MolFlow = dict['MolFlow'] - self.x_pc = dict['x_pc'].split(",") - self.thermoPackage = dict['thermoPackage'] - self.Prop['F_p[1]'] = self.MolFlow - self.Prop[self.mode2] = dict[self.mode2] - self.Prop[self.mode1] = dict[self.mode1] - for i in range(len(self.CompNames)): - print('####### x_pc #########\n',self.x_pc[i]) - if self.x_pc: - self.Prop['x_pc[1,'+str(i+1)+']'] = self.x_pc[i] - else: - self.Prop['x_pc[1,'+str(i+1)+']'] = None - - if self.xm_pc: - self.Prop['xm_pc[1,'+str(i+1)+']'] = self.xm_pc[i] - else: - self.Prop['xm_pc[1,'+str(i+1)+']'] = None - - self.Prop['F_pc[1,'+str(i+1)+']'] = None - self.Prop['Fm_pc[1,'+str(i+1)+']'] = None - for i in range(0,len(self.CompNames)): - self.Prop['x_pc[2,'+str(i+1)+']'] = None - self.Prop['xm_pc[2,'+str(i+1)+']'] = None - self.Prop['F_pc[2,'+str(i+1)+']'] = None - self.Prop['Fm_pc[2,'+str(i+1)+']'] = None - self.Prop['x_pc[3,'+str(i+1)+']'] = None - self.Prop['xm_pc[3,'+str(i+1)+']'] = None - self.Prop['F_pc[3,'+str(i+1)+']'] = None - self.Prop['Fm_pc[3,'+str(i+1)+']'] = None - - def setPos(self,pos): - self.pos = pos - - def GetMinEqnValues(self): - x_pclist = [] - for i in range(0,len(self.CompNames)): - print(self.Prop['x_pc[1,'+str(i+1)+']']) - x_pclist.append(self.Prop['x_pc[1,'+str(i+1)+']']) - print(x_pclist) - #x_pclist = list(self.Prop(x_pc[1,1)]) - x_pc = json.dumps(x_pclist) - print(x_pc) - x_pc = x_pc.replace('[','{') - x_pc = x_pc.replace(']','}') - x_pc = x_pc.replace('"','') - - # x_pcstr = json.dumps(self.x_pc) - # x_pcstr = x_pcstr.replace('[','{') - # x_pcstr = x_pcstr.replace(']','}') - # x_pcstr = x_pcstr.replace('"','') - - if self.Prop[self.mode1]: - self.eqnDict[self.mode1] = self.Prop[self.mode1] - if self.Prop[self.mode2]: - self.eqnDict[self.mode2] = self.Prop[self.mode2] - if self.x_pc: - self.eqnDict['x_pc[1,:]'] = x_pc - if self.MolFlow: - self.eqnDict['F_p[1]'] = self.Prop['F_p[1]']#self.MolFlow - - print("##############$GetMinVEqnValuesStart$##################") - print("P:",self.Prop[self.mode1]) - print("T:",self.Prop[self.mode2]) - print("x_pc",x_pc) - print("F_p",self.Prop['F_p[1]']) - print("##############$GetMinVEqnValuesEnd$##################") - - # def GetEquationValues(self): # Not being called anywhere - # if self.Prop[self.mode1]: - # self.eqnDict[self.mode1] = self.Prop[self.mode1] - - # if self.Prop[self.mode2]: - # self.eqnDict[self.mode2] = self.Prop[self.mode2] - - # if self.Prop['x_pc[1,1]']: - # cfa = [] - # for i in range(1,len(self.CompNames)+1): - # cfa.append(self.Prop['x_pc[1,'+str(i)+']']) - # cmpMolFracstr = json.dumps(cfa) - # cmpMolFracstr = cmpMolFracstr.replace('[','{') - # cmpMolFracstr = cmpMolFracstr.replace(']','}') - # cmpMolFracstr = cmpMolFracstr.replace('"','') - # self.eqnDict['x_pc[1,:]'] = cmpMolFracstr - - # if self.Prop['F_p[1]']: - # self.eqnDict['F_p[1]'] = self.Prop['F_p[1]'] - - - def GetStartValues(self): - try: - if self.Prop[self.mode1]: - self.startDict[self.mode1] = self.Prop[self.mode1] - - if self.Prop[self.mode2]: - self.startDict[self.mode2] = self.Prop[self.mode2] - - - if self.Prop['x_pc[2,1]'] != None: - x_pcarr = [] - for i in range(1,4): - cmf = [] - for j in range(1,len(self.CompNames)+1): - cmf.append(str(self.Prop['x_pc['+str(i)+','+str(j)+']'])) - 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 - - if self.Prop['xm_pc[2,1]'] != None: - xm_pcarr = [] - for i in range(1,4): - cmf = [] - for j in range(1,len(self.CompNames)+1): - cmf.append(str(self.Prop['xm_pc['+str(i)+','+str(j)+']'])) - 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 - - if self.Prop['Fm_pc[2,1]'] != None: - Fm_pcarr = [] - for i in range(1,4): - cmf = [] - for j in range(1,len(self.CompNames)+1): - cmf.append(str(self.Prop['Fm_pc['+str(i)+','+str(j)+']'])) - 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 - - if self.Prop['F_pc[2,1]'] != None: - F_pcarr = [] - for i in range(1,4): - cmf = [] - for j in range(1,len(self.CompNames)+1): - cmf.append(str(self.Prop['F_pc['+str(i)+','+str(j)+']'])) - 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 - - if self.Prop['MW_p[2]'] != None: - MW_pArr = [] - for i in range(1,4): - MW_pArr.append(self.Prop['MW_p['+str(i)+']']) - MW_pStr = json.dumps(MW_pArr) - MW_pStr = MW_pStr.replace('[','{') - MW_pStr = MW_pStr.replace(']','}') - MW_pStr = MW_pStr.replace('"','') - self.startDict['MW_p'] = MW_pStr - - if self.Prop['F_p[2]'] != None: - F_pArr = [] - for i in range(1,4): - F_pArr.append(self.Prop['F_p['+str(i)+']']) - F_pStr = json.dumps(F_pArr) - F_pStr = F_pStr.replace('[','{') - F_pStr = F_pStr.replace(']','}') - F_pStr = F_pStr.replace('"','') - self.startDict['F_p'] = F_pStr - - if self.Prop['Cp_p[2]'] != None: - Cp_pArr = [] - for i in range(1,4): - Cp_pArr.append(self.Prop['Cp_p['+str(i)+']']) - Cp_pStr = json.dumps(Cp_pArr) - Cp_pStr = Cp_pStr.replace('[','{') - Cp_pStr = Cp_pStr.replace(']','}') - Cp_pStr = Cp_pStr.replace('"','') - self.startDict['Cp_p'] = Cp_pStr - - if self.Prop['H_p[2]'] != None: - H_pArr = [] - for i in range(1,4): - H_pArr.append(self.Prop['H_p['+str(i)+']']) - H_pStr = json.dumps(H_pArr) - H_pStr = H_pStr.replace('[','{') - H_pStr = H_pStr.replace(']','}') - H_pStr = H_pStr.replace('"','') - self.startDict['H_p'] = H_pStr - - - if self.Prop['S_p[2]'] != None: - S_pArr = [] - for i in range(1,4): - S_pArr.append(self.Prop['S_p['+str(i)+']']) - S_pStr = json.dumps(S_pArr) - S_pStr = S_pStr.replace('[','{') - S_pStr = S_pStr.replace(']','}') - S_pStr = S_pStr.replace('"','') - self.startDict['S_p'] = S_pStr - - if self.Prop['Fm_p[2]'] != None: - Fm_pArr = [] - for i in range(1,4): - Fm_pArr.append(self.Prop['Fm_p['+str(i)+']']) - Fm_pStr = json.dumps(Fm_pArr) - Fm_pStr = Fm_pStr.replace('[','{') - Fm_pStr = Fm_pStr.replace(']','}') - Fm_pStr = Fm_pStr.replace('"','') - self.startDict['Fm_p'] = Fm_pStr - - except Exception as e: - exc_type, exc_obj, exc_tb = sys.exc_info() - print(exc_type,exc_tb.tb_lineno) - print(e) - print('error') - - - def OM_Flowsheet_Initialize(self,addedcomp): - 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 + ("end ms"+str(self.count)+";\n") - comp_count = len(addedcomp) - # self.GetStartValues() - - #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) - self.OM_data_init = self.OM_data_init + ",C = {" - C = str(addedcomp).strip('[').strip(']') - C = C.replace("'","") - self.OM_data_init = self.OM_data_init + C + "}," - #for key, value in self.startDict.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' - return self.OM_data_init - - - def OM_Flowsheet_Equation(self,addedcomp,method): - self.OM_data_eqn = '' - self.comp_count = len(addedcomp) - if method == 'Eqn': - self.eqnDict = {} - self.GetMinEqnValues() - if method == 'SM': - self.eqnDict = {} - self.GetMinEqnValues() - #self.GetEquationValues() - #self.GetEquationValues() - - for key,value in self.eqnDict.items(): - self.OM_data_eqn = self.OM_data_eqn + self.name + '.'+ key + ' = ' + str(value) + ';\n' - return self.OM_data_eqn - - -''' \ No newline at end of file diff --git a/Undo.dat b/Undo.dat index a236cae..df0bd43 100644 Binary files a/Undo.dat and b/Undo.dat differ diff --git a/UnitOperations.py b/UnitOperations.py index 92d6f07..9591dc2 100644 --- a/UnitOperations.py +++ b/UnitOperations.py @@ -1,4 +1,5 @@ from OMChem.Flowsheet import Flowsheet +from OMChem.EngStm import EngStm from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtGui import QTextDocument ,QTextCursor ,QTextCharFormat ,QFont ,QPixmap @@ -9,12 +10,11 @@ from PyQt5.QtGui import QBrush ,QTransform ,QMouseEvent from PyQt5.QtGui import * import PyQt5.QtCore as QtCore import PyQt5.QtWidgets as QtWidgets -from component_selector import * -from container import * +from ComponentSelector import * +from Container import * class UnitOperation(): counter = 1 - def __init__(self): self.OM_data_eqn = '' self.OM_data_init = '' @@ -27,13 +27,12 @@ class UnitOperation(): self.type = '' self.no_of_inputs = 1 self.no_of_outputs = 1 - self.Prop = {} - self.x = 2500-30 + self.x = 2500-30 self.y = 2500-30 self.pos = QPointF(self.x, self.y) - #self.Prop = {} + self.count = UnitOperation.counter self.variables = {} - self.modeslist = [] + self.modesList = [] self.parameters = [] self.extra = [] self.ForNaming = [] @@ -43,13 +42,14 @@ class UnitOperation(): def paramgetter(self,mode=None): params = {} - if mode == None: - self.mode = self.modeslist[0] + if mode == None and self.modesList: + self.mode = self.modesList[0] else: self.mode = mode + params[self.mode] = None for i in self.parameters: params[i] = self.variables[i]['value'] - params[self.mode] = None + return params def paramsetter(self,params): @@ -60,11 +60,12 @@ class UnitOperation(): self.k = v self.variables[k]['value'] = v else: + self.variables[k]['value'] = v self.modeVal = params[self.mode] + print(self.variables) def add_connection(self,flag,UnitOpr): - if flag==1: - # Input stream if flag is 1 + if flag==1: # Input stream if flag is 1 print("INPUT CONNECTION") self.InputStms.append(UnitOpr) else : @@ -158,6 +159,275 @@ class UnitOperation(): return self.OM_data_eqn +class ShortcutColumn(UnitOperation): + def __init__(self, CompNames = [], name='ShortcutColumn'): + UnitOperation.__init__(self) + self.name = name + str(ShortcutColumn.counter) + self.type = 'ShortcutColumn' + self.no_of_inputs = 1 + self.no_of_outputs = 2 + self.InputStms = None + self.OutputStms = None + self.EngStm1 = EngStm(name='EngStm1'+self.name) + self.EngStm2 = EngStm(name='EngStm2'+self.name) + self.count = ShortcutColumn.counter + + self.parameters = ['HKey', 'LKey', 'HKey_x_pc', 'LKey_x_pc', 'Ctype', 'Pcond', 'Preb', 'RR'] + type(self).counter += 1 + + self.variables = { + 'HKey' : {'name':'Heavy Key', 'value':None, 'unit':''}, + 'LKey' : {'name':'Light Key', 'value':None, 'unit':''}, + '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':''}, + '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) + self.variables['HKey']['value'] = params[0] + self.variables['LKey']['value'] = params[1] + self.variables['HKey_x_pc']['value'] = params[2] + self.variables['LKey_x_pc']['value'] = params[3] + self.variables['Ctype']['value'] = params[4] + self.variables['Pcond']['value'] = params[5] + self.variables['Preb']['value'] = params[6] + self.variables['RR']['value'] = params[7] + + print(self.variables) + + +class DistillationColumn(UnitOperation): + def __init__(self,name='DistillationColumn'): + self.name = name + str(DistillationColumn.counter) + self.type = 'DistillationColumn' + self.no_of_inputs = 2 + self.no_of_outputs = 2 + + self.compounds = compound_selected + + self.EngStm1 = EngStm(name='EngStm1'+self.name) + 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.parameters = [''] + #self.parameters = ['Nt', 'InT_s', 'In_s', 'thermoPackage', '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)'] + + type(self).counter += 1 + self.variables = { + 'RR' : {'name':'Reflux Ratio', 'value':None, 'unit':''}, + 'T' : {'name':'Temperature', 'value':300, 'unit':'K'}, + 'Nout' : {'name':'No of Sidedraws', 'value':None, 'unit':''}, + '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':''}, + '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) + self.variables['Nt']['value'] = params[0] + self.variables['In_s']['value'] = params[1] + self.variables['InT_s']['value'] = params[2] + self.variables['Ctype']['value'] = params[3] + self.variables['Pcond']['value'] = params[4] + self.variables['C_Spec']['type'] = params[5] + if 'Compound' in self.variables['C_Spec']['type']: + self.variables['C_Spec']['comp'] = params[6] + self.variables['C_Spec']['value'] = params[7] + self.variables['Preb']['value'] = params[8] + self.variables['R_Spec']['type'] = params[9] + if 'Compound' in self.variables['R_Spec']['type']: + self.variables['R_Spec']['comp'] = params[10] + self.variables['R_Spec']['value'] = params[11] + print(self.variables) + +class ConvertionReactor(UnitOperation): + def __init__(self,name='',Nr=None,b=None,X=None,Z=None,a=[],operation=None,Tdef=None): + UnitOperation.__init__(self) + self.name = name + self.type = 'ConvertionReactor' + + self.Nr = str(Nr) + self.b = str(b) + self.X = str(X) + self.Z = str(Z) + self.a = json.dumps(a).replace('[','{').replace(']','}') + self.operation = str(operation) + self.Tdef = str(Tdef) + +class CompoundSeparator(UnitOperation): + def __init__(self, name='CompoundSeparator'): + UnitOperation.__init__(self) + self.name = name + str(CompoundSeparator.counter) + self.type = 'CompoundSeparator' + self.no_of_inputs = 1 + self.no_of_outputs = 2 + + self.SepFact_modes = ['Molar_Flow (mol/s)', 'Mass_Flow (kg/s)', 'Inlet_Molar_Flow_Percent', 'Outlet_Molar_Flow_Percent'] + + type(self).counter += 1 + self.variables = { + 'SepStrm' : {'name':'Separation Stream', 'value':1, 'unit':''}, + #'SepVal' : {'name':'Separation Value', 'value':[], 'unit':''}, + #'SepFact' : {'name':'Separaction Factor', 'value':'', 'unit':''}, + } + + for i in self.compounds: + self.variables[i] = {'name':'SepVal_'+i, 'value':'', 'type':'', 'unit':''} + + # 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) + if params[0]: + self.variables['SepStrm']['value'] = 1 + elif params[1]: + self.variables['SepStrm']['value'] = 2 + + j = 2 + for i in self.compounds: + self.variables[i]['type'] = params[j] + self.variables[i]['value'] = float(params[j+1]) + j += 2 + print(self.variables) + +class Flash(UnitOperation): + def __init__(self,name='Flash'): + UnitOperation.__init__(self) + self.name = name + str(Flash.counter) + self.type = 'Flash' + self.no_of_inputs = 1 + self.no_of_outputs = 2 + self.InputStms = None + self.OutputStms = None + self.count = Flash.counter + + type(self).counter += 1 + self.variables = { + 'thermoPackage' : {'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] + self.variables['BTdef']['value'] = params[1] + self.variables['Tdef']['value'] = params[2] + self.variables['BPdef']['value'] = params[3] + self.variables['Pdef']['value'] = params[4] + print(self.variables) + +class Pump(UnitOperation): + def __init__(self,name='Pump'): + 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.parameters = ['Eff'] + + type(self).counter += 1 + self.variables = { + 'Eff' : {'name':'Efficiency', 'value':1, 'unit':''}, + 'Pdel' : {'name':'Pressure Increase', 'value':None, 'unit':'Pa'}, + 'Pout' : {'name':'Outlet Pressure', 'value':None, 'unit':'Pa'}, + 'Q' : {'name':'Power Required', 'value':None, 'unit':'W'}, + } + +class Valve(UnitOperation): + def __init__(self,name='Valve'): + UnitOperation.__init__(self) + self.name = name + str(Valve.counter) + self.type = 'Valve' + self.InputStms = None + self.OutputStms = None + self.modesList = ['Pdel', 'Pout'] + + type(self).counter += 1 + self.variables = { + 'Pdel' : {'name':'Pressure Drop', 'value':None, 'unit':'Pa'}, + 'Pout' : {'name':'Outlet Pressure', 'value':None, 'unit':'Pa'} + } + +class Splitter(UnitOperation): + def __init__(self,name='Splitter'): + UnitOperation.__init__(self) + self.name = name + str(Splitter.counter) + self.type = 'Splitter' + self.no_of_outputs = 3 + + # self.InputStms = None + self.CalcType_modes = ['Split Ratios', 'Mole Flow Specs', 'Mass Flow Specs'] + + self.parameters = ['NOO', 'CalcType']#, 'SpecVal_s' + type(self).counter += 1 + + self.variables = { + 'NOO' : {'name':'No. of Output', 'value':3, 'unit':''}, + 'CalcType' : {'name':'Calculation Type', 'value':self.CalcType_modes[0], 'unit':''}, + 'SpecVal_s' : {'name':'Specification Value', 'value':[50,50], 'unit':''} + } + + specval = self.variables['SpecVal_s']['value'] # [50,50] + self.specval = json.dumps(specval).replace('[','{').replace(']','}') + + def paramsetter(self,params): + print("paramsetter ", 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])] + if self.variables['CalcType']['value'] == 'Mole Flow Specs': + self.variables['SpecVal_s']['unit'] = 'mol/s' + elif self.variables['CalcType']['value'] == 'Mass Flow Specs': + self.variables['SpecVal_s']['unit'] = 'kg/s' + print(self.variables) + +class Mixer(UnitOperation): + + def __init__(self,name='Mixer'): + UnitOperation.__init__(self) + self.name = name + str(Mixer.counter) + self.type = 'Mixer' + self.no_of_inputs = 6 + + self.Pout_modes = ['Inlet Minimum', 'Inlet Average', 'Inlet Maximum'] + self.parameters = ['NOI', 'Pout'] + # self.OutputStms = 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) + self.variables['NOI']['value'] = int(params[0]) + self.variables['Pout']['value'] = params[1] + print(self.variables) + + class Heater(UnitOperation): def __init__(self, name='Heater'): @@ -178,6 +448,7 @@ class Heater(UnitOperation): 'Tout' : {'name':'Outlet Temperature', 'value':298.15, 'unit':'K'}, 'Tdel' : {'name':'Temperature Increase', 'value':0, 'unit':'K'}, 'Q' : {'name':'Heat Added', 'value':0, 'unit':'W'}, + 'xvapout': {'name':'Outlet Vapour', 'value':None, 'unit':''} } class Cooler(UnitOperation): @@ -188,18 +459,19 @@ class Cooler(UnitOperation): self.type = 'Cooler' self.no_of_inputs = 1 self.no_of_outputs = 1 - self.modesList = ["Q","Tout","xvapout","Tdel"] + self.modesList = ['Q','Tout','Tdel','xvap'] self.extra = None self.ForNaming = None self.parameters = ['Pdel', 'Eff'] type(self).counter += 1 self.variables = { - 'Pdel' : {'name':'Pressure Drop', 'value':0, 'unit':'Pa'}, - 'Eff' : {'name':'Efficiency', 'value':1, 'unit':''}, - 'Tout' : {'name':'Outlet Temperature', 'value':298.15, 'unit':'K'}, - 'Tdel' : {'name':'Temperature Increase', 'value':0, 'unit':'K'}, - 'Q' : {'name':'Heat Added', 'value':0, 'unit':'W'}, + 'Pdel' : {'name':'Pressure Drop', 'value':0, 'unit':'Pa'}, + 'Eff' : {'name':'Efficiency', 'value':1, 'unit':''}, + 'Tout' : {'name':'Outlet Temperature', 'value':298.15, 'unit':'K'}, + 'Tdel' : {'name':'Temperature Increase', 'value':0, 'unit':'K'}, + 'Q' : {'name':'Heat Added', 'value':0, 'unit':'W'}, + 'xvap' : {'name':'Vapour Phase Mole Fraction', 'value':None, 'unit':'g/s'}, } class AdiabaticCompressor(UnitOperation): @@ -220,9 +492,10 @@ class AdiabaticCompressor(UnitOperation): self.variables = { 'Pdel' : {'name':'Pressure Drop', 'value':0, 'unit':'Pa'}, 'Tdel' : {'name':'Temperature Increase', 'value':0, 'unit':'K'}, - 'Pout' : {'name':'Outlet Pressure', 'value':101325, 'unit':'Pa'}, - 'Tout' : {'name':'Outlet Temperature', 'value':298.15, 'unit':'K'}, + 'Pout' : {'name':'Outlet Pressure', 'value':101325, 'unit':'Pa'}, + 'Tout' : {'name':'Outlet Temperature', 'value':298.15, 'unit':'K'}, 'Q' : {'name':'Heat Added', 'value':0, 'unit':'W'}, + 'Eff' : {'name':'Efficiency', 'value':1, 'unit':''} } class AdiabaticExpander(UnitOperation): @@ -246,6 +519,7 @@ class AdiabaticExpander(UnitOperation): 'Pout' : {'name':'Outlet Pressure', 'value':101325, 'unit':'Pa'}, 'Tout' : {'name':'Outlet Temperature', 'value':298.15, 'unit':'K'}, 'Q' : {'name':'Heat Added', 'value':0, 'unit':'W'}, + 'Eff' : {'name':'Efficiency', 'value':1, 'unit':''} } \ No newline at end of file diff --git a/comp_selector.ui b/comp_selector.ui deleted file mode 100644 index 09d8c78..0000000 --- a/comp_selector.ui +++ /dev/null @@ -1,139 +0,0 @@ - - - Dialog - - - - 0 - 0 - 461 - 289 - - - - Compound Selector - - - - - 10 - 20 - 441 - 256 - - - - - - - - Comic Sans MS - 12 - - - - Search For Compounds : - - - - - - - - - - - - - Comic Sans MS - - - - Select - - - true - - - - - - - - Comic Sans MS - - - - Remove - - - false - - - - - - - - - 110 - - - true - - - - CAS Number - - - - - Name - - - - - Molecular Formula - - - - - Molecular Weight - - - - - - - - - - - Comic Sans MS - - - - Submit - - - - - - - - Comic Sans MS - - - - Cancel - - - - - - - - - - - diff --git a/component_selector.py b/component_selector.py deleted file mode 100644 index 600b5f2..0000000 --- a/component_selector.py +++ /dev/null @@ -1,181 +0,0 @@ -from PyQt5.QtCore import * -from PyQt5.QtWidgets import * -from PyQt5.QtGui import * -from PyQt5.uic import loadUiType -import pandas as pd -from Simulator.Databases.Databases import ChemsepDatabase -ui_dialog,_ = loadUiType('comp_selector.ui') - - -#df = pd.read_csv("compoundsDatabase.csv") - -compound_selected = [] #list storing components that are selected inintialised as empty - -class componentSelector(QDialog,ui_dialog): - def __init__(self,parent=None): - #super(componentSelector,self).__init__(parent) - - QDialog.__init__(self,parent) - - self.setupUi(self) - - 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.lines+=x - print(self.lines) - - - #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.lines=self.DB1_list #combined list of all the edited compounds - - self.model = QStringListModel() - self.model.setStringList(self.lines) - - self.completer = QCompleter() - self.completer.setCaseSensitivity(Qt.CaseInsensitive) - self.completer.setModel(self.model) - #QCompleter completes the text written in lineedit - self.lineEdit.setCompleter(self.completer) - - self.compoundSelectButton.clicked.connect(self.compoundSelection) - self.compoundSelectButton.setAutoDefault(False) - self.pushButton.clicked.connect(self.accept) - self.pushButton_2.clicked.connect(self.cancel) - self.pushButton_3.clicked.connect(self.removeItems) - - - def final_list(self,*list_name): - self.list_final=[] - #add multiple lists - for i in list_name: - self.list_final+=i - return (self.list_final) - - def isCompSelected(self): - if not compound_selected: - return False - else: - return True - - #attrib: - #CAS fro CAS Number - #CompoundID for Name - #Smiles for Molecular Formula - #MolecularWeight for Molecular Weight - -#the below function will match the entered compound and get the database obj - #of the corresponding database - - def get_object(self,component): - for ele in self.Dict1: - values=self.Dict1[ele] - for ind in values: - if ind ==component: - return(ele) - - -#the below finction removes the before added extra string from the cmpounds - def get_original_name(self,component,removing_attrib): - self.temp_comp= component.replace(removing_attrib,'') - return(self.temp_comp) - - - - def compoundSelection(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 - #and thus store the instance of the class to which the component belongs - self.removing_attrib='(' + self.obj.name + ')' #getting the attribute that is to be removed - self.comp=self.get_original_name(self.comp,self.removing_attrib) - #getting only air, water etc from air chemsep etc - compound_selected.append(self.comp) #appending that in the list - - self.prop_list=self.obj.get_comp_prop(self.comp) #getting prop of the comp - #obj is the required class object - # self.creating_mo_file() - self.final_mo() - - self.lineEdit.clear() - 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') - - Dict={'CAS':self.CAS,'Name':self.Name,'Molecular Formula':self.MolecularFormula,'Molecular Weight':self.MolecularWeight} - #converted everything to a dictionary which will be passes to addtable - #function as a parameter. - print(Dict) - self.addToTable(Dict) - else: - self.Show_Error() - - @staticmethod - def setCompounds(compounds): - #compound_selected = compounds - for i in compounds: - compound_selected.append(i) - - def addToTable(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']))) - 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? - 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 Show_Error(self): - QMessageBox.about(self, 'Important', "Selected Compound is not Available") - - def cancel(self): - compound_selected.clear() - self.tableWidget.setRowCount(0) - self.reject() - - def getComp(self): - return compound_selected - - def final_mo(self): - self.f_mo=open('Simulator/database.mo','w+') - self.f_mo.write('package database\n') - for line in self.prop_list: - self.f_mo.write(line) - self.f_mo.write('\n') - self.f_mo.write('\nend database;') - self.f_mo.close() - - - - - - - - diff --git a/container.py b/container.py index 6b4bcbe..6f9b0cd 100644 --- a/container.py +++ b/container.py @@ -1,5 +1,5 @@ from OMChem.Flowsheet import Flowsheet -from component_selector import * +from ComponentSelector import * from collections import defaultdict from PyQt5.QtCore import * from PyQt5.QtWidgets import * @@ -69,11 +69,12 @@ class Container(): # def addUnitOpObj(obj): # self.unitOp.append(obj) - def addUnitOp(self,obj): + def addUnitOp(self,obj, graphicsView): box = None self.obj = obj self.scene = self.graphics.getScene() - box = self.graphics.createNodeItem(self.obj, self) + self.graphicsView = graphicsView + box = self.graphics.createNodeItem(self.obj, self, self.graphicsView) self.scene.addItem(box) box.setPos(2500-30, 2500-30) @@ -92,6 +93,14 @@ class Container(): def delete(self,l): for item in l: self.scene.removeItem(item) + for i in dockWidgetLst: + if i.name == item.name: + i.hide() + del i + break + for i in dockWidgetLst: + print(i.name) + print("delete ", dockWidgetLst) if hasattr(item,'Input'): for x in item.Input: if x.newLine: diff --git a/dockWidget.py b/dockWidget.py index 36fbc32..8eeff51 100644 --- a/dockWidget.py +++ b/dockWidget.py @@ -4,7 +4,7 @@ from PyQt5.QtGui import * from PyQt5.uic import loadUiType import pandas as pd from functools import partial -from component_selector import * +from ComponentSelector import * from collections import defaultdict from Graphics import * @@ -12,7 +12,7 @@ ui_dialog,_ = loadUiType('DockWidget.ui') class DockWidget(QDockWidget,ui_dialog): - def __init__(self,name,comptype,obj,container,parent=None): + def __init__(self,name,comptype,obj,container, parent=None): QDockWidget.__init__(self,parent) self.setupUi(self) self.setWindowTitle(obj.name) @@ -23,21 +23,23 @@ class DockWidget(QDockWidget,ui_dialog): 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(j)) + 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() @@ -46,13 +48,21 @@ class DockWidget(QDockWidget,ui_dialog): self.inputdict= {} for i in reversed(range(self.formLayout.count())): self.formLayout.removeRow(i) - self.inputdict = self.obj.paramgetter(self.comboBox.currentText()) + 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() @@ -60,20 +70,24 @@ class DockWidget(QDockWidget,ui_dialog): 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.AlignRight) + 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=="condType"): + 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(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"): @@ -90,42 +104,49 @@ class DockWidget(QDockWidget,ui_dialog): 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) + 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(i+":"),0,0, alignment=Qt.AlignLeft) + 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) + 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=="condType"): + elif(i=="Ctype"): if (self.inputdict[i].currentText()): self.dict[i] = self.inputdict[i].currentText() else: @@ -145,10 +166,11 @@ class DockWidget(QDockWidget,ui_dialog): for c in range(len(compound_selected)): mf.append(str(float(l[c])/total_moles)) self.x_pclist[c].setText(mf[-1]) - # self.formLayout.addRow(QLabel(str(compound_selected[c])+" Mole Fraction: "+str(float(l[c])/total_moles))) self.dict[i] = ",".join(mf) - # self.update() + 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: @@ -163,7 +185,6 @@ class DockWidget(QDockWidget,ui_dialog): except Exception as e: print(e) - @staticmethod def showResult(lst): #DockWidget1.flag = True @@ -196,7 +217,4 @@ class DockWidget(QDockWidget,ui_dialog): self.tableWidget.resizeColumnsToContents() except Exception as e: - print(e) - - - \ No newline at end of file + print(e) \ No newline at end of file diff --git a/dockWidget.ui b/dockWidget.ui index 11855cb..5851d71 100644 --- a/dockWidget.ui +++ b/dockWidget.ui @@ -28,6 +28,9 @@ Form + + false + @@ -38,7 +41,7 @@ - true + false 0 diff --git a/icon/AdiabaticCompressor.png b/icon/AdiabaticCompressor.png new file mode 100644 index 0000000..08a874c Binary files /dev/null and b/icon/AdiabaticCompressor.png differ diff --git a/icon/AdiabaticExpander.png b/icon/AdiabaticExpander.png new file mode 100644 index 0000000..aaec6dc Binary files /dev/null and b/icon/AdiabaticExpander.png differ diff --git a/icon/CompoundSeparator.png b/icon/CompoundSeparator.png new file mode 100644 index 0000000..6fd2d0c Binary files /dev/null and b/icon/CompoundSeparator.png differ diff --git a/icon/Cooler.png b/icon/Cooler.png new file mode 100644 index 0000000..08519ea Binary files /dev/null and b/icon/Cooler.png differ diff --git a/icon/DistillationColumn.png b/icon/DistillationColumn.png new file mode 100644 index 0000000..32a06b3 Binary files /dev/null and b/icon/DistillationColumn.png differ diff --git a/icon/Equation.png b/icon/Equation.png new file mode 100644 index 0000000..687be3c Binary files /dev/null and b/icon/Equation.png differ diff --git a/icon/Flash.png b/icon/Flash.png new file mode 100644 index 0000000..4c38d8d Binary files /dev/null and b/icon/Flash.png differ diff --git a/icon/Heater.png b/icon/Heater.png new file mode 100644 index 0000000..18b891a Binary files /dev/null and b/icon/Heater.png differ diff --git a/icon/MaterialStream.png b/icon/MaterialStream.png new file mode 100644 index 0000000..ac543e4 Binary files /dev/null and b/icon/MaterialStream.png differ diff --git a/icon/Mixer.png b/icon/Mixer.png new file mode 100644 index 0000000..ee4b507 Binary files /dev/null and b/icon/Mixer.png differ diff --git a/icon/Pump.png b/icon/Pump.png new file mode 100644 index 0000000..daf804b Binary files /dev/null and b/icon/Pump.png differ diff --git a/icon/Sequential.png b/icon/Sequential.png new file mode 100644 index 0000000..3b08856 Binary files /dev/null and b/icon/Sequential.png differ diff --git a/icon/ShortcutColumn.png b/icon/ShortcutColumn.png new file mode 100644 index 0000000..32a06b3 Binary files /dev/null and b/icon/ShortcutColumn.png differ diff --git a/icon/Splitter.png b/icon/Splitter.png new file mode 100644 index 0000000..28f6d52 Binary files /dev/null and b/icon/Splitter.png differ diff --git a/icon/Valve.png b/icon/Valve.png new file mode 100644 index 0000000..63bd362 Binary files /dev/null and b/icon/Valve.png differ diff --git a/icon/compoundSelector.png b/icon/compoundSelector.png new file mode 100644 index 0000000..cc878eb Binary files /dev/null and b/icon/compoundSelector.png differ diff --git a/icon/icon_1.svg b/icon/icon_1.svg new file mode 100644 index 0000000..1da1384 --- /dev/null +++ b/icon/icon_1.svg @@ -0,0 +1,732 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + H + + + + + + + + + + + + + + + + + + + + + C + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SQ + + + + EQ + + + + + PW + + + + + + + + + + diff --git a/icon/logo.png b/icon/logo.png new file mode 100644 index 0000000..541e99e Binary files /dev/null and b/icon/logo.png differ diff --git a/icon/new.svg b/icon/new.svg new file mode 100644 index 0000000..bd566f3 --- /dev/null +++ b/icon/new.svg @@ -0,0 +1,83 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/icon/package-icon.svg b/icon/package-icon.svg new file mode 100644 index 0000000..43382a3 --- /dev/null +++ b/icon/package-icon.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + P + + diff --git a/icon/plus.png b/icon/plus.png new file mode 100644 index 0000000..08a6564 Binary files /dev/null and b/icon/plus.png differ diff --git a/icon/zoomIn.png b/icon/zoomIn.png new file mode 100644 index 0000000..b10c61a Binary files /dev/null and b/icon/zoomIn.png differ diff --git a/icon/zoomOut.png b/icon/zoomOut.png new file mode 100644 index 0000000..6c60a02 Binary files /dev/null and b/icon/zoomOut.png differ diff --git a/icon/zoomReset.png b/icon/zoomReset.png new file mode 100644 index 0000000..62fc917 Binary files /dev/null and b/icon/zoomReset.png differ diff --git a/icons/AdiabaticCompressor.png b/icons/AdiabaticCompressor.png index 08a874c..1fd7bb0 100644 Binary files a/icons/AdiabaticCompressor.png and b/icons/AdiabaticCompressor.png differ diff --git a/icons/AdiabaticExpander.png b/icons/AdiabaticExpander.png index aaec6dc..615a638 100644 Binary files a/icons/AdiabaticExpander.png and b/icons/AdiabaticExpander.png differ diff --git a/icons/Column.png b/icons/Column.png new file mode 100644 index 0000000..84c0bcc Binary files /dev/null and b/icons/Column.png differ diff --git a/icons/CompSep.png b/icons/CompSep.png deleted file mode 100644 index 6fd2d0c..0000000 Binary files a/icons/CompSep.png and /dev/null differ diff --git a/icons/CompoundSeparator.png b/icons/CompoundSeparator.png new file mode 100644 index 0000000..3435dcf Binary files /dev/null and b/icons/CompoundSeparator.png differ diff --git a/icons/Cooler.png b/icons/Cooler.png index 08519ea..4dcb802 100644 Binary files a/icons/Cooler.png and b/icons/Cooler.png differ diff --git a/icons/DistCol.png b/icons/DistCol.png deleted file mode 100644 index 32a06b3..0000000 Binary files a/icons/DistCol.png and /dev/null differ diff --git a/icons/DistillationColumn.png b/icons/DistillationColumn.png new file mode 100644 index 0000000..f65150b Binary files /dev/null and b/icons/DistillationColumn.png differ diff --git a/icons/Equation.png b/icons/Equation.png deleted file mode 100644 index 687be3c..0000000 Binary files a/icons/Equation.png and /dev/null differ diff --git a/icons/Flash.png b/icons/Flash.png index 4c38d8d..9a84def 100644 Binary files a/icons/Flash.png and b/icons/Flash.png differ diff --git a/icons/Heater.png b/icons/Heater.png index 18b891a..52b8c00 100644 Binary files a/icons/Heater.png and b/icons/Heater.png differ diff --git a/icons/MaterialStream.png b/icons/MaterialStream.png index ac543e4..b548d3f 100644 Binary files a/icons/MaterialStream.png and b/icons/MaterialStream.png differ diff --git a/icons/Mixer.png b/icons/Mixer.png index ee4b507..6656945 100644 Binary files a/icons/Mixer.png and b/icons/Mixer.png differ diff --git a/icons/Pump.png b/icons/Pump.png index daf804b..a2d3e8e 100644 Binary files a/icons/Pump.png and b/icons/Pump.png differ diff --git a/icons/Sequential.png b/icons/Sequential.png deleted file mode 100644 index 3b08856..0000000 Binary files a/icons/Sequential.png and /dev/null differ diff --git a/icons/ShortCol.png b/icons/ShortCol.png deleted file mode 100644 index 32a06b3..0000000 Binary files a/icons/ShortCol.png and /dev/null differ diff --git a/icons/ShortcutColumn.png b/icons/ShortcutColumn.png new file mode 100644 index 0000000..f65150b Binary files /dev/null and b/icons/ShortcutColumn.png differ diff --git a/icons/Splitter.png b/icons/Splitter.png index 28f6d52..778bcda 100644 Binary files a/icons/Splitter.png and b/icons/Splitter.png differ diff --git a/icons/Valve.png b/icons/Valve.png index 63bd362..3cfd5c4 100644 Binary files a/icons/Valve.png and b/icons/Valve.png differ diff --git a/icons/compound.png b/icons/compound.png new file mode 100644 index 0000000..a9c946d Binary files /dev/null and b/icons/compound.png differ diff --git a/icons/compoundSelector.png b/icons/compoundSelector.png deleted file mode 100644 index cc878eb..0000000 Binary files a/icons/compoundSelector.png and /dev/null differ diff --git a/icons/eq.png b/icons/eq.png new file mode 100644 index 0000000..cb0485a Binary files /dev/null and b/icons/eq.png differ diff --git a/icons/icon_1.svg b/icons/icon_1.svg new file mode 100644 index 0000000..7f6acd7 --- /dev/null +++ b/icons/icon_1.svg @@ -0,0 +1,868 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + H + + + + + + + + + + + + + + + + + + + + + C + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SQ + + + + EQ + + + + + PW + + + + + + + + + + diff --git a/icons/images.png b/icons/images.png new file mode 100644 index 0000000..559fdbb Binary files /dev/null and b/icons/images.png differ diff --git a/icons/logo.png b/icons/logo.png index 541e99e..60d94d8 100644 Binary files a/icons/logo.png and b/icons/logo.png differ diff --git a/icons/new.png b/icons/new.png new file mode 100644 index 0000000..f4343a7 Binary files /dev/null and b/icons/new.png differ diff --git a/icons/new.svg b/icons/new.svg deleted file mode 100644 index bd566f3..0000000 --- a/icons/new.svg +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - diff --git a/icons/package-icon.svg b/icons/package-icon.svg deleted file mode 100644 index 43382a3..0000000 --- a/icons/package-icon.svg +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - P - - diff --git a/icons/plus.png b/icons/plus.png deleted file mode 100644 index 08a6564..0000000 Binary files a/icons/plus.png and /dev/null differ diff --git a/icons/sq.png b/icons/sq.png new file mode 100644 index 0000000..b963402 Binary files /dev/null and b/icons/sq.png differ diff --git a/icons/zoo.png b/icons/zoo.png new file mode 100644 index 0000000..1de4314 Binary files /dev/null and b/icons/zoo.png differ diff --git a/icons/zoomIn.png b/icons/zoomIn.png deleted file mode 100644 index b10c61a..0000000 Binary files a/icons/zoomIn.png and /dev/null differ diff --git a/icons/zoomOut.png b/icons/zoomOut.png deleted file mode 100644 index 6c60a02..0000000 Binary files a/icons/zoomOut.png and /dev/null differ diff --git a/icons/zoomReset.png b/icons/zoomReset.png deleted file mode 100644 index 62fc917..0000000 Binary files a/icons/zoomReset.png and /dev/null differ diff --git a/icons/zoom_in.png b/icons/zoom_in.png new file mode 100644 index 0000000..cdf3e3f Binary files /dev/null and b/icons/zoom_in.png differ diff --git a/icons/zoom_out.png b/icons/zoom_out.png new file mode 100644 index 0000000..b6dbcc9 Binary files /dev/null and b/icons/zoom_out.png differ diff --git a/icons/zoom_reset.png b/icons/zoom_reset.png new file mode 100644 index 0000000..ca9d36f Binary files /dev/null and b/icons/zoom_reset.png differ diff --git a/main.ui b/main.ui index fd7045a..7974d9d 100644 --- a/main.ui +++ b/main.ui @@ -266,7 +266,7 @@ 0 - 0 + -246 221 956 @@ -734,11 +734,11 @@ Text-align:left - Component Seperator + Compound Seperator - icons/CompSep.pngicons/CompSep.png + icons/CompoundSeparator.pngicons/CompoundSeparator.png @@ -1037,7 +1037,7 @@ - icons/DistCol.pngicons/DistCol.png + icons/DistillationColumn.pngicons/DistillationColumn.png @@ -1081,7 +1081,7 @@ - icons/ShortCol.pngicons/ShortCol.png + icons/ShortcutColumn.pngicons/ShortcutColumn.png diff --git a/main2.ui b/main2.ui new file mode 100644 index 0000000..49b29e6 --- /dev/null +++ b/main2.ui @@ -0,0 +1,415 @@ + + + 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 + 1068 + 21 + + + + + File + + + + + + + + Edit + + + + + + + View + + + + + + + + Simulation + + + + + + + + + Compounds + + + + + + Help + + + + + + Utility + + + + + + + + + + + + + + + 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 new file mode 100644 index 0000000..9d30a8e --- /dev/null +++ b/main3.ui @@ -0,0 +1,2112 @@ + + + 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 + 1068 + 21 + + + + + File + + + + + + + + Edit + + + + + + + View + + + + + + + + Simulation + + + + + + + + + Compounds + + + + + + Help + + + + + + Utility + + + + + + + + + + + + + + + 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 7529845..240becb 100644 --- a/mainApp.py +++ b/mainApp.py @@ -14,12 +14,12 @@ from PyQt5.QtGui import QBrush ,QTransform ,QMouseEvent import PyQt5.QtGui as QtGui import PyQt5.QtCore as QtCore import PyQt5.QtWidgets as QtWidgets -from component_selector import * +from ComponentSelector import * from Bin_Phase_env import * from UnitOperations import * from Streams import * import datetime -from container import * +from Container import * from Graphics import * import pickle import threading @@ -27,7 +27,7 @@ import os import ctypes import sys -ui,_ = loadUiType('main.ui') +ui,_ = loadUiType('main3.ui') ''' MainApp class is responsible for all the main App Ui operations @@ -50,11 +50,11 @@ class MainApp(QMainWindow,ui): self.thrd = None # Creating instances of classes for the main app - self.Container = Container(self.textBrowser) - self.comp = componentSelector(self) + self.container = Container.Container(self.textBrowser) + self.comp = ComponentSelector(self) # Setting up interactive canvas - self.scene = self.Container.graphics.getScene() + self.scene = self.container.graphics.getScene() ### self.graphicsView.setScene(self.scene) self.graphicsView.setMouseTracking(True) self.graphicsView.keyPressEvent=self.deleteCall @@ -64,8 +64,6 @@ class MainApp(QMainWindow,ui): self.setCorner(Qt.BottomLeftCorner, Qt.LeftDockWidgetArea) self.addDockWidget(Qt.BottomDockWidgetArea,self.dockWidget_2) - # Setting up undo stack - # self.undoStack = QUndoStack(self) # Calling initialisation functions self.buttonHandler() self.menuBar() @@ -78,18 +76,18 @@ class MainApp(QMainWindow,ui): def menuBar(self): self.actionSelect_compounds.triggered.connect(self.selectCompounds) self.actionSelect_compounds.setShortcut('Ctrl+C') - self.actionZoomIn.triggered.connect(self.zoomin) + self.actionZoomIn.triggered.connect(self.zoomIn) self.actionZoomIn.setShortcut('Ctrl++') - self.actionNew_Flowsheet.triggered.connect(self.new) - self.actionNew_Flowsheet.setShortcut('Ctrl+N') - self.actionZoomOut.triggered.connect(self.zoomout) + self.actionNew.triggered.connect(self.new) + self.actionNew.setShortcut('Ctrl+N') + self.actionZoomOut.triggered.connect(self.zoomOut) self.actionZoomOut.setShortcut('Ctrl+-') self.actionResetZoom.triggered.connect(self.zoomReset) 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.actionSequential_mode.setShortcut('Ctrl+M') self.actionEquation_oriented.triggered.connect(partial(self.simulate,'EQN')) self.actionEquation_oriented.setShortcut('Ctrl+E') self.actionUndo.triggered.connect(self.undo) @@ -113,14 +111,14 @@ class MainApp(QMainWindow,ui): 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')) - self.pushButton_26.clicked.connect(partial(self.component,'DistCol')) - self.pushButton_18.clicked.connect(partial(self.component,'ShortCol')) + self.pushButton_26.clicked.connect(partial(self.component,'DistillationColumn')) + self.pushButton_18.clicked.connect(partial(self.component,'ShortcutColumn')) self.pushButton_11.clicked.connect(partial(self.component,'Heater')) self.pushButton_10.clicked.connect(partial(self.component,'Splitter')) self.pushButton_9.clicked.connect(partial(self.component,'Flash')) self.pushButton_25.clicked.connect(partial(self.component,'Valve')) self.pushButton_12.clicked.connect(partial(self.component,'Cooler')) - self.pushButton_13.clicked.connect(partial(self.component,'CompSep')) + self.pushButton_13.clicked.connect(partial(self.component,'CompoundSeparator')) self.pushButton_15.clicked.connect(partial(self.component,'AdiabaticCompressor')) self.pushButton_16.clicked.connect(partial(self.component,'AdiabaticExpander')) @@ -166,16 +164,16 @@ class MainApp(QMainWindow,ui): selected by the user. ''' def simulate(self,mode): - self.thrd = threading.Thread(target=self.Container.simulate, args=(mode,)) + self.thrd = threading.Thread(target=self.container.simulate, args=(mode,)) self.thrd.start() def terminate(self): - os.chdir(self.Container.flowsheet.root_dir) + os.chdir(self.container.flowsheet.root_dir) if self.thrd: thread_id = self.thrd.ident print('____________________Going to terminate simulation thread with Thread ID:',thread_id,'____________________') print('____________________Going to terminate the new process created for omc____________________') - self.Container.flowsheet.process.terminate() + 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 ") @@ -198,14 +196,14 @@ class MainApp(QMainWindow,ui): ''' ZoomOut the canvas ''' - def zoomout(self): + def zoomOut(self): self.graphicsView.scale(1.0/1.15,1.0/1.15) self.zoomcount -=1 ''' ZoomIn the canvas ''' - def zoomin(self): + def zoomIn(self): self.graphicsView.scale(1.15,1.15) self.zoomcount +=1 @@ -217,10 +215,10 @@ class MainApp(QMainWindow,ui): if(self.comp.isCompSelected()): self.type = unitOpType if(self.type=="MaterialStream"): - self.obj = MaterialStream(CompNames=compound_selected) + self.obj = MaterialStream(CompNames=compound_selected) else: self.obj = eval(self.type)() - self.Container.addUnitOp(self.obj) + self.container.addUnitOp(self.obj, self.graphicsView) else: QMessageBox.about(self, 'Important', "Please Select Compounds first") @@ -233,21 +231,7 @@ class MainApp(QMainWindow,ui): self.undo_redo_helper() self.comp.tableWidget.setRowCount(0) self.textBrowser.append("[" + str(self.currentTime()) + "] New flowsheet is created ... ") - - ''' - It helps by clearing screen and loading the objects by undo redo methods - ''' - def undo_redo_helper(self): - for i in self.Container.unitOp: - type(i).counter = 1 - del self.Container - lst.clear() - self.Container = Container(self.textBrowser) - compound_selected.clear() - self.scene = self.Container.graphics.getScene() - self.graphicsView.setScene(self.scene) - self.graphicsView.setMouseTracking(True) - self.graphicsView.keyPressEvent=self.deleteCall + dockWidgetLst.clear() ''' Handels all the operations which will happen when delete button is pressed. @@ -258,10 +242,30 @@ class MainApp(QMainWindow,ui): l=self.scene.selectedItems() for i in l: eval(i.type).counter -= 1 - self.Container.delete(l) + self.container.delete(l) except Exception as e: print(e) + ''' + It helps by clearing screen and loading the objects by undo redo methods + ''' + def undo_redo_helper(self): + for i in self.container.unitOp: + type(i).counter = 1 + del self.container + for i in dockWidgetLst: + i.hide() + del i + lst.clear() + self.container = Container.Container(self.textBrowser) + compound_selected.clear() + self.scene = self.container.graphics.getScene() + self.graphicsView.setScene(self.scene) + self.graphicsView.setMouseTracking(True) + self.graphicsView.keyPressEvent=self.deleteCall + + + ''' Function for undo ''' @@ -273,7 +277,7 @@ class MainApp(QMainWindow,ui): messages = self.textBrowser.toPlainText() try: self.undo_redo_helper() - self.Container.graphics.loadCanvas(undo_data) + self.container.graphics.loadCanvas(undo_data) self.textBrowser.setText(messages) except Exception as e: print(e) @@ -292,7 +296,7 @@ class MainApp(QMainWindow,ui): PUSH('Undo', redo_data) messages = self.textBrowser.toPlainText() self.undo_redo_helper() - self.Container.graphics.loadCanvas(redo_data) + self.container.graphics.loadCanvas(redo_data) self.textBrowser.setText(messages) else: messages = self.textBrowser.toPlainText() @@ -304,7 +308,7 @@ class MainApp(QMainWindow,ui): ''' def save(self): data = [] - for i in self.Container.unitOp: + for i in self.container.unitOp: data.append(i) print(i.pos) data.append(compound_selected) @@ -338,7 +342,7 @@ class MainApp(QMainWindow,ui): with open(fileName, 'rb') as f: obj = pickle.load(f) - self.Container.graphics.loadCanvas(obj) + self.container.graphics.loadCanvas(obj) except Exception as e: pass diff --git a/umlet.uxf b/umlet.uxf new file mode 100644 index 0000000..ed90e4f --- /dev/null +++ b/umlet.uxf @@ -0,0 +1,1448 @@ + + + 11 + + UMLClass + + 341 + 759 + 286 + 462 + + MainApp +-- ++ zoomcount: int = 0 ++ thrd: Thread = None ++ container: Container() ++ comp: ComponentSelector() ++ scene: Graphics.QGraphicsScene() +-- ++ menuBar() ++ buttonHandler() ++ help() ++ BinPhaseEnv() ++ selectCompounds() ++ currentTime() ++ simulate(mode) ++ terminate() ++ zoomReset() ++ zoomOut() ++ zoomIn() ++ component() ++ new() ++ deleteCall() ++ undo_redo_helper() ++ undo() ++ redo() ++ save() ++ open() + + + + + + UMLClass + + 363 + 484 + 242 + 187 + + QMainWindow +-- +graphicsView.keyPressEvent +textBrowser: UC1 +-- +setUpUi() +graphicsView.setScene() +graphicsView.setMouseTracking() +setDockNestingEnabled() +setCorner() +addDockWidget() + + + + Relation + + 473 + 660 + 33 + 121 + + lt=<<<- + 10.0;10.0;10.0;90.0 + + + UMLClass + + 385 + 330 + 187 + 66 + + UC1 (textBrowserClass) +-- +setText() + + + + Relation + + 462 + 385 + 33 + 121 + + lt=<<. + 10.0;10.0;10.0;90.0 + + + UMLClass + + 715 + 352 + 352 + 363 + + ComponentSelector +-- ++ Dict1: dictionary = dict() ++ instance: list = [ChemsepDatabase()] ++ lines: list = [] ++ model: QStringListModel() ++ completer: QCompleter() +-- ++ final_list(*list_name) ++ isCompSelected() ++ get_object(component) ++ get_original_name(component, removing_attrib) ++ compoundSelection() +_+ setCompounds(compounds)_ ++ addToTable(a) ++ addCompToList(comp) ++ removeItems() ++ Show_Error() ++ cancel() ++ getComp() ++ final_mo() + + + + + + + + + + UMLClass + + 737 + 748 + 253 + 462 + + Container +-- ++ unitOp: list = [] ++ termoPackage = None ++ compounds = None ++ conn: dictionary = defaultdict(list) ++ op: dictionary = defaultdict(list) ++ ip: dictionary = defaultdict(list) ++ msg ++ opl: list = [] ++ result: list = [] ++ graphics: Graphics(unitOp) ++ scene : graphics.getScene() +-- ++ currentTime() ++ addUnitOp(obj, graphicsView) ++ delete(l) ++ fetchObject(name) ++ addCompounds(comp) ++ add_thermoPackage(thermo) ++ msgBrowser() ++ simulate(mode) ++ flatlist(lst) ++ PUSH(fileName, data) ++ CLEAN_FILE(fileName) ++ POP(fileName) ++ get_last_list(fileName) + + + + + UMLClass + + 1078 + 836 + 374 + 187 + + Graphics +-- ++ scene: QGraphicsScene() ++ pos: QPointF = None ++ unitOp: list = unitOp +-- ++ getScene() ++ getComponentSelector() ++ createNodeItem(unitOpr, container, graphicsView) ++ boundingRect() ++ loadCanvas(obj) + + + + + UMLClass + + 1144 + 528 + 231 + 165 + + QDialog +-- +lineEdit: UC2 +compoundSelectButton: UC3 +pushButton: UC4 +pushButton_2: UC4 +pshButton_3: UC4 +-- +setupUi() +show() + + + + UMLClass + + 1144 + 220 + 231 + 55 + + QStringListModel +-- +setStringList() + + + + UMLClass + + 1430 + 517 + 231 + 77 + + UC3 (selectButtonClass) +-- +clicked.connect() +setAutoDefault() + + + + + UMLClass + + 1144 + 297 + 231 + 77 + + QCompleter +-- +setCaseSensitivity() +setModel() + + + + UMLClass + + 1144 + 407 + 231 + 55 + + UC2 (lineEditClass) +-- +setCompleter() + + + + UMLClass + + 1430 + 616 + 231 + 55 + + UC4 (pushButtonClass) +-- +clicked.connect() + + + + UMLClass + + 1045 + 1089 + 440 + 583 + + NodeItem +-- ++ obj: UnitOperation = unitOpr ++ container: Container = container ++ graphicsView: QGraphicsView = graphicsView ++ name: string = obj.name ++ type: string = obj.type ++ default_tooltip: string ++ default_tooltip_dict: dictionary ++ nin: int = obj.no_of_inputs ++ nop: int = obj.no_of_outputs ++ text: string = user_input ++ ok: boolean = user_input ++ dockWidget: DockWidget() or DockWidgetMaterialStream() + or DockWidgetMixer() or DockWidgetSplitter() + or DockWidgetFlash() or DockWidgetCompoundSeparator() + or DockWidgetDistillationColumn() + or DockWidgetShortcutColumn() ++ mainwindow = findMainWindow() ++ pic: QPixmap() ++ rect: QRect() ++ text: QGraphicsTextItem() ++ f: QFont() ++ brush: QBrush() ++ pen: QPen() ++ selPen: QPen() ++ Input:list = [NodeSocket(type)] ++ Output:list = [NodeSocket(type)] +-- +shape() +boundingRect() +paint() +mouseMoveEvent(event) +mouseDoubleClickEvent(event) ++ initializeSockets(type) + + + + + UMLClass + + 1012 + 1705 + 187 + 77 + + QtWidgets.QGraphicsItem +-- +setTooltip(default_tooltip) +setFlag + + + + + + UMLClass + + 1331 + 1782 + 231 + 55 + + QtWidgets.QInputDialog +-- +getText() + + + + + + UMLClass + + 1254 + 1870 + 231 + 55 + + QtGui.QFont +-- +setPointSize() + + + + + + UMLClass + + 1012 + 1826 + 231 + 121 + + QtWidgets.QGraphicTextItem +-- +setFont() +setDefaultTextColor() +setParentItem() +setPos() +setPlainText() + + + + + + UMLClass + + 759 + 1265 + 176 + 66 + + QtGui.QBrush +-- +setStyle() +setColor() + + + + + + UMLClass + + 462 + 1265 + 231 + 88 + + QtGui.QPen +-- +setStyle() +setColor() +setWidth() + + + + + + UMLClass + + 737 + 1419 + 231 + 363 + + NodeSocket +-- ++ rect: QRect = rect ++ type: string = socketType ++ parent: NodeItem = parent ++ newLine: NodeLine = None ++ otherLine: NodeLine = None ++ brush: QBrush() ++ pen: QPen() ++ outLines: list = [] ++ inLines: list = [] +-- +shape() +boundingRect() +paint() +mousePressEvent(event) +mouseMoveEvent(event) +mouseReleaseEvent(event) +hoverEnterEvent(event) +hoverLeaveEvent(event) ++ getCenter() + + + + + UMLClass + + 385 + 1419 + 231 + 418 + + NodeLine +-- ++ _pointA: QPointF = pointA ++ _pointB: QPointF = pointB ++ _source: QPointF = None ++ _targer: QPointF = None ++ socket: string = socket ++ pen: QPen() +-- +updatePath() +paint() +__delete__(instance) ++ pointA() ++ pointA(point) ++ pointB() ++ pointB(poing) ++ source() ++ target() + + + + + UMLClass + + 220 + 1265 + 231 + 88 + + QtWigets.QGraphicsPathItem +-- +setZValue() +setBrush() +setPen() + + + + + UMLClass + + 2101 + 396 + 264 + 330 + + DockWidgetMaterialStream +-- ++ name: string = name ++ obj: UnitOperations = obj ++ type: string = comptype ++ inputdict: dictionary = {} ++ dict: dictionary = {} ++ x_pclist: list = [] ++ nameType: string = None ++ container: Container = container ++ header: QTreeWidgetItem() +-- ++ modes() ++ modeSelection() ++ inputparamslist() ++ param() ++ resultsCategory(name) ++ _showResult(lst)_ ++ Show_Error() + + + + UMLClass + + 1430 + 704 + 231 + 55 + + UC5 (comboBoxClass) +-- +currentIndexChanged.connect() + + + + UMLClass + + 1716 + 616 + 264 + 308 + + DockWidget +-- ++ name: string = name ++ obj: UnitOperations = obj ++ type: string = comptype ++ inputdict: dictionary = {} ++ dict: dictionary = {} ++ x_pclist: list = [] ++ nameType: string = None ++ container: Container = container +-- ++ modes() ++ modeSelection() ++ inputparamslist() ++ param() ++ resultsCategory(name) +_+ showResult(lst)_ ++ Show_Error() + + + + UMLClass + + 1760 + 385 + 231 + 176 + + QDockWidget +-- +pushButton_2: UC4 +comboBox: UC5 + +btn:UC4 +-- +setupUi() +setWindowTitle() +hide() + + + + UMLClass + + 2101 + 1232 + 264 + 275 + + DockWidgetShortcutColumn +-- ++ name: string = name ++ obj: UnitOperations = obj ++ type: string = comptype ++ inputdict: list = [] ++ dict: list = [] ++ nameType: string = None ++ container: Container = container +-- ++ inputparamslist() ++ fun() ++ param() ++ Show_Error() +_+ showResult(lst)_ ++ resultCategory(name) + + + + UMLClass + + 2101 + 1012 + 264 + 198 + + DockWidgetMixer +DockWidgetCompoundSeparator +-- ++ name: string = name ++ obj: UnitOperations = obj ++ type: string = comptype ++ inputdict: list = [] ++ dict: list = [] +-- ++ inputparamslist() ++ param() ++ Show_Error() + + + + UMLClass + + 2101 + 770 + 264 + 220 + + DockWidgetSplitter +DockWidgetFlash +-- ++ name: string = name ++ obj: UnitOperations = obj ++ type: string = comptype ++ inputdict: list = [] ++ dict: list = [] +-- ++ inputparamslist() ++ fun() ++ param() ++ Show_Error() + + + + UMLClass + + 1606 + 957 + 451 + 473 + + Flowsheet +-- ++ sim_name: string = 'Simulator' ++ sim_method: string = '' ++ UnitOpn: list = [] ++ data: list = [] ++ compounds: list = [] ++ interface: string = '' ++ omc_path: string = None ++ omc_path: string = cwd() ++ sim_dir_path: string = join(curr_path, sim_name) ++ Flomo_path: string = join(ssim_dir_path, 'Flowsheet.mo') ++ eqn_mos_path: string = join(sim_dir_path, 'simlateEQN.mos') ++ sm_mos_path: string = join(sim_dir_path, 'simulateSM.mos') ++ resdata: list = [] ++ stdout = None ++ stderr = None +-- ++ get_omc_path() ++ add_UnitOpn() ++ remove_UnitOpn() ++ add_comp_list() ++ send_for_simulationEqn() ++ send_for_simulationSM() ++ ExtData() ++ simulateEQN() ++ simulateSM() + + + + UMLClass + + 1650 + 1694 + 297 + 517 + + MaterialStream +-- +_+ counter: int = 1_ ++ name: string = 'MaterialStream' + counter ++ type: string = 'MaterialStream' ++ CompNames: string = CompNames ++ count: int = counter ++ thermoPackage: string = 'RaoultsLaw' ++ mode1: string = 'P' ++ mode2: string = 'T' ++ mode1val: string = '' ++ mode2Val: string = '' ++ OM_data_init: string = '' ++ OM_data_eqn: string = '' ++ no_of_inputs: int = 1 ++ no_of_outputs: int = 2 ++ x: int = 2500-30 ++ y: int = 2500-30 ++ startDict: dictionary = {} ++ eqnDict: dictionary = {} ++ modesList: list = ['PT',...] ++ variables: dictionary = {'P':{..},...} +-- ++ paramgetter(mode) ++ paramsetter(params) ++ setPos(pos) ++ GetMinEqnValues() ++ GetStartValues() ++ OM_Flowsheet_Initialize() ++ OM_Flowsheet_Equation() + + + + UMLClass + + 2068 + 1694 + 297 + 572 + + UnitOperations +-- +_+ counter: int = 1_ ++ OM_data_eqn: string = '' ++ OM_data_init: string = '' ++ InputStms: list = [] ++ OutputStms: list = [] ++ compounds: list = compound_selected ++ name: string = '' ++ mode: string = None ++ modeVal: string = None ++ type: string = None ++ no_of_inputs: int = 1 ++ no_of_outputs: int = 1 ++ x: int = 2500-30 ++ y: int = 2500-30 ++ pos: QPointF(x, y) ++ count: int = counter ++ variables: dictionary = {} ++ modesList: list = [] ++ parameters: list = [] ++ extra: list = [] ++ ForNaming: list = [] ++ multidict: list = [] ++ ThermoPackReq: boolean = False ++ thermoPackage: list = None +-- ++ paramgetter(mode) ++ paramsetter(params) ++ setPos(pos) ++ add_connection(flag, UnitOpr) ++ OM_Flowsheet_Initialize() ++ OM_Flowsheet_Equation() + + + + UMLClass + + 0 + 935 + 275 + 264 + + Bin_Phase_env +-- ++ comp: CompoundSelector = comp ++ compounds: list = comp.getComp() ++ lines: list = [line.rstrip('\n')...] ++ counter: int = 1 +-- +setupUi() ++ button_handler() ++ T_xy() ++ P_xy() ++ get_omc_path() ++ plot() ++ pressEvent(evt) ++ entered(items) + + + + UMLClass + + 770 + 154 + 231 + 154 + + ChemsepDatabase +-- ++ comp_name_list: list = list() ++ name: string = 'chemsep' ++ comp_prop_list: list = list() +-- ++ get_comp_name_list() ++ get_value(comps, attrib) ++ get_comp_prop(comps) + + + + Relation + + 616 + 704 + 132 + 132 + + lt=<- + 100.0;10.0;100.0;100.0;10.0;100.0 + + + Relation + + 616 + 902 + 143 + 33 + + lt=<- + 110.0;10.0;10.0;10.0 + + + Relation + + 869 + 297 + 33 + 77 + + lt=<<<- + 10.0;10.0;10.0;50.0 + + + Relation + + 1056 + 594 + 110 + 33 + + lt=<<<- + 80.0;10.0;10.0;10.0 + + + Relation + + 1243 + 451 + 33 + 99 + + lt=<<. + 10.0;10.0;10.0;70.0 + + + Relation + + 1243 + 363 + 33 + 66 + + + 10.0;10.0;10.0;40.0 + + + Relation + + 1243 + 264 + 33 + 55 + + + 10.0;10.0;10.0;30.0 + + + Relation + + 1364 + 550 + 88 + 33 + + lt=<<. + 60.0;10.0;10.0;10.0 + + + Relation + + 1364 + 627 + 88 + 33 + + lt=<<. + 60.0;10.0;10.0;10.0 + + + Relation + + 979 + 935 + 121 + 33 + + lt=<- + 90.0;10.0;10.0;10.0 + + + Relation + + 1243 + 1012 + 33 + 99 + + lt=<- + 10.0;70.0;10.0;10.0 + + + Relation + + 957 + 1529 + 110 + 33 + + lt=<- + 10.0;10.0;80.0;10.0 + + + Relation + + 605 + 1529 + 154 + 33 + + lt=<- + 10.0;10.0;120.0;10.0 + + + Relation + + 341 + 1342 + 165 + 99 + + lt=<<. + 10.0;10.0;130.0;70.0 + + + Relation + + 495 + 1342 + 99 + 99 + + lt=<<. + 70.0;10.0;10.0;70.0 + + + Relation + + 847 + 1320 + 33 + 121 + + lt=<<. + 10.0;10.0;10.0;90.0 + + + Relation + + 924 + 1298 + 143 + 33 + + lt=<<. + 10.0;10.0;110.0;10.0 + + + Relation + + 1100 + 1661 + 33 + 66 + + lt=<<. + 10.0;40.0;10.0;10.0 + + + Relation + + 1441 + 1661 + 33 + 143 + + lt=<<. + 10.0;110.0;10.0;10.0 + + + Relation + + 1287 + 1661 + 33 + 231 + + lt=<<. + 10.0;190.0;10.0;10.0 + + + Relation + + 1210 + 1661 + 33 + 187 + + lt=<<. + 10.0;150.0;10.0;10.0 + + + Relation + + 979 + 1034 + 649 + 33 + + lt=<- + 570.0;10.0;10.0;10.0 + + + Relation + + 1529 + 1034 + 704 + 682 + + lt=<- + 620.0;600.0;620.0;520.0;10.0;520.0;10.0;10.0 + + + Relation + + 1782 + 1595 + 33 + 121 + + lt=<- + 10.0;90.0;10.0;10.0 + + + Relation + + 1474 + 539 + 1023 + 1023 + + lt=<- + 810.0;10.0;910.0;10.0;910.0;910.0;10.0;910.0 + + + Relation + + 2354 + 858 + 143 + 33 + + lt=<- + 10.0;10.0;110.0;10.0 + + + Relation + + 2354 + 1100 + 143 + 33 + + lt=<- + 10.0;10.0;110.0;10.0 + + + Relation + + 2354 + 1353 + 143 + 33 + + lt=<- + 10.0;10.0;110.0;10.0 + + + Relation + + 1969 + 737 + 528 + 33 + + lt=<- + 10.0;10.0;460.0;10.0 + + + Relation + + 1826 + 550 + 33 + 88 + + lt=<<. + 10.0;10.0;10.0;60.0 + + + Relation + + 1980 + 429 + 143 + 33 + + lt=<<. + 10.0;10.0;110.0;10.0 + + + Relation + + 1980 + 462 + 154 + 330 + + lt=<<. + 10.0;10.0;120.0;280.0 + + + Relation + + 1980 + 506 + 143 + 528 + + lt=<<. + 10.0;10.0;110.0;460.0 + + + Relation + + 1980 + 550 + 143 + 715 + + lt=<<. + 10.0;10.0;110.0;630.0 + + + Relation + + 264 + 1012 + 99 + 33 + + lt=<<<- + 10.0;10.0;70.0;10.0 + + + Relation + + 1650 + 638 + 88 + 33 + + lt=<<. + 10.0;10.0;60.0;10.0 + + + Relation + + 1650 + 726 + 88 + 33 + + lt=<<. + 10.0;10.0;60.0;10.0 + + + UMLNote + + 1804 + 165 + 176 + 55 + + UC is the abbreviation +for unknown class. +bg=white + + + + + UMLClass + + 1793 + 242 + 231 + 77 + + 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 + + Heater +Cooler +AdiabaticCompressor +AdiabaticExpander +Valve +Pump +Flash +-- + + + + + UMLClass + + 2442 + 1925 + 231 + 55 + + Mixer +-- ++ Pout_modes: list = [...] + + + + + UMLClass + + 2442 + 1991 + 231 + 55 + + Splitter +-- ++ CalcType_modes: list = [...] + + + + + UMLClass + + 2442 + 2068 + 231 + 55 + + CompoundSeparator +-- ++ SepFact_modes: list = [...] + + + + + UMLClass + + 2442 + 1716 + 275 + 110 + + DistillationColumn +-- ++ EngStm1:string = 'EngStm1'+name ++ EngStm2: string = 'EngStm2'+name ++ Cspec_list: list = [...] ++ Rsepc_list: list = [...] + + + + + + UMLClass + + 2442 + 1837 + 275 + 77 + + ShortcutColumn +-- ++ EngStm1:string = 'EngStm1'+name ++ EngStm2: string = 'EngStm2'+name + + + + + + Relation + + 2354 + 1760 + 110 + 33 + + lt=<<- + 10.0;10.0;80.0;10.0 + + + Relation + + 2354 + 1859 + 110 + 33 + + lt=<<- + 10.0;10.0;80.0;10.0 + + + Relation + + 2354 + 1947 + 110 + 33 + + lt=<<- + 10.0;10.0;80.0;10.0 + + + Relation + + 2354 + 2024 + 110 + 33 + + lt=<<- + 10.0;10.0;80.0;10.0 + + + Relation + + 2354 + 2090 + 110 + 33 + + lt=<<- + 10.0;10.0;80.0;10.0 + + + Relation + + 2354 + 2211 + 110 + 33 + + lt=<<- + 10.0;10.0;80.0;10.0 + + -- cgit