Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Embedded Systems

Forth and Real-Time Control


Oct98: Forth and Real-Time Control

William is a research engineer for the Renewable Energy Research Laboratory at the University of Massachusetts at Amherst. He can be contacted at [email protected].


Modern wind-turbine generators used for electric power production require real-time monitoring and control of their subsystems. These subsystems include synchronization of the generator to the three-phase electrical distribution grid and monitoring of system parameters -- voltage, frequency, three-phase currents, turbine rotational speed, ambient wind speed, and the like. The controller determines the startup and shutdown sequences. Startup requires release of the brakes and synchronization of the turbine's generator to the grid as the turbine accelerates up to speed. Shutdown requires the timed deployment of three independent braking systems.

In this article, I'll describe an intelligent Forth-based controller for a 50-kilowatt wind turbine. The controller utilizes the New Micros (http://www.newmicros .com/) Forth implementation running on a Motorola MC68HC11-based system. Forth is an important and useful tool for real-time controls. Its modularity and easy access to low-level controller functions enable quick changes to the code as "cut and try" prototyping often demands. Clearly, Forth's usefulness was evident by its successful application in the control of the wind-turbine generator discussed here.

Background

A few years ago, the National Renewable Energy Lab (http://www.nrel.gov/wind/) awarded a contract to review the design of the E-44, a 40-kilowatt wind turbine manufactured by Enertech Corp. The purpose of this review was to determine the areas in which the reliability and productivity of this turbine could be improved. This was a substantial undertaking that included all aspects of the design -- aerodynamic, mechanical, electrical, and control. At the completion of the review, only the major design configuration had been left intact. All subsystems had been redesigned to provide a more productive and more reliable wind turbine. Changes to the control were as substantial as changes to the other systems. The original E-44 control (see Figure 1) was a simple, but indirect control that monitored the wind speed and performed some averaging. When the average wind speed exceeded a set point, the control released the brakes and connected the generator to the grid. The type of generator used behaved as both a motor and a generator, depending upon whether it was driven above its synchronous speed (generating) or a torque load pulled its speed below synchronous (motoring). The control then continued monitoring and averaging. When the averaged wind speed fell below a lower set point, the control disconnected the generator from the grid, and applied the brakes. This type of control has the advantage of being quite simple. However, due to the fact that it always operates on information that is "late" (that is, long-term averages), much of the turbine's time is spent idle when it could be generating, and motoring when it should be disconnected, therefore reducing the turbine's potential productivity. A more serious flaw is that, on marginal days, the turbine would cycle through hundreds of braking/starting cycles, accumulating a tremendous amount of unnecessary wear and tear on the entire drive train and brake. The E-44 controller measures speed with Maximum's three-cup anemometer. An AC voltage representative of the wind speed is signal conditioned with a frequency to a voltage converter and filtered via a simple low-pass filter, then compared with two set points. These set points, which can be altered to suit local wind conditions, are typically set at 12 MPH for cut-in and nine MPH for stopping. Each start involves releasing the high-speed shaft parking brake and motoring the rotor from a stand still up to operating speed. Each stop involves disconnecting the turbine from the grid and energizing a dynamic brake and mechanical parking brake. Power is consumed and a large line transient is produced each time the turbine is cut in. Also, the turbine motors break during periods of insufficient wind, while controller information catches up. Conversely, the turbine is braked during periods of wind above cut in speed, while controller information catches up.

Freewheeling Control

To address these limitations, we designed and prototyped an entirely different type of control. In this control, the turbine was allowed to freewheel up to speed under the influence of aerodynamic forces. The generator frequency and phase (relative to the electric utility) were measured and at the appropriate point the generator was connected to the grid. Measurement of current was then used as a determination that the generator was motoring, indicating that the generator could be disconnected but allowed to freewheel in low winds. The freewheeling intelligent controller monitors the following parameters -- vibration, generator temperature, individual phase currents, generator speed, wind speed, and grid voltage -- to determine if a system fault occurred. Four control lines -- generator interconnection, dynamic brake, tip brake, and parking brake -- determine the state of the turbine. Figure 2 outlines the inputs and outputs to the 68HC11 microcontroller unit. The main program loop scans the eight input parameters, performs digital filtering, and determines if any faults have occurred. Determination of the enabling of the IRQ interrupt is made. Discrete signal conditioning of generator phase and frequency and integrated circuit logic is used to signal the IRQ of the 68HC11. When the generator is at synchronous speed or above, and the phase error is less than 10 degrees, an interrupt is sent to the HC11. An interrupt handler, written in assembly language, processes the interrupt to connect the generator to the grid. In short, measurement of the generator speed replaces wind-speed measurement. At the instant that the turbine accelerates up to the generator synchronous speed, connection to the grid is made. When the turbine falls below synchronous speed (motoring), it disconnects from the grid and again allows freewheeling, rather than applying brakes. Figure 3 is a block diagram of the freewheeling controller. For simplicity, we excluded "delay on disconnect" in the model, although in an actual system some small amount of delay (perhaps three to five seconds) after an interconnection is established is desirable to eliminate rapid on/off cycling of the wind-turbine generator.

Time-Step Models

To compare these two different control strategies, we developed a time-step computer simulation for each control. An input file of wind data was fed to each simulation and the rotor speed and power were calculated in each case. The system state at each time step was saved to a file for later analysis.

Anemometer Control Model

The low-pass filter of the E-44 control was represented by a sequence equation derived using the bilinear approximation (see Feedback Control of Dynamic Systems, by G.F. Franklin et al., Addison-Wesley, 1986). As each wind-speed data point is retrieved from a file, it is input to the sequence equation. The output is compared to the set points for determining whether or not a start/stop command is necessary. The sequence equation is Y(k)=9/11 Y(k-1)+1/11(X(k)+X(k-1), where Y(k) is the current filter output, Y(k-1) the filter output once past, X(k) the current input wind speed, and X(k-1) the once-past input wind speed. Once the turbine is commanded to start, the power production (positive or negative) is calculated based upon the torque coefficient (CQ) versus tip-speed ratio and the current wind speed. A fixed estimate of 0.0269 kilowatt consumption for each start is subtracted from the total production. One of the uncertainties in this type of modeling is turbine performance in the "motoring state." The amount of power consumed by the E-44 at tip-speed ratios above 11 is not exactly known. For this modeling effort, a straight line "tail" was appended to the CQ curve (see Figure 4) extending it to areas of negative power.

Freewheeling Control Model

The freewheeling control model is more complicated than the anemometer model. First, it is necessary to predict the rotational speed of the turbine while it is below cut-in speed. At the moment the generator reaches synchronous speed, its speed is calculated based upon generator slip and available shaft torque. Torque at any given wind speed is Q=CQ1/2pAV2R, where Q is the torque, rho the density of air, CQ the torque coefficient, A the rotor swept area, V the wind velocity, and R the rotor radius. Subsynchronous speed is then estimated once the rotor moment of inertia is known: W(k)=W(k-1)+Q/J, where W(k) is the current rotor speed, W(k-1) the previous rotor speed, and J the rotor and drive train moment of inertia.

Model Input

For the input data file of one-minute average wind speeds (along with the standard deviation), we used data from Cuttyhunk Island, Massachusetts. A portion of the complete data set, from noon to midnight, March 27, 1988, was used as the basis for synthesizing two-second data, which was required by the time-step simulation. A number of statistical properties are required by a data set to accurately represent wind data, including the mean, variance, frequency distribution, and power spectrum. To make the simulation as accurate as possible, the synthesized data had to reproduce the given mean and standard deviation. In addition, we wanted it to have a Gaussian distribution and the power spectrum to have the shape typical of turbulent wind. Consequently, we developed an empirical technique that matched these parameters fairly well. The technique involves interpolating within the one-minute data points, every two seconds. Filtered Gaussian distributed random numbers were then added to the interpolated points to create the desired values. The algorithm for generating Gaussian random numbers with a specified standard deviation was developed by Marsaglia and Bray (see BASIC Engineering, Science, and Business Programs for the Apple II and IIe, by P.M. Wolfe, et al., Brady Communications, 1984). Once the Gaussian random number set was generated, it was filtered with a discrete representation of the low-pass filter 0.06/(s+0.06) so as to achieve the proper power spectrum. Time series presentations of the power output for each model demonstrate the performance of the two models. Figure 5 shows the first hour of operation based on the E-44 controller. Motoring events and loss of productivity as the E-44 controller averages instantaneous wind speeds are evident. The freewheel controller, however, does not display these losses; see Figure 6. Among other things, we wanted to see if controller differences were influenced by the average wind speed. To do this, we separated the first nine hours of the results into one-hour segments, and the productivity, number of motor starts, number of line connections, and mean wind speed were tabulated; see Table 1.

Code Description

After application of power to the control panel, the New Micros 68HC11-based board autostarts. Its first task is to wait for several seconds to allow settling of the external electronics. A long-time constant phase locked loop requires approximately eight seconds to settle. After this delay period, variables and arrays are initialized, and the state of an operator's mode switch is determined. This switch lets operators manually start up or shutdown the turbine, as well as placing it in automatic, unattended operation. If the key switch is placed to Auto, the program continuously scans for faults, determines the state of the system, watches the key switch, and makes the appropriate decision dependent upon these conditions. Figure 7 outlines the overall controller operation. Some of the definitions created show the general approach taken to program the controller. The Word FILTER.LOWER is the first part of a digital low-pass filter implementation. Because the HC11 operates on four A/D channels at a time, it seemed natural to process them in groups of four. Listing One s the sequence equation being performed. This is the digital equivalent of a single pole, analog low-pass R-C filter. Listing Two is the actual code. At each repeated A/D conversion, the current data must be saved; see Listing Three. "History" seemed appropriate to describe the operation. This is repeated for the upper four of the eight analog inputs. These words are FILTER.UPPER and UPPER.HISTORY. The next upper-level word is SCAN.SENSORS, and includes the filtering operation. Its operation should be obvious; see Listing Four. The next sample word (Listing Five) is typical of the fault detection words. Here, the program determines if the turbine's generator has overheated. Each fault can be masked by the operator during testing. This lets the turbine run in the presence of noise or faulty signals, an important feature for prototype systems. Lastly, the overall operation has been factored into three words for compactness and readability; see Listing Six.

Conclusion

We installed the controller on a test unit at the U.S. Department of Agriculture Wind Test Center in Bushland, Texas. After three days of unexpected calm, the winds freshened to allow testing. Some modifications to the code were determined necessary, such as the delay to allow the signal-conditioning electronics to stabilize, and loading up the filters to the current conditions. Once these modifications were made, the controller performed as expected. Faults were simulated to observe the shutdown performance. The disconnection and braking proceeded as planned.

Acknowledgment

This work was performed as part of development efforts funded by the National Renewable Energy Laboratory.

DDJ

Listing One

U(i) = .98 U(i-1) + .01 [ X(i) + x(i-1)] 

Back to Article

Listing Two

: FILTER.LOWER ( THE BIT COUNT IS SAVED IN ARRAY U AND IS X100 )8 0 DO I U-1 + @ 98 100 */ 
I X-1 + @ I 2 / 
ADR1 + C@ DUP I 
1 + X + C! 
DUM C@ I X + C! 
+ + I U + ! 2 +LOOP ; 

Back to Article

Listing Three

: LOWER.HISTORY 8 0 DO 
      I U + @ I U-1 + ! 
      I X + @ I X-1 + ! 
      2 
    +LOOP ; 

Back to Article

Listing Four

: SCAN.SENSORS ( INCLUDES FILTERING )  SCAN-1-TO-4 
  DONE? 
  FILTER.LOWER 
  LOWER.HISTORY 
  SCAN-5-TO-8 
  DONE? 
  FILTER.UPPER 
  UPPER.HISTORY ; 

Back to Article

Listing Five

: OVER.TEMPERATURE ( -- F )  PORT.A C@ 1 AND 
  TEMPERATURE.MASK @ 
  AND 1 = DUP 
  IF 
    ." Excess temperature fault " 
    CRLF PORT.A C@ .  
    CRLF 20 PORT.C C! 
  THEN ; 

Back to Article

Listing Six

: AUTO   ?FAULTS IF 
             MASK.INTERRUPT 
             SHUT.DOWN ABORT 
          ELSE 
             RELEASE.T.BRAKE 
             RELEASE.P.BRAKE 
             ?GENERATOR.COMMANDED.ON 
             IF 
                 MASK.INTERRUPT ." INT.  MASKED " 
                 CRLF 
             THEN 
             ?MOTORING 
             IF 
                 DISCONNECT 
                 CLEAR.INTERRUPT.MASK 
                 ." UNMASKED " 
                 CRLF 
             THEN 
          THEN ; 
: DETERMINE.MODE ( LOOK AT ROTARY SW CONNECTED TO PA1 ) 
                 ( 00=OFF 01=AUTO ) 
  PORT.A C@ 2 / ( DO A RIGHT SHIFT TO TOSS OUT PA0 ) 
  1 AND DUP ( MASK OUT ALL BUT THE LSB ) 
  0 = IF 
        DROP OFF ." Off " CRLF 
      ELSE DUP 1 = 
           IF DROP AUTO ." Auto " CRLF
           ELSE ." Mode switch fault " CRLF ABORT 
           THEN 
      THEN ; 
: CONTROL.TURBINE ( THE MAIN WORD ) 
  MASK.INTERRUPT 
  0 DUM ! 
  SHUT.DOWN
  CLEAN.SLATE ( SET ALL THE FILTERED VARS INITIALLY TO 0 ) 
  EMIT.STATUS 
  0 PACTL C! ( MAKE PA7 AN INPUT ) 
  255 DDR.C C! ( MAKE C AN OUTPUT PORT ) 
  CLEAR.FAULT.LIGHTS 
  10000 MSEC ( GIVE THE ELEC, ESP PLL10 SEC TO STABILIZE ) 
  300 0 DO 
          SCAN.SENSORS 
        LOOP ( LOAD UP THE FILTERS ) 
  EMIT.STATUS ( LET US KNOW WHERE ITS AT ) 
  CLEAR.INTERRUPT.MASK ( SHOULD BE READY TO GO ! ) 
  BEGIN 
     DETERMINE.MODE 
     ?TERMINAL ( ESCAPE TO FORTH INTERPRETER ) 
  UNTIL 
  MASK.INTERRUPT ( OPERATOR SHUT IT DOWN, DON'T LET SYNC ) 
  ABORT ;

Back to Article

DDJ


Copyright © 1998, Dr. Dobb's Journal

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.