1 Introduction
With the help of Network-variables, a very simple communication between two CoDeSys based
Devices can be established without any programming effort. Just a little parametrization work.
The goal of this project is to extend this to the communication between CoDeSys devices, and.
.NET programs.
Since the communication is established with the help of UDP broadcast messages, existing
connections between two devices can be "monitored"
2 Implementation Guide for Read Operations (CoDeSys V3)
The Implementation of Read operations (Communication CoDeSys → .NET) is very simple. Just
follow these steps
1. Add a Network Variable List (sender) to your Application
2. Adjust the settings in the Property dialog of the „GNVL“
Important is to keep the „Pack variables“
checked
Also the „List identifier“ (COB-ID) is
important for the implemention in your
.NET program
3. Declare your Variables in the Variable-List
The name of the variables is NOT important for next steps. But
the order of the Variables with the appropriate Datatypes
matters.
4. Integrate the .DLL in your .NET Program
5. Call the methods in the class „NetVars“ as follows.
The important informations are:
– IP-Address of the CoDeSys-Device
– COB-ID (List-identifier)
– Order of the Variables as declared in the Global variable list
3 Implementation Guide for Write Operations (CoDeSys V3)
The following steps describes how to establish a connection for write operations between CoDeSys
based PLCs and .NET implementations.
1. Add the Variables you want to exchange to the ArrayList in your .NET implementation.
2. You can also type a Variable-name, but this is not mandatory. If no Variable-name has been
selected, the Variables are automatically named „variable[number]“
3. Call Method „CreateGVLFile“ to create an GVL-File which can be imported to CoDeSys
4. Add „Network Variable-List (Receive) to your CoDeSys Project and select the .GVL File
which has been created from your .NET Project as Import-source
5. Call Method „SendValues“ to execute send operations.
4 Program documentation
Name of class: NetVars
Name of Namespace: EasyNetVars
4.1 Methods
4.1.1 void disconnect()
releases the used socket - not Mandatory
4.1.2 ArrayList ReadValues()
Executes read operations. Read orders are stored in:
List<CDataTypeCollection> dataTypeCollection
It is very important that the order of the Variables to be read corresponds to the order of defined
Variables in the Global Variable List in CoDeSys.
4.1.3 void SendValues()
Executes write operations. Variables to be written including Values to send are stored in
List<CDataTypeCollection> dataTypeCollection
Use Method void CreateGVLFile(string fileName) to create an "GVL-File" which can be used to
import the variables in CoDeSys.
4.1.4 void CreateGVLFile(string fileName)
Can be used to create a GVL-file (Parameter fileName) which allows to import Variables for Write-
Operations in CoDeSys.
The GVL-File consists of all Variables in List<CDataTypeCollection> dataTypeCollection.
As an Option Variable names can be assigned. If no name is assigned, the variables will be named
automatically.
4.2 Properties
4.2.1 int CobID
List identifier (cobID)
Unique number of the NetworkVariablesList (sender)
4.2.2 int Port
Port of the CoDeSys Device and your local Computer listening.
No need to change!
4.2.3 string IPAddress
IP-Address of the CoDeSys Device.
4.2.4 List (Class: CDataTypeCollection) dataTypeCollection
Collection of Read or Write orders to be executed.
4.2.5 CTelegram CTelegramReceive
Can be used to get detailed informations about the received datagram.
Not mandatory; can be used for troubleshooting
4.2.6 int NumberOfTags
Not mandatory; The number of tags are determined by the number of elements in "List
dataTypeCollection"
Can be used to decrease the number of tags
5 License Information
EasyNetVar .NET
Copyright (C) 2014 Stefan Roßmann
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <[Link]