I am desperately trying to automate a script to log in to a series of (identical) PLCs to read a parameter value, write a recipe, etc.
I have 100 Moeller XC-CPU201 PLC's on a single network and occasionally need to check the value of (or write a new value to) a parameter that isn't accessible via the SCADA system. Doing this manually through easy Soft for 100 devices is a pain in the....
From reading the help file it seems to me that the table of command file (cmdfile) commands for command-line access can control everything EXCEPT specifying the "channel" (PLC identifier) in the Communication Parameters dialogue.
I have written a command file that opens easy Soft, opens the relevant project and goes online, but only with the PLC that was last accessed. I need to be able to change the selected PLC so I can loop through the whole lot of them!
PLEASE advise if this is possible...
The command file is running on the local gateway PC. I.e. CoDeSys gateway server is running on the same PC and all PLC's are accessed via TCP/IP (dedicated IP address for each PLC). The PLC target platform is Moeller XC-CPU201. Running easy Soft CoDeSys v2.3.9.11.
Any help would be much appreciated
Darren
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Norm - that's correct. Identical programs, and the need to make exactly the same change (or read the same variable or constant tag) from each of them.
Could you explain what you mean by the CanOpen option please? Each PLC already has a CanBus connection to its remote I/O rack, but the PLC's are networked via ethernet/IP and this is how I access them remotely.
Darren
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have never done this before but I believe Net Variables can be used for this. I have tried to search for the tech note on using them but I could only find references to it in other documents.
I know you could do it with raw CAN messages but that would take a bunch of testing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looks like an interesting option but I need to be able to access ANY of the 300+ variables/constants in the PLC and don't want to make them all global and broadcast all over the network.
The command file as I described above SHOULD be a perfect, simple solution, but it seems to have been created to do everything except the most basic function of choosing which PLC to connect to.... !!
Does anyone know if there is a workaround to select a channel/PLC??
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, I'm not all that familiar with the command file so I can't say if that should work or not.
The only other thing that comes to mind is to implement a Modbus/TCP client on each PLC. Then have one Modbus/TCP server that all plc's monitor for changes.
With that many parameters you would probably have to set up an array with all parameters in each PLC. Then when a bit goes high at the server, each plc will look for a modbus value to tell it which position in the array to change and a separate parameter to tell it what the new value is.
That's all i got
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I always use hosts file to connect to my plc, for example
```
192.168.0.162 PLC
``` And in all places where I must enter plc's IP I enter "PLC".
Maybe You should try next thing:
1) set first IP in hosts file
2) run codesys command file
3) change IP in hosts, move to step 1
PS. To automate this You can use windows cmd file.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
They are all connected over TCP/IP but are the PLC's running any industrial communication protocols? EtherCat, Modbus, Ethernet IP? Are the IP addresses continuous like 192.15.10.1-100? Do you expect confirmation that the reading/writing took place? If it were Modbus this could be accomplished with a little bit of work, free drivers and Java/Microsoft etc... I think it may be possible with the 3S Gateway/DDE/ and using VBA if it is only a few parameters. There is a DDE example with the CoDeSys install. Actually I'm pretty sure of it since going through the gateway it doesn't matter what protocol you have you can directly access variables on the PLC because the gateway connects with the 3s protocol. So you can make a loop in VBA that reads the IP address from one sheet opens the connection to the gateway reads or writes the variable closes the connection gets the next IP address from the list and continues until no more addresses. Here is the DDE excerpt from the CoDeSys manual. I have more info and examples on DDE if this is something that interests you contact me offline. Look at the DDE section in the manual. Ok the file will not upload it's too big. Go to the CoDeSys folder/documents/English/CoDeSys_V23_E.pdf or again contact me offline.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Avgur,
Thank you! I've done a quick test by using the hosts file to log in via the normal Moeller programming software and it works. I'll have to now write a test script to see if it will also work from the Codesys command file but looks promising...
Steve,
The PLC IP's aren't all contiguous - there will be 97 in the address range xxx.1 to xxx.252. They do run Modbus over TCP/IP. If I can't get the hosts file option above to work, I'll look into your DDE suggestion and let you know how I get on. Thank you
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am desperately trying to automate a script to log in to a series of (identical) PLCs to read a parameter value, write a recipe, etc.
I have 100 Moeller XC-CPU201 PLC's on a single network and occasionally need to check the value of (or write a new value to) a parameter that isn't accessible via the SCADA system. Doing this manually through easy Soft for 100 devices is a pain in the....
From reading the help file it seems to me that the table of command file (cmdfile) commands for command-line access can control everything EXCEPT specifying the "channel" (PLC identifier) in the Communication Parameters dialogue.
I have written a command file that opens easy Soft, opens the relevant project and goes online, but only with the PLC that was last accessed. I need to be able to change the selected PLC so I can loop through the whole lot of them!
PLEASE advise if this is possible...
The command file is running on the local gateway PC. I.e. CoDeSys gateway server is running on the same PC and all PLC's are accessed via TCP/IP (dedicated IP address for each PLC). The PLC target platform is Moeller XC-CPU201. Running easy Soft CoDeSys v2.3.9.11.
Any help would be much appreciated
Darren
Are you saying you need to change the identical parameters in all PLCs at the same time? Do they have identical programs in them?
Perhaps the built in CanOpen can be used for this.
Thanks Norm - that's correct. Identical programs, and the need to make exactly the same change (or read the same variable or constant tag) from each of them.
Could you explain what you mean by the CanOpen option please? Each PLC already has a CanBus connection to its remote I/O rack, but the PLC's are networked via ethernet/IP and this is how I access them remotely.
Darren
I have never done this before but I believe Net Variables can be used for this. I have tried to search for the tech note on using them but I could only find references to it in other documents.
I know you could do it with raw CAN messages but that would take a bunch of testing.
From this information:
http://www.3s-software.com/index.shtml?en_CoDeSys_DataX
It looks like you could also use the network variables over ethernet (UDP) which might be easier.
Looks like an interesting option but I need to be able to access ANY of the 300+ variables/constants in the PLC and don't want to make them all global and broadcast all over the network.
The command file as I described above SHOULD be a perfect, simple solution, but it seems to have been created to do everything except the most basic function of choosing which PLC to connect to.... !!
Does anyone know if there is a workaround to select a channel/PLC??
Well, I'm not all that familiar with the command file so I can't say if that should work or not.
The only other thing that comes to mind is to implement a Modbus/TCP client on each PLC. Then have one Modbus/TCP server that all plc's monitor for changes.
With that many parameters you would probably have to set up an array with all parameters in each PLC. Then when a bit goes high at the server, each plc will look for a modbus value to tell it which position in the array to change and a separate parameter to tell it what the new value is.
That's all i got
I always use hosts file to connect to my plc, for example
```
192.168.0.162 PLC
``` And in all places where I must enter plc's IP I enter "PLC".
Maybe You should try next thing:
1) set first IP in hosts file
2) run codesys command file
3) change IP in hosts, move to step 1
PS. To automate this You can use windows cmd file.
They are all connected over TCP/IP but are the PLC's running any industrial communication protocols? EtherCat, Modbus, Ethernet IP? Are the IP addresses continuous like 192.15.10.1-100? Do you expect confirmation that the reading/writing took place? If it were Modbus this could be accomplished with a little bit of work, free drivers and Java/Microsoft etc... I think it may be possible with the 3S Gateway/DDE/ and using VBA if it is only a few parameters. There is a DDE example with the CoDeSys install. Actually I'm pretty sure of it since going through the gateway it doesn't matter what protocol you have you can directly access variables on the PLC because the gateway connects with the 3s protocol. So you can make a loop in VBA that reads the IP address from one sheet opens the connection to the gateway reads or writes the variable closes the connection gets the next IP address from the list and continues until no more addresses. Here is the DDE excerpt from the CoDeSys manual. I have more info and examples on DDE if this is something that interests you contact me offline. Look at the DDE section in the manual. Ok the file will not upload it's too big. Go to the CoDeSys folder/documents/English/CoDeSys_V23_E.pdf or again contact me offline.
Avgur,
Thank you! I've done a quick test by using the hosts file to log in via the normal Moeller programming software and it works. I'll have to now write a test script to see if it will also work from the Codesys command file but looks promising...
Steve,
The PLC IP's aren't all contiguous - there will be 97 in the address range xxx.1 to xxx.252. They do run Modbus over TCP/IP. If I can't get the hosts file option above to work, I'll look into your DDE suggestion and let you know how I get on. Thank you