0
votes

The Simulink Library Block "Counter Limited" (Simulink/Sources/Counter Limited) counts up from zero to a specified upper limit. It then wraps round to zero and counts back up. This happens at a defined rate (sample time). The mask parameters are "Upper Limit" and "Sample Time".

My simulation contains a discrete-time cyclic process with a variable cycle duration, i.e. the number of samples per cycle varies (sample time is constant).

Question: Does anyone know how to make the mask parameter "Upper Limit" dynamic? I would like to pass the number of samples for the current cycle to the "Counter Limited" block at the beginning of each cycle. The current number of cycles is calculated in Simulink but I don't know how to pass it to the "Counter Limited" block correctly.

Thanks a lot for any suggestions offered!

1

1 Answers

1
votes

You'll need to roll your own counter implementation. Something like the following will enable the reset value (in this case 6) to be specified as a signal rather than a parameter. Note that the Unit Delay in the feedback path is needed to prevent an algebraic loop.

Custom Limited Counter