Forum

Please or Register to create posts and topics.

Turbine controller in python

Hello,

I adapted the sampleScript.py to run a simulation using the IEA15MW turbine, but when I used the ramp-fixed option the rotor RPM tends to zero after a few time steps, if I load the saved project at the end of the simulations into the GUI and restart the simulation I get the expected results.

My python script looks like this:

        QBLIB.advanceTurbineSimulation()
        # example how to extract a variable by name from the simulation, call as often as needed with different variable names, extracting rpm and time in the lines below
        power[k] = QBLIB.getCustomData_at_num(b”Aerodynamic Power [kW]”, 0, 0)
        power_gen[k] = QBLIB.getCustomData_at_num(b”Gen. Elec. Power [kW]”, 0, 0)
        thrust[k] = QBLIB.getCustomData_at_num(b”Aerodynamic Thrust [N]”, 0, 0)
        torque[k] = QBLIB.getCustomData_at_num(b”Aerodynamic Torque [Nm]”, 0, 0)
        rpm = QBLIB.getCustomData_at_num(b”Rotational Speed [rpm]”, 0, 0)
        time = QBLIB.getCustomData_at_num(b”Time [s]”, 0, 0)
        # uncomment the next line to try changing the position of the turbine dynamically
        # pitch = movement(movement_Amp, movement_f, time)
        # QBLIB.setTurbinePosition_at_num(0, 0, 0, 0, pitch, 0, 0)
        # assign the c-type double array ‘ctr_vars’ with length [5], initialized with zeros
        ctr_vars = (c_double * 5)(0)
        # advance the turbine controller and store the controller signals in the array ‘ctr_vars’
        QBLIB.advanceController_at_num(ctr_vars, 0)
        # pass the controller signals in ‘ctr_vars’ to the turbine by calling setControlVars_at_num(ctr_vars,0)
        QBLIB.setControlVars_at_num(ctr_vars, 0)
Thanks,
João Muralha

Hi João,

with the info that you provided its hard to debug this. At first glance it seems that you are doing things right.

Could you share the full script (.py files) and the project file that you are using (all packed in .zip format) and I can have a look at it.

BR,

David

Hello David,

Yes, here are the files.

Best regards,

João Muralha

 

 

Uploaded files:
  • You need to login to have access to uploads.

Hello João,

thanks for sending the files. They helped me to identify the issue, which actually is related a bug in the QBlade SIL.

In short: During the first step in the SIL the controller is not correctly initialized with data from the turbine. While this didnt cause any issues up until now (thats why the bug was not found yet), the ROSCO controller seems to be quite sensitive to this. The controller reacts by entering a “shutdown” mode, leading the blades to pitch to feather (90°) and halt the rotor. This issue does not occur in the GUI, where initialization is correctly executed.

I’ve corrected this in the repository, and the upcoming release will include the fix. In the meantime, I recommend switching from the Bladed (ROSCO) controller to the DTU controller. The DTU controller is less sensitive to this bug, allowing you to continue running simulations without the update. I’ve attached the parameter file for the 15MW (onshore) turbine using the DTU controller (dtu_we_controller_64).

One thing that you need to change however is the ramp-up RPM. In your current script you are ramping up to the target RPM – since it takes some time for the generator (and the generator torque) to “kick in” after the start of a simulation this can lead to a rotor overspeed and a triggering of the rotor shutdown sequence by the controller. I would suggest you ramp up to an RPM of ~3 for the IEA15MW, after that it takes around 10s for the rotor to accelerate to the target RPM. Check out the attached screenshot for one of the tests I conducted in the SIL with your script and the DTU controller.

BR,

David

Uploaded files:
  • You need to login to have access to uploads.

Thanks for the help and the advice.

Best regards,

João Muralha

Dear David,

I faced the same problems when changing the wind speed from the rated windspeed (10.59m/s) to a windspeed of 5 or 8 m/s. For windspeed above the rated one, everything is working fine. Is this again the same bug that affects windspeeds below the rated one more, or is it because of the controller inputs?

Thank you very much,
João Muralha

PS. For the cut-in wind speed, the simulation also gives the expected results

Uploaded files:
  • You need to login to have access to uploads.

Hi João ,

I realize this answer might be a bit late, but for some reason I didnt see your latest reply until now.

I am not sure why the controller is “triggering” the shutdown procedure, but this might also be related to an incorrect initialization of the controller in the SIL interface in the 2.0.6.4 release.

While this is fixed in the upcoming 2.0.7 release what worked for me to get around this issue is to set the following DTU controller parameters to a large value (999.0, previously set to 50.0):

  • constant 39 999.0 ; Overspeed percentage before initiating turbine controller alarm (shut-down) [%]
  • constant 45 999.0 ; Overspeed percentage before initiating safety system alarm (shut-down) [%]

Increasing the percentage of overspeed basically prevents the controller from going into “shutdown” mode and pitching to feather.

BR,

David