summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriyam Nayak2021-04-09 19:10:49 +0530
committerGitHub2021-04-09 19:10:49 +0530
commitd11902175b1bfb5c4fc854b3335fc5686a725647 (patch)
tree61242c7ae3f4cf5bd55bbd55431f380644b56d54
parent47a2cf43129fa18cbac56df8d53208a1b21ea4f7 (diff)
parentf788ec71ae3fe5e015bb16c1c76b0d278e8a4223 (diff)
downloadChemical-Simulator-GUI-d11902175b1bfb5c4fc854b3335fc5686a725647.tar.gz
Chemical-Simulator-GUI-d11902175b1bfb5c4fc854b3335fc5686a725647.tar.bz2
Chemical-Simulator-GUI-d11902175b1bfb5c4fc854b3335fc5686a725647.zip
Merge pull request #13 from pravindalve/master
Distillation Column Results
-rw-r--r--DockWidgets/DistillationColumnStagewiseResults.py12
-rw-r--r--DockWidgets/DistillationColumnStagewiseResults.ui62
-rw-r--r--DockWidgets/DockWidgetDistillationColumn.py189
-rw-r--r--DockWidgets/DockWidgetDistillationColumn.ui434
-rw-r--r--DockWidgets/DockWidgetMaterialStream.ui4
-rw-r--r--DockWidgets/__pycache__/DockWidget.cpython-37.pycbin4390 -> 4411 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pycbin5219 -> 9426 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pycbin8254 -> 8254 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pycbin4646 -> 4613 bytes
-rw-r--r--OMChem/Flowsheet.py2
-rw-r--r--Simulator/Simulator/UnitOperations/DistillationColumn/Cond.mo4
-rw-r--r--Streams.py1
-rw-r--r--Undo.datbin1981 -> 28916 bytes
-rw-r--r--UnitOperations.py40
14 files changed, 531 insertions, 217 deletions
diff --git a/DockWidgets/DistillationColumnStagewiseResults.py b/DockWidgets/DistillationColumnStagewiseResults.py
new file mode 100644
index 0000000..c5bd67d
--- /dev/null
+++ b/DockWidgets/DistillationColumnStagewiseResults.py
@@ -0,0 +1,12 @@
+from PyQt5.uic import loadUiType
+from PyQt5.QtWidgets import QWidget
+
+ui_dialog,_ = loadUiType('DockWidgets/DistillationColumnStagewiseResults.ui')
+
+
+class DistillationColumnStagewiseResults(QWidget,ui_dialog):
+
+ def __init__(self, parent=None):
+ QWidget.__init__(self, parent)
+ self.setupUi(self)
+ # self.setWindowTitle(self.parent.obj.name)
diff --git a/DockWidgets/DistillationColumnStagewiseResults.ui b/DockWidgets/DistillationColumnStagewiseResults.ui
new file mode 100644
index 0000000..9ce4060
--- /dev/null
+++ b/DockWidgets/DistillationColumnStagewiseResults.ui
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DistillationColumnStagewiseResults</class>
+ <widget class="QWidget" name="DistillationColumnStagewiseResults">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>594</width>
+ <height>411</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="geometry">
+ <rect>
+ <x>-1</x>
+ <y>-1</y>
+ <width>591</width>
+ <height>411</height>
+ </rect>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="T">
+ <attribute name="title">
+ <string>Temperature(K)</string>
+ </attribute>
+ <widget class="QTableWidget" name="T_table">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>591</width>
+ <height>391</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QWidget" name="x_pc">
+ <attribute name="title">
+ <string>Component Mole Fractions</string>
+ </attribute>
+ <widget class="QTableWidget" name="x_pc_table">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>591</width>
+ <height>391</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/DockWidgets/DockWidgetDistillationColumn.py b/DockWidgets/DockWidgetDistillationColumn.py
index dea2391..e98ba03 100644
--- a/DockWidgets/DockWidgetDistillationColumn.py
+++ b/DockWidgets/DockWidgetDistillationColumn.py
@@ -6,11 +6,13 @@ import pandas as pd
from functools import partial
from ComponentSelector import *
from collections import defaultdict
+from DockWidgets.DistillationColumnStagewiseResults import DistillationColumnStagewiseResults
from Graphics import *
ui_dialog,_ = loadUiType('DockWidgets/DockWidgetDistillationColumn.ui')
-class DockWidgetDistillationColumn(QDockWidget,ui_dialog):
+
+class DockWidgetDistillationColumn(QDockWidget, ui_dialog):
def __init__(self,name,comptype,obj,container,parent=None):
QDockWidget.__init__(self,parent)
@@ -25,6 +27,8 @@ class DockWidgetDistillationColumn(QDockWidget,ui_dialog):
self.input_params_list()
self.name_type = None
self.container = container
+ self.stage_res_table = DistillationColumnStagewiseResults()
+ self.stageResultsButton.clicked.connect(self.showStagewiseResults)
# input data tab
@@ -40,7 +44,6 @@ class DockWidgetDistillationColumn(QDockWidget,ui_dialog):
self.lay1.addWidget(l1,0,1, alignment=Qt.AlignLeft)
self.input_dict.append(l1)
-
for i in range(self.obj.variables['Ni']['value']):
print(i)
l = QLineEdit()
@@ -102,6 +105,13 @@ class DockWidgetDistillationColumn(QDockWidget,ui_dialog):
self.input_dict.append(self.cb4)
self.input_dict.append(self.le8)
+ self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
+ for j in self.lines:
+ self.cbTP.addItem(str(j))
+ self.cbTP.setCurrentText(self.obj.variables['thermo_package']['value'])
+
+ self.input_dict.append(self.cbTP)
+
# self.input_dict = [self.le1, self.le2, self.le3, self.cb5, self.le5, self.cb1, self.cb2, self.le6, self.le7, self.cb3, self.cb4, self.le8]
except Exception as e:
@@ -154,7 +164,9 @@ class DockWidgetDistillationColumn(QDockWidget,ui_dialog):
print(temp+8)
self.dict.append(int(self.input_dict[temp+9].text()))
print(temp+9)
-
+ self.dict.append(self.input_dict[temp+10].currentText())
+ print(temp + 10)
+
print("param ", self.dict)
self.obj.param_setter(self.dict)
self.hide()
@@ -162,14 +174,175 @@ class DockWidgetDistillationColumn(QDockWidget,ui_dialog):
except Exception as e:
print(e)
+ def showStagewiseResults(self):
+ self.stage_res_table.show()
@staticmethod
def showResult(lst):
- #DockWidget1.flag = True
+ # DockWidget1.flag = True
for i in lst:
- i.resultsCategory(i.name)
- #i.show()
+ try:
+ i.results_category(i.name)
+ except AttributeError:
+ pass
+
+ def clear_results(self):
+ self.tableWidget.setRowCount(0)
+ self.stage_res_table.T_table.setRowCount(0)
+ self.stage_res_table.T_table.setColumnCount(0)
+ self.stage_res_table.x_pc_table.setRowCount(0)
+ self.stage_res_table.x_pc_table.setColumnCount(0)
# result data tab
- def resultsCategory(self,name):
- pass \ No newline at end of file
+ def results_category(self,name):
+ flag = True
+ try:
+ print("Under result category name ", name)
+ result = self.container.result
+ obj = self.container.fetch_object(name)
+ self.tableWidget.setRowCount(0)
+ variKeys = obj.result_parameters
+ 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])
+ obj.variables[val]['value'] = 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()
+
+ # Stagewise Results
+ Nt = self.obj.variables['Nt']['value']
+ Nc = len(self.obj.compounds)
+ # initializing temporary arrays
+ Stages_T = [None]*Nt
+ # Can be uncommented when F_p and F_pc implemented in modelica table
+ # Stages_F_p = [[None for i in range(3)] for j in range(Nt)]
+ # Stages_F_pc = [[[None for i in range(3)] for j in range(Nc)] for k in range(Nt)]
+ Stages_x_pc = [[[None for i in range(3)] for j in range(Nc)] for k in range(Nt)]
+
+ Stages_res_varikeys = ['T']
+ for i in range(Nc):
+ for j in range(3):
+ Stages_res_varikeys.append('x_pc[' + str(j + 1) + ',' + str(i + 1) + ']')
+
+ for v in Stages_res_varikeys:
+ propertyname = name + '.condenser.' + v
+ if propertyname in result[0]:
+ ind = result[0].index(propertyname)
+ if v == 'T':
+ Stages_T[0] = result[-1][ind]
+ # Can be uncommented when F_p is implemented in modelica model
+ # elif v == 'F_p':
+ # if result[0][ind][result[0][ind].index('[') + 1] == '1':
+ # Stages_F_p[0][0] = result[-1][ind]
+ # elif result[0][ind][result[0][ind].index('[') + 1] == '2':
+ # Stages_F_p[0][1] = result[-1][ind]
+ # else:
+ # Stages_F_p[0][2] = result[-1][ind]
+ else:
+ print(ind)
+ phase_no = int(result[0][ind][result[0][ind].index('[') + 1])
+ comp_no = int(result[0][ind][result[0][ind].index(']') - 1])
+ Stages_x_pc[0][comp_no - 1][phase_no - 1] = result[-1][ind]
+ # Can be uncommented and improved when F_pc implemented in modelica model
+ # if v == 'F_pc':
+ # Stages_F_pc[0][comp_no - 1][phase_no - 1] = result[-1][ind]
+ # else:
+ # Stages_x_pc[0][comp_no - 1][phase_no - 1] = result[-1][ind]
+
+ for i in range(1, Nt - 1):
+ propertyname = name + '.tray[' + str(i) + '].' + v
+ if propertyname in result[0]:
+ ind = result[0].index(propertyname)
+ if v == 'T':
+ Stages_T[i] = result[-1][ind]
+ # Can be uncommented when F_p implemented in modelica model
+ # elif v == 'F_p':
+ # if result[0][ind][result[0][ind].index('[') + 1] == '1':
+ # Stages_F_p[i][0] = result[-1][ind]
+ # elif result[0][ind][result[0][ind].index('[') + 1] == '2':
+ # Stages_F_p[i][1] = result[-1][ind]
+ # else:
+ # Stages_F_p[i][2] = result[-1][ind]
+ else:
+ print(ind)
+ print(result[0][ind])
+ phase_no = int(result[0][ind].split('.')[-1][result[0][ind].split('.')[-1].index('[') + 1])
+ comp_no = int(result[0][ind].split('.')[-1][result[0][ind].split('.')[-1].index(']') - 1])
+ Stages_x_pc[i][comp_no - 1][phase_no - 1] = result[-1][ind]
+ # Can be uncommented when F_pc implemented in modelica model
+ # if v == 'F_pc':
+ # Stages_F_pc[i][comp_no - 1][phase_no - 1] = result[-1][ind]
+ # else:
+ # Stages_x_pc[i][comp_no - 1][phase_no - 1] = result[-1][ind]
+
+ propertyname = name + '.reboiler.' + v
+ if propertyname in result[0]:
+ ind = result[0].index(propertyname)
+ if v == 'T':
+ Stages_T[-1] = result[-1][ind]
+ # Can be uncommented when F_p implemented in modelica model
+ # elif v == 'F_p':
+ # if result[0][ind][result[0][ind].index('[') + 1] == '1':
+ # Stages_F_p[-1][0] = result[-1][ind]
+ # elif result[0][ind][result[0][ind].index('[') + 1] == '2':
+ # Stages_F_p[-1][1] = result[-1][ind]
+ # else:
+ # Stages_F_p[-1][2] = result[-1][ind]
+ else:
+ print(ind)
+ phase_no = int(result[0][ind][result[0][ind].index('[') + 1])
+ comp_no = int(result[0][ind][result[0][ind].index(']') - 1])
+ Stages_x_pc[-1][comp_no - 1][phase_no - 1] = result[-1][ind]
+ # Can be uncommented when F_pc implemented in modelica model
+ # if v == 'F_pc':
+ # Stages_F_pc[-1][comp_no - 1][phase_no - 1] = result[-1][ind]
+ # else:
+ # Stages_x_pc[-1][comp_no - 1][phase_no - 1] = result[-1][ind]
+
+ # Assigning temp variables to obj variabes
+ self.obj.variables['Stages.T']['value'] = Stages_T
+ # Can be uncommented when F_p and F_pc implemented in modelica model
+ # self.obj.variables['Stages.F_p']['value'] = Stages_F_p
+ # self.obj.variables['Stages.F_pc']['value'] = Stages_F_pc
+ self.obj.variables['Stages.x_pc']['value'] = Stages_x_pc
+
+ # filling stagewise result table
+ tables = [self.stage_res_table.T_table, self.stage_res_table.x_pc_table]
+ # Can be uncommented when F_p and F_pc implemented in modelica model
+ # tables = [self.stage_res_table.T_table, self.stage_res_table.F_p_table, self.stage_res_table.F_pc_table, self.stage_res_table.x_pc_table]
+
+ for t in tables:
+ t.setRowCount(Nt)
+ t.setVerticalHeaderItem(0, QTableWidgetItem('Condenser'))
+ t.setVerticalHeaderItem(Nt -1, QTableWidgetItem('Reboiler'))
+ for i in range(1, Nt - 1):
+ t.setVerticalHeaderItem(i, QTableWidgetItem('Stage ' + str(i)))
+
+ T_table = self.stage_res_table.T_table
+ T_table.setColumnCount(1)
+ for i in range(Nt):
+ T_table.setItem(i, 0, QTableWidgetItem(Stages_T[i]))
+
+ x_pc_table = self.stage_res_table.x_pc_table
+ x_pc_table.setColumnCount(2*Nc)
+ for i in range(Nc):
+ x_pc_table.setHorizontalHeaderItem(2*i, QTableWidgetItem(self.obj.compounds[i] + '(Vapor)'))
+ x_pc_table.setHorizontalHeaderItem(2*i + 1, QTableWidgetItem(self.obj.compounds[i] + '(Liquid)'))
+
+ for i in range(Nt):
+ for j in range(Nc):
+ x_pc_table.setItem(i, 2*j, QTableWidgetItem(Stages_x_pc[i][j][1]))
+ x_pc_table.setItem(i, 2 * j + 1, QTableWidgetItem(Stages_x_pc[i][j][2]))
+ for t in tables:
+ t.resizeColumnsToContents()
+ except Exception as e:
+ print(e)
diff --git a/DockWidgets/DockWidgetDistillationColumn.ui b/DockWidgets/DockWidgetDistillationColumn.ui
index 7e63254..932cbdd 100644
--- a/DockWidgets/DockWidgetDistillationColumn.ui
+++ b/DockWidgets/DockWidgetDistillationColumn.ui
@@ -9,7 +9,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>392</width>
+ <width>382</width>
<height>700</height>
</rect>
</property>
@@ -31,216 +31,278 @@
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
- <x>10</x>
+ <x>0</x>
<y>30</y>
- <width>361</width>
- <height>621</height>
+ <width>381</width>
+ <height>481</height>
</rect>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="currentIndex">
- <number>0</number>
+ <number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Input Data</string>
</attribute>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>10</y>
- <width>331</width>
- <height>204</height>
- </rect>
- </property>
- <property name="title">
- <string>Parameter Selection</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_10">
- <property name="sizeConstraint">
- <enum>QLayout::SetFixedSize</enum>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget_5">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <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>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab1">
- <attribute name="title">
- <string>General</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_6">
- <item>
- <layout class="QGridLayout" name="lay1">
- <property name="sizeConstraint">
- <enum>QLayout::SetDefaultConstraint</enum>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab2">
- <attribute name="title">
- <string>Condenser</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <item>
- <layout class="QGridLayout" name="lay2">
- <item row="3" column="0">
- <widget class="QLabel" name="l7">
- <property name="text">
- <string>TextLabel</string>
+ <item>
+ <widget class="QTabWidget" name="tabWidget_5">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab1">
+ <attribute name="title">
+ <string>General</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <layout class="QGridLayout" name="lay1">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
</property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="l4">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="l5">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QComboBox" name="cb1"/>
- </item>
- <item row="1" column="2">
- <widget class="QLineEdit" name="le5"/>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="l6">
- <property name="text">
- <string>TextLabel</string>
+ <property name="verticalSpacing">
+ <number>0</number>
</property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QComboBox" name="cb2">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QLabel" name="u1">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="QLabel" name="u2">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="QLineEdit" name="le6"/>
- </item>
- <item row="0" column="2">
- <widget class="QComboBox" name="cb5"/>
+ </layout>
</item>
</layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab3">
- <attribute name="title">
- <string>Reboiler</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_7">
- <item>
- <layout class="QGridLayout" name="lay3">
- <item row="4" column="0">
- <widget class="QLabel" name="l9">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="l8">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="l10">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="5" column="2">
- <widget class="QComboBox" name="cb4">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QLineEdit" name="le7"/>
+ </widget>
+ <widget class="QWidget" name="tab2">
+ <attribute name="title">
+ <string>Condenser</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <layout class="QGridLayout" name="lay2">
+ <item row="3" column="0">
+ <widget class="QLabel" name="l7">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="l4">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="l5">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QComboBox" name="cb1"/>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLineEdit" name="le5"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="l6">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QComboBox" name="cb2">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <widget class="QLabel" name="u1">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="QLabel" name="u2">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="2">
+ <widget class="QLineEdit" name="le6"/>
+ </item>
+ <item row="0" column="2">
+ <widget class="QComboBox" name="cb5"/>
+ </item>
+ </layout>
</item>
- <item row="4" column="2">
- <widget class="QComboBox" name="cb3"/>
- </item>
- <item row="6" column="2">
- <widget class="QLineEdit" name="le8"/>
- </item>
- <item row="3" column="3">
- <widget class="QLabel" name="u3">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab3">
+ <attribute name="title">
+ <string>Reboiler</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_7">
+ <item>
+ <layout class="QGridLayout" name="lay3">
+ <item row="4" column="0">
+ <widget class="QLabel" name="l9">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="l8">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="l10">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2">
+ <widget class="QComboBox" name="cb4">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QLineEdit" name="le7"/>
+ </item>
+ <item row="4" column="2">
+ <widget class="QComboBox" name="cb3"/>
+ </item>
+ <item row="6" column="2">
+ <widget class="QLineEdit" name="le8"/>
+ </item>
+ <item row="3" column="3">
+ <widget class="QLabel" name="u3">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QPushButton" name="pushButton_2">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>270</y>
- <width>331</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>Submit</string>
- </property>
- </widget>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Thermo Package</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="cbTP"/>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </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">
<string>Results</string>
</attribute>
- <layout class="QHBoxLayout" name="horizontalLayout_3"/>
+ <layout class="QVBoxLayout" name="verticalLayout_8">
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string/>
+ </property>
+ <widget class="QTableWidget" name="tableWidget">
+ <property name="geometry">
+ <rect>
+ <x>12</x>
+ <y>15</y>
+ <width>341</width>
+ <height>151</height>
+ </rect>
+ </property>
+ <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>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="stageResultsButton">
+ <property name="text">
+ <string>Stagewise Results</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</widget>
</widget>
diff --git a/DockWidgets/DockWidgetMaterialStream.ui b/DockWidgets/DockWidgetMaterialStream.ui
index 15807ca..8b9df28 100644
--- a/DockWidgets/DockWidgetMaterialStream.ui
+++ b/DockWidgets/DockWidgetMaterialStream.ui
@@ -305,8 +305,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>137</width>
- <height>96</height>
+ <width>341</width>
+ <height>518</height>
</rect>
</property>
<property name="styleSheet">
diff --git a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc
index 1a43e5b..a8934e2 100644
--- a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc
Binary files differ
diff --git a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc
index af05fb7..ee33ca4 100644
--- a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc
Binary files differ
diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc
index f2c5b98..395ced6 100644
--- a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc
Binary files differ
diff --git a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc
index bc4eb06..bc258f6 100644
--- a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc
Binary files differ
diff --git a/OMChem/Flowsheet.py b/OMChem/Flowsheet.py
index 79608ec..4fb0459 100644
--- a/OMChem/Flowsheet.py
+++ b/OMChem/Flowsheet.py
@@ -121,7 +121,7 @@ class Flowsheet():
self.stm = ['MaterialStream','EngStm']
for unitop in self.unit_operations:
if unitop.type not in self.stm:
- for j in unitop.output_stms:
+ for j in unitop.output_stms.values():
self.outlist.append(j)
for unitop in self.unit_operations:
diff --git a/Simulator/Simulator/UnitOperations/DistillationColumn/Cond.mo b/Simulator/Simulator/UnitOperations/DistillationColumn/Cond.mo
index 9518248..29fc163 100644
--- a/Simulator/Simulator/UnitOperations/DistillationColumn/Cond.mo
+++ b/Simulator/Simulator/UnitOperations/DistillationColumn/Cond.mo
@@ -71,8 +71,8 @@ within Simulator.UnitOperations.DistillationColumn;
En.Q = Q;
//Adjustment for thermodynamic packages
x_pc[1, :] = (Fout .* xout_c[:] + Fliqout .* xliqout_c[:]) ./ (Fout + Fliqout);
- x_pc[2, :] = xliqout_c[:];
- x_pc[3, :] = K_c[:] .* x_pc[2, :];
+ x_pc[2, :] = xliqout_c[:];
+ x_pc[3, :] = K_c[:] .* x_pc[2, :];
//Bubble point calculation
Pbubl = sum(gmabubl_c[:] .* x_pc[1, :] .* Pvap_c[:] ./ philiqbubl_c[:]);
//Dew point calculation
diff --git a/Streams.py b/Streams.py
index f5bdabe..4127945 100644
--- a/Streams.py
+++ b/Streams.py
@@ -311,7 +311,6 @@ class MaterialStream():
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)
diff --git a/Undo.dat b/Undo.dat
index d22999d..69b5ce3 100644
--- a/Undo.dat
+++ b/Undo.dat
Binary files differ
diff --git a/UnitOperations.py b/UnitOperations.py
index 33479d3..7f9ed5e 100644
--- a/UnitOperations.py
+++ b/UnitOperations.py
@@ -141,20 +141,21 @@ class UnitOperation():
if len(self.input_stms)>1 or self.type == 'Mixer':
strcount = 1
- for strm in self.input_stms:
+ for strm in self.input_stms.values():
self.OM_data_eqn += ('connect(' + strm.name + '.Out,' + self.name + '.In[' + str(strcount) + ']);\n')
strcount += 1
else:
- self.OM_data_eqn += ('connect(' + self.name + '.In,' + self.input_stms[0].name + '.Out);\n')
+ print(self.input_stms)
+ self.OM_data_eqn += ('connect(' + self.name + '.In,' + self.input_stms[1].name + '.Out);\n')
if len(self.output_stms)>1:
strcount = 1
- for strm in self.output_stms:
+ for strm in self.output_stms.values():
self.OM_data_eqn += ('connect(' + strm.name + '.In,' + self.name + '.Out[' + str(strcount) + ']);\n')
strcount += 1
else:
print("self.output_stms ", self.output_stms)
- self.OM_data_eqn += ('connect(' + self.name + '.Out,' + self.output_stms[0].name + '.In);\n')
+ self.OM_data_eqn += ('connect(' + self.name + '.Out,' + self.output_stms[1].name + '.In);\n')
if self.mode:
self.OM_data_eqn += (self.name + '.' + self.mode + '=' + str(self.mode_val) + ';\n')
@@ -219,7 +220,7 @@ class ShortcutColumn(UnitOperation):
def OM_Flowsheet_Equation(self):
self.OM_data_eqn = ''
- self.OM_data_eqn += ('connect(' + self.name + '.In,' + self.input_stms[0].name + '.Out);\n')
+ self.OM_data_eqn += ('connect(' + self.name + '.In,' + self.input_stms[1].name + '.Out);\n')
strcount = 1
for strm in self.output_stms:
@@ -246,6 +247,7 @@ class DistillationColumn(UnitOperation):
self.modes_list = []
self.parameters = ['Nt', 'Ni', 'Ctype', 'Pcond', 'condmode', 'C_comp', 'C_Spec', 'Preb', 'rebmode', 'rebcomp', 'R_Spec']
#self.parameters = ['Nt', 'InT_s', 'In_s', 'thermo_package', 'Ctype', 'Pcond', 'Preb']
+ self.result_parameters = ['Cduty.Q', 'Rduty.Q']
self.Cspec_list = ['Reflux Ratio','Product Molar Flow (mol/s)', 'Temperature (K)', 'Compound Molar Fraction', 'Compound Molar Flow (mol/s)']
self.Rspec_list = ['Product Molar Flow (mol/s)', 'Temperature (K)', 'Compound Molar Fraction', 'Compound Molar Flow (mol/s)']
@@ -257,12 +259,16 @@ class DistillationColumn(UnitOperation):
'Nout' : {'name':'No of Sidedraws', 'value':None, 'unit':''},
'Nt' : {'name':'No of Stages', 'value':12, 'unit':''},
'InT_s' : {'name':'Feed Stage', 'value':[], 'unit':''},
- 'thermo_package' : {'name':'Thermo Package', 'value':'Raoults_Law', 'unit':''},
+ 'thermo_package' : {'name':'Thermo Package', 'value':'Raoults_Law', 'unit':''},
'Ctype' : {'name':'Condenser Type', 'value':'Total', 'unit':''},
'Pcond' : {'name':'Condenser Pressure', 'value':101325, 'unit':'Pa'},
'Preb' : {'name':'Reboiler Pressure', 'value':101325, 'unit':'Pa'},
'C_Spec': {'name':'Condenser Specification', 'type':self.Cspec_list[0], 'value':'', 'comp':compound_selected[0], 'unit':''},
'R_Spec': {'name':'Reboiler Specification', 'type':self.Rspec_list[0], 'value':'', 'comp':compound_selected[0], 'unit':''},
+ 'Cduty.Q': {'name':'Condenser Duty', 'value': '', 'unit':'W'},
+ 'Rduty.Q': {'name':'Reboiler Duty', 'value': '', 'unit': 'W'},
+ 'Stages.T': {'name':'Stagewise Temperature', 'value':[], 'unit':'K'},
+ 'Stages.x_pc': {'name': 'Stagewise Component Mole Fraction', 'value':[],'unit':''}
}
def param_setter(self,params):
@@ -338,12 +344,12 @@ class DistillationColumn(UnitOperation):
# self.OM_data_eqn = self.OM_data_eqn + (
# 'connect(' + self.name + '.reboiler_duty' + ', ' + self.EngStm2.name + '.inlet);\n')
self.OM_data_eqn = self.OM_data_eqn + (
- 'connect(' + self.name + '.Dist' + ", " + self.output_stms[0].name + '.In);\n')
+ 'connect(' + self.name + '.Dist' + ", " + self.output_stms[1].name + '.In);\n')
self.OM_data_eqn = self.OM_data_eqn + (
- 'connect(' + self.name + '.Bot' + ", " + self.output_stms[1].name + '.In);\n')
+ 'connect(' + self.name + '.Bot' + ", " + self.output_stms[2].name + '.In);\n')
for i in range(len(self.input_stms)):
self.OM_data_eqn = self.OM_data_eqn + (
- 'connect(' + self.input_stms[i].name + '.Out' + ", " + self.name + '.In_s[' + str(
+ 'connect(' + self.input_stms[i +1].name + '.Out' + ", " + self.name + '.In_s[' + str(
i + 1) + ']);\n')
# ['Product Molar Flow (mol/s)', 'Temperature (K)', 'Compound Molar Fraction',
# 'Compound Molar Flow (mol/s)']
@@ -351,17 +357,17 @@ class DistillationColumn(UnitOperation):
self.OM_data_eqn = self.OM_data_eqn + (
self.name + '.' + 'RR' + '=' + str(self.variables['RR']['value']) + ';\n')
elif self.variables['C_Spec']['type'] == "Product Molar Flow (mol/s)":
- self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[0].name + '.' + 'F_p[1] = ' + str(
+ self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[1].name + '.' + 'F_p[1] = ' + str(
self.variables['C_Spec']['value']) + ';\n')
elif self.variables['C_Spec']['type'] == "Temperature (K)":
- self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[0].name + '.' + 'T = ' + str(
+ self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[1].name + '.' + 'T = ' + str(
self.variables['C_Spec']['value']) + ';\n')
elif self.variables['C_Spec']['type'] == "Compound Molar Fraction":
- self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[0].name + '.x_pc[1,:' +
+ self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[1].name + '.x_pc[1,:' +
str(self.compounds.index(self.variables['C_Spec']['comp']) + 1) + '] = ' + str(
self.variables['C_Spec']['value']) + ';\n')
elif self.variables['C_Spec']['type'] == "Compound Molar Flow (mol/s)":
- self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[0].name + '.F_pc[1,:' +
+ self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[1].name + '.F_pc[1,:' +
str(self.compounds.index(self.variables['C_Spec']['comp']) + 1) + '] = ' + str(
self.variables['C_Spec']['value']) + ';\n')
else:
@@ -369,17 +375,17 @@ class DistillationColumn(UnitOperation):
self.name + '.Condenser.' + self.mode + '=' + str(self.modeVal) + ';\n')
if self.variables['R_Spec']['type'] == "Product Molar Flow (mol/s)":
- self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[1].name + '.' + 'F_p[1] = ' + str(
+ self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[2].name + '.' + 'F_p[1] = ' + str(
self.variables['R_Spec']['value']) + ';\n')
elif self.variables['R_Spec']['type'] == "Temperature (K)":
- self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[1].name + '.' + 'T = ' + str(
+ self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[2].name + '.' + 'T = ' + str(
self.variables['R_Spec']['value']) + ';\n')
elif self.variables['R_Spec']['type'] == "Compound Molar Fraction":
- self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[1].name + '.x_pc[1,:' +
+ self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[2].name + '.x_pc[1,:' +
str(self.compounds.index(self.variables['R_Spec']['comp']) + 1) + '] = ' + str(
self.variables['R_Spec']['value']) + ';\n')
elif self.variables['R_Spec']['type'] == "Compound Molar Flow (mol/s)":
- self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[1].name + '.F_pc[1,:' +
+ self.OM_data_eqn = self.OM_data_eqn + (self.output_stms[2].name + '.F_pc[1,:' +
str(self.compounds.index(self.variables['R_Spec']['comp']) + 1) + '] = ' + str(
self.variables['R_Spec']['value']) + ';\n')