Simulink: Is there any setting that allows for partial library linking?
4 ビュー (過去 30 日間)
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.
回答 (2 件)
Kaustubha Govind 2012 年 3 月 26 日
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.
Vivek 2013 年 2 月 20 日
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.