How to input a signal to a Simulink Function within a Stateflow Chart?
2 views (last 30 days)
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.
Nick Choi on 6 Dec 2017
Edited: Nick Choi on 6 Dec 2017
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.