mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-02-08 21:05:14 -05:00
EES wrapper now works/builds/debugs etc. with v5 - much better debugging enabled - see Readme.txt in wrappers/EES
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
REM ******** set the variables ************
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
|
||||
call "C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
|
||||
|
||||
REM ******* compile all the sources ***************
|
||||
cl /c /MP3 /I../../CoolProp /EHsc ../../CoolProp/*.cpp
|
||||
|
||||
REM ******* compile the wrapper ***************
|
||||
cl /c /EHsc /I../../CoolProp main.cpp
|
||||
link /DLL *.obj /OUT:COOLPROP_EES.dlf
|
||||
|
||||
erase *.obj
|
||||
@@ -1,5 +0,0 @@
|
||||
REM ******* compile all the sources from CoolProp***************
|
||||
g++ -c -Wall -I../../CoolProp ../../CoolProp/*.cpp
|
||||
g++ -c -Wall -I../../CoolProp main.cpp
|
||||
g++ -shared -o COOLPROP_EES.dlf *.o -Wl
|
||||
erase *.o
|
||||
@@ -1,13 +0,0 @@
|
||||
REM ******** set the variables ************
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
|
||||
call "C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
|
||||
|
||||
REM ******* compile all the sources ***************
|
||||
cl /c /MP3 /I../../CoolProp /EHsc /DCOOLPROP_LIB /D"CONVENTION=__cdecl" ../../CoolProp/*.cpp
|
||||
|
||||
mkdir dll
|
||||
link /DLL *.obj /OUT:dll\CoolProp.dll
|
||||
copy dll\CoolProp.dll .
|
||||
dumpbin /EXPORTS CoolProp.dll > exports.txt
|
||||
erase *.obj
|
||||
erase *.exp
|
||||
@@ -2,7 +2,7 @@
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
#define MyAppName "CoolProp"
|
||||
#define MyAppVersion "${COOLPROP_VERSION}"
|
||||
#define MyAppVersion "${CoolProp_VERSION}"
|
||||
#define MyAppPublisher "University of Liege"
|
||||
#define MyAppURL "www.coolprop.org"
|
||||
|
||||
@@ -33,7 +33,6 @@ Source: "CoolProp.htm"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "CoolProp.LIB"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "COOLPROP_EES.dlf"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "CoolProp_EES_Sample.EES"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "coolpropsi.LIB"; DestDir: "{app}"; Flags: ignoreversion
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Icons]
|
||||
|
||||
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
copy COOLPROP_EES.dlf c:\EES32\Userlib\COOLPROP_EES\
|
||||
copy CoolProp.dll c:\EES32\Userlib\COOLPROP_EES\
|
||||
@@ -1,14 +0,0 @@
|
||||
[
|
||||
{
|
||||
"pre" : "",
|
||||
"sources" : ["%PACKAGE_HOME%/main.cpp"],
|
||||
"platform" : ["Windows"],
|
||||
"compiler" : "VS+",
|
||||
"bitness" : 32,
|
||||
"c_flags" : "/MP3 /I../../include /EHsc",
|
||||
"link_type" : "DLL",
|
||||
"link_fname" : "COOLPROP_EES.dlf",
|
||||
"link_flags" : "",
|
||||
"post" : ""
|
||||
}
|
||||
]
|
||||
@@ -1,76 +0,0 @@
|
||||
Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
|
||||
Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
|
||||
|
||||
Dump of file CoolProp.dll
|
||||
|
||||
File Type: DLL
|
||||
|
||||
Section contains the following exports for CoolProp.dll
|
||||
|
||||
00000000 characteristics
|
||||
535908FE time date stamp Thu Apr 24 14:52:14 2014
|
||||
0.00 version
|
||||
1 ordinal base
|
||||
50 number of functions
|
||||
50 number of names
|
||||
|
||||
ordinal hint RVA name
|
||||
|
||||
1 0 000A6950 DerivTerms
|
||||
2 1 000A6930 F2K
|
||||
3 2 001070D0 HAProps
|
||||
4 3 001088A0 HAProps_Aux
|
||||
5 4 0009EC70 IProps
|
||||
6 5 0009F650 IPropsSI
|
||||
7 6 0009C5F0 IsFluidType
|
||||
8 7 000A6910 K2F
|
||||
9 8 000A6CA0 Phase
|
||||
10 9 000A6D10 Phase_Tp
|
||||
11 A 000A6D80 Phase_Trho
|
||||
12 B 000A67A0 Props
|
||||
13 C 000A66E0 Props1
|
||||
14 D 000A6720 Props1SI
|
||||
15 E 000A6760 PropsS
|
||||
16 F 000A68A0 PropsSI
|
||||
17 10 000CA9B0 conductivity_background
|
||||
18 11 000CA930 conductivity_critical
|
||||
19 12 000CA530 conformal_Trho
|
||||
20 13 000A6EA0 disable_TTSE_LUT
|
||||
21 14 000A6F60 disable_TTSE_LUT_writing
|
||||
22 15 000A6E20 enable_TTSE_LUT
|
||||
23 16 000A6EE0 enable_TTSE_LUT_writing
|
||||
24 17 000A69A0 fromSI
|
||||
25 18 000A6A40 get_Fluid_index
|
||||
26 19 000A7090 get_TTSESinglePhase_LUT_range
|
||||
27 1A 000A6A20 get_debug_level
|
||||
28 1B 000A6C30 get_fluid_param_string
|
||||
29 1C 000A6BD0 get_global_param_string
|
||||
30 1D 000A6BA0 get_param_index
|
||||
31 1E 000A7150 get_standard_unit_system
|
||||
32 1F 000A6E60 isenabled_TTSE_LUT
|
||||
33 20 000A6F20 isenabled_TTSE_LUT_writing
|
||||
34 21 000CAB90 psatL_anc
|
||||
35 22 000CAC40 psatV_anc
|
||||
36 23 000A6620 redirect_stdout
|
||||
37 24 000CAA10 rhosatL_anc
|
||||
38 25 000CAAD0 rhosatV_anc
|
||||
39 26 000A6FA0 set_TTSESat_LUT_size
|
||||
40 27 000A7030 set_TTSESinglePhase_LUT_range
|
||||
41 28 000A6FE0 set_TTSESinglePhase_LUT_size
|
||||
42 29 000A6A70 set_TTSE_mode
|
||||
43 2A 000A6A30 set_debug_level
|
||||
44 2B 000A6DF0 set_phase
|
||||
45 2C 000A6690 set_reference_stateD
|
||||
46 2D 000A6650 set_reference_stateS
|
||||
47 2E 000A7160 set_standard_unit_system
|
||||
48 2F 000A69E0 toSI
|
||||
49 30 000CA7E0 viscosity_dilute
|
||||
50 31 000CA860 viscosity_residual
|
||||
|
||||
Summary
|
||||
|
||||
20000 .data
|
||||
9C000 .rdata
|
||||
25000 .reloc
|
||||
1FC000 .text
|
||||
@@ -29,13 +29,13 @@
|
||||
// //
|
||||
// Ian Bell //
|
||||
// Thermodynamics Laboratory //
|
||||
// University of Liège //
|
||||
// University of Liège //
|
||||
// //
|
||||
// January 2013 //
|
||||
//============================================================================================//
|
||||
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#include <algorithm>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "CoolProp.h"
|
||||
#include "CoolPropTools.h"
|
||||
|
||||
static const bool EES_DEBUG = false;
|
||||
static bool EES_DEBUG = false;
|
||||
|
||||
// Structure for handling ees calling syntax
|
||||
struct EesParamRec {
|
||||
@@ -54,8 +54,7 @@ struct EesParamRec {
|
||||
using namespace CoolProp;
|
||||
|
||||
// Tell C++ to use the "C" style calling conventions rather than the C++ mangled names
|
||||
|
||||
extern "C"
|
||||
extern "C"
|
||||
{
|
||||
__declspec (dllexport) double COOLPROP_EES(char fluid[256], int mode, struct EesParamRec *input_rec)
|
||||
{
|
||||
@@ -66,19 +65,19 @@ extern "C"
|
||||
|
||||
std::vector<double> z;
|
||||
|
||||
std::string ErrorMsg, Outstr, In1str, In2str, Fluidstr;
|
||||
std::string ErrorMsg, Outstr, In1str, In2str, Fluidstr, Units;
|
||||
std::vector<std::string> fluid_split;
|
||||
|
||||
if (mode==-1) {
|
||||
strcpy(fluid,"T = coolprop('D','P',101.325,'Q',0,'R134a')");
|
||||
strcpy(fluid,"T = PropsSI('T','P',101325,'Q',0,'Water')");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Split the string that is passed in at the '~' delimiter that was used to join it
|
||||
fluid_split = strsplit(fluid_string,'~');
|
||||
if (fluid_split.size() != 4)
|
||||
if (fluid_split.size() != 5)
|
||||
{
|
||||
sprintf(err_str,"fluid[%s] length[%d] not 4 elements long",fluid_string.c_str(),fluid_split.size());
|
||||
sprintf(err_str,"fluid[%s] length[%d] not 5 elements long",fluid_string.c_str(),fluid_split.size());
|
||||
strcpy(fluid,err_str);
|
||||
if (EES_DEBUG)
|
||||
{
|
||||
@@ -95,6 +94,15 @@ extern "C"
|
||||
Outstr = upper(fluid_split[1]);
|
||||
In1str = upper(fluid_split[2]);
|
||||
In2str = upper(fluid_split[3]);
|
||||
Units = upper(fluid_split[4]);
|
||||
}
|
||||
|
||||
if (Fluidstr.find("$DEBUG") != std::string::npos){
|
||||
EES_DEBUG = true;
|
||||
Fluidstr = Fluidstr.substr(0,Fluidstr.find("$DEBUG"));
|
||||
}
|
||||
else{
|
||||
EES_DEBUG = false;
|
||||
}
|
||||
|
||||
// Check the number of inputs
|
||||
@@ -128,31 +136,47 @@ extern "C"
|
||||
{
|
||||
FILE *fp;
|
||||
fp = fopen("log.txt","a+");
|
||||
fprintf(fp,"%s %s %g %s %g %s\n",Outstr.c_str(),In1str.c_str(),In1,In2str.c_str(),In2,Fluidstr.c_str());
|
||||
fprintf(fp,"Inputs: %s %s %g %s %g %s %s\n",Outstr.c_str(),In1str.c_str(),In1,In2str.c_str(),In2,Fluidstr.c_str(), Units.c_str());
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
//~ if (EES_DEBUG)
|
||||
//~ {
|
||||
//~ // This redirect standard output to file2.txt
|
||||
//~ freopen("log_stdout.txt", "w", stdout);
|
||||
//~ set_debug_level(10); // Maximum debugging
|
||||
//~ }
|
||||
if (EES_DEBUG)
|
||||
{
|
||||
// This redirects standard output to log_stdout.txt
|
||||
freopen("log_stdout.txt", "w", stdout);
|
||||
set_debug_level(100000); // Maximum debugging
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (z.size() > 0){
|
||||
// Mole fractions are given
|
||||
out = PropsSI(Outstr, In1str, In1, In2str, In2, Fluidstr, z);
|
||||
}
|
||||
else{
|
||||
out = PropsSI(Outstr, In1str, In1, In2str, In2, Fluidstr);
|
||||
}
|
||||
if (!Units.compare("SI")){
|
||||
if (z.size() > 0){
|
||||
// Mole fractions are given
|
||||
out = PropsSI(Outstr, In1str, In1, In2str, In2, Fluidstr, z);
|
||||
}
|
||||
else{
|
||||
// Mole fractions are not given
|
||||
out = PropsSI(Outstr, In1str, In1, In2str, In2, Fluidstr);
|
||||
}
|
||||
}
|
||||
else{
|
||||
// Mole fractions are not given
|
||||
out = PropsSI(Outstr, In1str, In1, In2str, In2, Fluidstr);
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
std::string err_str = format("Uncaught error: \"%s\",\"%s\",%g,\"%s\",%g,\"%s\"\n",Outstr.c_str(),In1str.c_str(),In1,In2str.c_str(),In2,Fluidstr.c_str());
|
||||
// There was an error
|
||||
if (EES_DEBUG)
|
||||
{
|
||||
FILE *fp;
|
||||
fp = fopen("log.txt","a+");
|
||||
fprintf(fp,"Error: %s \n",err_str.c_str());
|
||||
fclose(fp);
|
||||
}
|
||||
strcpy(fluid, err_str.c_str());
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@@ -186,6 +210,13 @@ extern "C"
|
||||
// There was a warning, write it back
|
||||
strcpy(fluid, warn_string.c_str());
|
||||
}
|
||||
if (EES_DEBUG)
|
||||
{
|
||||
FILE *fp;
|
||||
fp = fopen("log.txt", "a+");
|
||||
fprintf(fp,"Output: %g\n", out);
|
||||
fclose(fp);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user