Simple Mechanical DC Relays - A Building Block
About the writer: Harvey Morehouse is a contractor/consultant with many years of experience using circuit analysis programs. His primary activities are in Reliability, Safety, Testability and Circuit Analysis. He may be reached at email@example.com. Simple questions for which I know the answer are free. Complex questions, especially where I am ignorant of the answers, are costly!!!
Summary: Because of several B2SPICE forum questions relating to DC mechanical relay modeling, I am writing this article to show how relays may be modeled in the simplest manner. There are many materials present on the net which present essentially the same models, as well as much more exact, but much more complex models, however these must be tailored to specific relay types.
A relay, regardless of its complexity, is basically a voltage-controlled switch (or switches). It has a magnetic coil that creates a magnetic field, causing a switch contact(s) to open (close) when the magnetic field is greater than a turn-on or trip threshold value (in the simplest approximation). The contacts will, once actuated, remain in that state until the voltage diminishes to a somewhat lesser value than the trip threshold to a turn-off or drop-out threshold, when the contacts will return to the de-activated or un-actuated state.
There are complications, however. The magnetic coil itself, although basically resistive, has an inductive component. Consequently, the turn-on threshold must be exceeded for some minimum time to allow the relay to actuate, or trip. (There is some time required for the magnetic field to build, and create a force greater than the spring restoring force, or to decay to a level less than that force.) Additionally, the applied voltage must be less than the drop-out voltage for some minimum time to allow the relay to de-actuate. Usually the devices are quite slow in operation, but the driving signals are well enough behaved to make this not a major consideration. Still, in some cases, the nature of the driving signal (how much and how it exceeds the thresholds) can be important. For, the input signal characteristics can modify the motion of the clapper. If the input is momentarily interrupted, the clapper motion and position is determined by differential equations that can be messy to model.
Another complication is that, like all mechanical devices, there is some time required for the mechanical motion to complete. That is to say, from the time the input signal exceeds the turn on threshold (the clapper starts to move) to the actual changing of contact state (the clapper having reached its end position), some time elapses due to the necessity of the mechanical clapper or arm to move from one end position to the other. Moreover, the delays for closed contacts to open will usually be less than that for open contacts to close (in the case of break before make type relays.).
And, within groups of closed or open contacts some may switch differently than others due to slight mechanical construction differences.
Worst of all, the contacts may, unless special care is taken by design, exhibit bounce when closing, and 'tearing' (there is usually some contact sliding or wiping when a contact closes or opens, which helps establish a good contact, but due to surface irregularities can cause rapid openings, separate from bounce. This wiping also occurs during the contact opening and closing, causing a rapid series of openings and closing to occur. (This may be eliminated by use of mercury-wetted relays that rely on a film of mercury creating a fluid type conduction mechanism.) This is very difficult to model.
Another complication is that some relays are make-before-break, in that the normally open (NO) contacts are closed before the normally closed (NC) contacts open, while some are break-before-make, in that the NC contacts will open before the NO contacts close.
And, some relays are latching. There are usually two coils in this case, wound to create different polarity magnetic fields. The clapper in this case is designed to be 'over-center' in that, once the turn-on threshold is reached, and a critical time delay for clapper motion has elapsed, the clapper will then have moved to a state where it will switch to another stable position, where it will stay, regardless of the turn-on signal, unless toggled back by the turn off signal.
All or some of these considerations may be important to one's application. To make a most accurate simulation it might be required to include them in the model. This is not a trivial task.
In this paper, we shall only be modeling the simplest of relays. They shall be non-latching, essentially break-make at the same time, with no definable switching time in that the transitions shall occur virtually immediately after the input transition levels are reached. Note that this will as a consequence require that the input levels persist uninterrupted for at least the transition times at the threshold levels for state changes to occur.
Simple relay model:
We will create a (trivial) relay with a single NO and NC contact (a form 'C' relay). The contacts will have a common connection, although this need not be the case. The model is shown in Figure 1 following:
1st Form 'C" relay
The netlist for this primitive, including the test elements, is as follows:
.model switchopen SW vt = 20 vh = 3 ron = 1 roff = 1g
.model swclosed SW vt = 20 vh = 3 ron = 1g roff = 1
A plot of this network, using a triangle wave source to drive the input, is shown in Figure 2 following:
Test circuit 1 graph
In this model the turn-on threshold vt is 20 volts, with 3V of hysteresis. That is to say, the 'relay' actuates when the input voltage is 20 volts or greater, and drops out when the input voltage is less than 17V. Both 'contacts' (switches S1 and S2 elements) change state in about a microsecond. R1 simulates the coil resistance. One could add an inductance in series with R1 to simulate the input loading better, and to simulate the coil current rise time. (In that event, the voltage for the S1 and S2 switches should be changed to that of the resistor alone.)
Although primitive, this will work in many circuit models nicely. By adding more switch elements, one can create complex models. This may be made into a specific relay type by creating a subcircuit of the final product (without v1,v2, R2, R3 and the ground connections).. One could create a parameterized subcircuit from this model, passing the S1 and S2 values to make it general.
NOTE: The models for the switch-closed and switch-open elements in the library seem to refer to the same circuit element. If one sets JUST values of VT and VH, the circuit will NOT simulate as expected. This seems to be a bug in the database. Consequently, until this is fixed in the database, you need to do two things. First, make sure the closed and open switches, where used, are unique from each other. Second, for Normally Closed (NC) contacts, using the switch-closed symbol, set the 'ON' resistance to 1G ohms, and the 'OFF' resistance to 1 ohm (or some appropriate values). This will make the switches work in the correct manner.
To make the model more complete is trickier. What we wish to do is to add a delay to the model such that the S1 and S2 state change occurs an interval of time AFTER the threshold is reached. To do this we must add a delay such that the 'effect' of the R1 voltage on S1 and S2 occurs some time AFTER the thresholds are reached. We could do this by adding leading and trailing edge detectors, and delay elements. We also could use behavioral, logic elements we create or are already in existence to accomplish the same purpose. For our purposes a simple RC network will be used.
The conditions we might wish to model are as follows.
Conditions 3 and 4 represent a compromise. Consider what happens once the input threshold is reached. The clapper will slowly start to move from the relaxed position toward the fully energized state, accelerating as time progresses. If the input is interrupted, the motion will continue, the clapper decelerating, eventually stopping and reversing in motion (if the interruption is long enough). Or, with a short interruption, the clapper will start to decelerate but the re-accelerate and move toward closure. The actual motion and position of the clapper will depend on the differential equations governing the mechanical system. Without specific knowledge of the construction, depending on how long the input stays below the threshold, several scenarios could occur. The input circuitry could also affect this, as with a diode clamp at the input to prevent spikes, the recovery (or decay of relay current) would be slower than with a zener diode clamp or RC clamping.
However, the clapper transition times should be certainly less than a second in all cases, and on the order of one or two hundred milli-seconds at most. Consequently, if the input signal is postulated to be stable after transitions for more than this time, there is little effect. It is possible to model this, however the relay model becomes quite complex. This is out of scope for this article. About the only simple modification would be to add an inductor in series with the relay input resistance. A second modification, after the inductance, might to add internal clamp diodes across the input terminals, as some devices do have these elements.
simple relay model can be created which will have NO and NC contacts
in the desired numbers. To add many of the relay effects, such as
delay times, bounce, make-before-break and break-before-make effects
takes somewhat more work and thought, but this may be added to the
primitive model as required.