Discussion in 'Programmer's Corner' started by 19dan87, Apr 12, 2011.

1. ### 19dan87 Thread Starter New Member

Apr 12, 2011
5
0
I am modelling the vibration of a 2 D.O.F system with damping in Simulink.

I want to set up control such that if the control value is between two values (max and min) then it sets the control value to the specified input but if it is outside the max and min interval then the control value is set to the max or min as appropriate.

eg.

Fd> Fmax , then set to Fmax
Fd< Fmin , then set to Fmin

If not set to Fd.

Fmax and Fmin will vary slightly throughout the simulation so can not use a max/min since they vary with time during the simulation.

Any ideas how it will be best to do this. Basically going to be three inputs into the block from the system which need to be evaluated and then the appropriate input set as the output.

I have tried IF blocks but they won't work properly for the simulation.

Thanks

Dan

2. ### steveb Senior Member

Jul 3, 2008
2,433
469

It sounds like the "saturation block" under "discontinuities" will do exactly what you want.

Also, you can use the "min/max" blocks under "math operations".

The first way is probably easier to implement.

3. ### 19dan87 Thread Starter New Member

Apr 12, 2011
5
0
Hi Steve thanks for the reply. The saturation block was what I was describing but unfortunately I didn't think through the problem I was modelling properly and a simple saturation block will not work.

I am modelling Semi active damping with skyhook control. (MR damper with 2 DOF)

I want the control force to be; Fsky=Csky*x1
Ales the control force falls outside the Fmax and Fmin limits then I want to set the control force to Fmax or Fmin.

Fmax= sgn(Fy) + C(x1-x2) , sgn(Fy) is simply the offset force
Fmin= C(x1-x2)

The force-velocity diagram in the link below will help visualize the problem I am describing.
http://postimage.org/image/9rqiokn8/

Now 2 problems arise when using the saturation block alone.

(x1-x2) can be negative meaning I would have to swap the upper and lower limits around for the case when the relative velocity is negative.

Also If Fmax and Fmin are negative but the control force Fsky (Fd on the diagram) is positive and still between the +Fmax and +Fmin then I want the control force to be set to Fsky.

Any ideas how it would be best to model this problem in Simulink. Any suggestions would be very helpful. Thanks.

4. ### steveb Senior Member

Jul 3, 2008
2,433
469
OK, there are a few ways to do it, but I'll just mention two.

First of all, you need to use the dynamic saturation block rather than the normal saturation block because your saturation limits are variable, rather than constant values.

The first method is to generate the lower limit, and the upper limit, as functions which depends on velocity. The discontinuities, for both the upper and lower limit, at zero velocity, is just part of the functions.

The second method (which I prefer) is to take the absolute value of the force input (call it Fmag) and take the sign of the input (call it Fsgn). Since the functions appear to be symmetric around the origin, you can just work on the positive side (using the Fmag value as the input) and then take the output and multiply by Fsgn at the end to recover the signed value of the answer. With this method, the upper and lower limits are easier to generate as linear functions of velocity.

5. ### 19dan87 Thread Starter New Member

Apr 12, 2011
5
0
Thanks Steve second method worked a treat, you have been a great help, was already trying to do it with the saturation block but thought I was going to have to begin looking at producing a custom block.

Thanks again
Dan