Filter löschen
Filter löschen

Find name of MPT signal of input line

2 Ansichten (letzte 30 Tage)
Jeremy
Jeremy am 27 Aug. 2012
I have a large Simulink model which includes many signals associated with mpt.Signal objects in the base workspace (so that these lines auto code to simple, non-structured variables). To create some ancillary information for this model, I need my script to find which mpt signals are used as inputs to some of my custom subsystem blocks.
Looking at one of these blocks, I can use "get_param" to get its inport "Port" and "Line" object handles, but I cannot find a way to retrieve the name of the associated MPT signal.
Alternatively, my script has a list of these signals available. If I could generate a list of every subsystem inport which uses a given MPT signal, then I could search that list for the subsystems which intrest me, and complete my script from there.
So is there any way for a script to find the uses of an MPT signal, even after it is routed through multiple subsystem levels of a complex madel? I could use a solution which either examines an inport and determinies the signal or finds all inports which use a given signal.

Antworten (2)

Kaustubha Govind
Kaustubha Govind am 27 Aug. 2012
This might help:
>> signals = find_system('modelname', 'FindAll', 'on', 'RegExp', 'on', 'Type', 'line', 'Name', '\w')
This should give you the list of all signals with a non-empty name.
Alternately, if you have the line handle, you should just have to call GET_PARAM to ask for the "Name" parameter:
>> get_param(signals(1), 'Name')
You can also use "get" instead of get_param. The following command will query for all public properties of the line:
>> get(signals(1))

Jeremy
Jeremy am 27 Aug. 2012
Bearbeitet: Jeremy am 28 Aug. 2012
Unfortunately, that only finds lines which are manually named with the signal name. I need to find where the signal goes from there, including through the use of "To-From" blocks and into and out of subsystems. If I select one of these "downstream" lines and enter a less-than sign (<) as the name, or if I set the line's "signalPropagation" property to "on", then the signal name appears in my Simulink screen, surronded by less-than/greater-than signs (<MySignalName>). However, using "get(get_signals(1))" in this condition, I can see that "signalPropagation" is on, but I still cannot see the actual signal name in any property ("Name" is just set to an empty string).
So I can see the signal name in my Simulink screen, and I have traced a few of these blocks in the auto-code to verify that the intended MPT variable is used directly (not written to a structure element then used by reference to the structure). But I still have no way for my script to access this signal name.

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by