dear list,
i am currently about to introduce some kind of software library at my workplace. the idea is that someone writes for example a function block to access a specific device, which is then used by everybody else.
problem so far was, that (for example) a frequency inverter of a certain type, device-mapped via cc-link, would use different base addresses in every machine, moreover, every device of the same type in the same machine resides (of course) at different places.
my approach is, since it's only the base address that's changing, let's supply the function block with the base address. simplified example: fictional device with just one input.
would be used like this:
the FB itself would be implemented like this, given that action_a only meant to switch some output on/off:
where offset_action is the offset of that I/O point from the base address.
in this particular case it would of course be a bit of overkill, but i am about to use a similiarly organised FB to access a motor (mainly, because it saves a lot of time, if i don't have to look up the addresses of every single I/O of that motor every time i use one. i just have to copy the motor's FB and provide the base address.
so, finally, here are my questions:
* what do you guys think about it?
* will i run into troubles with execution speed? (i try carefully only to set the index registers when really neccessary, so i hope it won't take too much time)
* i haven't seen anybody programming like that (but then, industrial automation is not exactly my background) so i suppose there are reasons for that... (?)
* anything else, i should consider?
thanks a bunch in advance for your input on this!
best regards,
Volker.
i am currently about to introduce some kind of software library at my workplace. the idea is that someone writes for example a function block to access a specific device, which is then used by everybody else.
problem so far was, that (for example) a frequency inverter of a certain type, device-mapped via cc-link, would use different base addresses in every machine, moreover, every device of the same type in the same machine resides (of course) at different places.
my approach is, since it's only the base address that's changing, let's supply the function block with the base address. simplified example: fictional device with just one input.
would be used like this:
+--------------+
---[bla_base_X]---| base_X |
| |
| |
---||-------------| action_a |
HMI button | |
+--------------+
the FB itself would be implemented like this, given that action_a only meant to switch some output on/off:
---||-----------[MOV base_X Z2]
SM400
---|^|-------+--[+ offset_action Z2 Z10]
action_a |
+--[SET X0Z10]
---|v|-------+--[+ offset_action Z2 Z10]
action_a |
+--[RST X0Z10]
where offset_action is the offset of that I/O point from the base address.
in this particular case it would of course be a bit of overkill, but i am about to use a similiarly organised FB to access a motor (mainly, because it saves a lot of time, if i don't have to look up the addresses of every single I/O of that motor every time i use one. i just have to copy the motor's FB and provide the base address.
so, finally, here are my questions:
* what do you guys think about it?
* will i run into troubles with execution speed? (i try carefully only to set the index registers when really neccessary, so i hope it won't take too much time)
* i haven't seen anybody programming like that (but then, industrial automation is not exactly my background) so i suppose there are reasons for that... (?)
* anything else, i should consider?
thanks a bunch in advance for your input on this!
best regards,
Volker.
Last edited: