Driver inserted in an XObject
We suggest that Driver objects be only inserted in an XObject if they have common configurations, like IP, port, tag structure, etc.
In case there is a need to change any communication configuration of the physical layer (serial port, IP, telephone), you must use IOKit, which allows you to change any of the driver’s dialog properties at runtime.
This chapter uses a Modbus simulator as the communication device.
IOKit
IOKit is a shared component used by Elipse Drivers which implements default access to the physical layer and provides interfaces to Serial, Modem, Ethernet, and RAS.
Currently, IOKit only allows one connection to be opened for each Driver. This way, if there is a need to access two serial ports, you must add two Drivers on the application, and each one of them must be configured to each serial port.
To change any communication parameter, follow these steps:
- Configure the option Start driver Offline in the dialog box Extras of the Driver. So, the Driver starts offline.
- Configure the Driver parameters in a script on the application. The script can be executed automatically or according to a user request.
- Configure the Driver to online.
LevelData
The Communication Driver must be inserted into an XObject, get IP Address (ID) information from the device when starting the application, and then return the level value:
- Insert a new XObject in the Library, naming it
LevelData
. - Insert a Communication Driver object in the XObject
LevelData
. - Configure the Driver to communicate with a device.
- Insert an IOTag and configure it to read a memory address of the device.
Figure 1
- Test the connection and make sure it is working.
- Insert the properties according to the following figure:
Figure 2
- To attribute device settings to the Driver, insert the following script in the AfterStart event of the Driver:
'Configuration parameters Dim arr(2) arr(1) = Array("IO.Ethernet.MainIP", Parent.IP) arr(2) = Array("ModiconModbus.DefaultSlaveAddress", Parent.Address) Write -1, 0, 0, 3, arr 'Online Write -1, 0, 0, 4, 1
- In the Setup tab, check the Start driver OFFLINE option.
- To access all properties of the
Level
Tag in the application, link the IO Tag to the property of the XObject of type IOTag. Drag the IO Tag to the Initial Value field of the Level property ofTankData
.
Figure 3
- Save and register the Library.
- In the Data folder, insert an object LevelData named
Tank1
. Configure the IP and Address properties according to your equipment.
Figure 4
- On the screen, insert a Display and link it to the Level.Value property of the object
Tank1
.
Figure 5
- Execute the application and test its new functionalities.
Driver sharing
You must be careful with the physical structure of the devices.
Structure 1
In the first structure, there are three equipments, each one with a different IP address.
Figure 6
In this case, you must have three drivers performing a connection with each IP address. Each driver needs a hardkey license.
Structure 2
In the second structure, there are three equipments on a 458 network, where each one is identified by ID (Address). They are connected to the computer using an RS485/Ethernet converter.
Figure 7
In this case, you must have a driver connected to the converter IP, then all equipments exchange information through this channel.
With the Driver inserted in the XObject, you have one Driver for each instantiated XObject (for example, Tank1
, Tank2
, Tank3
) so that the first equipment connects, and the next ones try to connect and find a busy IP.
To create only one connection with the converter, you must share the driver. To do so, enable the ShareServer property of the Driver and configure the ShareMaximum property to the number of devices which can use this sharing.
ShaveServer
If the ShareServer property is configured to True, the Driver shares its execution among the other I/O Driver objects which have the same string in DriverLocation. This means that only the first configured Driver executes the communication initialization. All the other shared I/O Driver objects ignore the configuration parameters.