//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#pragma package(smart_init)
#include <vcl/dstring.h>
//---------------------------------------------------------------------------
#include "Lxd_Ai.h"
#include "Lxd_Ao.h"
#include "Lxd_Dio.h"
//---------------------------------------------------------------------------
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys\timeb.h>
#include <FileCtrl.hpp>
#include <Dialogs.hpp>
//---------------------------------------------------------------------------
int AINUM;
int AONUM;
int DINUM;
int DONUM;
int HOTNUM;
int LISTNUM;
int BARNUM;
//---------------------------------------------------------------------------
TAnalogeAI *vAin;
TAnalogeAO *vAout;
TdigitalDi *vDin;
TdigitalDo *vDout;
TQflow Qflow;
TdigitalHot *vHot;
int *HpList;
int *HpBar;
//---------------------------------------------------------------------------
#ifdef DEBUG
float vDemoTime;
long vStartTime;
#endif
extern AnsiString V1;
//---------------------------------------------------------------------------
#include "MainUnit.h"
extern TmainForm *mainForm;
extern void CommSend(void);
//---------------------------------------------------------------------------
#include "KaiUnit.h"
#include "HotUnit.h"
//---------------------------------------------------------------------------
#include "CovUnit.h"
extern TCoverForm *CoverForm; //系统名称画面 use for to change Form
//---------------------------------------------------------------------------
#include "ListUnit.h"
extern TListForm *ListForm; //数据列表画面 use for to change Form
extern void ListDataDisplay(void); //周期性数据列表刷新
extern void ListLedDisplay(void); //非周期性数据列表刷新
//---------------------------------------------------------------------------
#include "BarUnit.h"
extern TBarForm *BarForm; //数据棒图画面 use for to change Form
extern void BarDataDisplay(void); //周期性数据列表刷新
extern void BarLedDisplay(void); //非周期性数据列表刷新
//---------------------------------------------------------------------------
#include "TrdUnit.h"
extern TTrendForm *TrendForm; //实时趋势图画面 use for to change Form
extern void TrendDataDisplay(void); //周期性数据列表刷新
extern void TrendLedDisplay(void); //非周期性数据列表刷新
//---------------------------------------------------------------------------
#include "HistUnit.h"
extern THistForm *HistForm;//历史趋势图画面 use for to change Form
extern void HisDataSave(void);//Save History Data
extern void HisDataDisplay(void);//周期性刷新Form窗体
//---------------------------------------------------------------------------
#include "HisUnit2.h"
extern THistForm2 *HistForm2;//液位历史趋势图画面 use for to change Form
//extern void HisData2Save(void);//Save History2 Data
//---------------------------------------------------------------------------
#include "PidUnit.h"
extern TPidForm *PidForm; //调节画面 use for to change Form
extern void PidDataDisplay(void); //周期性数据列表刷新
extern void PidLedDisplay(void); //非周期性数据列表刷新
//---------------------------------------------------------------------------
#include "LU1Unit.h"
extern TLU1Form *LU1Form; //画面 use for to change Form
extern void LU1DataDisplay(void); //周期性数据列表刷新
//---------------------------------------------------------------------------
#include "RptUnit.h"
extern TRptForm *RptForm; //报表画面 use for to change Form
//extern void RptInitDataDisplay(void);
//---------------------------------------------------------------------------
#include "tools.h"
extern bool SetRange1Flag,SetRange2Flag;
extern bool SetPid1Flag,SetPid2Flag;
extern void GetDi(void);
extern void SetDo1(void);
extern void SetHot1(void);
extern void GetHot1(void);
extern void SetRange1Prodave(void);
extern void SetRange2Prodave(void);
extern void Get1Prodave(void);
extern void Get2Prodave(void);
extern void SetPid1Prodave(void);
extern void SetPid2Prodave(void);
extern void GetPid2(void);
extern bool CanHot;
extern bool CanSetDo;
//---------------------------------------------------------------------------
//For timer count
int vCount=0; //in Timer to count timer times every 100ms
int CurrentWinNum=-1; //当前前台显示的窗体号;0为CoverForm窗体
//使用在SpeedButton中直接赋值,WinChange和WinRepaint
//根据WinNum操作相应的窗体
//---------------------------------------------------------------------------
struct timeb t; //#include <sys\timeb.h>
TMyTime vMyTime;
//---------------------------------------------------------------------------
//CLASS=TMyTime构造函数
TMyTime::TMyTime(void)
{ ftime(&t);
vTimeMilliBegin=t.millitm; //毫秒开始时间计时
vTimeMilliEnd=t.millitm; //毫秒结束时间计时
vTimeMilliValue=30; //毫秒时间差值
vTimeSecondBegin=t.time; //秒开始时间计时
vTimeSecondEnd=t.time; //秒结束时间计时
vTimeSecondValue=2; //秒时间差值
vTimeValue=2.030; //时间差值
/*#ifdef DEBUG
vStartTime=vTimeSecondBegin;
#endif*/
}
//---------------------------------------------------------------------------
//CLASS=TMyTime析构函数
TMyTime::~TMyTime()
{
}
//---------------------------------------------------------------------------
void TMyTime::ValueOfTime(void)
{ ftime(&t);
vTimeMilliBegin=t.millitm;
vTimeSecondBegin=t.time;
vTimeSecondValue=vTimeSecondBegin-vTimeSecondEnd;
vTimeMilliValue=vTimeMilliBegin-vTimeMilliEnd;
if(vTimeSecondValue<0) {vTimeSecondValue=2;}
vTimeValue=vTimeSecondValue + vTimeMilliValue/1000;
/*#ifdef DEBUG
CoverForm->Label1->Caption="毫秒开始时间计时:";
CoverForm->Label2->Caption="毫秒结束时间计时:";
CoverForm->Label3->Caption="毫秒时间差值:";
CoverForm->Label4->Caption="秒开始时间计时:";
CoverForm->Label5->Caption="秒结束时间计时:";
CoverForm->Label6->Caption="秒时间差值:";
CoverForm->Label7->Caption="时间差值:";
CoverForm->Label8->Caption="时间累加值:";
CoverForm->Label9->Caption="系统时间差值:";
CoverForm->StaticText1->Caption=vMyTime.vTimeMilliBegin;
CoverForm->StaticText2->Caption=vMyTime.vTimeMilliEnd;
CoverForm->StaticText3->Caption=vMyTime.vTimeMilliValue;
CoverForm->StaticText4->Caption=vMyTime.vTimeSecondBegin;
CoverForm->StaticText5->Caption=vMyTime.vTimeSecondEnd;
CoverForm->StaticText6->Caption=vMyTime.vTimeSecondValue;
CoverForm->StaticText7->Caption=vMyTime.vTimeValue;
vDemoTime += vMyTime.vTimeValue;
CoverForm->StaticText8->Caption=vDemoTime;
CoverForm->StaticText9->Caption=vMyTime.vTimeSecondBegin-vStartTime;
#else
CoverForm->Label1->Visible=false;
CoverForm->Label2->Visible=false;
CoverForm->Label3->Visible=false;
CoverForm->Label4->Visible=false;
CoverForm->Label5->Visible=false;
CoverForm->Label6->Visible=false;
CoverForm->Label7->Visible=false;
CoverForm->Label8->Visible=false;
CoverForm->Label9->Visible=false;
CoverForm->StaticText1->Visible=false;
CoverForm->StaticText2->Visible=false;
CoverForm->StaticText3->Visible=false;
CoverForm->StaticText4->Visible=false;
CoverForm->StaticText5->Visible=false;
CoverForm->StaticText6->Visible=false;
CoverForm->StaticText7->Visible=false;
CoverForm->StaticText8->Visible=false;
CoverForm->StaticText9->Visible=false;
#endif */
vTimeMilliEnd=vTimeMilliBegin;
vTimeSecondEnd=vTimeSecondBegin;
}
//---------------------------------------------------------------------------
TdigitalHot::TdigitalHot(void)
{
}
TdigitalHot::~TdigitalHot(void)
{
}
//---------------------------------------------------------------------------
//CLASS=TAnalogeIn构造函数
TAnalogeAI::TAnalogeAI(void)