summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanWBR2022-07-25 09:28:57 -0400
committerDanWBR2022-07-25 09:28:57 -0400
commit950d5c7a3b2d0e3649c9d83f4a2988935a540d33 (patch)
tree2ba955c7c1aa0ebda0fcc3d8c40ca6cc2f2c5d9e
parentcb20b66f92270def6a52f99ee3cf96a464124bdb (diff)
downloadcrude-characterization-plugin-DWSIM-950d5c7a3b2d0e3649c9d83f4a2988935a540d33.tar.gz
crude-characterization-plugin-DWSIM-950d5c7a3b2d0e3649c9d83f4a2988935a540d33.tar.bz2
crude-characterization-plugin-DWSIM-950d5c7a3b2d0e3649c9d83f4a2988935a540d33.zip
updated interface to handle new data input options
-rw-r--r--.gitignore2
-rw-r--r--Characterization/Form1.Designer.vb68
-rw-r--r--Characterization/Form1.resx3
-rw-r--r--Characterization/Form1.vb41
4 files changed, 95 insertions, 19 deletions
diff --git a/.gitignore b/.gitignore
index ebd92fd..7aba638 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,5 @@ __pycache__/
/Python.Deployment/bin/Debug
/Python.Deployment/obj
/Characterization/.vs/Characterization/DesignTimeBuild
+/Characterization/obj/Release
+/Characterization/.vs/Characterization/v17
diff --git a/Characterization/Form1.Designer.vb b/Characterization/Form1.Designer.vb
index 8282d66..f25ae40 100644
--- a/Characterization/Form1.Designer.vb
+++ b/Characterization/Form1.Designer.vb
@@ -65,8 +65,11 @@ Partial Class Form1
Me.Label2 = New System.Windows.Forms.Label()
Me.Button2 = New System.Windows.Forms.Button()
Me.FolderBrowserDialog1 = New System.Windows.Forms.FolderBrowserDialog()
+ Me.cbInputType = New System.Windows.Forms.ComboBox()
+ Me.Label3 = New System.Windows.Forms.Label()
Me.Column1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.Column2 = New System.Windows.Forms.DataGridViewTextBoxColumn()
+ Me.Column5 = New System.Windows.Forms.DataGridViewTextBoxColumn()
CType(Me.DataGridViewTBP, System.ComponentModel.ISupportInitialize).BeginInit()
Me.GroupBox4.SuspendLayout()
Me.GroupBox1.SuspendLayout()
@@ -76,7 +79,7 @@ Partial Class Form1
'Label1
'
Me.Label1.AutoSize = True
- Me.Label1.Location = New System.Drawing.Point(13, 14)
+ Me.Label1.Location = New System.Drawing.Point(12, 40)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(81, 13)
Me.Label1.TabIndex = 0
@@ -84,7 +87,7 @@ Partial Class Form1
'
'TextBoxSG
'
- Me.TextBoxSG.Location = New System.Drawing.Point(198, 11)
+ Me.TextBoxSG.Location = New System.Drawing.Point(198, 36)
Me.TextBoxSG.Name = "TextBoxSG"
Me.TextBoxSG.Size = New System.Drawing.Size(100, 20)
Me.TextBoxSG.TabIndex = 1
@@ -94,16 +97,16 @@ Partial Class Form1
'
Me.DataGridViewTBP.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill
Me.DataGridViewTBP.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
- Me.DataGridViewTBP.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.Column1, Me.Column2})
- Me.DataGridViewTBP.Location = New System.Drawing.Point(12, 40)
+ Me.DataGridViewTBP.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.Column1, Me.Column2, Me.Column5})
+ Me.DataGridViewTBP.Location = New System.Drawing.Point(12, 65)
Me.DataGridViewTBP.Name = "DataGridViewTBP"
Me.DataGridViewTBP.RowHeadersVisible = False
- Me.DataGridViewTBP.Size = New System.Drawing.Size(286, 191)
+ Me.DataGridViewTBP.Size = New System.Drawing.Size(286, 203)
Me.DataGridViewTBP.TabIndex = 2
'
'Button1
'
- Me.Button1.Location = New System.Drawing.Point(12, 237)
+ Me.Button1.Location = New System.Drawing.Point(12, 274)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(286, 23)
Me.Button1.TabIndex = 3
@@ -128,7 +131,7 @@ Partial Class Form1
Me.GroupBox4.Controls.Add(Me.Label28)
Me.GroupBox4.Location = New System.Drawing.Point(305, 7)
Me.GroupBox4.Name = "GroupBox4"
- Me.GroupBox4.Size = New System.Drawing.Size(329, 255)
+ Me.GroupBox4.Size = New System.Drawing.Size(330, 290)
Me.GroupBox4.TabIndex = 4
Me.GroupBox4.TabStop = False
Me.GroupBox4.Text = "Methods and Correlations"
@@ -270,9 +273,9 @@ Partial Class Form1
Me.GroupBox1.Controls.Add(Me.Label6)
Me.GroupBox1.Controls.Add(Me.DataGridView2)
Me.GroupBox1.FlatStyle = System.Windows.Forms.FlatStyle.Popup
- Me.GroupBox1.Location = New System.Drawing.Point(12, 271)
+ Me.GroupBox1.Location = New System.Drawing.Point(12, 303)
Me.GroupBox1.Name = "GroupBox1"
- Me.GroupBox1.Size = New System.Drawing.Size(622, 248)
+ Me.GroupBox1.Size = New System.Drawing.Size(623, 315)
Me.GroupBox1.TabIndex = 8
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Properties"
@@ -282,7 +285,7 @@ Partial Class Form1
Me.Label6.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.Label6.AutoSize = True
Me.Label6.ImeMode = System.Windows.Forms.ImeMode.NoControl
- Me.Label6.Location = New System.Drawing.Point(6, 229)
+ Me.Label6.Location = New System.Drawing.Point(6, 296)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(391, 13)
Me.Label6.TabIndex = 10
@@ -323,7 +326,7 @@ Partial Class Form1
Me.DataGridView2.Name = "DataGridView2"
Me.DataGridView2.RowHeadersVisible = False
Me.DataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect
- Me.DataGridView2.Size = New System.Drawing.Size(619, 206)
+ Me.DataGridView2.Size = New System.Drawing.Size(620, 273)
Me.DataGridView2.TabIndex = 3
'
'DataGridViewTextBoxColumn1
@@ -404,7 +407,7 @@ Partial Class Form1
Me.KButton3.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.KButton3.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.KButton3.ImeMode = System.Windows.Forms.ImeMode.NoControl
- Me.KButton3.Location = New System.Drawing.Point(329, 527)
+ Me.KButton3.Location = New System.Drawing.Point(330, 626)
Me.KButton3.Name = "KButton3"
Me.KButton3.Size = New System.Drawing.Size(154, 25)
Me.KButton3.TabIndex = 18
@@ -414,9 +417,9 @@ Partial Class Form1
'
Me.TextBox1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
- Me.TextBox1.Location = New System.Drawing.Point(100, 530)
+ Me.TextBox1.Location = New System.Drawing.Point(100, 629)
Me.TextBox1.Name = "TextBox1"
- Me.TextBox1.Size = New System.Drawing.Size(222, 20)
+ Me.TextBox1.Size = New System.Drawing.Size(223, 20)
Me.TextBox1.TabIndex = 17
Me.TextBox1.Text = "OIL_1"
'
@@ -425,7 +428,7 @@ Partial Class Form1
Me.Label2.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.Label2.AutoSize = True
Me.Label2.ImeMode = System.Windows.Forms.ImeMode.NoControl
- Me.Label2.Location = New System.Drawing.Point(14, 533)
+ Me.Label2.Location = New System.Drawing.Point(14, 632)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(71, 13)
Me.Label2.TabIndex = 16
@@ -436,7 +439,7 @@ Partial Class Form1
Me.Button2.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.Button2.ImeMode = System.Windows.Forms.ImeMode.NoControl
- Me.Button2.Location = New System.Drawing.Point(489, 527)
+ Me.Button2.Location = New System.Drawing.Point(490, 626)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(144, 25)
Me.Button2.TabIndex = 19
@@ -446,6 +449,26 @@ Partial Class Form1
'
Me.FolderBrowserDialog1.Description = "Select a folder where to save the JSON files."
'
+ 'cbInputType
+ '
+ Me.cbInputType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
+ Me.cbInputType.FormattingEnabled = True
+ Me.cbInputType.Items.AddRange(New Object() {"Weight Percentages", "Volume Percentages", "Weight Percentages with SG Data", "Volume Percentages with SG Data"})
+ Me.cbInputType.Location = New System.Drawing.Point(141, 7)
+ Me.cbInputType.Name = "cbInputType"
+ Me.cbInputType.Size = New System.Drawing.Size(157, 21)
+ Me.cbInputType.TabIndex = 28
+ '
+ 'Label3
+ '
+ Me.Label3.AutoSize = True
+ Me.Label3.ImeMode = System.Windows.Forms.ImeMode.NoControl
+ Me.Label3.Location = New System.Drawing.Point(12, 11)
+ Me.Label3.Name = "Label3"
+ Me.Label3.Size = New System.Drawing.Size(58, 13)
+ Me.Label3.TabIndex = 27
+ Me.Label3.Text = "Input Type"
+ '
'Column1
'
DataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter
@@ -460,11 +483,19 @@ Partial Class Form1
Me.Column2.HeaderText = "Temperature"
Me.Column2.Name = "Column2"
'
+ 'Column5
+ '
+ Me.Column5.HeaderText = "SG"
+ Me.Column5.Name = "Column5"
+ Me.Column5.Visible = False
+ '
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
- Me.ClientSize = New System.Drawing.Size(645, 564)
+ Me.ClientSize = New System.Drawing.Size(646, 663)
+ Me.Controls.Add(Me.cbInputType)
+ Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.KButton3)
Me.Controls.Add(Me.TextBox1)
@@ -529,6 +560,9 @@ Partial Class Form1
Public WithEvents Label2 As Windows.Forms.Label
Public WithEvents Button2 As Windows.Forms.Button
Friend WithEvents FolderBrowserDialog1 As Windows.Forms.FolderBrowserDialog
+ Public WithEvents cbInputType As Windows.Forms.ComboBox
+ Public WithEvents Label3 As Windows.Forms.Label
Friend WithEvents Column1 As Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents Column2 As Windows.Forms.DataGridViewTextBoxColumn
+ Friend WithEvents Column5 As Windows.Forms.DataGridViewTextBoxColumn
End Class
diff --git a/Characterization/Form1.resx b/Characterization/Form1.resx
index 1a4efeb..f1fbe74 100644
--- a/Characterization/Form1.resx
+++ b/Characterization/Form1.resx
@@ -123,6 +123,9 @@
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
+ <metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
<metadata name="DataGridViewTextBoxColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
diff --git a/Characterization/Form1.vb b/Characterization/Form1.vb
index 5913d6c..23c121b 100644
--- a/Characterization/Form1.vb
+++ b/Characterization/Form1.vb
@@ -34,6 +34,8 @@ Public Class Form1
AddHandler AppDomain.CurrentDomain.AssemblyResolve, New ResolveEventHandler(AddressOf LoadFromPluginsFolder)
+ cbInputType.SelectedIndex = 0
+
Me.ComboBoxAF.SelectedIndex = 0
Me.ComboBoxMW.SelectedIndex = 0
Me.ComboBoxSG.SelectedIndex = 0
@@ -250,7 +252,7 @@ Public Class Form1
Dim SG = TextBoxSG.Text.ToDoubleFromCurrent()
- Dim datax, datay As New List(Of Double)
+ Dim datax, datay, datay2 As New List(Of Double)
For Each row As DataGridViewRow In DataGridViewTBP.Rows
If row.Cells(0).Value IsNot Nothing And row.Cells(0).Value IsNot Nothing Then
@@ -262,10 +264,34 @@ Public Class Form1
End If
Next
+ 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
+ Try
+ datay2.Add(Convert.ToDouble(row.Cells(2).Value))
+ Catch ex As Exception
+ End Try
+ End If
+ Next
+ End If
+
Dim x = np.array(datax)
Dim y = np.array(datay)
- Dim result As Object = charac1(SG, x, y)
+ Dim result As Object = Nothing
+
+ Select Case cbInputType.SelectedIndex
+ Case 0
+ result = charac1.characterization_wt(SG, x, y)
+ Case 1
+ result = charac1.characterization_vol(SG, x, y)
+ Case 2
+ Dim y2 = np.array(datay2)
+ result = charac1.characterization_wt_SG(SG, x, y)
+ Case 3
+ Dim y2 = np.array(datay2)
+ result = charac1.characterization_vol_SG(SG, x, y)
+ End Select
'return [Ti, Tf, Wf, Vf, Mf, MW, SG, Tb]
@@ -707,4 +733,15 @@ Public Class Form1
End Sub
+ Private Sub cbInputType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbInputType.SelectedIndexChanged
+
+ Select Case cbInputType.SelectedIndex
+ Case 0, 1
+ DataGridViewTBP.Columns(2).Visible = False
+ Case 2, 3
+ DataGridViewTBP.Columns(2).Visible = True
+ End Select
+
+ End Sub
+
End Class \ No newline at end of file