找传奇、传世资源到传世资源站!

delphi 干湿球温湿度计算小工具源码

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

【例子介绍】

【相关图片】

from clipboard

【源码结构】

unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,math;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    GanTEdit: TEdit;
    Label2: TLabel;
    Label3: TLabel;
    ShiTEdit: TEdit;
    Label4: TLabel;
    Button1: TButton;
    ganBHEdit: TEdit;
    Button2: TButton;
    shiBHEdit: TEdit;
    Button3: TButton;
    ChaEdit: TEdit;
    Button4: TButton;
    ShuiEdit: TEdit;
    Label5: TLabel;
    XishuEdit: TEdit;
    Label6: TLabel;
    QiyaEdit: TEdit;
    Label7: TLabel;
    mmph: TLabel;
    Button5: TButton;
    shiduEdit: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
  private
    { Private declarations }
    function antoineFunc(T:double):double;
    function antoineFunc1(T:double):double;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function TForm1.antoineFunc(T: double): double;
//Ph=e^(A-B/(C T))
const A=18.3063; B=3816.44;   C=-46.13;e=2.7182818284;
var
  lpot:double;
begin
  lpot:=(A-B/(C T 273.16));
  result:=power(e,lpot);
end;

function TForm1.antoineFunc1(T: double): double;
const  T1=273.16;
var ldou:double;
  {纯水平液面饱和水汽压的计算公式
logEW=10.79574(1-T1/T)-5.02800log(T/T1) 1.50475×10-4[1-
10-8.2969(T/ T1-1)] 0.42873×10-3(104.76955(1-T1/T)-
1)] 0.78614
式中,EW:纯水平液面饱和水汽压(hPa);T1=273.16K(水
的三相点温度);T=273.15 t℃(绝对温度K)。}
begin
  ldou:=10.79574*(1-T1/(T 273.15));
  ldou:=ldou-5.02800*log10((T 273.15)/T1);
  ldou:=ldou 1.50475*power(10,-4)*(1-power(10,-8.2969*((T 273.15)/ T1-1)));
  ldou:=ldou 0.42873*power(10,-3)*(power(10,4.76955*(1-(T 273.15)/T1))-1)-0.21368;
  result:=power(10,ldou);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  ldouble:double;
begin
  if not trystrtofloat(ganTedit.Text,ldouble) then
  begin
    showmessage('请您输入将输入的干球温度改为浮点数');
    exit;
  end;
  ldouble:=antoineFunc1(ldouble);
  ganbhEdit.text:=floattostr(ldouble);
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  ldouble:double;
begin
  if not trystrtofloat(shiTedit.Text,ldouble) then
  begin
    showmessage('请您输入将输入的湿球温度改为浮点数');
    exit;
  end;
  ldouble:=antoineFunc1(ldouble);
  shibhEdit.text:=floattostr(ldouble);
end;

procedure TForm1.Button3Click(Sender: TObject);
var
  ldouble1,ldouble2:double;
begin
  if not( trystrtofloat(shiTedit.Text,ldouble2)and trystrtofloat(ganTedit.Text,ldouble1))  then
  begin
    showmessage('请您输入将输入的干湿球温度改为浮点数');
    exit;
  end;
  ldouble1:=(ldouble1-ldouble2);
  chaEdit.text:=floattostr(ldouble1);
end;

procedure TForm1.Button4Click(Sender: TObject);
var
  ldouble1,ldouble2,ldouble3,ldouble4:double;
  ldouble:double;
begin
  //E=Etw-Ai*Ph*(t-tw)
  if not trystrtofloat(ganTedit.Text,ldouble1) then
  begin
    showmessage('请您输入将输入的干球温度改为浮点数');
    exit;
  end;
  if not trystrtofloat(shiTedit.Text,ldouble2) then
  begin
    showmessage('请您输入将输入的湿球温度改为浮点数');
    exit;
  end;
  if not trystrtofloat(xishuedit.Text,ldouble3) then
  begin
    showmessage('请您输入将输入的干球温度改为浮点数');
    exit;
  end;
  if not trystrtofloat(qiyaedit.Text,ldouble4) then
  begin
    showmessage('请您输入将输入的干球温度改为浮点数');
    exit;
  end;
  ldouble:=antoineFunc1(ldouble2);
  ldouble:=ldouble-ldouble3*0.001*ldouble4*(ldouble1-ldouble2);
  shuiedit.text:=floattostr(ldouble);
end;

procedure TForm1.Button5Click(Sender: TObject);
var
  ldouble1,ldouble2,ldouble3,ldouble4:double;
  ldouble:double;
begin
  //E=Etw-Ai*Ph*(t-tw)
  if not trystrtofloat(ganTedit.Text,ldouble1) then
  begin
    showmessage('请您输入将输入的干球温度改为浮点数');
    exit;
  end;
  if not trystrtofloat(shiTedit.Text,ldouble2) then
  begin
    showmessage('请您输入将输入的湿球温度改为浮点数');
    exit;
  end;
  if not trystrtofloat(xishuedit.Text,ldouble3) then
  begin
    showmessage('请您输入将输入的干温系数改为浮点数');
    exit;
  end;
  if not trystrtofloat(qiyaedit.Text,ldouble4) then
  begin
    showmessage('请您输入将输入的大气压改为浮点数');
    exit;
  end;
  ldouble:=antoineFunc1(ldouble2);
  ldouble:=ldouble-ldouble3*0.001*ldouble4*(ldouble1-ldouble2);
  ldouble1:=antoineFunc1(ldouble1);
  ldouble:=ldouble/ldouble1*100;
  //shuiedit.text:=floattostr(ldouble);
  shiduEdit.Text:=floattostr(ldouble);
end;


end.

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复