六 模拟控制室

本系统可用DP-668 实验仪模拟产生控制室数据。DP-668 实验仪具有模拟控制室温/湿度变化、自修改温/湿度SV 值以及报警等功能。其模拟温/湿度变化算法如下:

extern unsigned char code RoomID = 1; /* 房间 ID */

extern float RoomTemp = 0; /* 房间温度 */

extern float RoomHumi = 0; /* 房间湿度 */

。..

float code RoomTempTab[] = {

19.0, 19.2, 19.4, 19.6, 19.8,

20.0, 20.2, 20.4, 20.6, 20.8,

21.0, 21.2, 21.4, 21.6, 21.8,

21.8, 21.6, 21.4, 21.2, 21.0,

20.8, 20.6, 20.4, 20.2, 20.0,

19.8, 19.6, 19.4, 19.2, 19.0

};

float code RoomHumiTab[] = {

55.0, 55.5, 56.0, 56.5,

57.0, 57.5, 58.0, 58.5,

59.0, 59.5, 60.0, 60.5,

61.0, 61.5, 62.0, 62.5,

63.0, 63.5, 64.0, 64.5

};

void main(void)

unsigned int idata i, j;

。..

while (1)

/* 模拟温/湿度变化 */

RoomTemp = RoomTempTab[j % (sizeof (RoomTempTab)/sizeof(RoomTempTab[0]))];

RoomHumi = RoomHumiTab[j++ % (sizeof (RoomHumiTab)/sizeof(RoomHumiTab[0]))];

。..

本系统也可用任一款ZLGCAN 接口卡和PC 组成的系统来模拟产生控制室数据,基于ZLGCAN 通用函数接口编程,同样具有模拟控制室温/湿度变化、自修改温/湿度SV 值以及报警等功能。其模拟温/湿度变化算法(VC 示范)如下:

float m_dwTemp[8];// 房间1 6 及风道1 2 的温度

float m_dwHumi[8];// 房间1 6 及风道1 2 的湿度

。..

static double i;

i += 0.1;

m_dwTemp[0] = (float)sin(i + 0.0) + 20;

m_dwTemp[1] = (float)sin(i + 0.1) + 20;

m_dwTemp[2] = (float)sin(i + 0.2) + 20;

m_dwTemp[3] = (float)sin(i + 0.3) + 20;

m_dwTemp[4] = (float)sin(i + 0.4) + 20;

m_dwTemp[5] = (float)sin(i + 0.5) + 20;

m_dwTemp[6] = (float)sin(i + 0.6) + 20;

m_dwTemp[7] = (float)sin(i + 0.7) + 20;

m_dwHumi[0] = (float)cos(i + 0.0) + 60;

m_dwHumi[1] = (float)cos(i + 0.1) + 60;

m_dwHumi[2] = (float)cos(i + 0.2) + 60;

m_dwHumi[3] = (float)cos(i + 0.3) + 60;

m_dwHumi[4] = (float)cos(i + 0.4) + 60;

m_dwHumi[5] = (float)cos(i + 0.5) + 60;

m_dwHumi[6] = (float)cos(i + 0.6) + 60;

m_dwHumi[7] = (float)cos(i + 0.7) + 60;

。..

责任编辑:gt

关于接口,总线,驱动就介绍完了,您有什么想法可以联系小编。