Jump to content

melsec q modularising/software re-use


Recommended Posts

Guest Volker
Posted
dear all, 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. currently i am looking for some feedback. 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 import the motor's FB once 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 to only 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'm wondering: is that approach just too strange for everybody to consider or does it make no sense? in my opinion this way i save quite a lot of time editing FB headers, copying multiple FBs and the like... * anything else, i should consider? thanks a bunch in advance for your input on this! best regards, Volker.
Posted
This is not such a strange thing to do. I have used index registers in the past for this exact reason, moving a special function module around. The Index works great with the U\G device too.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...