IEC104开发-1 lib60870-IEC 60870常用函数示例

1、获取主站报文公共地址
int inCa = CS101_ASDU_getCA(asdu);
2、主动关闭主站链接
IMasterConnection_close(connection);
3、回复主站确认
IMasterConnection_sendACT_CON(connection, asdu, false);
4、短浮点数上报

CS101_ASDU newAsdu = CS101_ASDU_create(alParams, true, CS101_COT_SPONTANEOUS, 0, ca, false, false);
InformationObject io = (InformationObject)MeasuredValueShort_create(NULL, laddr, uploadValue, IEC60870_QUALITY_GOOD);
CS101_ASDU_addInformationObject(newAsdu, io);
InformationObject_destroy(io);
CS104_Slave_enqueueASDU(slave, newAsdu);
CS101_ASDU_destroy(newAsdu);

5、单点信息上报

CS101_ASDU newAsdu = CS101_ASDU_create(alParams, true, CS101_COT_SPONTANEOUS, 0, ca, false, false);
InformationObject io = (InformationObject)SinglePointInformation_create(NULL, laddr, uploadValue, IEC60870_QUALITY_GOOD);
CS101_ASDU_addInformationObject(newAsdu, io);
InformationObject_destroy(io);
CS104_Slave_enqueueASDU(slave, newAsdu);
CS101_ASDU_destroy(newAsdu);
lastUpLoadYXValMap[devNo][name] = itor->val;

posted @ 2022-03-05 15:21  zhaogaojian  阅读(1103)  评论(0编辑  收藏  举报