how can using command "RIM" to create the requirement Tracability of Transition in stateFlow

조회 수: 4 (최근 30일)
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'

답변 (1개)

Snehal
Snehal 2025년 6월 20일
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!

카테고리

Help CenterFile Exchange에서 Stateflow에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by