I'm a chem eng and busy trying to write some small apps which would help me in my day-to-day activities in designing petrochem plants.
In my search for thermo packages I came across DWSIM and DTL and am very impressed. I'm not nearly at the programming level you are, but I can help myself.
I've upgraded the VB2008 DTL code to VB2010 and the DTLTest program runs successfully. I started playing around with DTL, and immediately ran into a problem.
I can't seem to get a compound list loaded, similar to DWSIM. I can load the available property packages, but when I try to load the compounds, I get a blank array.
I've written some basic code to load the compounds into a listbox, and it is listed below. I've tried to initialize dtlc with a path to dwsim.xml and chemsep1.xml. dwsim.xml works, but still no compounds, chemsep throws an exception.
I've spent quite a number of hours on this so some guidance would be much appreciated. I've even tried to copy code from DWSIM (GetComponents), but ran into more problems than solutions.
Herewith the (fairly simple) code snippet:
Dim dtlc As New DTL.Thermodynamics.Calculator
dtlc.Initialize()
Dim comps As String()
comps = dtlc.GetCompoundList()
lbComps.Items.Clear()
For Each cp In comps
lbComps.Items.Add(cp)
Next
Thanks!
Oswald
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
try changing the GetCompoundList() function in Interfaces\Thermodynamics.vb to this:
<System.Runtime.InteropServices.DispId(7)> Public Function GetCompoundList() As String()
Try
Dim comps As New ArrayList
For Each c As ConstantProperties In _availablecomps.Values
comps.Add(c.Name)
Next
Dim values As Object() = comps.ToArray
Dim results2(values.Length - 1) As String
Dim i As Integer
For i = 0 To values.Length - 1
results2(i) = values(i)
Next
Return results2
Catch ex As Exception
Return New Object() {ex.ToString}
End Try
End Function
It should work. I'll update the source code to reflect this change. Thanks for your help!
Daniel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Daniel,
I'm a chem eng and busy trying to write some small apps which would help me in my day-to-day activities in designing petrochem plants.
In my search for thermo packages I came across DWSIM and DTL and am very impressed. I'm not nearly at the programming level you are, but I can help myself.
I've upgraded the VB2008 DTL code to VB2010 and the DTLTest program runs successfully. I started playing around with DTL, and immediately ran into a problem.
I can't seem to get a compound list loaded, similar to DWSIM. I can load the available property packages, but when I try to load the compounds, I get a blank array.
I've written some basic code to load the compounds into a listbox, and it is listed below. I've tried to initialize dtlc with a path to dwsim.xml and chemsep1.xml. dwsim.xml works, but still no compounds, chemsep throws an exception.
I've spent quite a number of hours on this so some guidance would be much appreciated. I've even tried to copy code from DWSIM (GetComponents), but ran into more problems than solutions.
Herewith the (fairly simple) code snippet:
Thanks!
Oswald
Hi Oswald,
try changing the GetCompoundList() function in Interfaces\Thermodynamics.vb to this:
It should work. I'll update the source code to reflect this change. Thanks for your help!
Daniel
Thanks Daniel, works perfectly.