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

1 次查看(过去 30 天)
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