summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanWBR2022-07-25 09:56:37 -0400
committerDanWBR2022-07-25 09:56:37 -0400
commit7eaf95087a15ba07dadbd33d778085ad0185f327 (patch)
tree1b2cbe28d2397e0088e762b5044e72bc3af4dc99
parent078e360549fa3f4caff0247bdfe4051204538802 (diff)
downloadcrude-characterization-plugin-DWSIM-7eaf95087a15ba07dadbd33d778085ad0185f327.tar.gz
crude-characterization-plugin-DWSIM-7eaf95087a15ba07dadbd33d778085ad0185f327.tar.bz2
crude-characterization-plugin-DWSIM-7eaf95087a15ba07dadbd33d778085ad0185f327.zip
fix
-rw-r--r--Characterization/Form1.Designer.vb39
-rw-r--r--Characterization/Form1.vb24
2 files changed, 38 insertions, 25 deletions
diff --git a/Characterization/Form1.Designer.vb b/Characterization/Form1.Designer.vb
index 54cf5bb..d7b7c0d 100644
--- a/Characterization/Form1.Designer.vb
+++ b/Characterization/Form1.Designer.vb
@@ -22,11 +22,12 @@ Partial Class Form1
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
- Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle4 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle5 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
+ Dim DataGridViewCellStyle6 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
+ Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1))
Me.Label1 = New System.Windows.Forms.Label()
Me.TextBoxSG = New System.Windows.Forms.TextBox()
@@ -297,31 +298,31 @@ Partial Class Form1
Me.DataGridView2.AllowUserToAddRows = False
Me.DataGridView2.AllowUserToDeleteRows = False
Me.DataGridView2.AllowUserToResizeRows = False
- DataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter
- DataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke
- Me.DataGridView2.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle3
+ DataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter
+ DataGridViewCellStyle4.BackColor = System.Drawing.Color.WhiteSmoke
+ Me.DataGridView2.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle4
Me.DataGridView2.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.DataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.DisplayedCells
- DataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter
- DataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control
- DataGridViewCellStyle4.Font = New System.Drawing.Font("Tahoma", 8.25!)
- DataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText
- DataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight
- DataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText
- DataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
- Me.DataGridView2.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle4
- Me.DataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
- Me.DataGridView2.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.DataGridViewTextBoxColumn1, Me.Column4, Me.DataGridViewTextBoxColumn2, Me.Column3, Me.DataGridViewTextBoxColumn3, Me.DataGridViewTextBoxColumn4, Me.DataGridViewTextBoxColumn5, Me.DataGridViewTextBoxColumn6, Me.DataGridViewTextBoxColumn7, Me.DataGridViewTextBoxColumn8, Me.prvs, Me.srkvs})
DataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter
- DataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Window
+ DataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control
DataGridViewCellStyle5.Font = New System.Drawing.Font("Tahoma", 8.25!)
- DataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.ControlText
+ DataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText
DataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight
DataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText
- DataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.[False]
- Me.DataGridView2.DefaultCellStyle = DataGridViewCellStyle5
+ DataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
+ Me.DataGridView2.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle5
+ Me.DataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
+ Me.DataGridView2.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.DataGridViewTextBoxColumn1, Me.Column4, Me.DataGridViewTextBoxColumn2, Me.Column3, Me.DataGridViewTextBoxColumn3, Me.DataGridViewTextBoxColumn4, Me.DataGridViewTextBoxColumn5, Me.DataGridViewTextBoxColumn6, Me.DataGridViewTextBoxColumn7, Me.DataGridViewTextBoxColumn8, Me.prvs, Me.srkvs})
+ DataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter
+ DataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window
+ DataGridViewCellStyle6.Font = New System.Drawing.Font("Tahoma", 8.25!)
+ DataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText
+ DataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight
+ DataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText
+ DataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.[False]
+ Me.DataGridView2.DefaultCellStyle = DataGridViewCellStyle6
Me.DataGridView2.Location = New System.Drawing.Point(3, 17)
Me.DataGridView2.Name = "DataGridView2"
Me.DataGridView2.RowHeadersVisible = False
@@ -486,6 +487,8 @@ Partial Class Form1
'
'Column5
'
+ DataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter
+ Me.Column5.DefaultCellStyle = DataGridViewCellStyle3
Me.Column5.HeaderText = "SG"
Me.Column5.Name = "Column5"
Me.Column5.Visible = False
diff --git a/Characterization/Form1.vb b/Characterization/Form1.vb
index 2a062fb..2c6e78b 100644
--- a/Characterization/Form1.vb
+++ b/Characterization/Form1.vb
@@ -230,9 +230,19 @@ Public Class Form1
End Sub
-
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
+ Try
+ Charac()
+ Catch ex As Exception
+ MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ End Try
+
+ End Sub
+
+
+ Private Sub Charac()
+
Dim charact As String
Using filestr As IO.Stream = Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Characterization.characterization.py")
@@ -260,8 +270,8 @@ Public Class Form1
For Each row As DataGridViewRow In DataGridViewTBP.Rows
If row.Cells(0).Value IsNot Nothing And row.Cells(0).Value IsNot Nothing Then
Try
- datax.Add(row.Cells(0).Value)
- datay.Add(Convert.ToDouble(row.Cells(1).Value).ConvertUnits(frm.FlowsheetOptions.SelectedUnitSystem.temperature, "C"))
+ If row.Cells(0).Value.ToString() <> "" Then datax.Add(row.Cells(0).Value)
+ If row.Cells(1).Value.ToString() <> "" Then datay.Add(Convert.ToDouble(row.Cells(1).Value).ConvertUnits(frm.FlowsheetOptions.SelectedUnitSystem.temperature, "C"))
Catch ex As Exception
End Try
End If
@@ -269,9 +279,9 @@ Public Class Form1
If cbInputType.SelectedIndex > 1 Then
For Each row As DataGridViewRow In DataGridViewTBP.Rows
- If row.Cells(0).Value IsNot Nothing And row.Cells(0).Value IsNot Nothing Then
+ If row.Cells(2).Value IsNot Nothing And row.Cells(2).Value IsNot Nothing Then
Try
- datay2.Add(Convert.ToDouble(row.Cells(2).Value))
+ If row.Cells(2).Value.ToString() <> "" Then datay2.Add(Convert.ToDouble(row.Cells(2).Value))
Catch ex As Exception
End Try
End If
@@ -290,10 +300,10 @@ Public Class Form1
result = characterization_vol(SG, x, y)
Case 2
Dim y2 = np.array(datay2)
- result = characterization_wt_SG(SG, x, y)
+ result = characterization_wt_SG(SG, x, y, y2)
Case 3
Dim y2 = np.array(datay2)
- result = characterization_vol_SG(SG, x, y)
+ result = characterization_vol_SG(SG, x, y, y2)
End Select
'return [Ti, Tf, Wf, Vf, Mf, MW, SG, Tb]