Simulink: Is there any setting that allows for partial library linking?
3 views (last 30 days)
Show older comments
I am building a library of generic blocks and I am having some trouble getting the library to function in the way I want to. I have the "Allow library block to modify its contents" option box checked, but when I try to run a linked block with a callback that changes the tag name for some goto's, the model siezes up and fails to run. If I disable the link, the callback changes the tag to the proper value and everything runs fine. I've tried moving the callback to various places, a subsystem mask, block properties on the top level linked subsystem, in the initialization parameters of the mask, but nothing works.
Unfortunately, the goto needs to be underneath the subsystem mask, so I can't move it to a higher level, but I want to maintain a library link to the technical content of the blocks. Is there anyway to create what I will call a "scoped" or "partial" library link for lack of a better term? Ideally there would be a feature that allows the user to opt-out of linking for selected child blocks when the parent subsystem retains an active link but I don't think that exists or is planned.
Thanks,
Stephen
1 Comment
Vivek
on 20 Feb 2013
Hi Stephen, I think I have implemened almost exactly what you have described. I too have created some custom libraries and one of the blocks is a custom GoTo block that automatically picks up the signal name, and adds a prefix/postfix if needed and assigns it to itself (tag). The way I did this is to check the "Allow library to modify contents" and used a masked subsystem over the normal simulink GoTo block. I didn't have any trouble not running it. I could even build it for embedded targets. The only issue I had was that Simulink kept throwing a warning saying that it was a library link and that I am overriding values within a library. It also says I can change the warning settings but that doesn't work. Anyway, let me know if you need any more clarifications on how I did this.
Cheers,
Answers (2)
Kaustubha Govind
on 26 Mar 2012
I'm not 100% sure, but I don't think such functionality currently exists. It seems like such a feature might cause a nightmare for maintaining libraries. You could confirm with Tech Support if your license is on maintenance.
However, it seems like what you are asking for may not be an encouraged modeling practice. Is there a reason that you need to change the Goto tag? Is it because the signal from the Goto is read in a From block outside of the subsystem? Why not simply output that signal from the subsystem instead, and connect a Goto block outside of the library block if need be.
If you are using someone else's library, can you confirm what the "Tag visibility" of the Goto block in the library subsystem is? If it is set to 'scoped', you might be able to wrap the subsystem with a nonvirtual subsystem in your model. Do not change the tag of the Goto, but use the same tag as the library uses in a 'From' block (also having visibility set to 'scoped') inside that nonvirtual subsystem. That way, your tag won't clash with others in the model.
4 Comments
Kaustubha Govind
on 29 Mar 2012
Stephen: I am very sorry that the current capabilities of Simulink do not satisfy your requirements. I'm not sure what the reasons for not having the ports on any side feature are, but regarding two-way signals - it looks like you might be operating in a domain that doesn't fit the "signal flow" paradigm in Simulink very well. For example, the SimScape domain has a different principle of "signal direction". See http://www.mathworks.com/help/toolbox/physmod/simscape/ug/bq89sba-1.html#bq89sba-5
Nonethless, I will still urge you to send an email to Tech Support and put in an enhancement request, so that the development team is aware of your need, and also so you may be notified if such a feature is ever introduced.
Vivek
on 20 Feb 2013
Hi Stephen, I think I have implemened almost exactly what you have described. I too have created some custom libraries and one of the blocks is a custom GoTo block that automatically picks up the signal name, and adds a prefix/postfix if needed and assigns it to itself (tag). The way I did this is to check the "Allow library to modify contents" and used a masked subsystem over the normal simulink GoTo block. I didn't have any trouble not running it. I could even build it for embedded targets. The only issue I had was that Simulink kept throwing a warning saying that it was a library link and that I am overriding values within a library. It also says I can change the warning settings but that doesn't work. Anyway, let me know if you need any more clarifications on how I did this.
Cheers,
0 Comments
See Also
Categories
Find more on Interactive Model Editing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!