Parameterize Simulink Goto and From

16 次查看(过去 30 天)
Aaron
Aaron 2015-3-27
Is it possible to parameterize the from and goto tag's using a mask?
In my case, I am trying to share a single multiplier and I want to use the same subsystem as a hook into the multiply with a parameterized name. Each signal pair I mux into the multiply would have it's own prefix and then I would select the tag in the multiplier itself
Ideally, I would even be able to construct a string for the tag like: [name '_mult_in'] [name '_mult_out']
R2015a
  1 个评论
Aaron
Aaron 2015-3-27
I should also mention I'm trying to do this in a library subsystem that is linked.
The solution proposed here did not work since it appears to require editing the subsystem

请先登录,再进行评论。

回答(3 个)

Sebastian Castro
Sebastian Castro 2015-4-9
In that answer, I only mentioned the case for the Goto block, and not the corresponding From block(s). I'm guessing you'd have to do some extra "magic" for your case to find corresponding tag names. For example, prior to changing the block tag name:
gotoTagName = get_param(gcb,'GoToTag');
fromBlks = find_system(bdroot,'GoToTag',gotoTagName);
Then, you can modify the tag names of the Goto block ( gcb , or 'get current block') and the list of From blocks ( fromBlks ) in one fell swoop.
- Sebastian
  1 个评论
Aaron
Aaron 2015-4-9
Thanks Sebastian, that is a handy callback!
I'm actually not doing any magic on the "From" side, I just hand select the goto blocks in my multiplier core to select the pair I want. There are a large number of the blocks I show in the image, these are the multiply pairs. I have pair a,b,c,d, ect and mutiplex them into a single, 32 bit multiplier.
I wanted a library link for the pairs themselves so that if I needed to change the way the data type conversions were working (because I made a mistake), I could update all my pairs at the same time.
Here is an updated version of what my multiplier looks like using the from/goto blocks:
User of a masked multiply pair:
Multiply masked subsystem (that I wanted to make a library element)
Multiplier Core

请先登录,再进行评论。


Jason Ghidella
Jason Ghidella 2015-4-1
Hi Aaron,
I have a few extra questions that would help me answer your question. First, the parameter name for the goto and from tags need to be the same in order to match where the from is getting its signal from. So in your example param_goto and param_from would not work. Both need to be the same name, for example something like:
[param_goto_from_1]
My second question is how are you using the from and goto tags? You mention that you want to have it in a library, this suggests this will be a component. Now are the goto and from tags created and consumed in the same component, or do they need to be accessible throughout the model? If they are self contained, then by simply masking the component where the got and from blocks are used, you get a reusable component that you can put in to a library. The masked block provides a local workspace for that block, so you don't need to parametise the tag. Let me know if this helps.
  1 个评论
Aaron
Aaron 2015-4-1
编辑:Aaron 2015-4-1
Jason, I think a simple example will show what I'm looking to do:
Basically I want the "mult_pair" subsystems all be library elements, since they are all just duplicated with different "Goto" tags

请先登录,再进行评论。


Vedang Kokil
Vedang Kokil 2023-7-13
Hi, I have a follow up question. I want to use get_params in command line to access the value of the goto block and not the tag. Is there any particular parameter that I can use with get_param ?
Thanks.

类别

Help CenterFile Exchange 中查找有关 Dependency Analysis 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by