From dcba7d32bb73e04a2f65e35f86d047d619d2c6ad Mon Sep 17 00:00:00 2001
From: pravindalve
Date: Mon, 12 Apr 2021 20:41:30 +0530
Subject: Small fixes for Distillation column and mixer
---
DockWidgets/DistillationColumnStagewiseResults.ui | 6 ++++++
DockWidgets/DockWidgetDistillationColumn.py | 3 ++-
DockWidgets/DockWidgetDistillationColumn.ui | 2 +-
DockWidgets/__pycache__/DockWidget.cpython-37.pyc | Bin 4411 -> 4390 bytes
.../DockWidgetDistillationColumn.cpython-37.pyc | Bin 9426 -> 9430 bytes
Graphics.py | 7 +++++--
Undo.dat | Bin 28916 -> 924 bytes
UnitOperations.py | 2 +-
8 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/DockWidgets/DistillationColumnStagewiseResults.ui b/DockWidgets/DistillationColumnStagewiseResults.ui
index 9ce4060..fb0ef9c 100644
--- a/DockWidgets/DistillationColumnStagewiseResults.ui
+++ b/DockWidgets/DistillationColumnStagewiseResults.ui
@@ -38,6 +38,9 @@
391
+
+ QAbstractScrollArea::AdjustToContents
+
@@ -53,6 +56,9 @@
391
+
+ QAbstractScrollArea::AdjustToContentsOnFirstShow
+
diff --git a/DockWidgets/DockWidgetDistillationColumn.py b/DockWidgets/DockWidgetDistillationColumn.py
index e98ba03..bd5a683 100644
--- a/DockWidgets/DockWidgetDistillationColumn.py
+++ b/DockWidgets/DockWidgetDistillationColumn.py
@@ -222,7 +222,7 @@ class DockWidgetDistillationColumn(QDockWidget, ui_dialog):
Nt = self.obj.variables['Nt']['value']
Nc = len(self.obj.compounds)
# initializing temporary arrays
- Stages_T = [None]*Nt
+ Stages_T = [None for i in range(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)]
@@ -342,6 +342,7 @@ class DockWidgetDistillationColumn(QDockWidget, ui_dialog):
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:
diff --git a/DockWidgets/DockWidgetDistillationColumn.ui b/DockWidgets/DockWidgetDistillationColumn.ui
index 932cbdd..920837b 100644
--- a/DockWidgets/DockWidgetDistillationColumn.ui
+++ b/DockWidgets/DockWidgetDistillationColumn.ui
@@ -41,7 +41,7 @@
true
- 1
+ 0
diff --git a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc
index a8934e2..0a00568 100644
Binary files a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc differ
diff --git a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc
index ee33ca4..066bc00 100644
Binary files a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc and b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc differ
diff --git a/Graphics.py b/Graphics.py
index a829849..3deb9e2 100644
--- a/Graphics.py
+++ b/Graphics.py
@@ -4,6 +4,7 @@ from PyQt5.QtGui import *
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import PyQt5.QtWidgets as QtWidgets
+from PyQt5.QtWidgets import QLineEdit
from DockWidgets.DockWidget import *
from DockWidgets.DockWidgetMaterialStream import *
@@ -424,7 +425,8 @@ class NodeItem(QtWidgets.QGraphicsItem):
if self.obj.type == 'Mixer' and not self.obj.saved:
- text, ok = QInputDialog.getText(self.container.graphicsView, 'Mixer', 'Enter number of input:')
+ text, ok = QInputDialog.getText(self.container.graphicsView, 'Mixer', 'Enter number of input:',
+ echo=QLineEdit.Normal, text=str(self.obj.no_of_inputs))
if ok and text:
self.nin = int(text)
self.obj.no_of_inputs = self.nin
@@ -436,7 +438,8 @@ class NodeItem(QtWidgets.QGraphicsItem):
# self.obj.no_of_outputs = self.nop
# self.obj.variables['No']['value'] = self.nop
elif self.obj.type == 'DistillationColumn'and not self.obj.saved:
- text, ok = QInputDialog.getText(self.container.graphicsView, 'DistillationColumn', 'Enter number of input:')
+ text, ok = QInputDialog.getText(self.container.graphicsView, 'DistillationColumn', 'Enter number of input:',
+ echo=QLineEdit.Normal, text=str(self.obj.no_of_inputs))
if ok and text:
self.nin = int(text)
self.obj.no_of_inputs = self.nin
diff --git a/Undo.dat b/Undo.dat
index 69b5ce3..f3f5d61 100644
Binary files a/Undo.dat and b/Undo.dat differ
diff --git a/UnitOperations.py b/UnitOperations.py
index 7f9ed5e..6fc2c9c 100644
--- a/UnitOperations.py
+++ b/UnitOperations.py
@@ -593,7 +593,7 @@ class Mixer(UnitOperation):
UnitOperation.__init__(self)
self.name = name + str(Mixer.counter)
self.type = 'Mixer'
- self.no_of_inputs = 6
+ self.no_of_inputs = 2
self.Pout_modes = ['Inlet_Minimum', 'Inlet_Average', 'Inlet_Maximum']
self.parameters = ['NI', 'outPress']
--
cgit
From a20b99806eb09c46d8ce673246b3563c78f94cfe Mon Sep 17 00:00:00 2001
From: pravindalve
Date: Tue, 13 Apr 2021 21:28:25 +0530
Subject: saved unit operations counter fixed
---
Graphics.py | 1 +
Undo.dat | Bin 924 -> 41926 bytes
2 files changed, 1 insertion(+)
diff --git a/Graphics.py b/Graphics.py
index 3deb9e2..3660f25 100644
--- a/Graphics.py
+++ b/Graphics.py
@@ -44,6 +44,7 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem):
pass
else:
self.unit_operations.append(i)
+ type(i).counter += 1
print(self.unit_operations)
new_box = self.create_node_item(i, container)
new_box.setPos(i.pos.toPoint().x(), i.pos.toPoint().y())
diff --git a/Undo.dat b/Undo.dat
index f3f5d61..0ccd67c 100644
Binary files a/Undo.dat and b/Undo.dat differ
--
cgit
From faffb95d8b6bbea5a55efc3550b8e8357d3b381e Mon Sep 17 00:00:00 2001
From: pravindalve
Date: Wed, 14 Apr 2021 01:00:06 +0530
Subject: Fixes for Compound Selector
---
ComponentSelector.py | 4 ++--
OMChem/Flowsheet.py | 25 +++++++++++++++++--------
Simulator/Databases/Databases.py | 1 +
Undo.dat | Bin 41926 -> 3757 bytes
4 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/ComponentSelector.py b/ComponentSelector.py
index c5ba6f5..79edef4 100644
--- a/ComponentSelector.py
+++ b/ComponentSelector.py
@@ -111,8 +111,8 @@ class ComponentSelector(QDialog,ui_dialog):
self.CAS=self.obj.get_value(self.comp,'CAS')
self.name=self.comp
- self.molecular_formula=self.obj.get_value(self.comp,'Smiles')
- self.molecular_weight=self.obj.get_value(self.comp,'MolecularWeight')
+ self.molecular_formula=self.obj.get_value(self.comp, 'StructureFormula')
+ self.molecular_weight=self.obj.get_value(self.comp, 'MolecularWeight')
dict={'CAS':self.CAS,'Name':self.name,'Molecular Formula':self.molecular_formula,'Molecular Weight':self.molecular_weight}
#converted everything to a dictionary which will be passes to addtable
diff --git a/OMChem/Flowsheet.py b/OMChem/Flowsheet.py
index 4fb0459..a61cd52 100644
--- a/OMChem/Flowsheet.py
+++ b/OMChem/Flowsheet.py
@@ -100,14 +100,23 @@ class Flowsheet():
self.sim_method = 'Eqn'
self.data.append("model Flowsheet\n")
- for c in self.compounds:
- ucase = c.title()
- lcase = c.lower()
- self.data.append("parameter database." + ucase +' '+ ucase + "; \n")
+ tempCompounds = self.compounds
+ for c in tempCompounds:
+ CompName = c
+ CompName = CompName.replace(" ", "")
+ CompName = CompName.replace("-", "")
+ CompName = CompName.replace(",", "")
+ CompName = CompName.replace("1", "One")
+ CompName = CompName.replace("2", "Two")
+ CompName = CompName.replace("3", "Three")
+ CompName = CompName.replace("4", "Four")
+ CompName = CompName.replace("5", "Five")
+ self.data.append("parameter database." + CompName +' '+ CompName + "; \n")
+ tempCompounds[tempCompounds.index(c)] = CompName
- self.data.append("parameter Integer Nc = " + str(len(self.compounds)) + ";\n")
+ self.data.append("parameter Integer Nc = " + str(len(tempCompounds)) + ";\n")
self.data.append("parameter Simulator.Files.ChemsepDatabase.GeneralProperties C[Nc] = {" +
- str(self.compounds).strip('[').strip(']').replace("'", "") + "};\n")
+ str(tempCompounds).strip('[').strip(']').replace("'", "") + "};\n")
for unitop in self.unit_operations:
if unitop.type != 'MaterialStream':
@@ -185,9 +194,9 @@ class Flowsheet():
self.data.append("model "+unitop.name.lower()+'\n')
for c in self.compounds:
- ucase = c.title()
+ c = c.title()
lcase = c.lower()
- self.data.append("parameter Simulator.Files.Chemsep_Database." + ucase +' '+ ucase + "; \n")
+ self.data.append("parameter Simulator.Files.Chemsep_Database." + c +' '+ c + "; \n")
self.data.append(unitop.OM_Flowsheet_Initialize())
diff --git a/Simulator/Databases/Databases.py b/Simulator/Databases/Databases.py
index 4b3a4c6..d6e0b46 100644
--- a/Simulator/Databases/Databases.py
+++ b/Simulator/Databases/Databases.py
@@ -60,6 +60,7 @@ class ChemsepDatabase():
CompName = CompName.replace("3","Three")
CompName = CompName.replace("4","Four")
CompName = CompName.replace("5","Five")
+
CAS = comp.getElementsByTagName("CAS")[0].getAttribute("value")
CriticalTemp = comp.getElementsByTagName("CriticalTemperature")[0].getAttribute("value")
CriticalPres = comp.getElementsByTagName("CriticalPressure")[0].getAttribute("value")
diff --git a/Undo.dat b/Undo.dat
index 0ccd67c..c101b89 100644
Binary files a/Undo.dat and b/Undo.dat differ
--
cgit