4
votes

How to use rate limiter with square signal and variable step size in Simulink?

Here's a screenshot of the model I'd like to set up:

model: enter image description here

I feed a customized rectangular signal to a rate limiter to avoid vertical slopes.

Unfortunately that doesn't seem to work. I'm using ode15s, it's a requirement. Here's the error message Simulink throws:

Error: Input signals to Rate Limiter '.../Rate Limiter' are neither discrete nor continuous sample time signals. Only discrete or continuous input signals are supported

Quite surprisingly I found a workaroud by adding an integrator directly followed by a derivative. This works:

workaroud:

enter image description here

But it's ugly and I'm getting some very annoying stability issues in some cases. And I doubt very much that it is considered "good practice".

So how is one supposed to use this rate limiter block in such a situation?

John

2
My first guess is, that your step function is starting directly at t=0 - but ode15s needs a value in advance for the rate limiter. Try to start the step a little later. Maybe also this question gives you some inspiration for alternatives.Robert Seifert

2 Answers

1
votes

Thank you both for your answers. I forgot to say I had already checked the sample time with the colour display. It was "Fixed-in-Minor-Step".

Actually it was quite simple. If I get it right, the sample time was not specified or specified in a wrong way in my subsystem. Specifying Continuous in the rate limiter dialog box solved the problem!

thewaywewalk, I'll keep your suggestion in mind. Since I'm using steps a lot it might be useful.

0
votes

Try displaying the sample time colours in your model to check what sample times your signals are using.

Introducing an integrator block will force the signal to become continuous, hence why it works. Maybe using a Signal Specification block or a Rate Transition block with a sample time of [0, 0] (for continuous signal, see Specify Sample Time in the documentation) will achieve the same thing and be slightly more elegant (using the derivative block is not considered good practice).