- https://www.mathworks.com/help/stateflow/ref/sfroot.html
- https://www.mathworks.com/help//releases/R2021a/slrequirements/ref/rmi.html#d123e14739
- https://www.mathworks.com/help//releases/R2021a/slrequirements/ref/rmi.html#d123e14834
how can using command "RIM" to create the requirement Tracability of Transition in stateFlow
6 views (last 30 days)
Show older comments
Hi,
I want to know how to create traceability requierment of transition in stateFlow, we use the simulink command "RIM", I have created the requirement for Simulink models by the script:
if true
% code
slvnvdemo_fuelsys_htmreq;
blk_with_req = ['slvnvdemo_fuelsys_htmreq/fuel rate' 10 'controller/...
Airflow calculation'];
%Create new requirement link to example document fuelsys_requirements2.htm.
new_req = rmi('createempty');
new_req.doc = 'fuelsys_requirements2.htm';
new_req.description = 'A new requirement';
%Add new requirement link to existing requirements links for the Airflow calculation block.
rmi('cat', blk_with_req, new_req);
end
my problem, I want to know the path of a transition ,for example in simulink the path of model ('input') is : blk_with_req ='name_blc/name_input'.for the test I use the Simulink model : 'slvnvdemo_fuelsys_htmreq'
0 Comments
Answers (1)
Snehal
on 20 Jun 2025
I understand that you want to create a requirement trace for a transition in a Stateflow chart and get the correct path string for the transition.
Please note: When dealing with requirements traceability in Stateflow models, use the Stateflow API object (ID handle) and not a string path.
This is a previously addressed MALTAB Answer which might be helpful:
You can also refer to the following code snippet for a better understanding:
% get the Stateflow root and search for transitions:
rt = sfroot;
m = rt.find('-isa', 'Stateflow.Machine', 'Name', model_name);
% get the chart inside the model:
chart = m.find('-isa','Stateflow.Chart','Name','control logic'); % You can also use findAll
% get a specific transition:
transitions = chart.find('-isa','Stateflow.Transition');
t1 = transitions(1); % For example, the first transition
% create a new requirement and link it to the valid transition handle created above:
% Create requirement
new_req = rmi('createempty');
new_req.doc = 'fuelsys_requirements2.htm';
new_req.description = 'Requirement for transition';
% Link it to the transition (use its ID handle)
rmi('cat', t1, new_req);
Here are some documentation links for reference on traceability requirements in Stateflow:
Hope this helps!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!