summaryrefslogtreecommitdiff
path: root/DockWidgets/DockWidgetMaterialStream.py
diff options
context:
space:
mode:
Diffstat (limited to 'DockWidgets/DockWidgetMaterialStream.py')
-rw-r--r--DockWidgets/DockWidgetMaterialStream.py75
1 files changed, 36 insertions, 39 deletions
diff --git a/DockWidgets/DockWidgetMaterialStream.py b/DockWidgets/DockWidgetMaterialStream.py
index 78959fc..130b290 100644
--- a/DockWidgets/DockWidgetMaterialStream.py
+++ b/DockWidgets/DockWidgetMaterialStream.py
@@ -40,13 +40,6 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
self.lTreeWidget.itemClicked.connect(lambda : self.printer(self.lTreeWidget.currentItem()))
self.vTreeWidget.itemClicked.connect(lambda : self.printer(self.vTreeWidget.currentItem()))
-
- # def printer(self, treeItem ):
- # foldername = treeItem.text(0)
- # comment = treeItem.text(1)
- # data = treeItem.text(2)
- # print(foldername , ': ' , comment , ' (' + data + ')')
-
# input data tab
def modes(self):
modes_list = self.obj.modes_list
@@ -69,6 +62,7 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
def input_params_list(self):
try:
print("input_params_list ", self.input_dict)
+
for c,i in enumerate(self.input_dict):
if(i=="thermo_package"):
print("thermo1")
@@ -83,39 +77,31 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
self.formLayout.addRow(lay)
self.input_dict[i] = combo
print("thermo")
- elif(i=="condType"):
- combo = QComboBox()
- self.lines = ["Total","Partial"]
- for j in self.lines:
- combo.addItem(str(j))
- lay = QGridLayout()
- lay.addWidget(QLabel("Condensor Type :"+":"), 0, 0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
- self.formLayout.addRow(lay)
- self.input_dict[i] = combo
elif(i=="x_pc"):
noc = len(compound_selected)
print(noc)
self.x_pclist.clear()
-
+
gp = QGroupBox("Mole Fractions")
lay = QGridLayout()
for j in range(noc):
l = QLineEdit()
if self.input_dict[i] != '':
- l.setText(str(self.obj.variables[compound_selected[j]]['value']))
+ l.setText(str(self.obj.variables['x_pc']['value'][j]))
+ 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(l,j,1, alignment=Qt.AlignCenter)
- self.x_pclist.append(l)
-
+ self.x_pclist.append(l)
gp.setLayout(lay)
- self.formLayout.addRow(gp)
+ self.formLayout.addRow(gp)
else:
print("elseloop")
l = QLineEdit()
if self.input_dict[i] != None:
l.setText(str(self.input_dict[i]))
+
lay = QGridLayout()
lay.addWidget(QLabel(i+":"),0,0, alignment=Qt.AlignLeft)
lay.addWidget(l,0,1, alignment=Qt.AlignCenter)
@@ -124,8 +110,7 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
else:
lay.addWidget(QLabel("mol/s"),0,2, alignment=Qt.AlignCenter)
self.formLayout.addRow(lay)
- self.input_dict[i] = l
-
+ self.input_dict[i] = l
except Exception as e:
print(e)
@@ -144,12 +129,6 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
else:
self.show_error()
break
- elif(i=="condType"):
- if (self.input_dict[i].currentText()):
- self.dict[i] = self.input_dict[i].currentText()
- else:
- self.show_error()
- break
elif(i =="x_pc"):
l=[]
mf = []
@@ -197,6 +176,7 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
result=self.container.result
obj = self.container.fetch_object(name)
+
d = {"Mole Fraction":"x_pc", "Mass Fraction":"xm_pc", "Mole Flow":"F_pc", "Mass Flow":"Fm_pc"}
lst = list(d.keys())
klst = list(d.values())
@@ -206,21 +186,21 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
# Amounts Tab
if obj.type == 'MaterialStream':
- l = [] # list for basis names
+ ll = [] # 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)
+ ll.append(i)
+ print(ll)
j = 0
t = 0
namee = klst[j]
print("namee ", namee)
- for i,k in enumerate(l):
+ for i,k in enumerate(ll):
ind = result[0].index(k)
print("index ", ind)
print("str ", k)
@@ -323,10 +303,27 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
self.mTableWidget.setItem(mrowPosition , 2, QTableWidgetItem(obj.variables[val.split('.')[1]]['unit']))
self.mTableWidget.resizeColumnsToContents()
- print(obj.variables)
- except Exception as e:
- print(e)
-
+ # updating the input data from fetched results from simulation
+ print(self.comboBox.currentText())
+
+ self.input_dict = {}
+ self.input_dict = self.obj.param_getter(self.comboBox.currentText())
+ print("before", self.input_dict)
+ self.input_dict.pop("x_pc")
+ temp = self.input_dict.pop('thermo_package')
+ for i in range(len(compound_selected)):
+ print(i)
+ self.input_dict['x_pc[1,' + str(i+1) + ']'] = self.obj.variables['x_pc[1,' + str(i+1) +']']['value']
+ self.input_dict['thermo_package'] = temp
+ print("after", self.input_dict)
+
+ # chaning index for updating the input data
+ indexx = self.comboBox.currentIndex()
+ self.comboBox.setCurrentIndex(1)
+ self.comboBox.setCurrentIndex(indexx)
+
- \ No newline at end of file
+
+ except Exception as e:
+ print(e) \ No newline at end of file