Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Industries Academia Support User Community Company

 

Newsletters - MATLAB Digest

Electrohydraulic Servo Control

Summary

In this example we develop a Simulink® model for a hydraulic servomechanism controlled by a pulse-width modulated (PWM) solenoid. This might represent a motion control system in an industrial or manufacturing setting, or a subsystem that controls the position of a valve in an automotive or aerospace application. Nonlinear differential equations are used to model the magnetic, hydraulic and mechanical components; discrete-time difference equations represent the controller. A behavioral model in Stateflow implements the electronic circuit which generates the PWM waveforms and regulates the solenoid current. Although a detailed power electronic model could be developed in Simulink, the Stateflow description provides the required functionality and speeds development.

Figure 1 shows a hydraulic schematic for the mechanism. The objective of the system is to position the load xp so that it follows commands issued in the form of a time-varying set point rset. An electronic controller compares these commands to feedback measurements of xp and generates a PWM control signal at a rate of 50 Hz. The PWM duty cycle is the percentage of the 20 millisecond period for which the valve directly supplies oil to the control pressure developed in the cylinder behind the piston, pc. For the remainder of the period, the valve vents pc to exhaust. The composite flow qnet thus controls pc which develops an actuating force against the piston. This forces the spring-loaded piston to its position xp such that it follows the reference trajectory rset.

Figure 1: Solenoid valve and hydraulic actuator.

We chose PWM control to regulate the net valve flow with its on/off duty ratio rather than relying on the strict mechanical tolerances of a continuous valve. This sequentially turns the solenoid completely on or off , rather than attempting to control it to a precise intermediate position. The tradeoff is that a disturbance is introduced into the system at the PWM frequency. As a result, we must take care that this is adequately attenuated by the low-pass response of the mechanical system. We can evaluate this requirement by constructing a simulation at the design phase rather than waiting for experimental parts.

Analysis and Physics

PWM Solenoid

The model of the solenoid-controlled PWM valve includes three parts:
Magnetic circuit
Armature motion
Valve flows

Figure 2 shows a cross-sectional view of a typical solenoid valve of this type. The enclosure, armature and pole piece are steel, and the coil is wound around the armature/pole axis. With no current, the internal spring forces the armature and ball to the right against the hydraulic force. This blocks the supply pressure Ps and opens a path from control pressure to exhaust. When the solenoid is energized, the armature and pole come together and the pressure force shuttles the ball to open the supply port and block the exhaust port.

Figure 2: Pulse-Width Modulated Solenoid Valve.

Consider first the magnetic circuit. Faraday's law determines the flux. We assume that fringing and leakage flux are negligible, as are eddy currents.   
 
    f = flux
vsol = solenoid voltage
     i = current
    R = winding resistance
    N = number of turns

The magnetomotive force required to develop this flux is broken up into components for the steel and the air gap. Although the majority of the circuit's reluctance is concentrated at the air gap, the nonlinear properties of the steel components, such as saturation and hysteresis, can limit performance.
  MMF = MMFair + MMFsteel
MMFair = Hairg
MMFsteel = HsteelLstee
MMF = magnetomotive force
H = magnetic field intensity
g = length of air gap
Lsteel = magnetic circuit length in steel
Equation 1

Within the steel, the flux density, B, is a nonlinear function of H, dependent upon the material properties. We also assume that the area, A, which relates f and B at the air gap, applies uniformly for the steel path.
 

 B = f/A
    = flux density
    = f(Hsteel)
    = µ0Hair
 A = cross-sectional area in air gap
µ0 = permeability of air

The solenoid force, Fsol, and current that result are:

Fsol = 0.5 B2A/µ0
    i = MMF/N

The armature responds to the solenoid force, as well as the hydraulic and spring forces.
 
x = armature position
= gmax - g
m = mass
A0 = supply orifice area
Ps = supply pressure
Ks = return spring rate
Cv = damping rate
Equation 2

The net oil flow directed from the valve to the actuator, qnet, is the supply flow less the exhaust flow
 
Equation 3

Actuator Dynamics
The actuator assembly moves the piston against a spring as a function of the control pressure developed behind it. Assuming negligible leakage,

 

 
b = fluid bulk modulus
V = xpAp
= fluid volume
xp = piston position
Ap = actuator (piston) area

Equation 4

The actuator's equation of motion, dominated by the relatively large hydraulic and spring forces, is simply:

 

    
Mp = net actuator mass
Ksp = spring rate
Equation 5

Electronic Controls
We employ a discrete-time PI (proportional + integral) control law to

1. Achieve zero steady-state error to step changes in the position set point, and
2. Compensate for the low-frequency actuator dynamics to improve response speed.

 

Equation 6

The integral term is essential because the null duty cycle, or equilibrium control input, is subject to uncertainty and will change with the system's operating point. The proportional part contributes phase lead at low frequency which is essential for stability.

Equation 6 computes the PWM duty cycle as a function of position error. The duty cycle is applied to a 50 Hz pulse train and the power electronics convert the pulse signal to solenoid current. Digital and analog integrated circuits are available to perform these functions, so we use a behavioral model, rather than a highly detailed physical model. The behavior is best described in terms of the circuitís reaction to the commands it receives and the response of its load. Figure 3 shows an idealized example.

At the beginning of each 20 millisecond period, the PWM pulse turns on and must pull the solenoid armature up against the pole piece to open the valve to supply pressure. Hence, the driver circuit applies the full supply voltage to achieve the fastest initial rise in current. The solenoid maintains this condition until the current has risen to the level at which the magnetic and hydraulic forces overcome the spring and move the armature.

Once the armature has been pulled in, the air gap is very small and somewhat less current is needed to hold the armature in place. The driver thus regulates the current at a lower level for the remainder of the "on" portion of the cycle. Typically, a switch-mode regulator controls the "hold" current. This technique alternatively applies the supply voltage to the solenoid and then allows the field to collapse slowly (shunted by a freewheel diode). This is significantly more efficient, in terms of power, than linear regulation.

At the end of each pulse, the armature releases so that the ball returns to its original position and the valve opens to exhaust. We achieve this by opening the solenoid circuit so that the magnetic field collapses quickly. Typically, we employ a zener diode to limit the large negative EMF while still allowing a fast decay. The current then remains at zero for the duration of the "off" time until the next cycle begins.

In this way, we divide the "on" portion of each pulse into two phases: "pull-in" and "hold". The "off" portion is characterized by the initial rapid decay, followed by zero voltage and current. The diagram in Figure 3 illustrates this scenario.

Figure 3: Current control within pulses.

Modeling

Figure 4 shows the top-level system block diagram (sf_electrohydraulic.mdl). The set point block consists of a signal generator and a step function which are added to give wide flexibility to the user in specifying the set point. The controller is a straightforward discrete-time subsystem. We implemented the PWM driver circuit in Stateflow, but it functions just like the other subsystems at the block diagram level. We refined the solenoid valve into three parts, as described above. The actuator model, consisting of the cylinder pressurization and piston motion subsystems, completes the overall system model.

Figure 4: Servo model using Simulink and Stateflow. Click on image to see enlarged view.

Controller
The controller samples the position error and generates a new solenoid duty cycle every 20 milliseconds. The duty cycle consists of a component that is proportional to the error plus a component that is proportional to the integral of the error. The model realizes the integration in the z domain with feedback around a 1/z block that places a pole at z = 1. The integral gain, as labeled in the diagram, (Figure 5) is fixed with respect to the proportional gain. An overall loop gain, Ka, adjusts both while keeping their ratio, hence the transfer function zero, constant. While in the linear operating range:

 

Equation 7

The model limits the computed duty cycle so that it never falls below the minimum time to open the valve, nor exceeds the time at which the valve remains continuously open. Whenever it reaches either of these limits, the integrator holds constant (zero input) until the error is of the appropriate sign to pull it away from the limit.

Figure 5: Discrete-time controller subsystem. Click on image to see enlarged view.

PWM Driver Circuit
The solenoid driver circuit uses the computed duty cycle to generate the PWM waveform. The solenoid voltage is applied in order to achieve the desired current, force, and hence, valve flow. We modeled this with a Stateflow block, which uses duty cycle and solenoid current as inputs and computes voltage as an output. Figure 6 shows the Stateflow diagram for the model.

Figure 6: Stateflow diagram for the PWM driver circuit.

Each PWM cycle begins with the local variable ton equal to the current simulation time. The unconditional transition which begins the cycle computes toff, the time at which the "on" portion of the pulse ends.

 

  toff = ton + duty_cycle*Tpwm/100;

Equation 8

Tpwm is a MATLAB workspace variable representing the pulse period. The system enters the energize_solenoid state and, by default, the pull_in_current state. As described above, the driver circuit connects the supply voltage to the output for this phase of the pulse. Once the current reaches Ipull, the worst-case current required to pull in the armature, it enters the regulate_hold_current state. A diode in the freewheel state shunts the coil which clamps the solenoid voltage at -Vd. When the current falls to the hold level, the system alternates between the hold and freewheel states to regulate it to Ihold±deltai.

When the time reaches t = toff, it exits the energize_solenoid state, regardless of which of the pull-in, freewheel or hold states is currently active. This is achieved by drawing the transition directly from the superstate boundary to the solenoid_off state. The value of ton, the beginning of the next cycle, is updated at this time. While in the solenoid_off state, the coil connects to the zener voltage, -Vz, until the field collapses and the current falls to zero, as described in the entry and during actions.

Magnetic Circuit
The model uses the applied voltage and armature position to determine the solenoid force and current. This requires evaluating Equations 1 with Simulink blocks placed in the appropriate configuration. The state variable is flux, computed by integrating the solenoid EMF. The flux density is calculated by dividing the flux by the cross-sectional area of the magnetic path. The force Fsol is computed as a gain times the square of the flux density.

Figure 7: Magnetic subsystem model.

The model computes the solenoid current by determining the magnetomotive force. In the air gap, Hair = B/µ0 is multiplied by the gap length to give MMFair. The gap length is computed by subtracting the armature position from the maximum gap. A small additional gap is added to model additional air in the circuit, at the armature bearing surface, for example. The MMF required to produce the flux density in the steel is computed by putting the material characteristics, H vs. B, in a 2-D lookup table. Since this curve has significant hysteresis, two curves are placed in the table, one for increasing and one for decreasing flux. The appropriate curve for Hsteel = f(B) is selected according to the sign of . HsteelLsteel is added to MMFair and the sum is divided by N to determine the solenoid current.

Armature Motion
The model solves the equation of motion for the armature directly, as shown in Figure 8. The sum and gains use standard blocks, and the subsystem Double Integrator computes the velocity and position of the armature based on its acceleration. The position x = 0 corresponds to the maximum air gap, gmax.

Figure 8: Mechanical subsystem for the solenoid armature.

In the double integrator subsystem (Figure 9), the model limits the position integrator by physical stops at x = 0 and at x = gmax - gmin (a shim typically limits the minimum gap). When these limits are reached, it is essential that the velocity becomes zero and remains zero while at the stops. The model achieves this by feeding the position saturation port back to the velocity reset trigger. In addition, the derivative input of the velocity integrator switches to zero as long as xdotdot (force/mass) holds the armature against the stop. The velocity thus remains zero until the force reverses direction.

Figure 9: Cascaded integrators with coordinated limit logic.

Valve Flows
Simulink models the turbulent flow through the valve orifices with the following subsystem, shown in Figure 10. The inputs pup and pdown are the upstream and downstream pressures and q is the flow from pup to pdown. The square root of the absolute value of the pressure drop, multiplied by the sign of the pressure drop and KoAo (defined in Equation 3) yields the flow.

Figure 10: Individual orifice subsystem.

The valve model shown in Figure 11 uses this subsystem twice, to model the flow from the supply to the control pressure and to model the flow from the control pressure to the exhaust. The net flow to the control pressure is the supply flow, when x > 0, and negative one times the exhaust flow, when x < balltravel. The maximum ball travel is less than the armature travel in order to assure that the ball seats against the exhaust port when the armature is pulled in. During the brief time in which the ball is at intermediate positions, with neither port blocked, flow occurs at both orifices.

Figure 11: Overall valve flow subsystem.

Cylinder Pressurization
The model for cylinder pressurization is a direct realization of Equation 4 in the actuator dynamics section (see Figure 12). Oil volume is the product of the piston position and its cross-sectional area. The division operator uses a function block within a masked subsystem and the other blocks are standard gains, a sum, and an integrator.

Figure 12: Hydraulic cylinder subsystem.

Piston Motion
Equation 5 is the differential equation for piston motion in the previously stated actuator dynamics section. The Simulink implementation is straightforward, as shown in Figure 13. We again use the double integrator subsystem, described above in the armature motion section, to insure that zero velocity is indicated when the actuator is being held against its physical stops.

Figure 13: Actuator mechanical subsystem.

Results

Figure 14 below shows the set point and piston position for a baseline simulation. During the first 0.1 second, and again from 1.0 to 1.1 seconds, the output is slew rate limited by the maximum flow available to the actuator. At other times, the 3 Hz sinusoid is tracked closely. Although the solenoid goes through a complete on/off cycle each PWM period, the 50 Hz dither superimposed on the actuator position is relatively small.

Figure 14: Simulated piston motion.

Figure 15 below depicts the solenoid current control, under the authority of the Stateflow model. The diagram shows two cycles with about 47% and about 55% duty cycle, respectively. During the pull-in phase, as the flux builds and the current approaches its 2.5A target, the current drops abruptly at about t = 2 milliseconds. This is the instant at which the armature is pulled in. This pull-in generates so much back EMF that the current drops appreciably. The notch in current is so distinct that it is often used in the laboratory to measure solenoid response time.

When the current reaches the conservative 2.5A target, more than enough to achieve armature pull-in, the solenoid enters the hold phase of its energized state. The model regulates the average current to 1A by chopping the voltage as described in the Stateflow diagram. The chopping takes place at a rate somewhat higher than 1 kHz in order to regulate the current within ±0.1 A. The freewheel state uses a value of Vd = 0.5 V to slow the decay of energy in the magnetic field. When the completion of each energized state turns off the solenoid, the negative voltage is limited by Vz = 50 V. The model achieves a rapid decay in current without subjecting the semiconductor devices to extreme voltages.

Figure 15: Simulated solenoid current.

Conclusions

Simulink and Stateflow combine to provide a powerful modeling environment for dynamic systems. In this case, Simulink enables the direct construction of block diagram subsystems which represent the nonlinear differential equations of the physical system and the difference equations of its discrete-time controller. A Stateflow model captures the behavior of the electronic PWM driver circuit, without resorting to the complexity of a detailed circuit model. The clear and natural logic of Stateflow facilitates rapid model development and debugging. The overall model develops in a structured, hierarchical manner, amenable to careful documentation.

Contact sales
E-mail this page
Print this page
Subscribe to newsletters