summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ComponentSelector.py1
-rw-r--r--DockWidgets/DockWidgetMaterialStream.py69
-rw-r--r--DockWidgets/DockWidgetMaterialStream.ui223
-rw-r--r--DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pycbin8326 -> 8132 bytes
-rw-r--r--Streams.py36
-rw-r--r--Undo.datbin0 -> 3191 bytes
-rw-r--r--UnitOperations.py6
7 files changed, 158 insertions, 177 deletions
diff --git a/ComponentSelector.py b/ComponentSelector.py
index 64ca167..80c88d8 100644
--- a/ComponentSelector.py
+++ b/ComponentSelector.py
@@ -2,6 +2,7 @@ from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.uic import loadUiType
+import os, sys
import pandas as pd
from Simulator.Databases.Databases import ChemsepDatabase
ui_dialog,_ = loadUiType('ComponentSelector.ui')
diff --git a/DockWidgets/DockWidgetMaterialStream.py b/DockWidgets/DockWidgetMaterialStream.py
index de223c3..d272933 100644
--- a/DockWidgets/DockWidgetMaterialStream.py
+++ b/DockWidgets/DockWidgetMaterialStream.py
@@ -30,7 +30,7 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
header = QTreeWidgetItem(['Compound','Value','Unit'])
self.mTreeWidget.setHeaderItem(header)
self.lTreeWidget.setHeaderItem(header)
- self.vTreeWidget.setHeaderItem(header)
+ self.vTreeWidget.setHeaderItem(header)
# input data tab
def modes(self):
@@ -68,9 +68,10 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
print('l = ', str(self.obj.variables['x_pc']['value'][j]))
self.input_dict[i] = "x_pc"
- lay.addWidget(QLabel(str(compound_selected[j])+":"),j,0, alignment=Qt.AlignLeft)
+ 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)
+ lay.setSizeConstraint(QLayout.SetFixedSize)
gp.setLayout(lay)
self.formLayout.addRow(gp)
else:
@@ -155,7 +156,6 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
# result data tab
def results_category(self,name):
- flag = True
try:
print("Under result category name ", name)
result=self.container.result
@@ -181,9 +181,13 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
print(ll)
j = 0
- t = 0
- namee = klst[j]
+ namee = 'none'
print("namee ", namee)
+ #initialization for treewidgets
+ lroot = 1
+ mroot = 1
+ vroot = 1
+
for i,k in enumerate(ll):
ind = result[0].index(k)
@@ -193,40 +197,29 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
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
+
+ if namee not in k:
+ mroot = QTreeWidgetItem(self.mTreeWidget, [lst[j]])
+ lroot = QTreeWidgetItem(self.lTreeWidget, [lst[j]])
+ vroot = QTreeWidgetItem(self.vTreeWidget, [lst[j]])
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
+
+ phase_no = int(k[k.index(',') - 1]) # phase no is from modelica list
+ compound_no = int(k[k.index(',') + 1]) - 1 # compound is from python list
+
+ if phase_no == 1:
+ child = QTreeWidgetItem(mroot, [compound_selected[compound_no], str(resultval),
+ obj.variables[k.split('.')[1]]['unit']])
+ elif phase_no == 2:
+ child = QTreeWidgetItem(lroot, [compound_selected[compound_no], str(resultval),
+ obj.variables[k.split('.')[1]]['unit']])
+ elif phase_no == 3:
+ child = QTreeWidgetItem(vroot, [compound_selected[compound_no], str(resultval),
+ obj.variables[k.split('.')[1]]['unit']])
+ if (compound_no + 1) == len(compound_selected):
+ j += 1
+
+
# Phase Properties Tab
phaseResLst = []
diff --git a/DockWidgets/DockWidgetMaterialStream.ui b/DockWidgets/DockWidgetMaterialStream.ui
index a442eee..15807ca 100644
--- a/DockWidgets/DockWidgetMaterialStream.ui
+++ b/DockWidgets/DockWidgetMaterialStream.ui
@@ -47,127 +47,114 @@
<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>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
</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="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Mode Selection</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
<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>
+ <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>
- </item>
- </layout>
- </widget>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>100</y>
- <width>331</width>
- <height>221</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>390</y>
- <width>331</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>Submit</string>
- </property>
- </widget>
- <widget class="QGroupBox" name="groupBox_3">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>330</y>
- <width>331</width>
- <height>51</height>
- </rect>
- </property>
- <property name="title">
- <string/>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_10">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_11">
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Parameter Selection</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
<item>
- <widget class="QLabel" name="label_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Thermo Package</string>
- </property>
- </widget>
+ <layout class="QFormLayout" name="formLayout"/>
</item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_10">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
+ </property>
<item>
- <widget class="QComboBox" name="cbTP">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout_11">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Thermo Package</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="cbTP">
+ <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>
- </item>
- </layout>
- </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButton_2">
+ <property name="text">
+ <string>Submit</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
@@ -205,8 +192,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>335</width>
- <height>494</height>
+ <width>341</width>
+ <height>518</height>
</rect>
</property>
<property name="styleSheet">
@@ -318,8 +305,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>151</width>
- <height>128</height>
+ <width>137</width>
+ <height>96</height>
</rect>
</property>
<property name="styleSheet">
@@ -407,8 +394,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>151</width>
- <height>128</height>
+ <width>137</width>
+ <height>96</height>
</rect>
</property>
<property name="styleSheet">
diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc
index 4f5c2cd..f3850cf 100644
--- a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc
Binary files differ
diff --git a/Streams.py b/Streams.py
index d9b939e..3cf3fc0 100644
--- a/Streams.py
+++ b/Streams.py
@@ -33,21 +33,21 @@ class MaterialStream():
'P' : {'name':'Pressure', 'value':101325, 'unit':'Pa'},
'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':100, 'unit':'g/s'},
+ 'xvap' : {'name':'Vapour Phase Mole Fraction', 'value':None, 'unit':''},
+ 'H_p[1]' : {'name':'Mixture Phase Molar Entalpy', 'value':None, 'unit':'J/mol'},
+ 'S_p[1]' : {'name':'Mixture Phase Molar Entropy', 'value':None, 'unit':'J/mol.K'},
+ 'F_p[1]' : {'name':'Mixture Molar Flow Rate', 'value':100, 'unit':'mol/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[2]' : {'name':'Liquid Phase Molar Entalpy', 'value':None, 'unit':'J/mol'},
+ 'S_p[2]' : {'name':'Liquid Phase Molar Entropy', 'value':None, 'unit':'J/mol.K'},
+ 'F_p[2]' : {'name':'Liquid Molar Flow Rate', 'value':None, 'unit':'mol/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'},
+ 'H_p[3]' : {'name':'Vapour Phase Molar Entalpy', 'value':None, 'unit':'J/mol'},
+ 'S_p[3]' : {'name':'Vapour Phase Molar Entropy', 'value':None, 'unit':'J/mol.K'},
+ 'F_p[3]' : {'name':'Vapour Molar Flow Rate', 'value':None, 'unit':'mol/s'},
- 'x_pc' : {'name':'Mole Fraction', 'value':[], 'unit':'mol/s'},
- 'xm_pc' : {'name':'Mass Fraction', 'value':None, 'unit':'g/s'},
+ 'x_pc' : {'name':'Mole Fraction', 'value':[], 'unit':''},
+ 'xm_pc' : {'name':'Mass Fraction', 'value':None, 'unit':''},
'F_pc' : {'name':'Mole Flow', 'value':100, 'unit':'mol/s'},
'Fm_pc' : {'name':'Mass Flow', 'value':None, 'unit':'g/s'},
@@ -57,18 +57,18 @@ class MaterialStream():
def init_variables(self):
Nc = len(self.compound_names)
for i, val in enumerate(self.compound_names):
- self.variables['x_pc[1,'+ str(i+1)+']'] = {'name':val + ' Mixture Mole Fraction', 'value':round(1/Nc,4), 'unit':'mol/s'}
- self.variables['xm_pc[1,'+ str(i+1)+']'] = {'name':val + ' Mixture Mass Fraction', 'value':None, 'unit':'g/s'}
+ self.variables['x_pc[1,'+ str(i+1)+']'] = {'name':val + ' Mixture Mole Fraction', 'value':round(1/Nc,4), 'unit':''}
+ self.variables['xm_pc[1,'+ str(i+1)+']'] = {'name':val + ' Mixture Mass Fraction', 'value':None, 'unit':''}
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['x_pc[2,'+ str(i+1)+']'] = {'name':[val + ' Liquid Mole Fraction'], 'value':None, 'unit':''}
+ self.variables['xm_pc[2,'+ str(i+1)+']'] = {'name':[val + ' Liquid Mass Fraction'], 'value':None, 'unit':''}
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['x_pc[3,'+ str(i+1)+']'] = {'name':[val + ' Vapour Mole Fraction'], 'value':None, 'unit':''}
+ self.variables['xm_pc[3,'+ str(i+1)+']'] = {'name':[val + ' Vapour Mass Fraction'], 'value':None, 'unit':''}
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'}
diff --git a/Undo.dat b/Undo.dat
index e69de29..914294e 100644
--- a/Undo.dat
+++ b/Undo.dat
Binary files differ
diff --git a/UnitOperations.py b/UnitOperations.py
index 5c53f59..410cdd1 100644
--- a/UnitOperations.py
+++ b/UnitOperations.py
@@ -178,8 +178,8 @@ class ShortcutColumn(UnitOperation):
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'},
+ 'HKey_x_pc' : {'name':'Heavy Key Mole Fraction', 'value':0.01, 'unit':''},
+ 'LKey_x_pc' : {'name':'Light Key Mole Fraction', 'value':0.01, 'unit':''},
'Ctype' : {'name':'Condensor Type', 'value':None, 'unit':''},
'thermo_package' : {'name':'Thermo Package', 'value':'Raoults_Law', 'unit':''},
'Pcond' : {'name':'Condensor Pressure', 'value':101325, 'unit':'Pa'},
@@ -306,7 +306,7 @@ class CompoundSeparator(UnitOperation):
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']
+ self.SepFact_modes = ['Molar_Flow (mol/s)', 'Mass_Flow (g/s)', 'Inlet_Molar_Flow_Percent', 'Outlet_Molar_Flow_Percent']
type(self).counter += 1
self.variables = {