Matlab sltrace alternatives/workarounds

5 visualizaciones (últimos 30 días)
vivek patel
vivek patel el 1 de Abr. de 2025
Respondida: Avni Agrawal el 3 de Abr. de 2025
I am trying to use sltrace to find source inputs for certain output signals.
But i am facing issue when the trace path is in the bus, sltrace gives source desitnation as all the elements in the bus. I know there is an option in the sltrace to select specific path in the bus but that is for when that element is the first in the path.
What i understand is sltrace will list all inputs for following cases.
  1. When there is bus operations in the path.
  2. When there is chart/stateflow in the path.
What i want to understand is that is their any workaround for these in sltrace itself, there is also modelslicer option. I am not sure if the modelslicer option also has same issue ?
I am okay with stateflow/chart complicating stuff because i understand that it is very difficult. I can do manually in those cases, but for the buses i cannot do manually as there are too many cases to do manually.

Respuestas (1)

Avni Agrawal
Avni Agrawal el 3 de Abr. de 2025
I understant that when dealing with complex Simulink models, especially those involving buses and Stateflow charts, tracing signal paths can indeed become challenging.
Here are some suggestions and potential workarounds for your situation:
Using `sltrace` with Buses
  1. Selective Path Tracing: Although `sltrace` has limitations with buses, you can try using the `-busElement` option to specify the bus element of interest. However, as you mentioned, this might not be effective when the bus element is deep within the path.
  2. Custom Script: If `sltrace` doesn't meet your requirements, consider writing a custom MATLAB script using the Simulink API. You can programmatically traverse the model, inspect bus selectors, and identify specific paths. This approach requires a good understanding of MATLAB scripting and the Simulink model API.
Using Model Slicer
`Model Slicer` is another tool that can help you analyze signal dependencies and trace paths in your model. It provides more flexibility compared to `sltrace` and might handle buses more gracefully. Here's how you could use it:
  1. Setup Model Slicer: Open your model in Simulink.Go to the **Model Slicer** tool from the Simulink Analysis menu.
  2. Configure Slicing: Define the starting point (source) and the endpoint (destination) for the signal path you are interested in. Use the slicing options to refine the path and focus on the relevant part of the model.
  3. Handle Buses: Model Slicer can sometimes automatically handle buses better than `sltrace`. If it still includes unwanted paths, you might need to manually refine the slice using the tool's options.
While `sltrace` and `Model Slicer` have their limitations, combining them with custom scripting and model simplification strategies can help you effectively trace signal paths in complex models. If Model Slicer still doesn't meet your needs, investing time in a custom solution might be the most reliable approach.
I hope this helps!

Categorías

Más información sobre Model Simplification with Dependency Analysis en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by