Hi,
I have the product line as mentioned above. I have 4 types of drive devices and 2 types of IO devices.
Please note that the number of each device may vary as per my PLC configuration.
I wish to declare in my program a global variable as below:
VAR
device : Array [1..MAX_NO_OF_DEVICE] of Device ;
END_VAR
Is it possible that I can assign an individual type of device to the indexed element.
For e.g.
device[1] is (Drive > Type1)
device[2] is (Drive > Type4)
device[3] is (Drive > Type3)
device[4] is (IO > Type2)
device[5] is (IO> Type1)
Yes this is very possible indeed using the new OOP features in V3:
Create a interface called IDevice and add a method Update to that interface (and the other methods you'd need ) and then create a few function blocks implementing the interface and the interface methods.
your suggestion sounds interesting but i still wasn't succeessfull getting this to run. I'm afraid I havn't understood the example. Could you please explain this a little bit more?
best regards
Lothar
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Device
|-Drive
| ^---Type1
| ^---Type2
| ^---Type3
| ^---Type4
|
|-IO
| ^---Type1
| ^---Type2
Hi,
I have the product line as mentioned above. I have 4 types of drive devices and 2 types of IO devices.
Please note that the number of each device may vary as per my PLC configuration.
I wish to declare in my program a global variable as below:
VAR
device : Array [1..MAX_NO_OF_DEVICE] of Device ;
END_VAR
Is it possible that I can assign an individual type of device to the indexed element.
For e.g.
device[1] is (Drive > Type1)
device[2] is (Drive > Type4)
device[3] is (Drive > Type3)
device[4] is (IO > Type2)
device[5] is (IO> Type1)
Regards,
Rahul.
Related
Talk.ru: 1
Talk.ru: 2
Talk.ru: 3
Talk.ru: 5
no impossible as a declaration is not dynamic.
however you can compile it with a variable in the compile list.
Yes this is very possible indeed using the new OOP features in V3:
Create a interface called IDevice and add a method Update to that interface (and the other methods you'd need ) and then create a few function blocks implementing the interface and the interface methods.
END_VAR
Related
Talk.ru: 1
Talk.ru: 2
Hi Andreaz,
your suggestion sounds interesting but i still wasn't succeessfull getting this to run. I'm afraid I havn't understood the example. Could you please explain this a little bit more?
best regards
Lothar