Promotic
WikipediaLinkedInYoutubeTwitterFacebook

PmCharServer - Driver for communication by user defined ASCII/BIN protocol

Before using this driver in the PROMOTIC application it is highly recommended to read the chapter: Communication using the PROMOTIC drivers.

Basic properties of the driver:
- Usage of this driver requires purchase of the PmChar licence. With the freeware version PmFree, or when developing the application (with development environment for testing purposes), this component is always functional.
It is also necessary to purchase the corresponding number of PmDataClient licences. This number is indicated in the "Maximum number of clients" configurator.
- In the PmFree mode, the number of clients is set to 2.
- When developing and testing the application with the development licence, the number of clients is set to 10.
- The communication is done for Ethernet (PROMOTIC application is server) (for Ethernet-client or for serial link use the the PmChar communication driver).
- The driver is incorporated into the PROMOTIC system by means of the PmaComm object.
The driver supports to usage of the PmaCommMsg object. The PmaCommGroup object cannot be used.
For easy integration of this driver into the application it is handy to use: Preconfigurations in group "PmChar configurable protocol"


The driver is simple but powerful tool for communication by user configured protocol. It is determined first of all for the communication where using a special communication protocol doesn't pay in the end.
The usage of this driver is especialy handy for:
- communications by simple protocols.
- both text and binary oriented communications.
- testing purposes.


The PmCharServer driver is not determined for the emulation of more complex protocols. We'll be glad to help you with the decision if the given protocol can be implemented by the PmCharServer driver; don't hesitate to contact us! (sw-support@microsys.cz).

Recommended parameters values of the PmaComm object:

Description and recommended values for the Protocol parameters:
Received data will always be in only one packetIf checked, then it is assumed that the entire contents of the received message will always fit into a single IP packet.
This setting affects the optimization of the reception rate:
Once the packet is received the reception is terminated and the system does not wait for timeout (defined in the "Timeout of one packet transfer [ms]" configurator).
The packet size is predefined by current network. It can be e.g. 521 bytes, 1024 bytes etc.

The communication description by means of the PmaCommMsg object of the Slave type

This object type can be placed in the PmaComm object only once.
This object will receive all incomming messages and can also reply.
Message parameters:
There is HexaString in 'Data-sent'On the "Data-sent" tab there is always the Data variable of the String type.
If checked, then it is presumed that the content of this variable is so-called HexaString that can be used in order to transfer binary values in the String type as folows:
Example: if you are to send 4 bytes with binary values of 01 A0 00 B3 (in hexadecimal), then it is necessary to put into the variable of the String type the value of "01A000B3" - i.e. the text of 2*4=8 characters.
This way you can easily transfer data containing binary zeroes, that are forbidden in the value of the String type.
The Pm.TransformValue(240) method can be used for preparation of the transferred data.
If not checked, then it is not possible to send binary data, only text data sending is allowed - the exact content of the of the String type variable is sent.
There is HexaString in 'Data-received'The sane as the previous configurator, only for the "Data-received" tab.
If checked, then the Pm.TransformValue(241) method can be used for processing the received data.


There are following variables on the "Data-sent" tab:
Data - (String) Data for sending.
There are following variables on the "Data-received" tab:
Data - (String) The received data is stored here.


The transfer procedure for this message type is following:
- The object waits for receiving the data from other side.
- After the message is received from the other side it is decided which Slave object this message belongs to. If there is only a single Slave type object, then the data is transferred there, otherwise the procedure goes as follows:
The received message length is compared to requested messages (defined on the "Data-received" tab). The received message is assigned to the object that requested message of equal length (as the received message).
- After the received data is saved into the Data variable on the "Data-received" tab of corresponding object, the onDataReceive event is triggered. The designer can then set the data for transfer on the "Data-sent" tab.
- If on the "Data-sent" tab the Data variable contains empty string then the transfer is terminated (the onEndOfTransfer event is triggered). This is used if the PRMOTIC is not requested to send a reply to the other side.
- If on the "Data-sent" tab the Data variable contains non-empty string then the content of this variable is modified (e.g. the transformation from HexaString to binary form) and the modified data is then sent to the other side.
- After the transfer is done the onEndOfTransfer event is triggered.

The communication description by means of the PmaCommMsg object of the Master type

This object type can be placed in the PmaComm object multiple times.
This object is functional only if the "Ethernet transfer type" configurator is set to TCP.
This object will send messages to the specified client and will not receive anything. It is handy for situations when the server needs to send data to client by itself, without client request.
This object usage is now limited only for cases when there is a single client connected to the server.
Message parameters:
There is HexaString in 'Data-sent'On the "Data-sent" tab there is always the Data variable of the String type.
If checked, then it is presumed that the content of this variable is so-called HexaString that can be used in order to transfer binary values in the String type as folows:
Example: if you are to send 4 bytes with binary values of 01 A0 00 B3 (in hexadecimal), then it is necessary to put into the variable of the String type the value of "01A000B3" - i.e. the text of 2*4=8 characters.
This way you can easily transfer data containing binary zeroes, that are forbidden in the value of the String type.
The Pm.TransformValue(240) method can be used for preparation of the transferred data.
If not checked, then it is not possible to send binary data, only text data sending is allowed - the exact content of the of the String type variable is sent.


There are following variables on the "Data-sent" tab:
Data - (String) Data for sending.
ClientId - (String) The identifier of the client the message is to be sent to. At this moment there can only be a single client so the value of this identifier must be left not set.
There is no varible on the "Data-received" tab. This PmaCommMsg object only sends and does not wait for receipt.

History:
Pm9.00.15: Added option to use the PmaCommMsg object of the Master type. At this moment it is working only for communication with a single client.
Pm9.00.03: Created
PROMOTIC 9.0.16 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice