This example shows the use of Simulink® and Stateflow® to model a hydraulic servomechanism controlled by a pulse-width modulated (PWM) solenoid. This type of motion control system is used in industrial, manufacturing, automotive and aerospace applications.
In this example, nonlinear differential equations are used to model the magnetic, hydraulic and mechanical components of the system. Discrete-time difference equations are used to represent the controller. A behavioral model in Stateflow implements the electronic circuit generating the PWM waveforms and regulating the solenoid current. Figure 1 shows a schematic of this mechanism.
Figure 1: Schematic diagram of the Solenoid valve and hydraulic actuator
Note: This is a basic hydraulics example. You can more easily build hydraulic models using Simscape™ and Simscape Fluids™. Simscape Fluids extends Simulink with tools for modeling and simulating hydraulic power and control systems. It enables you to describe multi-domain systems containing connected hydraulic and mechanical components as physical networks.
The model of the servomechanism valve is divided in four parts:
Solenoid Armature Motion
Consider first the magnetic circuit. The derivative of the magnetic flux is determined by Faraday's law as:
where is the solenoid voltage, is the current, is the winding resistance and the number of turns. This equation assumes that fringing and leakage flux are negligible, as are eddy currents.
We assume that the cross-sectional area of the air gap which relates the flux and the flux density at the air gap applies uniformly for the steel path so that:
The flux density is linked to the magnetic field intensity in the air and the steel. In the air, magnetic field intensity is computed by:
where is the permeability of air. In the steel, the magnetic field intensity is linked to the flux density through a nonlinear function so that:
Note that the hysteresis is not modeled in this example. The combination of the magnetic fields in the air and the steel gives us the magnetomotive force:
where is the length of the air gap and is the length of the steel magnetic circuit.
One last equation is now required to close the loop and obtain the current in the magnetic circuit by:
On the mechanical side, the force developed by the solenoid is computed as:
Implemented in Simulink, magnetic circuit equations look like:
Figure 2: Solenoid magnetic circuit subsystem
Solenoid Armature Motion
The motion of the solenoid moving part, the armature, is generated by a combination of magnetic, hydraulic and mechanical forces:
where is the supply orifice area, is the hydraulic circuit supply pressure, is the spring preload, is the return spring rate and is the damping rate.
In Simulink this equation is implemented using the Second-Order Integrator block as shown in figure 3.
Figure 3: Armature motion subsystem
The flow in the hydraulic circuit is controlled by the motion of the solenoid armature. A schematic of this system is displayed in the following diagram
Figure 4: Solenoid Schematic
This diagram shows that when no current is applied to the magnetic circuit, the internal spring pushes the armature and ball to block the supply pressure . When the supply pressure is blocked, the control pressure is directed toward the exhaust. When the solenoid is energized, the armature and pole come together and the supply pressure pushes the ball to open the supply port and block the exhaust port.
The oil flow directed from the supply system to the piston, , is the combination of the supply flow and the exhaust flow.
The supply flow is computed has:
where is the control pressure and is the flow coefficient. The exhaust flow is computed has
In Simulink, the supply and exhaust equations are implemented using If Action Subsystems. These subsystems are activated based on the armature position.
Figure 5: Valve flows subsystem
Figure 6: Orifice flow subsystem
To complete the hydraulic circuit, the control pressure must be computed. This pressure is a function of the net oil flow in the circuit and the piston position as:
where is the oil bulk modulus and is the cross-sectional area of the cylinder.
In Simulink this is implemented as:
Figure 7: Cylinder Pressurization Subsystem
The piston's equation of motion is:
where is the net actuator mass and is the spring rate.
In Simulink this equation is implemented using the Second-Order Integrator block as:
Figure 8: Piston Motion Subsystem
The objective of the system is to position the load so that it follows a time-varying set point . An electronic controller compares the command and set point to generate a PWM control signal at a rate of 50 Hz. We employ a discrete-time PI control law:
The control signal is applied to a 50 Hz pulse train and the power electronics converts the pulse signal to the solenoid current.
Digital and analog integrated circuits are available to perform this function, 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 and the response of its load. The voltage and current for one typical cycle of the control circuit is shown in figure 9.
Figure 9: Voltage and current behavior of the PWM signal within one pulse.
At the beginning of each cycle, the PWM pulse turns on to push the armature against the pole and open the valve supplying pressure. At that time the driver circuit applies the full 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 less current is needed to hold the armature in place. The driver regulates the current at a lower level for the remainder of the "on" portion of the cycle.
At the end of each pulse, the armature releases so that the ball returns to its original position to open the exhaust. This is achieved by opening the solenoid circuit so that the magnetic field collapses quickly. The current then remains at zero for the duration of the "off" time until the next cycle begins.
This way, the "on" portion of the PWM cycle is composed of the "pull in" and "hold". The "off" portion is characterized by the initial rapid decay, followed by zero voltage and current.
This can be implemented in Stateflow as:
Figure 10: Stateflow implementation of the PWM driver circuit