Parameterize Simulink Goto and From

14 Ansichten (letzte 30 Tage)
Aaron
Aaron am 27 Mär. 2015
Beantwortet: Vedang Kokil am 13 Jul. 2023
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 Kommentar
Aaron
Aaron am 27 Mär. 2015
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

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Sebastian Castro
Sebastian Castro am 9 Apr. 2015
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 Kommentar
Aaron
Aaron am 9 Apr. 2015
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

Melden Sie sich an, um zu kommentieren.


Jason Ghidella
Jason Ghidella am 1 Apr. 2015
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 Kommentar
Aaron
Aaron am 1 Apr. 2015
Bearbeitet: Aaron am 1 Apr. 2015
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

Melden Sie sich an, um zu kommentieren.


Vedang Kokil
Vedang Kokil am 13 Jul. 2023
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.

Kategorien

Mehr zu Dependency Analysis finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by