Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DanWBR committed Aug 28, 2018
1 parent 5ba891d commit a52db87
Show file tree
Hide file tree
Showing 25 changed files with 423 additions and 60 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ obj
/DTLTest3/bin/Release
/DWSIM/bin/Release
*.suo
/.vs/DTL/v15/Server/sqlite3
7 changes: 5 additions & 2 deletions DTL.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2003
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DTL", "DWSIM\DTL.vbproj", "{34BE2D2D-9B3C-4C12-8C90-732E21CD7CB1}"
EndProject
Expand Down Expand Up @@ -60,4 +60,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AA0A61F3-6EE0-4247-9830-8C8B619D69E2}
EndGlobalSection
EndGlobal
Binary file modified DTL.v12.suo
Binary file not shown.
3 changes: 2 additions & 1 deletion DTLTest/DTLTest.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B444F627-6E4F-467E-B736-F9D117849788}</ProjectGuid>
<OutputType>Exe</OutputType>
<StartupObject>DTLTest.Module1</StartupObject>
<StartupObject>DTLTest.test</StartupObject>
<RootNamespace>DTLTest</RootNamespace>
<AssemblyName>DTLTest</AssemblyName>
<FileAlignment>512</FileAlignment>
Expand Down Expand Up @@ -61,6 +61,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Module1.vb" />
<Compile Include="Module2.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
Expand Down
63 changes: 63 additions & 0 deletions DTLTest/Module2.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
Imports DTL.DTL.SimulationObjects.PropertyPackages
Imports System.Linq
Module test
Sub Main()
Dim dtlc As New DTL.Thermodynamics.Calculator()
dtlc.Initialize()
dtlc.SetDebugLevel(0)
'Peng-Robinson Property Package
Dim prpp As PropertyPackage = dtlc.GetPropPackInstance("Peng-Robinson (PR)")
Dim FlashAlg As Integer = 2 'Nested loops VLE
Dim compounds As String() = New String() {"Methane", "Isobutane", "N-decane"}
Dim molefractions As Double() = New Double() {0.8, 0.1, 0.1}
Dim P As Double = 80 'bar
Dim T As Double = 30 'C
prpp.SetParameterValue(Parameter.FlashAlgorithmFastMode, 0)
Dim result As Auxiliary.FlashAlgorithms.FlashCalculationResult
result = dtlc.CalcEquilibrium(DTL.Thermodynamics.Calculator.FlashCalculationType.PressureTemperature,
FlashAlg, P * 101325, T + 273.15, prpp, compounds, molefractions, Nothing, 0)
If result.ResultException Is Nothing Then
Dim vmolefractions() As Double
Dim lmolefractions() As Double
Dim fv As Double
Console.Write("Vapor mole fraction ")
fv = result.GetVaporPhaseMoleFraction
Console.Write(fv)
Console.Write(vbCrLf)
'Vapor Phase compound mole fractions:
Console.Write("Vapor compound mole fractions ")
vmolefractions = result.GetVaporPhaseMoleFractions
For count = 0 To UBound(vmolefractions)
Console.Write(vmolefractions(count) & " ")
Next
Console.Write(vbCrLf)
'Liquid Phase 1 compound mole fractions:
Console.Write("Liquid compound mole fractions ")
lmolefractions = result.GetLiquidPhase1MoleFractions
For count = 0 To UBound(lmolefractions)
Console.Write(lmolefractions(count) & " ")
Next
Console.Write(vbCrLf)
Dim PropValues As Object
PropValues = dtlc.CalcProp(prpp, "viscosity", "mole", "Vapor", compounds, T + 273.15, P * 101325, vmolefractions)
Console.Write("Vapor viscosity ")
Console.Write(PropValues(0).ToString & vbTab)
Console.Write(vbCrLf)
PropValues = dtlc.CalcProp(prpp, "viscosity", "mole", "Liquid", compounds, T + 273.15, P * 101325, lmolefractions)
Console.Write("Liquid viscosity ")
Console.Write(PropValues(0).ToString & vbTab)
Console.Write(vbCrLf)
Console.Write("Surface Tension ")
PropValues = dtlc.CalcTwoPhaseProp(prpp, "surfaceTension", "UNDEFINED", "Vapor", "Liquid", compounds, T + 273.15, P * 101325, vmolefractions, lmolefractions)
Console.Write(PropValues(0).ToString & vbTab)
Console.Write(vbCrLf)
Else
Console.Write(vbCrLf)
Console.WriteLine("Error calculating flash: " & result.ResultException.Message.ToString)
Console.Write(vbCrLf)
End If
Console.Write(vbCrLf)
Console.WriteLine("Press any key to continue...")
Console.ReadKey(True)
End Sub
End Module
10 changes: 3 additions & 7 deletions DTLTest3/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using DTL.DTL.SimulationObjects.PropertyPackages;
using DTL.DTL.SimulationObjects.Streams;
using DTL;

namespace DTLTest3
{
Expand All @@ -15,7 +11,7 @@ class Program
static void Main(string[] args)
{

Test1();
Test2();

}

Expand All @@ -25,8 +21,8 @@ static void Test1()

DTL.Thermodynamics.Calculator dtlc = new DTL.Thermodynamics.Calculator();
dtlc.Initialize();
string[] comps = new string[] { "Ethane", "Methane" };
double[] fracs = new double[] { 0.5, 0.5 };
string[] comps = new string[] { "Ethane", "Methane", "Propane" };
double[] fracs = new double[] { 0.5, 0.5, 1e-6 };

double[] critpt = dtlc.CalcTrueCriticalPoint("PR", comps, fracs);

Expand Down
31 changes: 23 additions & 8 deletions DWSIM/DTL.vbproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.props" Condition="Exists('..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -10,7 +11,7 @@
<StartupObject>
</StartupObject>
<RootNamespace>DTL</RootNamespace>
<AssemblyName>DTL</AssemblyName>
<AssemblyName>DWSIM.Thermodynamics</AssemblyName>
<MyType>Windows</MyType>
<IsWebBootstrapper>false</IsWebBootstrapper>
<ManifestCertificateThumbprint>9811384C174DFC8254FB98B174DA65366428B233</ManifestCertificateThumbprint>
Expand Down Expand Up @@ -48,28 +49,30 @@
<ApplicationVersion>0.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>DTL.xml</DocumentationFile>
<DocumentationFile>DWSIM.Thermodynamics.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355</NoWarn>
<WarningsAsErrors>
</WarningsAsErrors>
<UseVSHostingProcess>true</UseVSHostingProcess>
<RemoveIntegerChecks>true</RemoveIntegerChecks>
<Optimize>true</Optimize>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>false</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>DTL.xml</DocumentationFile>
<DocumentationFile>DWSIM.Thermodynamics.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355</NoWarn>
<WarningsAsErrors>
</WarningsAsErrors>
Expand All @@ -82,7 +85,7 @@
<DefineDebug>false</DefineDebug>
<DefineTrace>false</DefineTrace>
<OutputPath>bin\x86\Debug\</OutputPath>
<DocumentationFile>DTL.xml</DocumentationFile>
<DocumentationFile>DWSIM.Thermodynamics.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355</NoWarn>
<DebugType>Full</DebugType>
<PlatformTarget>x86</PlatformTarget>
Expand All @@ -93,7 +96,7 @@
<DebugSymbols>true</DebugSymbols>
<DefineTrace>false</DefineTrace>
<OutputPath>bin\x86\Release\</OutputPath>
<DocumentationFile>DTL.xml</DocumentationFile>
<DocumentationFile>DWSIM.Thermodynamics.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355</NoWarn>
<DebugType>Full</DebugType>
<PlatformTarget>x86</PlatformTarget>
Expand All @@ -105,7 +108,7 @@
<DebugSymbols>true</DebugSymbols>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x86\</OutputPath>
<DocumentationFile>DTL.xml</DocumentationFile>
<DocumentationFile>DWSIM.Thermodynamics.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -115,7 +118,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'x86|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\x86\</OutputPath>
<DocumentationFile>DTL.xml</DocumentationFile>
<DocumentationFile>DWSIM.Thermodynamics.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355</NoWarn>
<DebugType>Full</DebugType>
<PlatformTarget>x86</PlatformTarget>
Expand Down Expand Up @@ -255,6 +258,7 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="ILMerge.props" />
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
Expand Down Expand Up @@ -345,7 +349,18 @@
<EmbeddedResource Include="bin\x86\Release\data\NIST-MODFAC_IP.txt" />
<EmbeddedResource Include="bin\x86\Release\data\NIST-MODFAC_RiQi.txt" />
</ItemGroup>
<ItemGroup>
<Content Include="ILMergeOrder.txt" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.props'))" />
<Error Condition="!Exists('..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.targets'))" />
</Target>
<Import Project="..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.targets" Condition="Exists('..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
68 changes: 68 additions & 0 deletions DWSIM/ILMerge.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- -->
<!-- ILMerge project-specific settings. Almost never need to be set explicitly. -->
<!-- for details, see http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx -->
<!-- -->
<!-- *** set this file to Type=None, CopyToOutput=Never *** -->

<!-- If True, all copy local dependencies will also be merged from referenced projects whether they are referenced in the current project explicitly or not -->
<ILMergeTransitive>true</ILMergeTransitive>

<!-- Extra ILMerge library paths (semicolon-separated). Dont put your package dependencies here, they will be added automagically -->
<ILMergeLibraryPath></ILMergeLibraryPath>

<!-- The solution NuGet package directory if not standard 'SOLUTION\packages' -->
<ILMergePackagesPath></ILMergePackagesPath>

<!-- The merge order file name if differs from standard 'ILMergeOrder.txt' -->
<ILMergeOrderFile></ILMergeOrderFile>

<!-- The strong key file name if not specified in the project -->
<ILMergeKeyFile></ILMergeKeyFile>

<!-- The assembly version if differs for the version of the main assembly -->
<ILMergeAssemblyVersion></ILMergeAssemblyVersion>

<!-- added in Version 1.0.4 -->
<ILMergeFileAlignment></ILMergeFileAlignment>

<!-- added in Version 1.0.4, default=none -->
<ILMergeAllowDuplicateType></ILMergeAllowDuplicateType>

<!-- If the <see cref="CopyAttributes"/> is also set, any assembly-level attributes names that have the same type are copied over into the target assembly -->
<ILMergeAllowMultipleAssemblyLevelAttributes></ILMergeAllowMultipleAssemblyLevelAttributes>

<!-- See ILMerge documentation -->
<ILMergeAllowZeroPeKind></ILMergeAllowZeroPeKind>

<!-- The assembly level attributes of each input assembly are copied over into the target assembly -->
<ILMergeCopyAttributes></ILMergeCopyAttributes>

<!-- Creates a .pdb file for the output assembly and merges into it any .pdb files found for input assemblies, default=true -->
<ILMergeDebugInfo></ILMergeDebugInfo>

<!-- Target assembly will be delay signed -->
<ILMergeDelaySign></ILMergeDelaySign>

<!-- Types in assemblies other than the primary assembly have their visibility modified -->
<ILMergeInternalize></ILMergeInternalize>

<!-- The path name of the file that will be used to identify types that are not to have their visibility modified -->
<ILMergeInternalizeExcludeFile></ILMergeInternalizeExcludeFile>

<!-- XML documentation files are merged to produce an XML documentation file for the target assembly -->
<ILMergeXmlDocumentation>true</ILMergeXmlDocumentation>

<!-- External assembly references in the manifest of the target assembly will use full public keys (false) or public key tokens (true, default value) -->
<ILMergePublicKeyTokens></ILMergePublicKeyTokens>

<!-- Types with the same name are all merged into a single type in the target assembly -->
<ILMergeUnionMerge></ILMergeUnionMerge>

<!-- The version of the target framework, default 40 (works for 45 too) -->
<ILTargetPlatform></ILTargetPlatform>

</PropertyGroup>
</Project>
3 changes: 3 additions & 0 deletions DWSIM/ILMergeOrder.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# this file contains the partial list of the merged assemblies in the merge order
# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build
# and finetune merge order to your satisfaction
4 changes: 2 additions & 2 deletions DWSIM/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("DWSIM Thermodynamics Library (DTL)")>
<Assembly: AssemblyCompany("DWSIM Project")>
<Assembly: AssemblyProduct("DWSIM")>
<Assembly: AssemblyCopyright("Copyright 2007-2016 Daniel Wagner O. de Medeiros")>
<Assembly: AssemblyCopyright("Copyright 2007-2018 Daniel Wagner O. de Medeiros")>
<Assembly: AssemblyTrademark("DWSIM")>

<Assembly: ComVisible(True)>
Expand All @@ -31,7 +31,7 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("3.3.0")>
<Assembly: AssemblyVersion("3.4.0")>
'<Assembly: AssemblyFileVersion("1.6")>

<Assembly: NeutralResourcesLanguageAttribute("pt-BR")>
Loading

0 comments on commit a52db87

Please sign in to comment.