十四. IEC 61499开源项目4diac功能块接口模型讲解
IEC 61499开源项目4diac功能块接口模型讲解,介绍了功能块接口事件与数据的关系,以及在运行时里面怎么存储功能块接口模型
IEC 61499的功能块与IEC 61131-3里的功能块是有差异的,IEC 61499的功能块出了有输入、输出数据,还有输入输出事件,下面已4diac里的SUBSCRIBE_1类型的功能块来举例讲解事件与数据的关系,以及4diac运行时功能块接口描述是怎么实现的。
输入事件INIT与输入变量QI、ID管理,当INIT事件触发时,运行时会操作变量QI和ID;
输入事件RSP与输入变量QI关联,当RSP事件触发时,运行时会操作变量QI;
输出事件INITO与输出变量QO、STATUS关联,当INITO事件触发时,运行时会操作变量QO、STATUS;
输出事件IND与输出变量QO、STATUS、RD_1关联,当IND事件触发时,运行时会操作变量QO、STATUS、RD_1;
功能块接口在forte的存储结构如下:
struct SFBInterfaceSpec {
TForteUInt8 m_nNumEIs; //表示输入事件数量
const CStringDictionary::TStringId *m_aunEINames; //表示输入事件名称
const TDataIOID *m_anEIWith;//表示输入事件与输入变量关联的数组
const TForteInt16 *m_anEIWithIndexes; //表示输入事件下标与m_anEIWith关联关系
TForteUInt8 m_nNumEOs; //表示输出事件个数
const CStringDictionary::TStringId *m_aunEONames;//表示输出事件名称
const TDataIOID *m_anEOWith;//表示输出事件与输出变量关联的数组
const TForteInt16 *m_anEOWithIndexes;//表示输出事件下标与m_anEOWith关联关系
TForteUInt8 m_nNumDIs;//表示输入数据个数
const CStringDictionary::TStringId *m_aunDINames;//表示输入数据名称数组
const CStringDictionary::TStringId *m_aunDIDataTypeNames;//表示输入数据类型数组
TForteUInt8 m_nNumDOs; //表示输出数据个数
const CStringDictionary::TStringId *m_aunDONames; /表示输出数据名称数组
const CStringDictionary::TStringId *m_aunDODataTypeNames; //表示输出数据类型数组
TForteUInt8 m_nNumAdapters; //适配器个数,即61499里的插头、插座数据类型
const SAdapterInstanceDef *m_pstAdapterInstanceDefinition;//适配器描述模型
};
在运行时SFBInterfaceSpec对应存储的数据如下:
m_nNumEIs=2;
m_aunEINames={ g_nStringIdINIT, g_nStringIdRSP};
m_anEIWith={0,1,255,0,255};
m_anEIWithIndexes={0,3};
m_nNumEOs=2;
m_aunEONames={g_nStringIdINITO, g_nStringIdIND};
m_anEOWith={0,1,255,0,1,2,255};
m_anEOWithIndexes={0,3};//0表示第一个事件对应m_anEOWith里的第一个值0,3表示第二个事件对应m_anEOWith里的第4个值0
m_nNumDIs=2;
m_aunDINames={g_nStringIdQI, g_nStringIdID};
m_aunDIDataTypeNames={g_nStringIdBOOL, g_nStringIdWSTRING};
m_nNumDOs=2;
m_aunDONames={g_nStringIdQO, g_nStringIdSTATUS, g_nStringIdRD_1};
m_aunDODataTypeNames={g_nStringIdBOOL, g_nStringIdWSTRING, g_nStringIdANY};
m_nNumAdapters=0;
m_pstAdapterInstanceDefinition=0;
更多推荐
所有评论(0)