mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-01-22 20:38:01 -05:00
log14dec2105.txt
This commit is contained in:
BIN
wrappers/Delphi/Project4.res
Normal file
BIN
wrappers/Delphi/Project4.res
Normal file
Binary file not shown.
14
wrappers/Delphi/Project5.dpr
Normal file
14
wrappers/Delphi/Project5.dpr
Normal file
@@ -0,0 +1,14 @@
|
||||
program Project5;
|
||||
{$apptype console}
|
||||
|
||||
uses
|
||||
cpIntf;
|
||||
|
||||
var
|
||||
dat: AnsiString;
|
||||
begin
|
||||
SetLength(dat, 1024);
|
||||
get_global_param_string('FluidsList', PAnsiChar(dat), 1024);
|
||||
writeln(dat);
|
||||
readln;
|
||||
end.
|
||||
BIN
wrappers/Delphi/coolprop_error01.png
Normal file
BIN
wrappers/Delphi/coolprop_error01.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
1
wrappers/Delphi/log14dec2015.txt
Normal file
1
wrappers/Delphi/log14dec2015.txt
Normal file
@@ -0,0 +1 @@
|
||||
Some more examples.
|
||||
20
wrappers/Delphi/project1.dpr
Normal file
20
wrappers/Delphi/project1.dpr
Normal file
@@ -0,0 +1,20 @@
|
||||
program project1;
|
||||
{$apptype console}
|
||||
|
||||
uses
|
||||
SysUtils, Windows,
|
||||
cpIntf;
|
||||
|
||||
var
|
||||
h: Double;
|
||||
begin
|
||||
|
||||
{
|
||||
Very simple example
|
||||
Get the vapor enthalpy at a given pressure.
|
||||
}
|
||||
|
||||
h := PropsSI('H', 'P', 101e3, 'Q', 1, 'R22');
|
||||
writeln(format('h = %0.3f kJ/kg',[1e-3*h]));
|
||||
readln;
|
||||
end.
|
||||
41
wrappers/Delphi/project2.dpr
Normal file
41
wrappers/Delphi/project2.dpr
Normal file
@@ -0,0 +1,41 @@
|
||||
program project2;
|
||||
{$apptype console}
|
||||
|
||||
uses
|
||||
SysUtils, Windows,
|
||||
cpIntf;
|
||||
|
||||
var
|
||||
T, h, p, D: Double;
|
||||
begin
|
||||
|
||||
{
|
||||
This example comes from Ian Bell.
|
||||
When I ran the original with Delphi, there were a few problems.
|
||||
In my cpIntf interface, the fpu exceptions are disabled
|
||||
and Ian's example works fine.
|
||||
}
|
||||
|
||||
Writeln('FLUID STATE INDEPENDENT INPUTS');
|
||||
|
||||
Writeln('TWO PHASE INPUTS (Pressure)');
|
||||
Writeln(Format('Density of saturated liquid Propane at 101325 Pa: %g kg/m^3', [PropsSI('D', 'P', 101325, 'Q', 0, 'Propane')]));
|
||||
Writeln(Format('Density of saturated vapor R290 at 101325 Pa: %g kg/m^3'+ sLineBreak, [PropsSI('D', 'P', 101325, 'Q', 1, 'R290')]));
|
||||
|
||||
Writeln('TWO PHASE INPUTS (Temperature)');
|
||||
Writeln(Format('Density of saturated liquid Propane at 300 K: %g kg/m^3', [PropsSI('D', 'T', 300, 'Q', 0, 'Propane')]));
|
||||
Writeln(Format('Density of saturated vapor R290 at 300 K: %g kg/m^3' + sLineBreak, [PropsSI('D', 'T', 300, 'Q', 1, 'R290')]));
|
||||
|
||||
Writeln('SINGLE PHASE CYCLE (Propane)');
|
||||
p := PropsSI('P', 'T', 300, 'D', 1, 'Propane');
|
||||
h := PropsSI('H', 'T', 300, 'D', 1, 'Propane');
|
||||
Writeln(Format('T,D -> P,H : 300,1 -> %g,%g', [p, h]));
|
||||
T := PropsSI('T', 'P', p, 'H', h, 'Propane');
|
||||
D := PropsSI('D', 'P', p, 'H', h, 'Propane');
|
||||
Writeln(Format('P,H -> T,D : %g, %g -> %g, %g' + sLineBreak, [p, h, T, D]));
|
||||
|
||||
Writeln('************ HUMID AIR PROPERTIES *************' + sLineBreak);
|
||||
Writeln(Format('Humidity ratio of 50%% rel. hum. air at 300 K, 101.325 kPa: %g kg_w/kg_da', [HAPropsSI('W', 'T', 300, 'P', 101325, 'R', 0.5)]));
|
||||
Writeln(Format('Relative humidity from last calculation: %g (fractional)', [HAPropsSI('R', 'T', 300, 'P', 101325, 'W', HAPropsSI('W', 'T', 300, 'P', 101325, 'R', 0.5))]));
|
||||
readln;
|
||||
end.
|
||||
19
wrappers/Delphi/project3.dpr
Normal file
19
wrappers/Delphi/project3.dpr
Normal file
@@ -0,0 +1,19 @@
|
||||
program project3;
|
||||
{$apptype console}
|
||||
|
||||
uses
|
||||
SysUtils, Windows,
|
||||
cpIntf;
|
||||
|
||||
var
|
||||
res: AnsiString;
|
||||
T: Double;
|
||||
begin
|
||||
SetLength(res, 1024);
|
||||
get_global_param_string('FluidsList', PAnsiChar(res), 1024);
|
||||
writeln(res);
|
||||
|
||||
T := PropsSI('T', 'P', 4.7e6, 'H', 330e3, 'R22')-273.15;
|
||||
writeln(T:6:2);
|
||||
readln;
|
||||
end.
|
||||
BIN
wrappers/Delphi/project4.png
Normal file
BIN
wrappers/Delphi/project4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
32
wrappers/Delphi/project6.dpr
Normal file
32
wrappers/Delphi/project6.dpr
Normal file
@@ -0,0 +1,32 @@
|
||||
program project6;
|
||||
{$apptype console}
|
||||
|
||||
{ Not using cpIntf
|
||||
This is to demo the problem when the exception is not disabled.
|
||||
It happens with the Delphi compiler.
|
||||
}
|
||||
|
||||
function PropsSI(spec: PAnsiChar;
|
||||
prop1: PAnsiChar; val1: Double;
|
||||
prop2: PAnsiChar; val2: Double;
|
||||
ref: PAnsiChar): Double; stdcall;
|
||||
external 'CoolProp.dll' name '_PropsSI@32';
|
||||
|
||||
const
|
||||
MCW_EM = Word($133f); // Disable all fpu exceptions
|
||||
var
|
||||
Saved8087CW: Word;
|
||||
p, h, t: double;
|
||||
begin
|
||||
Saved8087CW := Default8087CW;
|
||||
Set8087CW(MCW_EM);
|
||||
h := 330;
|
||||
p := 4.3; // no problem
|
||||
t := PropsSI('T', 'P', 1e6*p, 'H', 1e3*h, 'R22');
|
||||
writeln(t);
|
||||
p := 4.4; // crash if fpu not disabled
|
||||
t := PropsSI('T', 'P', 1e6*p, 'H', 1e3*h, 'R22');
|
||||
Set8087CW(Saved8087CW);
|
||||
writeln(t);
|
||||
readln;
|
||||
end.
|
||||
Reference in New Issue
Block a user