1.OPC Server
架构
酒店人事架构图下载公司架构图下载企业应用架构模式pdf监理组织架构图免费下载银行管理与it架构pdf
:
OPC Server 透过一组一组的接口提供服务,不过在实作的架构上,OPC Server 共分为三层:分别是 OPCServer, OPCGroup, OPCItem .
其中每一个 OPCItem 对应到一个实际的硬件装置上的某一个 channel 或 port;每一个 OPCGroup 则包含了许多的 OPCItem,同时并定义这些 OPCItem 更新的时间、方式,以及提供读取 OPCItem 值的接口;而每一个 OPCServer 则包含若干个 OPCGroup,同时提供操作这些 OPCGroup 的接口。
OPC Custom Interface
OPCServer 提供的接口: IOPCCommon
HRESULT SetLocaleID ( dwLcid ) 设定位置信息
HRESULT GetLocaleID ( pdwLcid ) 取得位置信息
HRESULT QueryAvailableLocaleIDs ( pdwCount, pdwLcid ) 查询可用的位置ID HRESULT GetErrorString ( dwError, ppString) 取得错误信息字符串
HRESULT SetClientName (szName)设定Clinet的名称
IOPCServer
HRESULT AddGroup(szName, bActive, dwRequestedUpdateRate, hClientGroup, pTimeBias, pPercentDeadband, dwLCID, phServerGroup, pRevisedUpdateRate, riid, ppUnk) 新增一个 OPCGroup
HRESULT GetErrorString(dwError, dwLocale, ppString) 取得错误信息字符串
HRESULT GetGroupByName(szName, riid, ppUnk) 依据名称取得OPCGroup 的介面 HRESULT GetStatus(ppServerStatus) 取得 OPCServer的状态信息
HRESULT SetClientName (szName)设定Clinet的名称RemoveGroup(hServerGroup, bForce)移除一个OPCGroup
HRESULT CreateGroupEnumerator(dwScope, riid, ppUnk) 产生一个OPCGroup 列举器 IConnectionPointContainer
HRESULT EnumConnectionPoints( IEnumConnectionPoints ppEnum) 列举所有的 Connection Points
HRESULT FindConnectionPoint( REFIID riid, IConnectionPoint ppCP)找出一个 Connection Point
IOPCItemProperties
HRESULT QueryAvailableProperties(szItemID, pdwCount,ppPropertyIDs, ppDescriptions, ppvtDataTypes ); 查询可用的 OPCItem属性
HRESULT GetItemProperties (szItemID, dwCount, pdwPropertyIDs,ppvData, ppErrors ) 取得 OPCItem 的属性
HRESULT LookupItemIDs( szItemID, dwCount, pdwPropertyIDs,ppszNewItemIDs, ppErrors )使用名称查询OPCItem 的 ID IOPCBrowseServerAddressSpace (optional)
HRESULT QueryOrganization(pNameSpaceType )查询组织名称
HRESULT ChangeBrowsePosition(dwBrowseDirection, szString )变更浏览的位置 HRESULT BrowseOPCItemIDs( dwBrowseFilterType, szFilterCriteria, vtDataTypeFilter, dwAccessRightsFilter, ppIEnumString )浏览 OPCServer 内所有定义的 OPCItem HRESULT GetItemID( szItemDataID, szItemID ) 取得 OPCItem 的 ID
HRESULT BrowseAccessPaths( szItemID, ppIEnumString )浏览存取OPCItem 的路径 OPCGroup Object 提供的介面
IOPCGroupStateMgt
HRESULT GetState(pUpdateRate, pActive, ppName, pTimeBias, pPercentDeadband, pLCID, phClientGroup, phServerGroup)取得OPCGroup的状态即设定信息
HRESULT SetState(pRequestedUpdateRate, pRevisedUpdateRate, pActive, pTimeBias, pPercentDeadband, pLCID, phClientGroup)设定OPCGroup 的状态信息
HRESULT SetName(szName)设定OPCGroup的名称 HRESULT CloneGroup(szName, riid, ppUnk) 复制一个OPCGroup
IOPCSyncIO
HRESULT Read(dwSource, dwCount, phServer, ppItemValues, ppErrors); 以同步方式读取OPCGroup内的OPCItem(s) 的值
HRESULT GetItemProperties (szItemID, dwCount, pdwPropertyIDs,ppvData, ppErrors ) 取得 OPCItem 的属性
HRESULT Write(dwCount, phServer, pItemValues, ppErrors) 以同步方式将值写入OPCGroup 内的 OPCItem(s)
IOPCAsyncIO2
HRESULT Read(dwCount, phServer, dwTransactionID, pdwCancelID, ppErrors,) 以非同步方式读取OPCGroup内的OPCItem(s)的值,值会在读取硬件的动作结束后以callback的形式传回 HRESULT SetState(pRequestedUpdateRate, pRevisedUpdateRate, pActive, pTimeBias, pPercentDeadband, pLCID, phClientGroup)设定OPCGroup的状态信息
HRESULT Write(dwCount, phServer, pItemValues, dwTransactionID, pdwCancelID, ppErrors)以非同步方式将值写入OPCGroup内的OPCItem(s)
HRESULT Cancel2 (dwCancelID) 取消前一次的非同步读取/写入
HRESULT Refresh2(dwSource, dwTransactionID, pdwCancelID) 更新 OPCGroup 内 OPCItem(s) 的值
HRESULT SetEnable(bEnable) 将 OPCGroup 设为 Enable HRESULT GetEnable(pbEnable) 传回 OPCGroup 是否为 Enable
IOPCItemMgt
HRESULT AddItems(dwCount, pItemArray, ppAddResults, ppErrors); 在OPCGroup内新增OPCItem(s)
HRESULT ValidateItems(dwCount, pItemArray, bBlobUpdate, ppValidationResults, ppErrors)检查OPCItem(s)的名称是否可用
HRESULT RemoveItems(dwCount, phServer, ppErrors) 移除OPCGroup 内的 OPCItem(s) HRESULT SetActiveState(dwCount, phServer, bActive, ppErrors)高定 OPCItem(s)是否为Avtive
HRESULT SetClientHandles(dwCount, phServer, phClient, ppErrors)设定 OPCItem(s) 的 handle
HRESULT SetDatatypes(dwCount, phServer, pRequestedDatatypes, ppErrors) 设定OPCItem(s)的数据类型
HRESULT CreateEnumerator(riid, ppUnk)产生OPCItems的列举器 IConnectionPointContainer
HRESULT EnumConnectionPoints( IEnumConnectionPoints ppEnum)列举所有的 Connection Points
HRESULT FindConnectionPoint( REFIID riid, IConnectionPoint ppCP)找出一个Connection Point 5. 结论 OPC Server/Client 是一套利用微软的 COM/DCOM 技术达成工业自动化资料取得的架构。OPC Server 提供了许多的接口,Client 端通过这些接口,可以取得与 OPC Server 相连的硬件装置的信息,而无须了解这些硬件装置的细节信息。也就是说,程序
设计
领导形象设计圆作业设计ao工艺污水处理厂设计附属工程施工组织设计清扫机器人结构设计
者可以使用相同的程序代码,操作不同的硬件装置,充分达成 software reuse 的理想。同时,由于 COM/DCOM 已实作了网络部分的细节,也使得 Client 对 OPC Server 进行远程访问非常容易,使程序设计者很容易地达成远程控制的目标。