Time Delay/S-Function: The specified delay time is smaller than the specified Sample time (Ts). This may cause inaccurate simulation results.

12 views (last 30 days)
Hello,
so I have a dc microgrid model with sources generation and loads, and this microgrid is controlled by model predictive controller, the model predictive controller is a referenced model, as for the microgrid model it is defined as a parent model, plus the model predictive controller has a plant model, and it imports the signals from the microgrid model as well, before the plant model i placed a discrete variable time delay because of an error that occured before, and when i run the model it's working fine, but it's giving me this error, i will upload a photo showing the parameters of the delay time,
the error:'' Warning: Block Modelpredictivecontroller/Discrete Variable
Time Delay/S-Function: The specified delay time is smaller than the specified Sample time (Ts). This may cause inaccurate simulation results.''
the sample time of the microgrid model is 1e-6, total time is 0.48, and i tried to change the value of the sample time of the block from 1e-6 to 1e-8 and to 1e-4, but none of it worked, always the same error
ps: additional to the error before it is giving me another error:
''The specified buffer for 'Modelpredictivecontroller/Measurment/Power generation/Mean3/Model/Transport Delay' was too small. During simulation, the buffer size was temporarily increased to 21504. In order to generate code, you need to update the buffer size parameter''.
thanks in advance

Answers (1)

Hassaan
Hassaan on 15 Jan 2024
The warning message you are seeing suggests that the delay time specified in the Discrete Variable Time Delay block is less than the sample time configured for that block. When you use a discrete time delay in a simulation with a predictive controller, you need to ensure that the delay time is an integer multiple of the sample time to avoid interpolation issues and to maintain accurate simulation results.
Here are the steps to resolve the issue:
  1. Check the Sample Time: Ensure that the sample time set in the Discrete Variable Time Delay block is consistent with the sampling rate of the predictive controller and the microgrid model. The sample time should match the rate at which the controller updates its output.
  2. Adjust the Delay Time: The delay time in the Discrete Variable Time Delay block should be an integer multiple of the sample time. For example, if your sample time is 1e-6, then the delay time should be 1e-6, 2e-6, 3e-6, and so on.
  3. Buffer Size: For the second error regarding the buffer size, you should adjust the buffer size parameter to be larger than the temporary size that the simulation increased it to. In this case, set the buffer size to something larger than 21504.
Here's how to adjust these settings in your model:
  • For the Discrete Variable Time Delay block, set the Sample time parameter to match the sample time of your microgrid model, which you mentioned is 1e-6. Then set the Maximum delay to an integer multiple of 1e-6.
  • For the Transport Delay block inside the Modelpredictivecontroller/Measurment/Power generation/Mean3/Model, increase the buffer size parameter to be larger than the value suggested by the error message (e.g., set it to 22000 or more).
Adjusting these parameters should help you resolve the warnings and errors. It's important to maintain consistency in sampling times across all elements of your simulation to ensure accurate results, particularly when dealing with predictive control systems where timing is crucial. If you continue to encounter issues, you may want to review the documentation for the blocks you're using or consult with a control systems expert who can provide more detailed guidance based on the specifics of your model and control strategy.
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.

Categories

Find more on Simulink in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!