How To Connect to WCC Lite WAN IP Setup Enable Internet or WAN for connected devices Comlynx to Modbus TCP protocol conversion DLMS Serial to IEC104 protocol conversion Modbus RTU to IEC104 protocol conversion Capture packets using tcpdump IOMod setup with WCC Lite In this chapter you will learn how to connect all kinds of Elseta IOMods to the WCC Lite Connecting IOMod 16DI to the WCC Lite Description This article describes how to connect and configure IOMod 16DI to the WCC Lite using IEC101, IEC103, and Modbus RTU. Preparing the configuration At first you need to make a configuration for the WCC Lite. This can be done using any spreadsheet editing program. Templates for configuration can be found on the WCC Lite web. Protocol Hub --> Configuration. On the bottom of the page there will be a Download button for template configurations. You can download the example configuration for each firmware versions at the bottom of the article or create your own using these links: For IEC103 For IEC101 For Modbus You need to configure Devices and Signals sheets before continuing.  After downloading template configurations, open phub templates folder. You will see that there's different templates for each IOMod: To select correct configuration, check the sticker on the back of IOMod. There you will find which protocol to use according to Factory FW type. For example, if you have IOMod 16DI with IEC103 FW, select configuration iomod_16DI_IEC103_to_IEC104_DNP3_Modbus_SCADA. Uploading configuration Template configurations can work with default settings without any further changes. These template configurations can also be used to configure protocols like Modbus-master and DNP3. Configuration can be modified according to functionality needed. For that you can rely on the examples given in the links above (Preparing the configuration). If you need to specify different IEC104 slave settings, you can do that by changing excel configuration.  By changing settings such as info_address or data_type you can adapt IEC104 slave to work as needed. To test this example you have to specify your computer's IP address in excel configuration for IEC104 slave. After configuration is ready, upload it to WCC Lite (Configuration --> Choose file --> Import configuration): After upload is done and no errors were detected, you should see all imported signals (Protocol Hub --> Imported signals): Before doing anything further you should also check for protocol connections if IOMod16DI is connected to WCC Lite via PORT1. Go to Protocol connections where you can see all the connected slave and master protocol devices: Simulating SCADA via Vinci software After uploading Excel configuration, you can simulate SCADA using Vinci software. In order to simulate IEC104 slave you need to choose IEC 60870-5-104 protocol and Master(Client) mode and press start. In Settings tab, check Structure, Timeouts and Windows values to match Excel configuration. Then set correct IP address and Port at the top of the program page. Port for IEC104 should be 2404 and IP address should match your WCC Lite IP address (default address is 192.168.1.1 if it's connected to your computer via ethernet cable). After clicking start, you should check protocol connections tab again to see if IEC104 slave is connected. On the right side of the page you can find Tags and System tabs. In Tags you can create jobs which are specified in you excel configuration job_todo and tag_job_todo. To do so, click Add and choose Type. This type should match data_type described in excel configuration. If needed change asdu (in Excel configuration – asdu_address) and ioa (info_address). Create user friendly name for this job and click save. To execute when needed click send. In System tab you can execute commands accordingly by setting ASDU, Type and IOA. To execute commands you need to specify Value and Cause. To execute these commands you need to click Execute. After executing one of the commands you should see results on the web as well as Vinci software window. Connecting two IOMod 16DI Description This article describes how to connect and configure two IOMods 16DI to the WCC Lite using IEC103, and Modbus RTU. Typical connection schematic for two IOMod 16DI Preparing the configuration At first you need to make a configuration for the WCC Lite. This can be done using any spreadsheet editing program. Templates for configuration can be found on the WCC Lite web. Protocol Hub --> Configuration. On the bottom of the page there will be a Download button for template configurations. You need to configure Devices and Signals sheets before continuing. These template configurations can also be used to configure protocols like Modbus-master and DNP3. Configuration can be modified according to functionality needed. In this case, Device sheet will only have three devices, WCC Lite and two IOMod 16DI. It is important to use only one protocol for each port, otherwise configuration will not work. Second step Before connecting IOMods to WCC Lite you need to configure it via mini USB. This can be done following these steps: For IEC103 For IEC101(WIP) For Modbus You need to configure it, like it is done in the excel configuration. To do that, fist you need to open PuTTY terminal and change these parameters: parity, link address, asdu address. It is important, that link address and asdu address for both IOMods are different and parity should be even. Other parameters such as baudrate, databits and stopbits should be set to default. Signals sheet should be mapped according to functionality needed. Connecting IEC104-slave via Vinci After Excel and USB configurations, you can connect to device using Vinci software. In order to simulate IEC104 slave you need to choose IEC 60870-5-104 protocol and Master(Client) mode and press start. In Settings tab, check Structure, Timeouts and Windows values to match Excel configuration. Then set correct IP address and Port at the top of the program page. Port for IEC104 should be 2404 and IP address should match your WCC Lite IP address. On the right side of the page you can find Tags and System tabs. In Tags you can create jobs which are described in you excel configuration job_todo and tag_job_todo. To do so, click  Add and choose Type. This type should match data_type described in excel configuration. If needed change asdu (in Excel configuration – asdu_address) and ioa (info_address). Create user friendly name for this job and click save. To execute when needed click send. In System tab you can execute commands accordingly by setting ASDU, Type and IOA. To execute commands you need to specify Value and Cause. Depending on your configuration in order to execute these commands you need to click Execute or Select. By clicking Execute, command will be executed immediately and Select will only select given command but will not execute it. DLMS Serial to IEC61850-server protocol conversion (Wcc Lite FW: 1.7.0) Firmware update Lua runner examples Configuration Example With Default and Saved Values (Modbus TCP, IEC104) Excel configuration In order to control signals with Lua script an excel configuration for WCC Lite is needed. In this case three devices are required: one for Modbus TCP Master, one for IEC104-slave and one for Lua runner. Configuration example: In order to connect slave and master devices, master's IP address and slave's host addresses has to be specified. Modbus IP address will be the address of Wi-Fi to which the computer is connected (this can be checked on terminal window with command ipconfig) and host address for IEC104 slave protocol will be the IP address to which WCC Lite is connected. To reach the device via these addressed WCC Lite has to be connected to the internet. When creating Excel configuration with Lua, there is an option default value for signal. This value will be set to the signal right after uploading configuration or if the script does not return any saved values. Signals sheet: As it is seen from example values such as min_value and max_value can be added to determine limits of a signal. This way command signal will only return results which are within this range. Otherwise command value will have negative cot with invalid, non topical or overflow attributes and new value will not be sent to result signals. As configured, until command value is sent default value will be represented for Lua command signal. For saved values to be represented a Lua script is needed. Lua script Lua script example for this configuration is shown below: local saved = get(signals.result) --getting result signal which is equated to new variable 'saved'local command = get(signals.command) --getting command signal which is equated to new variable 'command'--get() function returns nill if there is no valid valueif not command then --if command is not nill    if saved then --if signal is not nill        publish(signals.result, saved.value) --this value is published to result signals and saved value    end    return 0end local time_diff = time_ms() - tonumber(command.time) --compares command time and real timelocal is_command = time_diff < 30000 and time_diff > -30000 --if command time differs from--real time more than 30s it will not be executed if string.find(command.attributes, "nt") or string.find(command.attributes, "iv") or string.find(command.attributes, "ov") then --searching if signal has negative attributes   if is_command then --if command execution time is not exceeding the limits then        command.attributes = "cot=7,cotn" --equates negative cot values to response signal attributes        publish(signals.command, command) -- and publishes value to command signals and value        if saved then --if there is saved value then            publish(signals.result, saved.value) --restores saved value to result signals        end        return 0    endelse    if is_command then        command.attributes = "cot=7"         publish(signals.command, command)   --in this cycle command value is being returned as well as --cot7 and cot10 values in case given signal is command and has no negative attributes        command.attributes = "cot=10"        publish(signals.command, command) --publishes response to the command        save(signals.result, command.value) --command value is being saved to result signal    end    publish(signals.result, command.value) --in this row command value is being published to result signalsend Uploading configuration and Lua script to WCC Lite First Excel configuration needs to be uploaded to WCC Lite: After uploading configuration default value will be shown: After uploading configuration no errors should appear and all signal should be represented on the web. To upload Lua script go to Script-Runner, select upload script and then start: Connecting master and slave via Vinci software Connecting IEC104 slave In order to connect to WCC Lite via IEC104 protocol, select Master(Client) mode on Vinci: Check Settings tab to match excel configuration: Specify IP address which should match the one in Excel configuration. Connecting ModbusTCP master: To connect ModbusTCP Master, select Slave (Server) mode on Vinci: Check address to match id in Excel configuration: Match the IP address given in Excel configuration as well. Executing commands Start both master and slave simulations on Vinci. Check if both protocols are connected to WCC Lite on the web tab Protocol Connections: To execute commands, open Vinci program with IEC104 master running. Here, go to System tab and fill in required fields such as IOA and select data type indicated in Excel configuration. First, try sending value that is outside the set range: After selecting execute this value will not be showed on the web and positive cot6 and negative cot7 values will be seen on Vinci IEC104 simulation window. Positive cot6 indicates command activation and negative cot7 means that command activation confirmation was denied. The command signal value will not be represented as result signals, because it is determined in the script, that signals with negative attributes will not be published. Now specify value which will be sent as a result and is within the given range. Positive cot7 and cot10 values will be seen on the Vinci IEC104 simulation window: This value will also be represented on Modbus TCP master Vinci simulation window: To show what happens if the value is not within determined range after the correct value has been sent before, try executing command with smaller or larger value specified: Again, positive cot6 and negative cot7 values is seen on Vinci window. As seen on WCC Lite web window, command signals have negative attributes and result signals have the same value as before, because it was saved by Lua script. This example shows that Lua runner can be used to save certain values to signal. For example after the restart saved value could be seen on command signal to determine minimum or maximum value, last value or typical value. This solution could be useful for protecting important data even after reboot or connection faults. Configuration --> Download Lua script --> Download Signal Delay with Lua For delaying the response of command execution, Lua runner could be used as one of the solutions. In this example IEC104 and Modbus TCP are used. IEC104 protocol sends the command to Modbus and Lua signals and the results are represented as two separate signals. To create Excel configuration for WCC Lite in this case device sheet should look like this: In the fields marked red, for Modbus TCP enter IP address of Wi-Fi connected to computer and for IEC104 enter IP address of WCC Lite. Map the signals as shown below: IEC104 SCADA will send command which will then go to Lua signal. Lua signal will send the response back to IEC104 SCADA and to Modbus TCP result signal. For delaying signal response, Lua script could be written in many ways, however the most simple and effective one is to determine a wait time before publishing signal values to result signals. So in this case Lua script will look like this: local saved = get(signals.result)--getting result signal which is equated to new variable 'saved'local command = get(signals.command) --getting command signal which is equated to new variable 'command'if not command then if saved then publish(signals.result, saved.value)--this value is published to result signals and saved value end return 0endif string.find(command.attributes, "nt") or string.find(command.attributes, "iv") or string.find(command.attributes, "ov") then --searching if signal has negative attributes  if command then command.attributes = "cot=7,cotn"--equates negative cot values to response signal attributes publish(signals.command, command)-- and publishes value to command signals and value if saved then publish(signals.result, saved.value)--restores saved value to result signals end return 0 end else if command then command.attributes = "cot=7" publish(signals.command, command)--in this cycle command value is being returned as well as --cot7 and cot10 values in case given signal is command type and has no negative attributes command.attributes = "cot=10" publish(signals.command, command) --publishes response to the command save(signals.result, command.value)--command value is being saved to result signal end local sleepTime = 30 sleep(sleepTime) --before publishing values to result signals script waits 30s publish(signals.result, command.value)--in this row values are being published to result signalsend After entering values to empty Excel configuration fields, upload the configuration to WCC Lite (it should upload without any errors): Upload Lua script to script runner and press start. After this, Status should show Running and script process number will appear. Open Vinci as IEC104 master, enter IP address of WCC Lite and start communication. Then open another Vinci window and connect Modbus TCP master – select Modbus TCP slave in Vinci and enter the same IP address as set in Excel configuration for Modbus device. With both communications running check Protocol connections on WCC Lite web interface, it should show connected. From IEC104 Vinci window go to System tab. Select command determined in the Excel configuration (50), IOA (1) and value (eg. 2). Execute the command and check Imported signals: After 30s result signals will now have the same value: Signal delay could be used as a tool to synchronize signals so all the values are received at the same time. It can also be used to schedule commands or tasks when delay is required. Since Lua is one of the faster programming languages, it is the most effective instrument to be used is such matters. Configuration --> Download Lua script --> DownloadMathematical Operations With Lua (FW version 1.7) Mathematical operations can be applied to Lua signals as in any other protocol. This can be done by configuring WCC Lite according to solution needed. To create an example which would test multiple mathematical operations, Excel configuration and Lua script is required. Device sheet should look similar to this: Each Lua device is created to send result values to Modbus TCP signals with different mathematical functions applied. This way the same Lua script can be reused and is more optimal since signal alias for each device can stay the same. There are many other solutions but this one allows to observe results more clearly. In the field  "ip" for Modbus TCP master, enter IP address of Wi-Fi connection for computer in use. In the field "host" for IEC104 slave protocol enter IP address of WCC Lite device. Signals for these devices should be mapped in example to this: Each Lua device has command and result signals. Command received from IEC104 protocol is sent to Lua command signal and then this signal sends back a response for IEC104 protocol. If the response does not have negative cot attributes, value is then sent to Lua result signal which sends value to Modbus TCP result signal. Mathematical operations are applied to IEC104 protocol signals since it is the one sending the commands. As mentioned before Lua script for each Lua device is going to be unchanged and should look like this: local saved = get(signals.result) --getting result signal which is equated to new variable 'saved'local command = get(signals.command) --getting command signal which is equated to new variable 'command'--get() function returns nill if there is no valid valueif not command then --if command is not nill    if saved then --if signal is not nill        publish(signals.result, saved.value) --this value is published to result signals and saved value    end    return 0end local time_diff = time_ms() - tonumber(command.time) --compares command time and real timelocal is_command = time_diff < 30000 and time_diff > -30000 --if command time differs from--real time more than 30s it will not be executed if string.find(command.attributes, "nt") or string.find(command.attributes, "iv") or string.find(command.attributes, "ov") then --searching if signal has negative attributes   if is_command then --if command execution time is not exceeding the limits then        command.attributes = "cot=7,cotn" --equates negative cot values to response signal attributes        publish(signals.command, command) -- and publishes value to command signals and value        if saved then --if there is saved value then            publish(signals.result, saved.value) --restores saved value to result signals        end        return 0    endelse    if is_command then        command.attributes = "cot=7"         publish(signals.command, command)   --in this cycle command value is being returned as well as --cot7 and cot10 values in case given signal is command and has no negative attributes        command.attributes = "cot=10"        publish(signals.command, command) --publishes response to the command        save(signals.result, command.value) --command value is being saved to result signal    end    publish(signals.result, command.value) --in this row command value is being published to result signalsend Upload Excel configuration to WCC Lite: After uploading configuration no errors should appear and all signal should be represented on the web. To upload Lua script go to Script-Runner, select upload script and then start (for each Lua device): Open Vinci as IEC104 master, enter IP address of WCC Lite and start communication. Then open another Vinci window and connect Modbus TCP master – select Modbus TCP slave in Vinci and enter the same IP address as set in Excel configuration for Modbus device. With both communications running check Protocol connections on WCC Lite web interface, it should show Connected. From IEC104 Vinci window go to System tab. Select command determined in the Excel configuration (50), IOA (different for each signal) and value. After executing command, each signal (IEC104 command, Lua command, Lua result and Modbus result) will have the same value, which now will be with math applied. For example, command with IOA=1 and value 1 is being executed. In Excel configuration for this signal add column has a value of 5, which means that this value is going to be added to the value sent and the result will be 6. There can be multiple mathematical operations for one signal. For example add, multiply, bit select etc. If that is the case, math will be applied in typical order (eg. first bit select, then multiply, then add).  More detailed explanation about mathematical operations in Excel configuration can be found here: Optional parameters for signals A user can also apply mathematical condition for the signal value. For example minimum or maximum  value, threshold, suppression time for specific value etc. Minimum and maximum values can be applied to set the range of the signal, if the value is smaller or larger signal state will show invalid or overflow. Thresholds can be used in many ways. It can be a specific value or a percentage. If the signal value passes set threshold it will be represented on imported signals window. Threshold works by comparing old value with new value and then applying the condition of either representing the value or suppressing it, depending on the value change. Suppression value and suppression time is best used together, because suppression time determines how long the specific value should be suppressed. There could be multiple values set for suppression. In Excel configuration those values should be separated by comma. Mathematical operations combined with Lua script is useful for may cases. They can be used for filtering data, converting units, applying specific mathematical logic or other solutions. Configuration --> Download Lua script --> Download Cronjob example Lua device can be configured using cron time expression. This way script execution can be scheduled or executed at certain times. To create such solution, device sheet of Excel configuration should look like this: As seen in this configuration, execution type for Lua device is date and execution parameter is in cron time expression. In this case script will be executed every 30s starting from a mm:30 or a mm:00 mark. There are a lot of online cron expression parsers or generators to convert this expression to a more understandable form: https://crontab.cronhub.io/. A Cron expression must have six variables, for instance, the code "0 * * * *" will not suffice because it contains only five variables. To rectify this, add a "0" to the beginning of the code: "0 0 * * * *". Similarly, the code "0 20-23,0-4,11 * * *" which is displayed as correct on the website, to achieve the effect of every hour from 08:00 PM to 11:59 PM, 12:00 AM to 04:59 AM, and 11:00 AM, it must be adjusted as follows: "0 0 20-23,0-4,11 * * *". To complete Excel configuration fill out the red fields with correct parameters. For "ip" field enter IP address of Wi-Fi connection that is connected to computer. This can be checked by entering command "ipconfig" on terminal window. For the "host" field enter IP address of WCC Lite device. Signals sheet should look similar to this: IEC104 SCADA will send command which will then go to Lua signal. Lua signal will send the response back to IEC104 SCADA and to Modbus TCP result signal. Lua script in this case will be very simple. To show how Lua with cronjob can be used in real life, a calculation for kilowatts per hour has been added: local kW = tonumber(get_value(signals.command))--function "get_value" will get value from iec104 command--without any attributes this value is still in string form so funtion "tonumber" will convert it to number--a new variable is creted which is now equal to command valuevalue = value or 0 --new variable is created. It has to be equal to itself or to 0 if the script is running--for the forst timevalue = (kW * 30/3600) + value --formula for calculating kilowatts. command value from iec104 is multiplied by time. --Since the script is being executed every 30s, this time needs to be converted to hours. an old value is being--added to new value, this way result value that is being published will grow every 30spublish(signals.result, value)--publishes result to result signals for lua and modbus TCP. --Since the script is being executed every 30s, those values will be refreshed every 30s as well To test the functionality of this script upload Excel configuration to WCC Lite (it should upload without any errors): Upload Lua script to script runner and press start. After this, Status should show Running and script process number will appear: Open Vinci as IEC104 master, enter IP address of WCC Lite and start communication. Then open another Vinci window and connect Modbus TCP master – select Modbus TCP slave in Vinci and enter the same IP address as set in Excel configuration for Modbus device. With both communications running check Protocol connections on WCC Lite web interface, it should show connected. From IEC104 Vinci window go to System tab. Select command determined in the Excel configuration (50), IOA (1) and value (for example 3600). Execute the command and check Imported signals: On a 30s mark result signals will have calculated value: After another 30s new value will be added to old value and result signals will be updated accordingly: Cronjob with Lua can be used mainly to schedule tasks. It can also be used as a way to filter, monitor or control the data. As seen in this example, Lua script can help calculate certain parameters which will then can be sorted using cron time expression. Configuration --> Download Lua script --> DownloadSelecting specific bit as data (using bit_select) IEC 61850 interoperability with IEC 104 WCC Excel utility Single point to double point and double point to single point information Firmware 1.5 and 1.8 configurations comparison SNMP M-Bus Serial Communication Setup Guide