Skip to main content

Telediagram Editor

Using IEC 104

IEC 60870-5-104 is a protocol for power system monitoring and controlling. Mostly used to communicate between substations and control centers over Ethernet (Fiber optics, 2/3/4G, ...). IEC 60870-5-104 protocol is an extension of IEC 60870-5-101 protocol with the changes in transport, network, link and physical layer services to suit the complete network access.

Here you will find basic information about protocol parameters:

  • APCI - Application Protocol Control Information
  • APDU - Application Protocol Data Unit
  • ASDU - Application Service Data Unit

Address

  • IP address - every device in Ethernet have physical address
  • ASDU address - every slave (client) device has a logical address, also one device could have more than one ASDU address
  • IOA address - information object address
DecTypeDescriptionDirection
1M_SP_NA_1Single-point informationMonitor
2M_SP_TA_1Single-point information with time tagMonitor
3M_DP_NA_1Double-point informationMonitor
4M_DP_TA_1Double-point information with time tagMonitor
5M_ST_NA_1Step position informationMonitor
6M_ST_TA_1Step position information with time tagMonitor
7M_BO_NA_1Bit string of 32 bitMonitor
8M_BO_TA_1Bit string of 32 bit with time tagMonitor
9M_ME_NA_1Measured value, normalized valueMonitor
10M_ME_TA_1Measured value, normalized value with time tagMonitor
11M_ME_NB_1Measured value, scaled valueMonitor
12M_ME_TB_1Measured value, scaled value wit time tagMonitor
13M_ME_NC_1Measured value, short floating point numberMonitor
14M_ME_TC_1Measured value, short floating point number with time tagMonitor
15M_IT_NA_1Integrated totalsMonitor
16M_IT_TA_1Integrated totals with time tagMonitor
17M_EP_TA_1Event of protection equipment with time tagMonitor
18M_EP_TB_1Packed start events of protection equipment with time tagMonitor
19M_EP_TC_1Packed output circuit information of protection equipment with time tagMonitor
20M_PS_NA_1Packed single point information with status change detectionMonitor
21M_ME_ND_1Measured value, normalized value without quality descriptorMonitor
30M_SP_TB_1Single-point information with time tag CP56Time2aMonitor
31M_DP_TB_1Double-point information with time tag CP56Time2aMonitor
32M_ST_TB_1Step position information with time tag CP56Time2aMonitor
33M_BO_TB_1Bit string of 32 bit with time tag CP56Time2aMonitor
34M_ME_TD_1Measured value, normalized value with time tag CP56Time2aMonitor
35M_ME_TE_1Measured value, scaled value with time tag CP56Time2aMonitor
36M_ME_TF_1Measured value, short floating point number with time tag CP56Time2aMonitor
37M_IT_TB_1Integrated totals with time tag CP56Time2aMonitor
38M_EP_TD_1Event of protection equipment with time tag CP56Time2aMonitor
39M_EP_TE_1Packed start events of protection equipment with time tag CP56Time2aMonitor
40M_EP_TF_1Packed output circuit information of protection equipment with time tag CP56Time2aMonitor
45C_SC_NA_1Single commandControl
46C_DC_NA_1Double commandControl
47C_RC_NA_1Regulating step commandControl
48C_SE_NA_1Set-point Command, normalized valueControl
49C_SE_NB_1Set-point Command, scaled valueControl
50C_SE_NC_1Set-point Command, short floating point numberControl
51C_BO_NA_1Bit string 32 bit commandControl
58C_SC_TA_1Single command with time tag CP56Time2aControl
59C_DC_TA_1Double command with time tag CP56Time2aControl
60C_RC_TA_1Regulating step command with time tag CP56Time2aControl
61C_SE_TA_1Measured value, normalized value command with time tag CP56Time2aControl
62C_SE_TB_1Measured value, scaled value command with time tag CP56Time2aControl
63C_SE_TC_1Measured value, short floating point number command with time tag CP56Time2aControl
64C_BO_TA_1Bit string of 32 bit command with time tag CP56Time2aControl
70M_EI_NA_1End of InitializationMonitor
100C_IC_NA_1Interrogation commandControl
101C_CI_NA_1Counter interrogation commandControl
102C_RD_NA_1Read commandControl
103C_CS_NA_1Clock synchronization commandControl
104C_TS_NA_1Test commandControl
105C_RP_NA_1Reset process commandControl
106C_CD_NA_1Delay acquisition commandControl
107C_TS_TA_1Test command with time tag CP56Time2aControl
110P_ME_NA_1Parameter of measured values, normalized value ControlNo
111P_ME_NB_1Parameter of measured values, scaled value ControlNo
112P_ME_NC_1Parameter of measured values, short floating point number ControlNo
113P_AC_NA_1Parameter activation ControlNo
120F_FR_NA_1File readyFile transfer
121F_SR_NA_1Section readyFile transfer
122F_SC_NA_1Call directory, select file, call file, call sectionFile transfer
123F_LS_NA_1Last section, last segmentFile transfer
124F_FA_NA_1ACK file, ACK sectionFile transfer
125F_SG_NA_1SegmentFile transfer
126F_DR_TA_1DirectoryFile transfer
127F_SC_NB_1Request archive fileFile transfer
  • Cause of transmission
DecDescription
1Periodic, cyclic
2Background interrogation
3Spontaneous
4Initialized
5Interrogation or interrogated
6Activation
7Confirmation activation
8Deactivation
9Confirmation deactivation
10Termination activation
11Return information caused by a remote command
12Return information caused by a local command
13File transfer
20Interrogated by general interrogation
21Interrogated by interrogation group 1
22Interrogated by interrogation group 2
23Interrogated by interrogation group 3
24Interrogated by interrogation group 4
25Interrogated by interrogation group 5
26Interrogated by interrogation group 6
27Interrogated by interrogation group 7
28Interrogated by interrogation group 8
29Interrogated by interrogation group 9
30Interrogated by interrogation group 10
31Interrogated by interrogation group 11
32Interrogated by interrogation group 12
33Interrogated by interrogation group 13
34Interrogated by interrogation group 14
35Interrogated by interrogation group 15
36Interrogated by interrogation group 16
37Interrogated by counter general interrogation
38Interrogated by interrogation counter group 1
39Interrogated by interrogation counter group 2
40Interrogated by interrogation counter group 3
41Interrogated by interrogation counter group 4
44Type Identification unknown
45Cause unknown
46ASDU address unknown
47Information object address unknown

Block Information

  • By adding IEC104 slave block , IEC 104 will be activated on the RTU.
  • TCP or Serialport block is connected to IEC104 block ser input.
  • IEC 104 blocks must be added for each server to serve multiple servers.
  • Asd input is used if IEC104 Asdu address is set from outside but not inside block.
  • On the rising edge of the trigger, periodic transmission between IEC104 objects is activated and the selected objects are transmitted to the server periodically. Trigger input can be left blank.

iec104_01

Ser: TCP Socket Input. The TCP server socket block from which the IEC104 protocol will work is connected from this input

Trg: Trigger Input Trigger input for periodic sending. It works as a rising edge.

Asd: Asdu Address Input The ASDU address is used as input.

Q1: Link Status If the IEC104 connection between SCADA and RTU is installed, this output value is 1, otherwise 0.

Q2: SCADA write status, If SCADA requests select and execute, a pulse is generated at this output.

Custom Settings

  • AsduAddress: IEC104 slave station ASDU address is defined

iec104_02

AsduAddress: IEC104 slave station ASDU address is defined

T0: Timeout for the establishment of the connection with the server. (Not used Slave)

T1: This parameter defines the time in seconds that slave waits maximum for an acknowledge from the master.

T2: Timeout period for Ack (A S-format frame will be sent at the latest after this time starting from the last received telegram from the master)

T3: Test frame sending time (A Test frame will be sent at the latest after this time starting from the last received telegram from the master)

K: The maximum allowable difference between the sequence number in the received packet and the number in the send status variable.

W: ACK(acknowledge message) sending frequency(sends ACK after W packets)

Sample Application

  • In RTU logic projects , with the addition of IEC 104 Slave Block, the IEC 104 protocol is activated in the RTU. Variables in the RTU logic project, IEC104 association is provided in the variable address table.

iec104_03

Variable Mapping with Protocol

Variable Address Table

  • The relevant protocol is activated in the RTU logic project by adding the protocol block. Variables in the RTU logic Project, association between protocol.is provided in te variable address table

iec104_04

Defining Line Labels

*Line label can be defined for all blocks defined on the Mikrodiagram. In the variable table, the line label must be defined in order to be able to associate with the protocol addresses.

telediagram-editor-05

Attaching a Line Label

telediagram-editor-06

Alias: A special name is given that defines this defined variable.

Start Address: The address allocated for this variable on SCADA is written here. It is written as a decimal value

Line Label: The block to be associated on the Mikrodiagram is selected with the line label.

Point Count: Calculated automatically. It makes sense on tables.

Quality Register Block: Block entry to define Quality Register.

Send Trig Block: If you want to send IEC104 data with an independent trigger from the trigger input of the block, the trigger block is selected from this section and the periodic send option in the block special settings must not be ticked in order to send trigger-dependent data here.

Protocol Type: Modbus, Dnp3, IEC101, IEC104 are selected. Object type will change according to protocol type.

Object Type: IEC104 object type information selected. look the protocol type information for detailed information.

Object Class: The class information to which the variable belongs is selected.

Send On Trigger: IEC104 Slave block is the selection to send to this SCADA as a periodic send when the test is detected from the trigger input.

Send Method:

If the value of the defined variable is changed, the operation to be performed is selected.

Level: When the quantity defined in "Change Value" is changed, the transmission is triggered.

Percentage: The transmission is triggered when there is a change in the percentage defined in "Change Value".

None: Value exchange does not trigger posting

Change Value: With the "Send method", it adjusts the percentage change in the level.

Using DNP3 Slave

General Information

DNP3 protocol is a distributed communication protocol. Primary advantage are:

•Time-labeled variable support

•Ability to re-send the events that occurred during the absence of communication when connected with the time tags.

•The ability of SCADA to automatically send changes without the need to query.

•Ability to query multiple variables as a class, not individually

•Time syncronization

DNP3 SLAVE Driver

Mikrodev RTU devices are supports DNP3 SLAVE mode and gives service to DNP3 supported systems over TCP IP and/or SerialPort . The following services are supported:

1- Bulk object reading with Class object query

2- Time syncronization

3- Event control in instantaneous measurement data as a percentage and level

4- Automatic send the event datas

5- Periodically send the points of data

DNP3 Slave Block Definitions

Connections

dnp3_01

Connection Explanation

Ser: TCP Socket Input

The TCP server socket block, where the DNP3 protocol will run, is connected from this input.

Trg: Trigger Input

The trigger input for periodically send operation. Works as a rising edge.

Asd: Asdu Address Input

It is used as an ASDU address entry.

dnp3_02

Block Explanation

By adding the DNP3 slave block, DNP3 is activated on the RTU. TCP or Seriport block is added to the DNP3 block Ser entry. To serve more than one server, a DNP3 block must be added for each server. If the DNP3 asdu address is to be set from outside the ASD entry is used.On the rising edge of trigger , periodic submission between DNP3 objects active selected objects, send to server with periodic COT. The input of trigger and can be left blank.

dnp3_03

DNP3 Variable Table Definitions

Variable Table

To RTU logic project , Dnp3 becomes active in the DNP3 protocol within the RTU with the addition of the Slave Block to DNP3. Variables that in the RTU logic, The association of DNP3 is provided in the variable address table.

dnp3_04

Line Label Definition

Line label can be defined for all blocks defined on the microdiagram. In order to associate with the protocol addresses in the variable table, the line label must be defined.

dnp3_05

Line Label Attribution

Associating the protocol adresses with line labelss, The variable is provided from the menu by pressing the “Add” button in the address table.

dnp3_06

● Alias:

A special name is given that defines this variable.

● Start Address:

The address reserved for this variable on SCADA is written here.İt is written as a Decimal value.

● LineLabel:

The block to be associated with on the microdiagram is selected by the line label.

● Point Coint:

It is calculated automatically. It makes sense in tables.

● Quality Register Block:

Block entry to define Quality Register.

● Send Trig Block:

If you want to send IEC104 data with an independent trigger from the trigger input of the block, the trigger block is selected from this section and the periodic send option in the block special settings must not be ticked in order to send trigger-dependent data here.

● Protocol Type:

Modbus, Dnp3, iec101, iec104 to choosing from among them. The Object Type will change according to the protocol type.

● Object Type:

DNP3 object type information is selected. See protocol type information for detailed information.

● Object Class:

The class information to which the variable belongs is selected.

● Send On Trigger:

When Dnp3 Slave is detected from the trigger input in the trigger block, it is the choice of whether to send this variable as a periodic send to SCADA.

● Send Method:

When the value of the defined variable changes, the operation to be performed is selected.

  • None: Spinner does not trigger submission.

  • Level: When the amount defined "Change Value" changes, sending is triggered.

  • Percentage: Submission is triggered when there is a percentage change defined in " Change Value”.

● Change Value:

Sets the percent or level change value with” Send method".

DNP3 Object Types

DNP3 Object Types in Reading Direction

DNP3 Object TypeRegister Data Type
Single Bit Binary Input : Data Object 01 - Variation 01Binary, Word, Analog, Long
Binary Input With Status :Data Object 01 - Variation 02Binary, Word, Analog, Long
Binary Input Change Without Time : Data Object 02 - Variation 01Binary, Word, Analog, Long
Binary Output : Data object 10 - Variation 01Binary, Word, Analog, Long
Binary Output Status : Data object 10 - Variation 02Binary, Word, Analog, Long
32 BIT Analog Input : Data Object 30 - Variation 01Long
16 BIT Analog Input : Data Object 30 - Variation 02Binary, Word
32 BIT Analog Input Without Flag : Data Object 30 - Variation 03Long
16 BIT Analog Input Without Flag : Data Object 30 - Variation 04Binary, Word
Short Float Analog Input Without Flag : Data Object 30 - Variation 05Analog

NOTE 1: A variable of type DNP_OBJTYPE_CLASSOBJ must be added from the variable Adress table to draw Class 0, Class 1, and Class 2 data. Other settings of this variable, such as address, line tag, can be selected at random.

dnp3_07

DNP3 Object Types in Control Direction

The write variable is also automatically generated for each block mapped to the read type. The types of variables that can be accessed as write to defined read objects are as follows:

DNP3 Object TypeRegister Data Type
Control Relay Output Block : Data Object 12 - Variation 01Binary, Word, Analog, Long
32 Bit Analog Output Block : Data Object 41 - Variation 01Long
16 Bit Analog Output Block : Data Object 41 - Variation 02Binary, Word
Short Float Analog Output Block : Data Object 41 - Variation 03Analog

DNP3 Event Mechanism

Event Definition for DNP3 Objects

In the variable address table, the send in change selection is available for DNP3 objects. When the value of the variable defined in this menu changes, the operation to be performed is selected.

● None: Spinner does not trigger submission

● Level: when the amount defined in “Change Value” is changed, the sending is triggered.

● Percentage: Submission is triggered when there is a percentage change defined in " Change Value”.

The change face or level is set with the value” Change Value". Sets the percent or level change value with “Send method”.

DNP3 Instantaneous Transmission of Event Situations

The RTU device tags the states defined as send and change detected as events and assigns a time tag to the event. In case of a tagged event, if there is a connection to the server and the server is active in the device sending “UNSOLICED”, the relevant object is immediately forwarded as “UNSOLICED”.

If the connection exists with the server and the events detected with the “UNSOLICITED” sending active are sent with the DNP3 object types specified in the following table.

DNP3 Object TypeRegister Data Type
Binary Input Change Without Time : Data Object 02 - Variation 01Binary
32 Bit Analog Input Change Without Time : Data Object 32 - Variation 01Long
16 Bit Analog Input Change Without Time : Data Object 32 - Variation 02Word
Short Float Analog Input Change Without Time : Data Object 32 - Variation 05Analog

DNP3 Time-Tagged Submission Of Event States

Event Controls continue passively sending “UNSOLICED” even if there is connection to the server or even if there is no connection. In the event of an event under these circumstances, event information is recorded in the event memory with the time tag and this data is kept in the device as CLASS 1 data.
This event data stored in memory can be read by the server with Class 1 data read management. This CLASS 1 data is also automatically forwarded to the server by RTU if” UNSOLICED " sending is enabled.

Class 1 event data is dispatched with the DNP3 object types specified in the following table.

DNP3 Object TypeRegister Data Type
Binary Input Change With Time : Data Object 02 - Variation 02Binary
32 Bit Analog Input Change With Time : Data Object 32 - Variation 03Long
16 Bit Analog Input Change With Time : Data Object 32 - Variation 04Word
Short Float Analog Input Change With Time : Data Object 32 - Variation 07Analog

Using MQTT

mqtt_table

General Information

mqtt_01

Figure 1: MQTT Communication

MQTT (Message Queuing Telemetry Transport) protocol is a machine-to-machine (M2M) message-based protocol widely used on the Internet. It has been adopted in the Internet of Things (IoT) ecosystem with its light weight and low resource consumption. Almost all IoT cloud platforms support MQTT protocol to send and receive data from smart objects.

Block Definitions

MQTT Config Block

To configure MQTT settings, you must first add the Mqtt Config block to your project.

mqtt_02

Figure 2: MQTT Config Block

Pin Definitions;

• Soc: It is used for TCP socket block connection. Mqtt Config block cannot be used without TCP socket block.

• Trg: When periodic data transfer is desired, a trigger should be given to the mqtt config block from this input. If this entry is left blank, data is transmitted according to other specified conditions.

• Mqtt0: Output showing the connection status. The information from this output is as follows;

      - 0: TCP Disconnected
- 1: TCP Connecting
- 2: MQTT Connecting
- 3: MQTT Connected

• Sta: Output showing the communication status. The information from this output means:

      - 0: MQTT Send Conn Pack
- 1: MQTT Idle Status
- 2: MQTT Subscribe Status
- 3: MQTT Publish Status

• Pub: Output showing Publish timeout.

Mqtt Config Block Custom Settings;

mqtt_03

Figure 3: Mqtt Config Block Custom Settings

Definitions;

• Client Id: The field where the device is manually given an ID for the broker connection.

• User Name: The field where the device is named for the broker connection.

• Password: Password field entered in the device for the broker connection.

• Keep Alive: If the connection between the broker and the Publisher is lost, the waiting time before reconnecting.

• Clean Session: If selected, messages will be broadcast if there is communication between the device and the broker, otherwise the information recorded in communication interruptions will not be sent.

• Use Device Serial as User Name: If selected, the serial number of the device is used as the device username.

• SSL Enabled: It is marked to make the connection with SSL. (Only active in DM Series.)

TCP Socket Block Connection

The output of the TCP Socket block is connected to the Soc input of the Mqtt Config block.

mqtt_04

Figure 4: TCP Socket Block and Mqtt Block Connection

The special settings of the TCP Socket block should be made for mqtt connection as follows;

• TCP Client should be selected as the socket type,

• The mqtt server IP to be connected to the Server IP section must be entered,

• Mqtt server port information should be entered in the Server Port Section,

• As for the media type, Ethernet, GSM or WI-FI can be selected according to the characteristics of the microdev device used.

mqtt_05

Figure 5: TCP Block Custom Settings

MQTT Table

The table where all MQTT-related adjustments are made can be accessed from the Projects/MQTT Table tab.

mqtt_06

Figure 6: Mqtt Table

Topics The Publish

In this table, the Publish topic is entered to publish the data to the broker. The topic name is entered on the screen that appears by pressing the Add Topic button in the table. Block definitions where you can enable/disable Qos, Retain, Last Will, Payload settings, send on exchange and periodically send options are also made on this page.

mqtt_07

Figure 7: Topic Definition

Definitions;

• Topic Name: The field where the topics you will send the messages are determined.

• QoS: Quality of Service refers to the agreement between the sender of a message and the receiver of the message. The QoS levels are as follows;

o QoS 0: Minimum data transfer is ensured. At this level, each message is forwarded to a subscriber and no confirmation is received that the message has arrived.

o QoS 1: The broker tries to transmit the message and waits for an acknowledgment response from the subscriber, if no confirmation is received within a specified time frame, the message is sent again.

o QoS 2: The broker receives two acknowledgments to ensure that the subscriber receives the message and only once.

• Retain: If this option is checked, if the connection between the broker and the subscriber is broken, the last value will be saved in memory.

• Is Last Will Topic: Last will topic. If a topic is created and this option is checked, the message under this topic will be forwarded to the subscribers when the device is disconnected from the broker.

• Payload Type: It is determined in which format the message content will be sent. Subscriber interprets incoming messages with this information. “MJson v1” can be selected if a time stamp is desired to be added to the sent messages.

• On Change Send Enable Block: Block selection added in the diagram to enable or disable the sending feature of the created topic on change.

• Periodic Send Enable Block: Block selection added in the diagram to enable or disable the periodic sending feature of the created topic.

Publish Blocks for Topic

In this table, the blocks to be published for the relevant Topic are selected. After clicking the topic in the Publish to topic table, the Add Entry button becomes active and by pressing this button, the block to be published in the project is selected. How to transmit the data can also be selected from the screen.

mqtt_08

Figure 8: Add Block for Message

Definitions;

• Select Block for Subscribe on Topic: The area where the block that you want to send as a message in your project is selected.

• Send On Change: Send selection field on exchange

o On Level Change: Send when there is a change in the value specified in Change Value, if 0 is written, it will be sent in every change.

o On Percent Change: Send when there is a percentage change of value specified in Change Value, for example 10%.

• Change Value: Change amount input field.

• Send Periodcally: If checked, a message is sent every time a trigger comes to the trg input of the mqtt config block.

• Select Block for Quality Value: The block in which the Quality value included in the message content is selected in MJson v1 payload type.

• Select Trigger Block: Apart from change or periodicity, we can send the message by triggering the block we will specify here.

mqtt_09

Figure 9: Message Formats

Note: Blocks used in messages; It can be sent and received with the block number (B:3006) under the block, or it can be added to the messages with line tags (word_publish_ch). This selection is made under the Mqtt Format tab in the block properties.

• Message that will appear if View and Set is selected;

mqtt_10

Figure 10: View And Set Select

• The message that will appear if No View is selected;

mqtt_11

Figure 11: No View Select

Subscribe to Topic

In this table, the relevant subscribe topic is entered to send data from the broker to the device.

mqtt_12

Figure 12: Topic to Subscribe Screen

Definitions;

• Subscribe Topic Name: Enter the name of the topic to be subscribed to.

• QoS: Service quality level is selected.

• Parse Format: Select the format in which the messages will be parsed.

Subscribed Block Values for Topic

From this screen, the blocks to be associated for the subscribe topic are added. To use line tags, mqtt format should be selected as view and set from the special settings of the relevant block.

mqtt_13

Figure 13: Subscribed Block Values for Topic Screen

Special Applications

Ubidots

When you want to use Mikrodev PLC with ubidots mqtt, the following steps should be followed in addition to the settings described above;

  1. From the Mqtt Config block custom settings, Ubidots ID should be entered in the Client Id section and the Token Key of the device created in Ubidots should be entered in the Username section.

  2. Publish Topic: Enter as /v1.6/devices/< Device Name >. There is no need to define variables in the ubidots calculation for the blocks to be associated. With the first sent data, the variables are created automatically by Ubidots. The data is read on the Ubidots server with the block number or line tag.

  3. Subscribe Topic: Entered as /v1.6/devices/< Device Name >/< Value Name >. A separate connection must be defined for each data to be subscribed. Data must be defined in the Ubidots environment. If the line tag is to be used, the variable created in Ubidots should have the same name as the line tag, if the line tag is to be transmitted only with the block number, the variable with the same name as the block number should be defined in the ubidots environment.

Example Applications

Topic Publish

General Configuration; After the project is created, the diagram is designed as in the figure, the mqtt formats of word and analog registers are selected as view and set.

mqtt_14

Figure 14: Example Project Configuration

Send On Change;

Follow Projects > MQTT Table >Topics to Publish > Add Topic.

mqtt_15

Figure 15: Add Topic Screen

Select the Topic name, enter the High gate we have prepared in the diagram for the OnChange Send Enable Block, and click add.

Then, from the Publish Blocks for Topic section in a subtable, click to the Add Entry.

mqtt_16

Figure 16: Add Block Into The Topic Screen

Select the block in the diagram that you want to broadcast as a message to the Select Block for Subscribe on Topic section. In the SendOn Change section, On Level Change is selected and Change Value is set to 0 so that it can send a message every time the value changes. Click on Add and continue.

The project is loaded on the device and online monitoring is opened.

Subscribe to the topic opened with a program such as MQTTBox. After watching the mqtt config block value of 3 in online monitoring in the Mikrodiagram, when the value of the register is changed, it is seen that the value is published.

mqtt_17

Figure 17: Messages of Send on Change

Periodic Send; In addition to the configuration sent in the change, a real time pulse generator is added to the trg input of the mqtt config block,

mqtt_18

Figure 18: Sample Project with Periodic Sending Attached

Real time pulse generator is set for 5 seconds to broadcast a message periodically every 5 seconds and the created topic is changed as follows. OnChange Enable Block= NULL and Set the High gate in the Periodic Send Enable Block diagram, In the Select Block for Subscribe on Topic section, select SendOn Change= None and click Send Periodically.

mqtt_19

Figure 19: Changes Made for Periodic Sending

The project is loaded back to the device and incoming messages are observed.

mqtt_20

Figure 20: Periodically Send Messages

Subscribe Topic

General Configuration;

After the project is created, the diagram is designed as in the figure, the mqtt formats of the word and analog registers and the relay output are selected as view and set.

mqtt_21

Figure 21: Sample Project Configuration with Added Blocks to Subscribe

Follow Projects > MQTT Table >Topics to Subscribe > Add Topic.

mqtt_22

Figure 22: Name of Topic to Subscribe

Enter the topic name and click Add. Then, the add entry is clicked from the Publish Blocks for Topic section in a subtable.

mqtt_23

Figure 23: Selection Block of Subscribtion

Here, the block to which the subscribed value will be transferred is selected.

mqtt_24

Figure 24: Subscriber Blocks

After all blocks to be subscribed are determined, the project is loaded into the device.

mqtt_25

Figure 25

When the message is published to the test2 topic with the above format, the final state of the variables is as follows;

mqtt_26

Figure 26: Values of Subscribed

Using MOD-C

modc_01

Serial Port Block Definitions

modc_02

Note: for RS485; Serial Port No: 0 , for RS232; Serial Port No: 1

Note: We can leave the values in this section as default.

MOD-C Table Panel

Add Meter

Adding Meter, adding OBIS Code, adding programming mode command are done in this section.

modc_03

Note: For Makel Meter ; Meter Serial Prefix: MSY

Note: If the serial number is less than 8 digits, it is necessary to complete the serial number to 8 digits. For this, it is necessary to write 0 in the counter serial prefix section until the number of missing digits.

Note: Port 1 : RS485 , Port 2 : RS232 , Protocol : Mode C

MeterMakelKöhlerEMH
Starting Baudrate30030019200
MODC Baudrate9600960019200
Data Bit777
Parity BitEven ParityEven ParityEven Parity
Stop Bit111
Readout Type000

Add OBIS Codes

modc_04

modc_05

Add Programming Mode

Reading OBIS Codes Outside The Service List

First of all, we enter the meter number we want to read and the OBIS codes we want to read on it.

  • We enter the OBIS codes, outside the service list.

  • For example; 2.8.0 Obis code.

  • Add Programming Mode Command to the Selected Meter.

  • We enter the code we want to read.

modc_08

Note: An example is given for the Köhler brand meter. You can request the codes suitable for your device from your meter manufacturer.

Load Profile Reading
  • Choose the Meter.

  • Add Programming Mode Command to the Selected Meter

  • We add the commands one after the other.

01 52 32 02 31 32 38 2e 31 30 2e 30 30 30 30 28 29 03 5a  // [ Read Load Profile Index Information ]
01 52 32 02 31 32 38 2e 35 31 2e 31 28 46 46 46 46 29 03 46 // [ Read values defined in load profile MODC OBIS Codes section ]
01 42 30 03 71 // [ Ends the load profile reading process ]

  • We add the data we want to see the load profile values, from the Add OBIS Code to the Selected Meter.

Load Profile Codes:

for Ael tf 19/20/21 ;

#P1#,2,0,8,0; ----> Load Profile Index Value (DECIMAL)
#P1#,2,20,8,-3; ----> +T value (FLOAT)
#P1#,2,28,8,-3; ----> -T value (FLOAT)
#P1#,2,36,8,-3; ----> +Ri value (FLOAT)
#P1#,2,44,8,-3; ----> +Rc value (FLOAT)
#P1#,2,52,8,-3; ----> -Ri value (FLOAT)
#P1#,2,60,8,-3; ----> -Rc value (FLOAT)
#P1#,2,8,10,0; ----> Load profile record date epoch (DATETIME)

for Makel c410, c500 ;

#P2#,Active ----> +T value ( FLOAT ) 
#P2#,Capacitive ----> +Rc value ( FLOAT )
#P2#,DateTime ----> Load profile record date epoch (DATETIME)
#P2#,I1 ----> IrmsA value ( FLOAT )
#P2#,I2 ----> IrmsB value ( FLOAT )
#P2#,I3 ----> IrmsC value ( FLOAT )
#P2#,Inductive ----> +Ri value ( FLOAT)
#P2#,V1 ----> VrmsA value ( FLOAT )
#P2#,V2 ----> VrmsB value ( FLOAT )
#P2#,V3 ----> VrmsC value ( FLOAT )

modc_06

modc_07

Rest API Configuration

Defining REST API servers

rest_table_01

The first thing to do is to define some parameters related with the REST API Server. On the RestTablePanel, click on Add Server button to open New Rest Server Dialog. On the dialog you will be asked the following parameters:

Server URL

The root url of the server which serves the API.

Auth Route Path

If the API requires authentication, set the path for the authentication path here. Do not use the root url here, only the relative path should be inserted(eg : /api/login ) .

Headers

If you need to use any special headers during authentication process insert them in a comma separated key/value format(eg: Key1 : Value1, Key2 : Value2) .

Request Body

If you need to use a request body during authentication process insert it here.

Expected Auth Token Name

After authentication, if the server sends a token for authentication , insert the name used for token data in here.

Token Name For Queries

After you get the token data, you may need to use a different token name on your API calls. Write here the token key name to be used.

rest_table_02

Add new REST Request Object

After you add a Rest Server, now you can start to add API request definitions on that server. Click on the Rest Server to which you will add the request and click Add Request button. You need to insert the following parameters on the dialog

Method

The HTTP method to be used for the request. It could be a POST, GET, PUT or DELETE request.

Route Path

The route path of the request. Start with "/" and do not use the root URL here (eg: /api/GetTankLevel ).

Request Body

If you need to use a request body during the API call insert it here.

Reply Object Filter

After you send the API request the server will send you a reply in JSON form. You need to use a filter to be able to get the relevant data from this JSON object. Please see the following example to be able to get the data in different forms:

The example reply from the server is:

  {
"Message": null,
"ResponseModel": {
"AvailableTags": [
{
"CanTakeFuelOutside": false,
"CurrentMachineHours": 20,
"THPT": 85,
"TagNumber": "TestTag000000001",
"UnitType": "Hour",
"VehicleTankCapacity": 300
},
{
"CanTakeFuelOutside": false,
"CurrentMachineHours": 102,
"THPT": 85,
"TagNumber": "TestTag000000002",
"UnitType": "Hour",
"VehicleTankCapacity": 300
}
],
"ServerDateTime": "14.02.2021 22:01:44"
},
"Type": "S"
}
Example Filters

• To be able to get the VehicleTankCapacity of the first element of the AvailableTags array and write it into a block with number 6000 :

ResponseModel.AvailableTags[0].VehicleTankCapacity ,6000;

• Get all the CurrentMachineHours in the AvailableTags array and write them into a table block with number 6000:

ResponseModel.AvailableTags[].CurrentMachineHours , 6000;

• Find the object with TagNumber is equal to "TestTag000000002" in the array and get the VehicleTankCapacity value of this object and write that value into the block with block number 6000:

ResponseModel.AvailableTags[].TagNumber(TestTag000000002).VehicleTankCapacity, 6000;
Select Block for Status Value

The return code of the API request will be written into this block

Select Trigger Block

Whenever this block is enabled the API request will be sent to server.

Telediagram License

Installing the License File

To get a valid license please send your "hardware id" to [email protected].

To find out your hardware id; after you download and install Telediagram application, go to the "bin" directory of the application and run "license_user.exe" .

Before running "license_user.exe" make sure that no "usb stick" or "external harddrive" is connected on your computer since that may change your hardware ID.

telediagram-editor-07

After you receive a valid "tlicense.dat" file, copy this file into the "bin" directory of Telediagram application

The licence will automatically be loaded when you restart the Editor