0

I have a single PLC program that will be run on multiple ABB AC500 PLCs. I need each PLC to have a very slightly different behaviour (limited to selecting an integer value unique for each PLC, to allow timing of a specific event to be different on each PLC).

To allow a single, identical program to be maintained and uploaded to the multiple PLCs, the strategy I have in mind is to access a piece of unique metadata about the PLC to determine the correct value for the specific PLC.

Reasonable information might include the IP address assigned to the PLC, or perhaps the PLC serial number.

I've looked carefully but cannot find a way of accessing this information at runtime - I'm guessing there is a straightforward function in a module that will return one or other of these pieces of info?

Or perhaps there is a better way of having this kind of PLC-specific behaviour?

Thank you!

3 Answers3

0

If you want specific behavior to be binded by hardware you can use DI module. You can take 3 inputs and use them as bits. You can differ 7 PLCs with 3 inputs like 3 bits by using wire jumpers.

This way will be better because if one want to change PLC for whatever reason, you do not need to change programm and change serial number or such. It will work with any PLC.

For example if you have

| DI  | PLC1 | PLC2 | PLC3 |
|-----|------|------|------|
| DI1 |    0 |    1 |    0 |
| DI2 |    0 |    0 |    1 |
| DI3 |    0 |    0 |    0 |

And so on.

But I would simply use constant variable in programm and change it before programm download.

Sergey Romanov
  • 2,949
  • 4
  • 23
  • 38
0

Quicly looking at Automation Builder help files (from here), it seems that there should be a library called Internal System Library (SysInt_AC500_Vx.lib).

The library includes a function block called SLOT_PROD_ENTRY_READ, which "reads one line from the production data in the Flash memory of a Communication Module." You can find it using the search function in the manual.

One of the values that can be read is serial number. Another solution would be use for example MAC address. I don't have an ABB PLC to try on, and the documentation doesn't include a very clear example. But it should be possible. Note the the following is not tested. ​

​VAR
    instance    : CPU_PROD_ENTRY_READ; //Might need a library namespace
    serial      : STRING(80);
END_VAR


instance(
    EN          := TRUE, 
    SLOT        := 0,
    SECTION     := 'Common',
    KEY_SEARCH​  := 'SERIAL_NR',
    INDEX       := 0,
    ACT         := FLASH_DATA_READ
);


IF instance.DONE THEN
    serial := instance.VALUE;
    
    instance(EN := FALSE);
END_IF
Quirzo
  • 1,183
  • 8
  • 10
  • If it's accessing the IP and MAC address of the PLC, according to the [CODESYS documentation](https://faq.codesys.com/display/CDSFAQ/Reading+the+IP+and+MAC+Addresses+from+AdapterInfo) you should be able to do so using standard libraries. Though it didn't work for me on a simulation, I might try it later on a real PLC. (If I try, it would be on a Schneider PLC using their app, Machine Expert, so might want to try this yourself) – Guiorgy Sep 23 '20 at 15:39
  • Using Machine Expert 1.2.4 (codesys 3.5.12.80) on a TM241 PLC this didn't work (`SysSockGetFirstAdapterInfo` returned result 1, which is a general error). Maybe it will work better for others? – Guiorgy Sep 23 '20 at 16:19
  • Thanks for your comments! Hopefully Philip gets some results. – Quirzo Sep 24 '20 at 05:30
0

use the following snippet for the mac address.

Variable :

diNumber: DINT;
iAdapter: DINT;
stName: STRING(255);
stDescription: STRING(255);
aby_address:ARRAY[1..6]OF BYTE;

Program:

getnumberofadapters(ADR(diNumber));
FOR iAdapter := 0 TO diNumber DO

    getadapterinfo(
    iAdapterNum := iAdapter,
    pbName := ADR(stName),
    pbDescrition := ADR(stDescription),
    iBuffersize := SIZEOF(stName),
    iMacLength := 6,
    sMacAdress := ADR(aby_address));

END_FOR
Kamal
  • 1
  • 1