P
pdrich
Unregistered / Unconfirmed
GUEST, unregistred user!
类的属性赋值方法?
unit uLossClass;
interface
uses
Windows;
type
TLoss = class
private
RatedCapacity: Single
//变压器额定容量 KVA
RatedHighVoltage: Single
//变压器额定高压电压 KV
RatedLowVoltage: Single
//额定低压电压 KV
RatedHighCurrent: Single
//额定高压电流 A
RatedLowCurrent: Single
//额定低压电流 A
ResistanceMeasureTemperature: Single
//电阻测量时温度
LoadMeasureTemperature: Single
//负载测量时温度
HighResistance_OA: Single
//高压电阻OA
HighResistance_OB: Single
//高压电阻OB
HighResistance_OC: Single
//高压电阻OC
LowResistance_ab: Single
//低压电阻ab
LowResistance_bc: Single
//低压电阻bc
LowResistance_ca: Single
//低压电阻ca
VoltageInductorMultiple: Integer
//电压互感器档位
CurrentInductorMultiple: Integer
//电流互感器档位
MeasureVoltage_AB: Single
//测量电压值AB
MeasureVoltage_BC: Single
//测量电压值BC
MeasureVoltage_CA: Single
//测量电压值CA
MeasureCurrent_A: Single
//测量电流值A
MeasureCurrent_B: Single
//测量电流值B
MeasureCurrent_C: Single
//测量电流值C
public
function Loss_K: Single
// 计算负载K常数值函数
function ResistanceLoss_K: Single
// 计算K2常数值函数
procedure SetValue (K1, K2: Single);
end;
implementation
{ TLoss }
{ TLoss }
function TLoss.Loss_K: Single
// 计算负载K常数值函数
begin
Result :=(235+75)/(235+LoadMeasureTemperature);
end;
function TLoss.ResistanceLoss_K: Single
// 计算K2常数值函数
begin
Result :=(235+LoadMeasureTemperature)/(235+ResistanceMeasureTemperature);
end;
procedure TLoss.SetValue(K1, K2: Single);
begin
ResistanceMeasureTemperature := K1;
LoadMeasureTemperature := K2;
end;
end.
-----------------------------
unit LoadLossFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,uLossClass;
type
TFrmLoadLoss = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Button1: TButton;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FrmLoadLoss: TFrmLoadLoss;
implementation
{$R *.dfm}
procedure TFrmLoadLoss.Button1Click(Sender: TObject);
var
ADay: TLoss;
begin
// create an object
ADay:= TLoss.Create;
// use the object
ADay.SetValue (StrToFloat (Edit1.Text),StrToFloat (Edit2.Text) );
ShowMessage ('K2=' +FloatToStr(ADay.ResistanceLoss_K)+';K1='+FloatToStr(ADay.Loss_K));
end;
end.
unit uLossClass;
interface
uses
Windows;
type
TLoss = class
private
RatedCapacity: Single
//变压器额定容量 KVA
RatedHighVoltage: Single
//变压器额定高压电压 KV
RatedLowVoltage: Single
//额定低压电压 KV
RatedHighCurrent: Single
//额定高压电流 A
RatedLowCurrent: Single
//额定低压电流 A
ResistanceMeasureTemperature: Single
//电阻测量时温度
LoadMeasureTemperature: Single
//负载测量时温度
HighResistance_OA: Single
//高压电阻OA
HighResistance_OB: Single
//高压电阻OB
HighResistance_OC: Single
//高压电阻OC
LowResistance_ab: Single
//低压电阻ab
LowResistance_bc: Single
//低压电阻bc
LowResistance_ca: Single
//低压电阻ca
VoltageInductorMultiple: Integer
//电压互感器档位
CurrentInductorMultiple: Integer
//电流互感器档位
MeasureVoltage_AB: Single
//测量电压值AB
MeasureVoltage_BC: Single
//测量电压值BC
MeasureVoltage_CA: Single
//测量电压值CA
MeasureCurrent_A: Single
//测量电流值A
MeasureCurrent_B: Single
//测量电流值B
MeasureCurrent_C: Single
//测量电流值C
public
function Loss_K: Single
// 计算负载K常数值函数
function ResistanceLoss_K: Single
// 计算K2常数值函数
procedure SetValue (K1, K2: Single);
end;
implementation
{ TLoss }
{ TLoss }
function TLoss.Loss_K: Single
// 计算负载K常数值函数
begin
Result :=(235+75)/(235+LoadMeasureTemperature);
end;
function TLoss.ResistanceLoss_K: Single
// 计算K2常数值函数
begin
Result :=(235+LoadMeasureTemperature)/(235+ResistanceMeasureTemperature);
end;
procedure TLoss.SetValue(K1, K2: Single);
begin
ResistanceMeasureTemperature := K1;
LoadMeasureTemperature := K2;
end;
end.
-----------------------------
unit LoadLossFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,uLossClass;
type
TFrmLoadLoss = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Button1: TButton;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FrmLoadLoss: TFrmLoadLoss;
implementation
{$R *.dfm}
procedure TFrmLoadLoss.Button1Click(Sender: TObject);
var
ADay: TLoss;
begin
// create an object
ADay:= TLoss.Create;
// use the object
ADay.SetValue (StrToFloat (Edit1.Text),StrToFloat (Edit2.Text) );
ShowMessage ('K2=' +FloatToStr(ADay.ResistanceLoss_K)+';K1='+FloatToStr(ADay.Loss_K));
end;
end.