Sign in to follow this  
Followers 0
Guest Volker

melsec q modularising/software re-use

2 posts in this topic

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0