I am trying to implement my Pitch control in Simulink with the 5MW FOWT. But is something that I do not understant why the S-Function works like that:
- The pitch setpoint that I introduce to the S-Function model has a mismatch with the output blade pitch angle at some point. I mean, when it is working in normal operation the input and output pitch value is the same (OK), but when an error ocurs the output signal grows above the maximun pitch angle while the input does not. Why is that? Has not sense higher pitch angle than 1.57rad, rigth?
Thank you so much in advance,
P.D.: I attach the Simulink scheme, error message and IO signal mismatch.
The FAST v8 S-Function for the MATLAB/Simulink interface is a discrete-time block, meaning that inputs go in at time step “n” and outputs come out at time step “n+1”. Within the block, the output calculation at n+1 involves an extrapolation of inputs (linear or quadratic), which is normally negligible when the inputs vary slowly in time, but is visible when the inputs vary a lot between time steps.
The error seems to imply that the model has going unstable, with vary large unrealistic displacement.
Thank you for your fast reply. I agree with you, I think that I need to retun again my control loops.
is it possible to change the circumstance about output coming out at step “n+1” using a delay or memory block or somethin similar in Simulink?
Also, how does the extrapolation work exaclty? I am trying to set the whole TMD module out to Simulink, so that control or other operations with TMD are possible using Simulink. So far I have seen my model in Simulink works well, when I compare passive TMD forces from FAST with my Simulink model forces calculated in the background. When I want to use the forces calculated in my Simulink model as the actual used TMD forces however, FAST uses different values for TMD forces: In the following I try to phrase the problem using F_Simu as Force calculated by my model and F_FAST as the read in force that is actually applied to the wind turbine:
F_Simu(t=0) = x0 F_FAST(t=0) = 0
F_Simu(t=1) = x1 F_FAST(t=1) = 3*x0
… F_FAST(t=2) = ?? I dont understand what FAST uses here. Probably some result of the extrapolation.
The following time steps seem to work just fine except for some smaller differences which probably result from the extrapolation. The problem is with the initialization using quite high forces in ‘t=1’ the wind turbine is actuated very strongly resulting in divergence problems. I hope to achieve that F_FAST(t=0) is unequal 0 and for the first extrapolation step to be not three times the initial value from Simulink.
I also tried comparing this issue to the external control of Gen Torque and got the same result: When I apply Simulink control of Gen Torque and set that value constant in Simulink, the initial output from FAST is 0, then three times the constant, then 0 again and only in the following time steps the constant value from Simulink is taken as Output in FAST. Is it possible to alternatively turn off the extrapolation from ServoDyn and just take the values from Simulink directly with one time step difference?
I hope I was able to phrase my concern understandable and thank you all for your help.
FAST uses either a linear or quadratic extrapolation depending on the setting of InterpOrder in the FAST primary input file. You cannot eliminate the extrapolation without changing the source code, but I can clarify how the extrapolation works. In linear extrapolation, the values at time n and n-1 are used to find the two constants of the linear equation that will yield an extrapolation to the value at n+1. In quadratic extrapolation, the values at n, n-1, and n-2 are used to find the three constants of the quadratic equation that will yield an extrapolation to the value at n+1. At initialization (time n = 0), the value at time n=0 is used at times n=-1 and n=-2.
The extrapolation tends to work well for smooth functions, but steps in the function result in an overshoot of the extrapolated value (more so for quadratic than for linear extrapolation). As such, I would always encourage the use of smooth functions. I’m not sure I fully understand what you saying is happening in your simulation at initialization, but you could probably reduce the start-up transient by ramping up the force over the first few seconds of simulation.
Thank you for your quick reply. I changed the source code in a way so that the TMD forces and moments y%Mesh%Force(:,1) and y%Mesh%Moment(:,1) are read in by the S-Function in Simulink. Afterwards I copied TMD.f90 so that the equations are carried out by Simulink itself. I now ran a Free Decay calculation of the 5MW onshore wind turbine. After I changed the interpolation order from quadratic to linear it seems to work just fine. Thank you very much!
Could you still tell me where in the source code the part with the interpolation is stored? I am not sure I understand why I would prefer to interpolate rather than just take the exact Simulink values from ‘n’ and let FAST take them as output at ‘n+1’. For me no interpolation at all would do as well I guess.
The source code change to eliminate all interpolation and extrapolation is simple. Routine FAST_Subs.f90/ValidateInputData() checks to ensure that FAST primary input parameter InterpOrder is either 1 or 2. All of you to do is change this check so that InterpOrder can be 0, 1, or 2, where InterpOrder=0 corresponds to no interpolation or extrapolation. The interpolation/extrapolation routines already allow for the situation where InterpOrder=0, but we prevented the user from selecting this option because we felt that in general it would be better to have some sort of interpolation/extrapolation.