Repository navigation
2.7 Device Application Layer Machine
Device Presentation Layer means a device that links to host software. It is an ecapsulution of Utility in Modbus.Net.
It is the high level API in Modbus.Net.
Machine in Modbus.Net has two parts: IMachineProperty and IMachineMethod.
-
IMachineProperty: All properties of a machine, including Id, Name, Addresses.
-
AddressUnit: Definitions of addresses.
AddressUnit describes communication addresses in a class. It has multiple definitions that makes the address easy to read by developers and users. It could be changed at any time.
-
AddressFormater: Formatting tool to an address.
AddressFormater change AddressUnit to a string definition, this string could be used for IUtility. It could be changed at any time.
-
AddressCombiner: Combination tool to many addresses.
AddressCombiner combine duplicated address into an address group, one group send one group of messages(often once) to the device and device will response in one protocol communication.
-
Endian: Endian of data storage.
BaseMachine need to import Endian at the same time because of the bytes reading and writing. It needs to reorganize and transform these datas in a proper way。
-
IMachineMethod: Method groups of a machine.
-
IMachineMethodData: Data reading and writing interface, inherit from IMachineMethod.
When machine read datas, it first combine addresses that require to read to one or multiple continus addresses, then change these AddressUnit groups into string address and read count, then send it to Utility.
When machine write datas, first it will read data once, and replace writing datas into the reading datas, finally send write data message into Utility to write replacing datas.
-
Only IMachineProperty will be shown to users, by there is a function in IMachineProperty called GetMachineMethods will show all functions in the method group interface.
classDiagram
class IMachine~TKey~ {
<<interface>>
+Id: TKey
+ConnectionToken: string
+IsConnected: bool
+GetDatasAsync(getDataType) Task
+SetDatasAsync(setDataType, values) Task
}
class BaseMachine~TKey,TUnitKey~ {
+BaseUtility: BaseUtility
+AddressFormater: AddressFormater
+AddressCombiner: AddressCombiner
+AddressTranslator: AddressTranslator
+Endian: Endian
+GetAddresses: IEnumerable~AddressUnit~
+GetDatasAsync()
+SetDatasAsync()
}
class AddressUnit~TUnitKey,TAddressKey,TSubAddressKey~ {
+Id: TUnitKey
+Name: string
+Area: string
+Address: TAddressKey
+SubAddress: TSubAddressKey
+DataType: Type
+Zoom: double
+DecimalPos: int
}
IMachine <|.. BaseMachine
BaseMachine *-- AddressUnit : GetAddresses
BaseMachine --> BaseUtility
BaseMachine has been implemented IMachineMethodData, including GetDatas(Async) and SetDatas(Async).
sequenceDiagram
participant User as User / MachineJob
participant M as BaseMachine
participant AC as AddressCombiner
participant U as BaseUtility
participant P as IProtocol
User->>M: GetDatasAsync/getDataType
M->>AC: Combine(GetAddresses)
AC-->>M: CommunicationUnits
loop Each batch
M->>U: GetDatasAsync(startAddress, count)
U->>P: SendReceiveAsync
P-->>U: response
U-->>M: ReturnStruct~byte[]~
end
M-->>User: ReturnStruct~Dictionary~
Modbus.Net © 2016-2026 Hangzhou Delian Science Technology Co.,Ltd. | Licensed under MIT
- 1-概要介绍
- 2-Modbus.Net主体框架规范
- 3-利用Modbus.Net实现一个协议
- 4-使用Modbus.Net
- 5-Modbus.Net.Modbus
- 6-Modbus.Net.Siemens
- 7-Modbus.Net.HJ212
- 8-调试与Issue提交
- 1-Overview
-
2-Specification of Modbus.Net main framework
- 2.1-Modbus.Net Architecture
- 2.2-Transmission Control Layer Controller
- 2.3-Transmission Link Layer Connector
- 2.4-Concrete Protocol Layer ProtocolLinker
- 2.5-Abstract Protocol Layer Protocol
- 2.6-Protocol Presentation Layer Utility
- 2.7-Device Application Layer Machine
- 2.8-Task Application Layer MachineJob
- 3-Using Modbus.Net to implement a protocol
- 4-Using Modbus.Net
- 5-Modbus.Net.Modbus
- 6-Modbus.Net.Siemens
- 7-Modbus.Net.HJ212
- 8-Debug method and issue upload