summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DockWidgetMatStm.py332
-rw-r--r--DockWidgetMatStm.ui458
-rw-r--r--Graphics.py35
-rw-r--r--OMChem/Flowsheet.py148
-rw-r--r--Simulator/BinaryEnvelopes.mo19
-rw-r--r--Streams.py377
-rw-r--r--UnitOperations.py102
-rw-r--r--comp_selector.ui6
-rw-r--r--component_selector.py32
-rw-r--r--container.py4
-rw-r--r--dockWidget.py96
-rw-r--r--dockWidget.ui259
-rw-r--r--icons/plus.pngbin0 -> 3337 bytes
-rw-r--r--mainApp.py14
-rw-r--r--paramDock.ui147
-rw-r--r--resDock.ui187
-rw-r--r--resDockWidget.py92
17 files changed, 1459 insertions, 849 deletions
diff --git a/DockWidgetMatStm.py b/DockWidgetMatStm.py
new file mode 100644
index 0000000..76ecb11
--- /dev/null
+++ b/DockWidgetMatStm.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 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
new file mode 100644
index 0000000..8995ba6
--- /dev/null
+++ b/DockWidgetMatStm.ui
@@ -0,0 +1,458 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>392</width>
+ <height>700</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>3200</width>
+ <height>5000</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>361</width>
+ <height>621</height>
+ </rect>
+ </property>
+ <property name="autoFillBackground">
+ <bool>true</bool>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string>Input Data</string>
+ </attribute>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="geometry">
+ <rect>
+ <x>9</x>
+ <y>9</y>
+ <width>331</width>
+ <height>71</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Mode Selection</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Mode : </string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>100</y>
+ <width>331</width>
+ <height>321</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Parameter Selection</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QFormLayout" name="formLayout"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QPushButton" name="pushButton_2">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>430</y>
+ <width>331</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Submit</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QWidget" name="tab_2">
+ <attribute name="title">
+ <string>Results</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QToolBox" name="toolBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>8</pointsize>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QToolBox{
+ background: white;
+ border: 1px solid gray;
+ selection-background-color: rgb(255, 170, 127);
+}
+</string>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="mixtureTB">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>335</width>
+ <height>494</height>
+ </rect>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QWidget{
+ background: white;
+}</string>
+ </property>
+ <attribute name="label">
+ <string>Mixture</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QTabWidget" name="tabWidget_2">
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QTabWidget{
+ background: rgb(240, 240, 240);
+}</string>
+ </property>
+ <property name="tabPosition">
+ <enum>QTabWidget::North</enum>
+ </property>
+ <property name="tabShape">
+ <enum>QTabWidget::Triangular</enum>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <property name="elideMode">
+ <enum>Qt::ElideNone</enum>
+ </property>
+ <widget class="QWidget" name="tab_3">
+ <attribute name="title">
+ <string>Amounts</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <widget class="QTreeWidget" name="mTreeWidget">
+ <attribute name="headerCascadingSectionResizes">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="headerDefaultSectionSize">
+ <number>150</number>
+ </attribute>
+ <attribute name="headerShowSortIndicator" stdset="0">
+ <bool>false</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_4">
+ <attribute name="title">
+ <string>Phase Properties</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QTableWidget" name="mTableWidget">
+ <property name="columnCount">
+ <number>3</number>
+ </property>
+ <attribute name="horizontalHeaderCascadingSectionResizes">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderDefaultSectionSize">
+ <number>100</number>
+ </attribute>
+ <attribute name="horizontalHeaderShowSortIndicator" stdset="0">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ <attribute name="verticalHeaderStretchLastSection">
+ <bool>false</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string>Attribute</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Unit</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="liquidTB">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>335</width>
+ <height>494</height>
+ </rect>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QWidget{
+ background: white;
+}</string>
+ </property>
+ <attribute name="label">
+ <string>Liquid</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QTabWidget" name="tabWidget_3">
+ <property name="styleSheet">
+ <string notr="true">QTabWidget{
+ background: rgb(240, 240, 240);
+}</string>
+ </property>
+ <property name="tabShape">
+ <enum>QTabWidget::Triangular</enum>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab_5">
+ <attribute name="title">
+ <string>Amounts</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QTreeWidget" name="lTreeWidget">
+ <attribute name="headerDefaultSectionSize">
+ <number>150</number>
+ </attribute>
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_6">
+ <attribute name="title">
+ <string>Phase Properties</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout_9">
+ <item>
+ <widget class="QTableWidget" name="lTableWidget">
+ <property name="columnCount">
+ <number>3</number>
+ </property>
+ <attribute name="horizontalHeaderDefaultSectionSize">
+ <number>100</number>
+ </attribute>
+ <attribute name="horizontalHeaderStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string>Attribute</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Unit</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="vapourTB">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>335</width>
+ <height>494</height>
+ </rect>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QWidget{
+ background: white;
+
+}</string>
+ </property>
+ <attribute name="label">
+ <string>Vapour</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout_7">
+ <item>
+ <widget class="QTabWidget" name="tabWidget_4">
+ <property name="styleSheet">
+ <string notr="true">QTabWidget{
+ background: rgb(240, 240, 240);
+}</string>
+ </property>
+ <property name="tabShape">
+ <enum>QTabWidget::Triangular</enum>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab_7">
+ <attribute name="title">
+ <string>Amounts</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout_8">
+ <item>
+ <widget class="QTreeWidget" name="vTreeWidget">
+ <attribute name="headerDefaultSectionSize">
+ <number>150</number>
+ </attribute>
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_8">
+ <attribute name="title">
+ <string>Phase Properties</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QTableWidget" name="vTableWidget">
+ <property name="columnCount">
+ <number>3</number>
+ </property>
+ <attribute name="horizontalHeaderDefaultSectionSize">
+ <number>100</number>
+ </attribute>
+ <attribute name="horizontalHeaderStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string>Attribute</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Unit</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Graphics.py b/Graphics.py
index f5129d4..bf65acc 100644
--- a/Graphics.py
+++ b/Graphics.py
@@ -15,7 +15,10 @@ import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import PyQt5.QtWidgets as QtWidgets
from component_selector import *
-from dockWidget import dockWidget
+from DockWidget import *
+from DockWidgetMatStm import *
+
+
import datetime
from container import *
from Streams import *
@@ -37,8 +40,8 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem):
def getComponentSelector(self):
return componentSelector(self)
- def createNodeItem(self,unitOpr):
- return NodeItem(unitOpr)
+ def createNodeItem(self,unitOpr, container):
+ return NodeItem(unitOpr, container)
def boundingRect(self):
return QtCore.QRectF(self.rect)
@@ -55,7 +58,7 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem):
pass
else:
self.unitOp.append(i)
- new_box = self.createNodeItem(i)
+ new_box = self.createNodeItem(i, self)
new_box.setPos(i.pos.toPoint().x(), i.pos.toPoint().y())
self.scene.addItem(new_box)
@@ -335,7 +338,7 @@ class NodeSocket(QtWidgets.QGraphicsItem):
if self.newLine.source.parent.obj.type not in stm:
self.newLine.source.parent.obj.add_connection(0,self.newLine.target.parent.obj)
if self.newLine.target.parent.obj.type not in stm:
- self.newLine.target.parent.obj.add_connection(1,self.newLine.source.parent.obj)
+ self.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
@@ -363,6 +366,7 @@ class NodeSocket(QtWidgets.QGraphicsItem):
# all created node items will be put inside this list
# it is used for recreating the node lines by returning the node item object based on unit operation object's name
lst = []
+dockWidgetLst = []
class NodeItem(QtWidgets.QGraphicsItem):
@@ -372,11 +376,17 @@ class NodeItem(QtWidgets.QGraphicsItem):
if i.name == namee:
return i
- def __init__(self,unitOpr):
+ @staticmethod
+ def getDockWidget():
+ return dockWidgetLst
+
+ def __init__(self,unitOpr, container):
l = ['Mixer','Splitter']
+ stm = ['MaterialStream', 'EnergyStream']
super(NodeItem, self).__init__()
self.obj = unitOpr
+ self.container = container
self.name = self.obj.name
self.type = self.obj.type
@@ -395,8 +405,15 @@ class NodeItem(QtWidgets.QGraphicsItem):
lst.append(self)
if(self.obj.type not in l):
- self.dockWidget = dockWidget(self.obj.name,self.obj.type,self.obj)
+ 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()
@@ -487,10 +504,14 @@ class NodeItem(QtWidgets.QGraphicsItem):
line.pointB = line.target.getCenter()
self.pos = event.scenePos()
self.obj.setPos(self.pos)
+ #print(self.name, self.pos)
def mouseDoubleClickEvent(self, event):
self.setPos(event.scenePos().x()-250,event.scenePos().y())
+ temp = self.obj.pos
self.dockWidget.show()
+ self.setPos(temp)
+
def findMainWindow(self):
'''
diff --git a/OMChem/Flowsheet.py b/OMChem/Flowsheet.py
index 92d040c..25143ce 100644
--- a/OMChem/Flowsheet.py
+++ b/OMChem/Flowsheet.py
@@ -75,8 +75,8 @@ class Flowsheet():
for row in csvreader:
print("124125")
self.resdata.append(row)
+ print(self.resdata)
#self.ExtData()
-
def send_for_simulationSM(self,unitop):
@@ -99,36 +99,6 @@ class Flowsheet():
self.resdata.append(row)
self.ExtData()
-
-
-
-
- # if self.sim_method == 'SM':
- # for unitop in self.UnitOpn:
- # self.resdata = []
- # if unitop.type != 'MaterialStream':
- # print 'Simulating '+unitop.name+'...'
- # csvpath = os.path.join(self.sim_dir_path,unitop.name+'_res.csv')
- # with open(csvpath,'r') as resultFile:
- # csvreader = csv.reader(resultFile,delimiter=',')
- # for row in csvreader:
- # self.resdata.append(row)
- # self.ExtData()
-
-
-
-
-
- # if self.interface == 'OMPython':
- # omc = OMCSession()
- # omc.sendExpression("loadModel(Modelica)")
- # omc.sendExpression("loadFile(\"Simulator.mo\")")
- # omc.sendExpression("loadFile(\"Flowsheet.mo\")")
- # execsim = omc.sendExpression("simulate(Flowsheet, outputFormat=\"csv\", stopTime=1.0, numberOfIntervals=1)")
-
- # else:
- # os.system(self.omc_path + ' -s ')
-
def ExtData(self):
for unit in self.UnitOpn:
if unit[0].type == 'MaterialStream':
@@ -140,84 +110,7 @@ class Flowsheet():
#resultval = str(omc.sendExpression("val("+unit.name+ "." + value + ", 0.5)"))
print(resultval)
unit[0].Prop[key] = resultval
- #print(unit[0].Prop)
- # else:
- # for v in value:
- # propertyname = unit.name + '.' + v
- # if propertyname in self.resdata[0]:
- # ind = self.resdata[0].index(propertyname)
- # resultval = str(self.resdata[-1][ind])
- # # resultval = str(omc.sendExpression("val("+unit.name+ "." + v + ", 0.5)"))
- # unit.Prop[key][i] = resultval
- # i = i + 1
-
- # for key, value in unit.OMVapProp.iteritems():
- # i = 0
-
- # if type(value) is str:
- # propertyname = unit.name + '.' + value
- # if propertyname in self.resdata[0]:
- # ind = self.resdata[0].index(propertyname)
- # resultval = str(self.resdata[-1][ind])
- # # resultval = str(omc.sendExpression("val("+unit.name+ "." + value + ", 0.5)"))
- # unit.VapProp[key] = resultval
- # else:
- # for v in value:
- # propertyname = unit.name + '.' + v
- # if propertyname in self.resdata[0]:
- # ind = self.resdata[0].index(propertyname)
- # resultval = str(self.resdata[-1][ind])
- # # resultval = str(omc.sendExpression("val("+unit.name+ "." + v + ", 0.5)"))
- # unit.VapProp[key][i] = resultval
- # i = i + 1
-
-
- # for key, value in unit.OMLiqProp.iteritems():
- # i = 0
-
- # if type(value) is str:
- # propertyname = unit.name + '.' + value
- # if propertyname in self.resdata[0]:
- # ind = self.resdata[0].index(propertyname)
- # resultval = str(self.resdata[-1][ind])
- # # resultval = str(omc.sendExpression("val("+unit.name+ "." + value + ", 0.5)"))
- # unit.LiqProp[key] = resultval
- # else:
- # for v in value:
- # propertyname = unit.name + '.' + v
- # if propertyname in self.resdata[0]:
- # ind = self.resdata[0].index(propertyname)
- # resultval = str(self.resdata[-1][ind])
- # # resultval = str(omc.sendExpression("val("+unit.name+ "." + v + ", 0.5)"))
- # unit.LiqProp[key][i] = resultval
- # i = i + 1
- # for key, value in unit.OMVapProp.iteritems():
- # i = 0
-
- # if type(value) is str:
- # resultval = str(omc.sendExpression("val("+unit.name+ "." + value + ", 0.5)"))
- # unit.VapProp[key] = resultval
- # else:
- # for v in value:
- # resultval = str(omc.sendExpression("val("+unit.name+ "." + v + ", 0.5)"))
- # unit.VapProp[key][i] = resultval
- # i = i + 1
-
-
- # for key, value in unit.OMLiqProp.iteritems():
- # i = 0
-
- # if type(value) is str:
- # resultval = str(omc.sendExpression("val("+unit.name+ "." + value + ", 0.5)"))
- # unit.LiqProp[key] = resultval
- # else:
- # for v in value:
- # resultval = str(omc.sendExpression("val("+unit.name+ "." + v + ", 0.5)"))
- # unit.LiqProp[key][i] = resultval
- # i = i + 1
-
-
-
+
def simulateEQN(self):
self.data = []
print("##################################################")
@@ -247,8 +140,6 @@ class Flowsheet():
self.outlist.append(j)
print(j.name)
-
-
for unitop in self.UnitOpn:
if unitop not in self.outlist:
@@ -274,10 +165,9 @@ class Flowsheet():
self.send_for_simulationEqn()
-
-
def simulateSM(self,ip,op):
+ print("ip op = ", ip, op)
self.sim_method = 'SM'
self.data = []
self.resdata = []
@@ -351,15 +241,7 @@ class Flowsheet():
self.data.append('equation\n')
print("##################equation")
self.data.append(unitop.OM_Flowsheet_Equation())
- '''
- if type(outstms) is list:
- for stm in outstms:
- #stm.GetEquationValues()
- self.data.append(stm.OM_Flowsheet_Equation(self.compounds,'SM'))
- else:
- #outstms.GetEquationValues()
- self.data.append(outstms.OM_Flowsheet_Equation(self.compounds,'SM'))
-'''
+
if type(inpstms) is list:
for stm in inpstms:
#stm.GetEquationValues()
@@ -419,9 +301,7 @@ class Flowsheet():
ind = self.resdata[0].index(propertyname)
resultval = str(self.resdata[-1][ind])
stm.Prop[key] = resultval
-
- #print("input",stm.Prop[key])
-
+ #print("input",stm.Prop[key])
else:
for key, value in inpstms.Prop.items():
@@ -449,7 +329,6 @@ class Flowsheet():
resultval = str(self.resdata[-1][ind])
outstms.Prop[key] = resultval
print("output key:",key,"value:",outstms.Prop[key])
-
self.dataframes = [pd.read_csv(i) for i in self.csvlist]
os.chdir(self.sim_dir_path)
@@ -460,20 +339,3 @@ class Flowsheet():
csvreader = csv.reader(resultFile,delimiter=',')
for row in csvreader:
self.resdata.append(row)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Simulator/BinaryEnvelopes.mo b/Simulator/BinaryEnvelopes.mo
deleted file mode 100644
index 990bf31..0000000
--- a/Simulator/BinaryEnvelopes.mo
+++ /dev/null
@@ -1,19 +0,0 @@
-package BinaryEnvelopes
- model NRTL
- parameter Integer NOC;
- parameter Integer data_points;
- parameter Real BIP[NOC, NOC, 2] = Simulator.Files.Thermodynamic_Functions.BIPNRTL(NOC, comp.CAS);
- parameter Simulator.Files.Chemsep_Database.General_Properties comp[NOC];
- Simulator.Binary_Phase_Envelope.Binary_Phase_Envelope_NRTL.base points[data_points](each NOC = NOC, each comp = comp, each BIP = BIP);
- Real x[data_points, NOC], y[data_points, NOC], P[data_points], T[data_points];
- equation
- points[:].x = x;
- points[:].y = y;
- points[:].P = P;
- points[:].T = T;
- for i in 1:data_points loop
- x[i, 1] = 0 + (i - 1) * 1/(data_points-1);
- end for;
- end NRTL;
-
-end BinaryEnvelopes; \ No newline at end of file
diff --git a/Streams.py b/Streams.py
index a9a69cf..f35a056 100644
--- a/Streams.py
+++ b/Streams.py
@@ -6,6 +6,366 @@ from collections import defaultdict
class MaterialStream():
counter = 1
+ def __init__(self, CompNames = []):
+
+ self.name = 'MaterialStream' + str(MaterialStream.counter)
+ self.type = 'MaterialStream'
+
+ self.CompNames = CompNames
+ self.count = MaterialStream.counter
+ self.thermoPackage ="RaoultsLaw"
+ self.mode1 = "P"
+ self.mode2 = "T"
+
+ self.mode1val = ""
+ self.mode2val = ""
+ self.OM_data_init = ''
+ self.OM_data_eqn = ''
+ 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.variables = {
+ 'P' : {'name':'Pressure', 'value':101325, 'unit':'Pa'}, # {'Pa':1, 'mmHg':0, 'N/m^2':0}},
+ 'T' : {'name':'Temperature', 'value':300, 'unit':'K'},
+
+ 'xvap' : {'name':'Vapour Phase Mole Fraction', 'value':None, 'unit':'g/s'},
+ 'H_p[1]' : {'name':'Mixture Phase Molar Entalpy', 'value':None, 'unit':'g/s'},
+ 'S_p[1]' : {'name':'Mixture Phase Molar Entropy', 'value':None, 'unit':'g/s'},
+ 'F_p[1]' : {'name':'Mixture Molar Flow Rate', 'value':None, 'unit':'g/s'},
+
+ 'H_p[2]' : {'name':'Liquid Phase Molar Entalpy', 'value':None, 'unit':'g/s'},
+ 'S_p[2]' : {'name':'Liquid Phase Molar Entropy', 'value':None, 'unit':'g/s'},
+ 'F_p[2]' : {'name':'Liquid Molar Flow Rate', 'value':None, 'unit':'g/s'},
+
+ 'H_p[3]' : {'name':'Vapour Phase Molar Entalpy', 'value':None, 'unit':'g/s'},
+ 'S_p[3]' : {'name':'Vapour Phase Molar Entropy', 'value':None, 'unit':'g/s'},
+ 'F_p[3]' : {'name':'Vapour Molar Flow Rate', 'value':None, 'unit':'g/s'},
+
+ 'x_pc' : {'name':'Mole Fraction', 'value':1.0, 'unit':'mol/s'},
+ 'xm_pc' : {'name':'Mass Fraction', 'value':None, 'unit':'g/s'},
+
+ 'F_pc' : {'name':'Mole Flow', 'value':100, 'unit':'mol/s'},
+ 'Fm_pc' : {'name':'Mass Flow', 'value':None, 'unit':'g/s'},
+ }
+ self.initVariables()
+
+ def initVariables(self):
+ for i, val in enumerate(self.CompNames):
+ self.variables['x_pc[1,'+ str(i+1)+']'] = {'name':val + ' Mixture Mole Fraction', 'value':None, 'unit':'mol/s'}
+ self.variables['xm_pc[1,'+ str(i+1)+']'] = {'name':val + ' Mixture Mass Fraction', 'value':None, 'unit':'g/s'}
+ self.variables['F_pc[1,'+ str(i+1)+']'] = {'name':val + ' Mixture Mole Flow', 'value':None, 'unit':'mol/s'}
+ self.variables['Fm_pc[1,'+ str(i+1)+']'] = {'name':val + ' Mixture Mass Flow', 'value':None, 'unit':'g/s'}
+
+ self.variables['x_pc[2,'+ str(i+1)+']'] = {'name':[val + ' Liquid Mole Fraction'], 'value':None, 'unit':'mol/s'}
+ self.variables['xm_pc[2,'+ str(i+1)+']'] = {'name':[val + ' Liquid Mass Fraction'], 'value':None, 'unit':'g/s'}
+ self.variables['F_pc[2,'+ str(i+1)+']'] = {'name':[val + ' Liquid Mole Flow'], 'value':None, 'unit':'mol/s'}
+ self.variables['Fm_pc[2,'+ str(i+1)+']'] = {'name':[val + ' Liquid Mass Flow'], 'value':None, 'unit':'g/s'}
+
+ self.variables['x_pc[3,'+ str(i+1)+']'] = {'name':[val + ' Vapour Mole Fraction'], 'value':None, 'unit':'mol/s'}
+ self.variables['xm_pc[3,'+ str(i+1)+']'] = {'name':[val + ' Vapour Mass Fraction'], 'value':None, 'unit':'g/s'}
+ self.variables['F_pc[3,'+ str(i+1)+']'] = {'name':[val + ' Vapour Mole Flow'], 'value':None, 'unit':'mol/s'}
+ self.variables['Fm_pc[3,'+ str(i+1)+']'] = {'name':[val + ' Vapour Mass Flow'], 'value':None, 'unit':'g/s'}
+
+ for i in self.CompNames:
+ self.variables[i] = {'value':''}
+
+ def paramgetter(self,mode):
+ dict = {}
+
+ if(mode=="PT"):
+ self.mode1 = 'P'
+ self.mode2 = 'T'
+ dict = {self.mode1:self.variables['P']['value'], self.mode2:self.variables['T']['value'],
+ "MolFlow":self.variables['F_pc']['value'],"x_pc":self.variables['x_pc']['value'], "thermoPackage":self.thermoPackage}
+ elif(mode=="PH"):
+ self.mode1 = 'P'
+ self.mode2 = 'H_p[1]'
+ dict = {self.mode1:self.variables['P']['value'], self.mode2:self.variables['H_p[1]']['value'],
+ "MolFlow":self.variables['F_pc']['value'], "x_pc":self.variables['x_pc']['value'], "thermoPackage":self.thermoPackage}
+ elif(mode=="PVF"):
+ self.mode1 = 'P'
+ self.mode2 = 'xvap'
+ dict = {self.mode1:self.variables['P']['value'], self.mode2:self.variables['xvap']['value'],
+ "MolFlow":self.variables['F_pc']['value'], "x_pc":self.variables['x_pc']['value'], "thermoPackage":self.thermoPackage}
+ elif(mode=="TVF"):
+ self.mode1 = 'T'
+ self.mode2 = 'xvap'
+ dict = {self.mode1:self.variables['T']['value'], self.mode2:self.variables['xvap']['value'],
+ "MolFlow":self.variables['F_pc']['value'], "x_pc":self.variables['x_pc']['value'], "thermoPackage":self.thermoPackage}
+ elif(mode=="PS"):
+ self.mode1 = 'P'
+ self.mode2 = 'S_p[1]'
+ dict = {self.mode1:self.variables['P']['value'], self.mode2: self.variables['S_p[1]']['value'],
+ "MolFlow":self.variables['F_pc']['value'], "x_pc":self.variables['x_pc']['value'], "thermoPackage":self.thermoPackage}
+
+ return dict
+
+ def paramsetter(self,dict):
+
+ print("inside paramsetter ", dict)
+
+ self.variables['x_pc']['value'] = dict['x_pc'].split(",")
+ self.thermoPackage = dict['thermoPackage']
+ self.variables['F_p[1]']['value'] = dict['MolFlow']
+ print("inside")
+ # self.Prop[self.mode2] = dict[self.mode2]
+ # self.Prop[self.mode1] = dict[self.mode1]
+ self.variables[self.mode1]['value'] = dict[self.mode1]
+ self.variables[self.mode2]['value'] = dict[self.mode2]
+
+ print(self.variables)
+ print(self.variables['x_pc']['value'])
+ for i in range(len(self.CompNames)):
+ print('####### x_pc #########\n',self.variables['x_pc']['value'][i])
+ print('x_pc')
+ if self.variables['x_pc']['value'][i]:
+ self.variables['x_pc[1,'+str(i+1)+']']['value'] = self.variables['x_pc']['value'][i]
+ else:
+ self.variables['x_pc[1,'+str(i+1)+']']['value'] = None
+ print('xm_pc')
+ # if self.variables['xm_pc']['value'][i]:
+ # self.variables['xm_pc[1,'+str(i+1)+']']['value'] = self.variables['xm_pc']['value'][i]
+ # else:
+ self.variables['xm_pc[1,'+str(i+1)+']']['value'] = self.variables['xm_pc']['value']
+
+ print('f_pc')
+ self.variables['F_pc[1,'+str(i+1)+']']['value'] = None
+ print('fm_pc')
+ self.variables['Fm_pc[1,'+str(i+1)+']']['value'] = None
+ print('first for')
+ print('secnod for')
+ for i in range(0,len(self.CompNames)):
+ self.variables['x_pc[2,'+str(i+1)+']']['value'] = None
+ self.variables['xm_pc[2,'+str(i+1)+']']['value'] = None
+ self.variables['F_pc[2,'+str(i+1)+']']['value'] = None
+ self.variables['Fm_pc[2,'+str(i+1)+']']['value'] = None
+
+ self.variables['x_pc[3,'+str(i+1)+']']['value'] = None
+ self.variables['xm_pc[3,'+str(i+1)+']']['value'] = None
+ self.variables['F_pc[3,'+str(i+1)+']']['value'] = None
+ self.variables['Fm_pc[3,'+str(i+1)+']']['value'] = 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)+']'])
+ x_pclist.append(self.variables['x_pc[1,'+str(i+1)+']']['value'])
+ 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.variables[self.mode1]['value']:
+ self.eqnDict[self.mode1] = self.variables[self.mode1]['value']
+ if self.variables[self.mode2]['value']:
+ self.eqnDict[self.mode2] = self.variables[self.mode2]['value']
+ if self.variables['x_pc']['value']:
+ self.eqnDict['x_pc[1,:]'] = x_pc
+ if self.variables['F_pc']['value']:
+ self.eqnDict['F_p[1]'] = self.variables['F_pc']['value']
+
+ print("##############$GetMinVEqnValuesStart$##################")
+ print("P:",self.variables[self.mode1]['value'])
+ print("T:",self.variables[self.mode2]['value'])
+ print("x_pc",self.variables['x_pc']['value'])
+ print("F_p",self.variables['F_p[1]']['value'])
+ print("##############$GetMinVEqnValuesEnd$##################")
+
+ def GetStartValues(self):
+ try:
+ if self.variables[self.mode1]['value']:
+ self.startDict[self.mode1] = self.variables[self.mode1]['value']
+
+ if self.variables[self.mode2]['value']:
+ self.startDict[self.mode2] = self.variables[self.mode2]['value']
+
+
+ if self.variables['x_pc[2,1]']['value'] != None:
+ x_pcarr = []
+ for i in range(1,4):
+ cmf = []
+ for j in range(1,len(self.CompNames)+1):
+ cmf.append(str(self.variables['x_pc['+str(i)+','+str(j)+']']['value']))
+ x_pcarr.append(cmf)
+ x_pcstr = json.dumps(x_pcarr)
+ x_pcstr = x_pcstr.replace('[','{')
+ x_pcstr = x_pcstr.replace(']','}')
+ x_pcstr = x_pcstr.replace('"','')
+ self.startDict['x_pc'] = x_pcstr
+
+ if self.variables['xm_pc[2,1]']['value'] != None:
+ xm_pcarr = []
+ for i in range(1,4):
+ cmf = []
+ for j in range(1,len(self.CompNames)+1):
+ cmf.append(str(self.variables['xm_pc['+str(i)+','+str(j)+']']['value']))
+ xm_pcarr.append(cmf)
+ xm_pcstr = json.dumps(x_pcarr)
+ xm_pcstr = xm_pcstr.replace('[','{')
+ xm_pcstr = xm_pcstr.replace(']','}')
+ xm_pcstr = xm_pcstr.replace('"','')
+ self.startDict['xm_pc'] = xm_pcstr
+
+ if self.variables['Fm_pc[2,1]']['value'] != None:
+ Fm_pcarr = []
+ for i in range(1,4):
+ cmf = []
+ for j in range(1,len(self.CompNames)+1):
+ cmf.append(str(self.variables['Fm_pc['+str(i)+','+str(j)+']']['value']))
+ Fm_pcarr.append(cmf)
+ Fm_pcstr = json.dumps(x_pcarr)
+ Fm_pcstr = Fm_pcstr.replace('[','{')
+ Fm_pcstr = Fm_pcstr.replace(']','}')
+ Fm_pcstr = Fm_pcstr.replace('"','')
+ self.startDict['Fm_pc'] = Fm_pcstr
+
+ if self.variables['F_pc[2,1]']['value'] != None:
+ F_pcarr = []
+ for i in range(1,4):
+ cmf = []
+ for j in range(1,len(self.CompNames)+1):
+ cmf.append(str(self.variables['F_pc['+str(i)+','+str(j)+']']['value']))
+ F_pcarr.append(cmf)
+ F_pcstr = json.dumps(F_pcarr)
+ F_pcstr = F_pcstr.replace('[','{')
+ F_pcstr = F_pcstr.replace(']','}')
+ F_pcstr = F_pcstr.replace('"','')
+ self.startDict['F_pc'] = F_pcstr
+
+ if self.variables['MW_p[2]']['value'] != None:
+ MW_pArr = []
+ for i in range(1,4):
+ MW_pArr.append(self.variables['MW_p['+str(i)+']']['value'])
+ 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.variables['F_p[2]']['value'] != None:
+ F_pArr = []
+ for i in range(1,4):
+ F_pArr.append(self.variables['F_p['+str(i)+']']['value'])
+ 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.variables['Cp_p[2]']['value'] != None:
+ Cp_pArr = []
+ for i in range(1,4):
+ Cp_pArr.append(self.variables['Cp_p['+str(i)+']']['value'])
+ 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.variables['H_p[2]']['value'] != None:
+ H_pArr = []
+ for i in range(1,4):
+ H_pArr.append(self.variables['H_p['+str(i)+']']['value'])
+ 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.variables['S_p[2]']['value'] != None:
+ S_pArr = []
+ for i in range(1,4):
+ S_pArr.append(self.variables['S_p['+str(i)+']']['value'])
+ 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.variables['Fm_p[2]']['value'] != None:
+ Fm_pArr = []
+ for i in range(1,4):
+ Fm_pArr.append(self.variables['Fm_p['+str(i)+']']['value'])
+ 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
+
+
+'''
+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'
@@ -37,7 +397,6 @@ class MaterialStream():
self.startDict = {}
self.eqnDict = {}
self.modesList = ["PT","PH","PVF","TVF","PS"]
-
self.Prop = {
@@ -144,6 +503,7 @@ class MaterialStream():
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)):
@@ -171,12 +531,12 @@ class MaterialStream():
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('"','')
- '''
+
+ # 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]:
@@ -381,4 +741,5 @@ class MaterialStream():
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
+
+''' \ No newline at end of file
diff --git a/UnitOperations.py b/UnitOperations.py
index c5259a1..b57ded5 100644
--- a/UnitOperations.py
+++ b/UnitOperations.py
@@ -30,9 +30,10 @@ class UnitOperation():
self.x = 2500-30
self.y = 2500-30
self.pos = QPointF(self.x, self.y)
- self.Prop = {}
+ #self.Prop = {}
+ self.variables = {}
self.modeslist = []
- self.parameters = {}
+ self.parameters = []
self.extra = []
self.ForNaming = []
self.multidict = []
@@ -46,17 +47,19 @@ class UnitOperation():
else:
self.mode = mode
# print("Hello hello ", self.mode)
- params = self.parameters.copy()
+ #params = self.parameters.copy()
+ for i in self.parameters:
+ params[i] = self.variables[i]['value']
params[self.mode] = None
return params
def paramsetter(self,params):
- print(params)
+ print("paramsetter ", params)
for k,v in params.items():
print(k,v)
if k != self.mode:
self.k = v
- self.parameters[k] = v
+ self.variables[k]['value'] = v
else:
self.modeVal = params[self.mode]
@@ -125,9 +128,9 @@ class UnitOperation():
C = C.replace("'", "")
self.OM_data_init += ',C = {' + C + '}'
- for k,v in self.parameters.items():
+ for k in self.parameters:
self.OM_data_init += ', '
- self.OM_data_init += k + ' = ' + str(v)
+ self.OM_data_init += k + ' = ' + str(self.variables[k]['value'])
self.OM_data_init += ');\n'
return self.OM_data_init
@@ -158,95 +161,92 @@ class UnitOperation():
class Heater(UnitOperation):
- def __init__(self, name='Heater',Pdel='None', Eff='None'):
+ def __init__(self, name='Heater'):
UnitOperation.__init__(self)
self.name = name + str(type(self).counter)
self.type = 'Heater'
self.no_of_inputs = 1
self.no_of_outputs = 1
- self.Prop = {
- 'Pdel':None,
- 'Eff':None,
- 'Tout':None,
- 'Tdel':None,
- 'Q':None,
- }
- self.modesList = ["Q","Tout","xvapout","Tdel"]
+ self.modesList = ['Q','Tout','xvapout','Tdel']
+ self.parameters = ['Pdel', 'Eff']
self.extra = None
self.ForNaming = None
- self.Pdel = Pdel
- self.Eff = Eff
- self.parameters = {'Pdel':self.Pdel, 'Eff':self.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'},
+ }
+
class Cooler(UnitOperation):
- def __init__(self, name='Cooler', Pdel='None', Eff='None'):
+ def __init__(self, name='Cooler'):
UnitOperation.__init__(self)
self.name = name + str(type(self).counter)
self.type = 'Cooler'
self.no_of_inputs = 1
self.no_of_outputs = 1
- self.Prop = {
- 'Pdel':None,
- 'Eff':None,
- 'Tout':None,
- 'Tdel':None,
- 'Q':None,
- }
- self.modesList = ["Q","Tout","xvapout","Tdel","enFlo"]
+ self.modesList = ["Q","Tout","xvapout","Tdel"]
self.extra = None
self.ForNaming = None
- self.Pdel = Pdel
- self.Eff = Eff
- self.parameters = {'Pdel':self.Pdel, 'Eff':self.Eff}
+ 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'},
+ }
+
class AdiabaticCompressor(UnitOperation):
- def __init__(self, name='AdiabaticCompressor', Eff='None'):
+ def __init__(self, name='AdiabaticCompressor'):
UnitOperation.__init__(self)
self.name = name + str(type(self).counter)
self.type = 'AdiabaticCompressor'
self.no_of_inputs = 1
self.no_of_outputs = 1
- self.Prop = {
- 'Pdel':None,
- 'Tdel':None,
- 'Pout':None,
- 'Tout':None,
- 'Q':None
- }
self.modesList = ["Pdel","Pout","Q"]
self.extra = ['AdiabaticCompressor']
self.ForNaming = ['AdiabaticCompressor']
self.ThermoPackReq = True
self.thermoPackage ="RaoultsLaw"
- self.Eff = Eff
- self.parameters = {'Eff':self.Eff}
+ self.parameters = ['Eff']
type(self).counter += 1
+ 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'},
+ 'Q' : {'name':'Heat Added', 'value':0, 'unit':'W'},
+ }
class AdiabaticExpander(UnitOperation):
- def __init__(self, name='AdiabaticExpander', Eff='None'):
+ def __init__(self, name='AdiabaticExpander'):
UnitOperation.__init__(self)
self.name = name + str(type(self).counter)
self.type = 'AdiabaticExpander'
self.no_of_inputs = 1
self.no_of_outputs = 1
- self.Prop = {
- 'Pdel':None,
- 'Tdel':None,
- 'Pout':None,
- 'Tout':None,
- 'Q':None
- }
self.modesList = ["Pdel","Pout","Q"]
self.extra = ['AdiabaticExpander']
self.ForNaming = ['AdiabaticExpander']
self.ThermoPackReq = True
self.thermoPackage ="RaoultsLaw"
- self.Eff = Eff
- self.parameters = {'Eff':self.Eff}
+ self.parameters = ['Eff']
type(self).counter += 1
+ 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'},
+ 'Q' : {'name':'Heat Added', 'value':0, 'unit':'W'},
+ }
+
\ No newline at end of file
diff --git a/comp_selector.ui b/comp_selector.ui
index e0bf0b8..09d8c78 100644
--- a/comp_selector.ui
+++ b/comp_selector.ui
@@ -75,6 +75,12 @@
</item>
<item>
<widget class="QTableWidget" name="tableWidget">
+ <attribute name="horizontalHeaderDefaultSectionSize">
+ <number>110</number>
+ </attribute>
+ <attribute name="horizontalHeaderStretchLastSection">
+ <bool>true</bool>
+ </attribute>
<column>
<property name="text">
<string>CAS Number</string>
diff --git a/component_selector.py b/component_selector.py
index ff97992..600b5f2 100644
--- a/component_selector.py
+++ b/component_selector.py
@@ -1,35 +1,3 @@
-# -*- coding: utf-8 -*-
-"""
-Created on Wed Dec 25 17:41:56 2019
-
-@author: Eshika Mahajan
-"""
-
-'''
-
-after one simulation all the instances get recreated and the program runs afresh.
-Thus new database.mo wil not have the gen prop of the previous iteration's compounds'
-same goes with lists and all ot
-
-'''
-'''
-FUNCTION(COMPOUNDSELECTION)
-any compound selected , compound selection function will first check whether the text
-written in lineEdit is a part of database or not by checking the text entered with
-LINES that contain the list of all the compiundsin the database.
-if it is a part of database then it will proceed further else it will show error
-
-'''
-'''
-FINCTION(CREATIN_MO_FILE)
-the below codes fetch the general properties of the compiund selected from
-Database.py in the form of lists.
-first creates the combined list 'comp_prop_list' of gen prop of all the compounds
-then appended with one starting line 'package database' and end with 'end database'
-and the extension will be changed to .mo file.
-
-'''
-
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
diff --git a/container.py b/container.py
index 6cfc689..cc10c38 100644
--- a/container.py
+++ b/container.py
@@ -73,7 +73,7 @@ class Container():
box = None
self.obj = obj
self.scene = self.graphics.getScene()
- box = self.graphics.createNodeItem(self.obj)
+ box = self.graphics.createNodeItem(self.obj, self)
self.scene.addItem(box)
box.setPos(2500-30, 2500-30)
@@ -131,6 +131,8 @@ class Container():
self.result=self.flowsheet.resdata
print("under Eqn mode simulation")
+ DockWidget.showResult(NodeItem.getDockWidget())
+
def flatlist(lst):
flat_list=[]
for sublist in lst:
diff --git a/dockWidget.py b/dockWidget.py
index 9bc9052..36fbc32 100644
--- a/dockWidget.py
+++ b/dockWidget.py
@@ -6,12 +6,13 @@ import pandas as pd
from functools import partial
from component_selector import *
from collections import defaultdict
-ui_dialog,_ = loadUiType('dockWidget.ui')
+from Graphics import *
+ui_dialog,_ = loadUiType('DockWidget.ui')
-class dockWidget(QDockWidget,ui_dialog):
+class DockWidget(QDockWidget,ui_dialog):
- def __init__(self,name,comptype,obj,parent=None):
+ def __init__(self,name,comptype,obj,container,parent=None):
QDockWidget.__init__(self,parent)
self.setupUi(self)
self.setWindowTitle(obj.name)
@@ -21,12 +22,15 @@ class dockWidget(QDockWidget,ui_dialog):
self.inputdict = {}
self.x_pclist = []
self.modes()
- self.pushButton_2.clicked.connect(self.modeSelection)
- #self.inputparamslist()
- print(self.inputdict)
- self.pushButton.clicked.connect(self.param)
+ 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):
@@ -41,13 +45,13 @@ class dockWidget(QDockWidget,ui_dialog):
def modeSelection(self):
self.inputdict= {}
for i in reversed(range(self.formLayout.count())):
- self.formLayout.itemAt(i).widget().setParent(None)
+ self.formLayout.removeRow(i)
self.inputdict = self.obj.paramgetter(self.comboBox.currentText())
self.inputparamslist()
def inputparamslist(self):
try:
- print(self.inputdict)
+ print("inputparamslist ", self.inputdict)
for c,i in enumerate(self.inputdict):
if(i=="thermoPackage"):
print("thermo1")
@@ -56,7 +60,10 @@ class dockWidget(QDockWidget,ui_dialog):
print("thermo2")
for j in self.lines:
combo.addItem(str(j))
- self.formLayout.addRow(QLabel(i+":"),combo )
+ 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"):
@@ -64,34 +71,53 @@ class dockWidget(QDockWidget,ui_dialog):
self.lines = ["Total","Partial"]
for j in self.lines:
combo.addItem(str(j))
- self.formLayout.addRow(QLabel("Condensor Type :"+":"),combo)
+ 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("Compounds")
+ lay = QGridLayout()
for j in range(noc):
l = QLineEdit()
- self.inputdict[i] = "x_pc"
- self.formLayout.addRow(QLabel(str(compound_selected[j])+":"),l )
+ self.inputdict[i] = "x_pc"
+ lay.addWidget(QLabel(str(compound_selected[j])+":"),j,0, alignment=Qt.AlignLeft)
+ lay.addWidget(l,j,1, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(self.obj.variables[i]['unit']),j,2, alignment=Qt.AlignCenter)
self.x_pclist.append(l)
+ gp.setLayout(lay)
+ self.formLayout.addRow(gp)
else:
print("elseloop")
l = QLineEdit()
if self.inputdict[i] != None:
l.setText(str(self.inputdict[i]))
- self.formLayout.addRow(QLabel(i+":"),l )
+ 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()):
@@ -129,14 +155,48 @@ class dockWidget(QDockWidget,ui_dialog):
print(self.inputdict[i].text())
self.Show_Error()
break
+
+ print("param ", self.dict)
self.obj.paramsetter(self.dict)
- print(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()
-
-
- \ No newline at end of file
+ # result data tab
+ def resultsCategory(self,name):
+ flag = True
+ try:
+ print("Under result category name ", name)
+ result=self.container.result
+ obj = self.container.fetchObject(name)
+ self.tableWidget.setRowCount(0)
+ variKeys = list(obj.variables.keys())
+ print(variKeys)
+ for i, val in enumerate(variKeys):
+ propertyname = name + '.' + val
+ print(i,val, propertyname)
+ if propertyname in result[0]:
+ ind = result[0].index(propertyname)
+ resultval = str(result[-1][ind])
+ print("######Resultsfetch####",val,resultval)
+ rowPosition = self.tableWidget.rowCount()
+ self.tableWidget.insertRow(rowPosition)
+ self.tableWidget.setItem(rowPosition , 0, QTableWidgetItem(obj.variables[val]['name']))
+ self.tableWidget.setItem(rowPosition , 1, QTableWidgetItem(resultval))
+ self.tableWidget.setItem(rowPosition , 2, QTableWidgetItem(obj.variables[val]['unit']))
+ self.tableWidget.resizeColumnsToContents()
+
+ except Exception as e:
+ print(e)
+
+
+ \ No newline at end of file
diff --git a/dockWidget.ui b/dockWidget.ui
index a08f3c9..11855cb 100644
--- a/dockWidget.ui
+++ b/dockWidget.ui
@@ -2,173 +2,164 @@
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>250</width>
- <height>382</height>
+ <width>392</width>
+ <height>700</height>
</rect>
</property>
<property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="minimumSize">
- <size>
- <width>250</width>
- <height>250</height>
- </size>
- </property>
<property name="maximumSize">
<size>
- <width>250</width>
- <height>600</height>
+ <width>3200</width>
+ <height>5000</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
- <widget class="QPushButton" name="pushButton">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>350</y>
- <width>231</width>
- <height>23</height>
- </rect>
- </property>
- <property name="text">
- <string>Submit</string>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- <property name="default">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QGroupBox" name="groupBox">
+ <widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
- <width>231</width>
- <height>61</height>
+ <width>361</width>
+ <height>621</height>
</rect>
</property>
- <property name="title">
- <string>Modes Selection</string>
+ <property name="autoFillBackground">
+ <bool>true</bool>
</property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
+ <property name="currentIndex">
+ <number>0</number>
</property>
- <widget class="QWidget" name="horizontalLayoutWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>20</y>
- <width>231</width>
- <height>32</height>
- </rect>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>30</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>30</height>
- </size>
- </property>
- <property name="text">
- <string>Mode:-</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="comboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>30</height>
- </size>
- </property>
- </widget>
- </item>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string>Input Data</string>
+ </attribute>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="geometry">
+ <rect>
+ <x>9</x>
+ <y>9</y>
+ <width>331</width>
+ <height>71</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Mode Selection</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Mode : </string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>100</y>
+ <width>331</width>
+ <height>321</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Parameter Selection</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QFormLayout" name="formLayout"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QPushButton" name="pushButton_2">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>430</y>
+ <width>331</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Submit</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QWidget" name="tab_2">
+ <attribute name="title">
+ <string>Results</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
- <widget class="QPushButton" name="pushButton_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>30</width>
- <height>30</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>30</width>
- <height>30</height>
- </size>
- </property>
- <property name="text">
- <string>GO</string>
+ <widget class="QTableWidget" name="tableWidget">
+ <property name="columnCount">
+ <number>3</number>
</property>
+ <attribute name="horizontalHeaderDefaultSectionSize">
+ <number>110</number>
+ </attribute>
+ <attribute name="horizontalHeaderStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string>Attribute</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Unit</string>
+ </property>
+ </column>
</widget>
</item>
</layout>
</widget>
</widget>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>90</y>
- <width>231</width>
- <height>251</height>
- </rect>
- </property>
- <property name="title">
- <string>Parameter Selection</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <widget class="QWidget" name="formLayoutWidget">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>20</y>
- <width>211</width>
- <height>221</height>
- </rect>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
- </property>
- </layout>
- </widget>
- </widget>
</widget>
<resources/>
<connections/>
diff --git a/icons/plus.png b/icons/plus.png
new file mode 100644
index 0000000..08a6564
--- /dev/null
+++ b/icons/plus.png
Binary files differ
diff --git a/mainApp.py b/mainApp.py
index 79c9f67..60f2b8b 100644
--- a/mainApp.py
+++ b/mainApp.py
@@ -15,9 +15,7 @@ import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import PyQt5.QtWidgets as QtWidgets
from component_selector import *
-from dockWidget import dockWidget
from Bin_Phase_env import *
-from resDockWidget import resdockWidget
from UnitOperations import *
from Streams import *
import datetime
@@ -43,9 +41,9 @@ class MainApp(QMainWindow,ui):
# Loading and setting up style sheet
self.setupUi(self)
- style = open('cyan.css','r')
- style = style.read()
- self.setStyleSheet(style)
+ # style = open('cyan.css','r')
+ # style = style.read()
+ # self.setStyleSheet(style)
# Initializing attributes
self.zoomcount = 0
@@ -136,7 +134,7 @@ class MainApp(QMainWindow,ui):
def BinPhaseEnv(self):
#compounds = self.comp.getComp()
if len(self.comp.getComp())<2:
- QMessageBox.about(self, 'Important', "Please select atleast 2 Compounds first")
+ QMessageBox.about(self, 'Important', "Please select at least 2 Compounds first")
self.comp.show()
#compunds = self.comp.getComp()
else:
@@ -166,10 +164,6 @@ class MainApp(QMainWindow,ui):
def simulate(self,mode):
self.thrd = threading.Thread(target=self.Container.simulate, args=(mode,))
self.thrd.start()
- self.dockWidget_2.show()
- self.res = resdockWidget(self.Container)
- self.addDockWidget(Qt.LeftDockWidgetArea, self.res)
- self.res.show()
def terminate(self):
os.chdir(self.Container.flowsheet.root_dir)
diff --git a/paramDock.ui b/paramDock.ui
deleted file mode 100644
index b48ac9b..0000000
--- a/paramDock.ui
+++ /dev/null
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Form</class>
- <widget class="QWidget" name="Form">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>250</width>
- <height>321</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>250</width>
- <height>250</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>600</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <widget class="QWidget" name="horizontalLayoutWidget">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>20</y>
- <width>221</width>
- <height>32</height>
- </rect>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>30</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>30</height>
- </size>
- </property>
- <property name="text">
- <string>Mode:-</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="comboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>30</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButton_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>30</width>
- <height>30</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>30</width>
- <height>30</height>
- </size>
- </property>
- <property name="text">
- <string>GO</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QPushButton" name="pushButton">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>290</y>
- <width>231</width>
- <height>23</height>
- </rect>
- </property>
- <property name="text">
- <string>Submit</string>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- <property name="default">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QWidget" name="widget" native="true">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>60</y>
- <width>231</width>
- <height>221</height>
- </rect>
- </property>
- <widget class="QWidget" name="formLayoutWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>10</y>
- <width>231</width>
- <height>211</height>
- </rect>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
- </property>
- </layout>
- </widget>
- </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/resDock.ui b/resDock.ui
deleted file mode 100644
index 5f948e5..0000000
--- a/resDock.ui
+++ /dev/null
@@ -1,187 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Form</class>
- <widget class="QWidget" name="Form">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>352</width>
- <height>650</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>350</width>
- <height>500</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>3500</width>
- <height>5000</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <widget class="QWidget" name="widget" native="true">
- <property name="geometry">
- <rect>
- <x>9</x>
- <y>9</y>
- <width>334</width>
- <height>631</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label_6">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>20</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>30</height>
- </size>
- </property>
- <property name="text">
- <string>Select Component :</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="comboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>20</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>450</width>
- <height>20</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButton_3">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>20</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>250</width>
- <height>20</height>
- </size>
- </property>
- <property name="text">
- <string>Submit</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QTableWidget" name="tableWidget">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>325</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>3200</width>
- <height>5000</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="styleSheet">
- <string notr="true">alternate-background-color:rgb(255, 170, 127) ;
-background-color: white;
-</string>
- </property>
- <property name="columnCount">
- <number>2</number>
- </property>
- <column>
- <property name="text">
- <string>Property</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Value</string>
- </property>
- </column>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/resDockWidget.py b/resDockWidget.py
deleted file mode 100644
index 52b86f8..0000000
--- a/resDockWidget.py
+++ /dev/null
@@ -1,92 +0,0 @@
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5.uic import loadUiType
-import pandas as pd
-from functools import partial
-from component_selector import *
-from collections import defaultdict
-from container import *
-
-ui_dialog,_ = loadUiType('resDock.ui')
-
-class resdockWidget(QDockWidget,ui_dialog):
-
- def __init__(self,containerobj,parent=None):
- QDockWidget.__init__(self,parent)
- self.setupUi(self)
- self.setWindowTitle("Results")
- self.nameType = None
- self.Container = containerobj
- self.results()
-
- self.pushButton_3.clicked.connect(self.resultTree)
-
- def abriveation(self,key):
- d ={"P":"Pressure","T":"Temperature",
- "xliq":"Liquid Phase Mol Fraction","xmliq":"Liquid Pase Mass Fraction",
- "xvap":"Vapour Phase Mol Fracrion","xmvap":"Vapour Phase Mass Fracrion",
- "F_p[1]":"Molar Flow","Fm_p[1]":"Mass Flow","MW_p[1]":"Mixer Phase Molecular Weight",
- "MW_p[2]":"Liquid Phase Molecular Weight","MW_p[3]":"Vapour Phase Molecular Weight",
- "Cp_p[1]":"Mixer Phase molar Heat Capacity","Cp_p[2]":"Liquid Phase molar Heat Capacity",
- "Cp_p[3]":"Vapour Phase molar Heat Capacity","H_p[1]":"Mixer Phase Molar Enthalpy",
- "H_p[2]":"Liquid Phase Molar Enthalpy","H_p[3]":"Vapour Phase Molar Enthalpy",
- "S_p[1]":"Mixer Phase Molar Entropy","S_p[2]":"Liquid Phase Molar Entropy",
- "S_p[3]":"Vapour Phase Molar Entropy","F_p[2]":"Liquid Phase Molar Flow Rate",
- "F_p[3]":"Vapour Phase Molar Flow Rate","Fm_p[2]":"Liquid Phase Mass Flow Rate",
- "F_p[3]":"Liquid Phase Mass Flow Rate",
- }
-
- for i in range(len(compound_selected)):
- d["compMolFrac[1,"+str(i+1)+"]"] = str(compound_selected[i]) +" Mixer mole fraction"
- d["compMolFrac[2,"+str(i+1)+"]"] = str(compound_selected[i]) +" Liquid mole fraction"
- d["compMolFrac[3,"+str(i+1)+"]"] = str(compound_selected[i]) +" Vapour mole fraction"
-
- d["compMasFrac[1,"+str(i+1)+"]"] = str(compound_selected[i]) +" Mixer mass fraction"
- d["compMasFrac[2,"+str(i+1)+"]"] = str(compound_selected[i]) +" Liquid mass fraction"
- d["compMasFrac[3,"+str(i+1)+"]"] = str(compound_selected[i]) +" Vapour mass fraction"
-
- d["compMasFlo[1,"+str(i+1)+"]"] = str(compound_selected[i]) +" Mixer mass flo"
- d["compMasFlo[2,"+str(i+1)+"]"] = str(compound_selected[i]) +" Liquid mass flo"
- d["compMasFlo[3,"+str(i+1)+"]"] = str(compound_selected[i]) +" Vapour mass flo"
-
- d["compMolFlo[1,"+str(i+1)+"]"] = str(compound_selected[i]) +" Mixer mole flo"
- d["compMolFlo[2,"+str(i+1)+"]"] = str(compound_selected[i]) +" Liquid mole flo"
- d["compMolFlo[3,"+str(i+1)+"]"] = str(compound_selected[i]) +" Vapour mole flo"
- if key in d.keys():
- return d[key]
- else:
- return key
-
- def resultsCategory(self,name):
- try:
- print("Under result category")
- result=self.Container.result
- obj = self.Container.fetchObject(name)
- self.tableWidget.setRowCount(0)
- for key, value in obj.Prop.items():
- propertyname = name + '.' + key
- print(key,value)
- if propertyname in result[0]:
- ind = result[0].index(propertyname)
- resultval = str(result[-1][ind])
- #stm.Prop[key] = resultval
- print("######Resultsfetch####",key,resultval)
- rowPosition = self.tableWidget.rowCount()
- self.tableWidget.insertRow(rowPosition)
- self.tableWidget.setItem(rowPosition , 0, QTableWidgetItem(str(self.abriveation(key))))
- self.tableWidget.setItem(rowPosition , 1, QTableWidgetItem(str(resultval)))
- self.tableWidget.resizeColumnsToContents()
- except Exception as e:
- print(e)
-
-
- def resultTree(self):
- self.resultsCategory(self.comboBox.currentText())
-
- def results(self): # Should be named as selecting object whose result is to be displayed
- self.nameType={}
- for i in self.Container.unitOp:
- #nameslist.append(i.name)
- self.nameType[i.name] = i.type
- self.comboBox.addItem(str(i.name)) \ No newline at end of file