Simulink - how do I find the number of inputs to a block per second?
Show older comments
Hi,
I am using system generator and I am trying to use a time division multiplexer block, but i am getting the error Output period = Input Period / Number of Inputs, is not an integer multiple of the system period. How do I calculate the Input period and number of inputs to know what I should set my system period as?
Thanks
Answers (1)
Hari
on 24 Apr 2024
Hi Abbey Stock,
I understand that you are working with a time division multiplexer block in System Generator and encountering an error related to the output period not being an integer multiple of the system period. Further, you want to calculate the input period and the number of inputs to correctly set your system period.
The error message suggests that the output period of your multiplexer (which is the input period divided by the number of inputs) needs to align with the system's clock period. This means your system period must evenly divide the output period.
To resolve your issue and calculate the necessary parameters:
- Calculating Input Period: The input period is determined by the rate at which data enters the multiplexer block. If you're unsure, look at the configuration of the block feeding into the multiplexer or use the "get_param" function to programmatically extract the sample time of the block.
inputPeriod = get_param('yourModel/yourBlock', 'SampleTime');
- Determining Number of Inputs: This can be a bit more straightforward; the number of inputs is typically a configurable parameter of the multiplexer block itself or can be inferred from the model setup.
- Setting System Period: Once you have the input period and the number of inputs, calculate the desired output period "(OutputPeriod = InputPeriod / NumberOfInputs)" and adjust your system period so that it is an integer divisor of the output period.
- Trial and Error: In some cases, you might need to experiment with different system periods to find one that satisfies the condition. Start with the calculated output period and try divisors of this period as your system period.
References for further exploration:
- Refer to the documentation of "get_param" to understand how to programmatically access block parameters: https://www.mathworks.com/help/simulink/slref/get_param.html
- For a deeper understanding of sample times in Simulink, this page can be helpful: https://www.mathworks.com/help/simulink/ug/what-is-sample-time.html
Hope this helps!
Categories
Find more on Simulink in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!