How to input a signal to a Simulink Function within a Stateflow Chart?

조회 수: 4 (최근 30일)
Adel Muhandes
Adel Muhandes 2017년 12월 4일
편집: Nick Choi 2017년 12월 6일
I am doing a simple bidirectional converter, and I would like to use a Stateflow chart to choose between different modes of operation (Buck or Boost). In the Chart, I defined a Simulink Function to control the duty cycle. After choosing the right mode based on input and output voltages. I would like to input the reference voltage and the feedback output voltage from the converter and get the duty cycle as output. I am getting the following error "'Simple_buck_boost_convertor_system/Chart/Motoring.Boost.Boost_Mood/Controller' has sample time '0'. Only constant (inf) or inherited (-1) sample times are allowed in 'function call' subsystem 'Simple_buck_boost_convertor_system/ChartMotoringg.Boost.Boost_Mood'."
PS: This is the first time I use Stateflow and logic charts.

답변 (1개)

Nick Choi
Nick Choi 2017년 12월 6일
편집: Nick Choi 2017년 12월 6일
Based off of the error message, it seems as though the function call block is set to have a sample time of zero. Since the inputs to the function are signals from Simulink and have a sample time, the function call block's sample time should be set to 'inf' or the block should inherit its sample time from the inputs. Otherwise, it cannot run/simulate properly.
You can go to 'Display' > 'Sample Time' > 'All' to see which sample times are used throughout the model.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by