資源簡介
c#調用refprop.dll文件來查物性參數, 只是封裝的代碼,refprop.dll需要自己下載。下載1分,沒分的消息給我。
代碼片段和文件信息
//R.?Franz
//Energent?LLC.
//Santa?Ana?CA.
#define?setup_use_string
using?System;
using?System.Runtime.InteropServices;
using?System.Text;
using?System.Windows.Forms;
//?all?variables?in?unmanaged?DLL?function?need?to?be?managed?types?in?code??i.e.?Int32?instead?of?long
namespace?mf_net_wa_sln
{
/*
for?nc=2?
HFILES_st=“C:/Program?Files/NIST/Refprop7/Fluids/R32.fld|C:/Program?Files/NIST/Refprop7/Fluids/R125.fld|“;
if?using?HFILES_ch?if?terminating?‘|‘?is?not?there?unable?to?find?file?for?2nd?component
console:??please?enter?file?name???unit?12
*/
//?modified?Refdemo.cpp
//?consider?changing?the?names?of?the?variables?in?this?sample?(and?Refdemo.cpp)?to?match?those?in?manual.txt
//??????subroutine?SETUP?(nchfileshfmixhrfierrherr)
//??????subroutine?SATP?(pxkphtrholrhovxliqxvapierrherr)
public?class?mf_net_wa__refprop
{
//?Some?constants...
//public?const?Int32?refpropfluidpathlength=10000;
public?const?Int32?refpropfluidpathlength=(refpropcharlength+1)*compsize;?//+1?for?‘|‘?between?file?names
public?const?Int32?refpropcharlength=255;
public?const?Int32?filepathlength=255;
public?const?Int32?lengthofreference=3;
public?const?Int32?errormessagelength=255;
public?const?Int32?compsize=20;
const?string?FluidsDirectory=??“c:/Program?Files/NIST/RefProp7/fluids/“;
const?string?MixturesDirectory=“c:/Program?Files/NIST/RefProp7/mixtures/“;
const?string?refpropDLL_path=??“c:/Program?Files/NIST/RefProp7/Refprop.dll“;
[DllImport(refpropDLL_path?EntryPoint=“SETUPdll“?SetLastError=true)]
//ok?public?static?extern?void?SETUPdll(ref?Int32?NumberOfComponents?char[]?HFILES?char[]?HFMIX?char[]?HRF?[In?Out]?ref?Int32?ierr?[MarshalAs(UnmanagedType.LPArray?SizeConst=errormessagelength)]?[In?Out]?char[]?HERR?Int32?l1?Int32?l2?Int32?l3?Int32?l4);
#if?(setup_use_string)
public?static?extern?void?SETUPdll(ref?Int32?NumberOfComponents?string?HFILES?string?HFMIX?string?HRF?[In?Out]?ref?Int32?ierr??[In?Out]?char[]?HERR?Int32?l1?Int32?l2?Int32?l3?Int32?l4);
#else
public?static?extern?void?SETUPdll(ref?Int32?NumberOfComponents?char[]?HFILES?char[]?HFMIX?char[]?HRF?[In?Out]?ref?Int32?ierr??[In?Out]?char[]?HERR?Int32?l1?Int32?l2?Int32?l3?Int32?l4);
#endif
[DllImport(refpropDLL_path?EntryPoint=“SATPdll“?SetLastError=true)]
//ok?public?static?extern?void?SATPdll(ref?double?PkPa?double[]?X?ref?Int32?KPH?[In?Out]?ref?double?TK?[In?Out]?ref?double?RHOF?[In?Out]?ref?double?RHOG?[Out]?double[]?XLIQ?[Out]?double[]?XVAP?[In?Out]?ref?Int32?ierr?[MarshalAs(UnmanagedType.LPArray?SizeConst=errormessagelength)]?[In?Out]?char[]?HERR?Int32?LengthHERR);
public?static?extern?void?SATPdll(ref?double?PkPa?double[]?X?ref?Int32?KPH?[In?Out]?ref?double?TK?[In?Out]?ref?double?RHOF?[In?Out]?ref?double?RHOG?[Out]?double[]?XLIQ?[Out]?double[]?XVAP?[In?Out]?ref?Int32?ierr?[In?Out]?char[]?HERR?Int32?LengthHERR);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????19068??2008-07-08?13:50??FENNESSY\refprop_NET.cs
?????文件???????21842??2008-07-08?13:50??FENNESSY\RefProp_NET.vb
?????目錄???????????0??2012-10-29?06:02??FENNESSY\
- 上一篇:C#+sqlite 登錄Demo
- 下一篇:Unity3d使用Meth實現溫度云圖
評論
共有 條評論