Borrar filtros
Borrar filtros

How do I define the chart data size, type and complexity of a bus signal to be used in an atomic subchart in StateFlow?

5 visualizaciones (últimos 30 días)
I am trying to set up an atomic subchart to be used as a chart-function. The atomic subchart is I made is a very simple toggle algorithm for the initial testing, and consists only of an input (called input1) and an output (called output1). But when I try to map the input and output of the subchart to entries of the input and output bus structures (called Controller_Internal.T and Controller_Internal.Setpoints.y respectively) I am using for my StateFlow controller in my main chart, I get the following error:
  • Error: Atomic subchart 'input1' accesses main chart output data 'Controller_Internal' with inherited size via mapped input data 'input1'. Subchart input data 'input1' can only map to main chart data if its size, type, and complexity are fully specified.
I can't seem to find out how to define these settings in the model explorer or in a script. But I have found a workaround, where I create a local data variables for the input/output mapping and then define the input and output before and after running the atomic subchart. But the workflow would be much more smooth if I could just directly define the input/output mapping directly using my bus structures.
I hope someone is able to help.
Best regards,
Emil

Respuestas (1)

Abhinaya Kennedy
Abhinaya Kennedy el 14 de Feb. de 2024
Hi Emil,
In Stateflow, when you map an atomic subchart's inputs and outputs to a main chart, you need to ensure that the subchart's inputs and outputs are fully defined. To fix the error, here's a step-by-step approach:
1. Define Bus Objects: Create “Simulink.Bus” objects in the MATLAB base workspace that correspond to “Controller_Internal.T” and “Controller_Internal.Setpoints.y”.
2. Set Data Properties: In the Stateflow editor, select each subchart input and output and specify their properties to match the bus object definitions.
3. Map Inputs and Outputs: Map the atomic subchart's inputs and outputs to the bus structures using the defined bus objects. In the Stateflow editor, set the “DataType” of the subchart's “input1” and “output1” to “Bus: Controller_Internal_Bus”, with appropriate size and complexity settings.
4. Use a MATLAB Script: If you prefer to define these settings using a script, you can do so by using the “set_param” function to set the properties of the input and output programmatically.
By defining the bus objects and setting the data properties correctly, you should be able to map the subchart's inputs and outputs directly to your bus structures without errors.
Here is a link to the documentation on mapping variables for atomic subcharts: https://www.mathworks.com/help/stateflow/ug/mapping-variables-for-atomic-subcharts.html

Categorías

Más información sobre Complex Logic en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by