Back EMF

A can use Back Electro-Motive Force (BEMF) as a governor. This feature prevents trains from slowing or accelerating on grades. Sometimes model trains stop when travelling slowly across a turnout or other rough trackage. BEMF control provides a solution.
Back Electro-motive Force is the voltage generated during the operation of a rotating machine (a generator or a motor). BEMF is proportional to speed and independent of load. It produces a counterforce that limits the speed of the motor.
 See the instructions for the multifunction decoder in question for more details and configuration variables related to Back EMF.
==Back Electro-motive Force==
When a voltage (an electro-motive force) is applied to a motor's armature, current begins to flow, creating a magnetic force which causes the armature to rotate. A counter force in the form of eddy currents is generated by the armature rotating in the magnetic field. This counter force is called Back Electro-motive Force or Back-EMF (BEMF). The faster the armature turns, the more BEMF is produced. The eddy currents in turn oppose the current flowing in the winding. The net effect is the BEMF limits just how fast the motor or generator can turn. 
----
=== Intro to Back EMF ===
In this episode of DCC Programming, host Dana Kawala explains Back-Electro-Motive-Force (Back EMF) control and how it functions to aid performance on DCC-equipped locomotives. 
To view the entire video (and many more!), visit nmra.org to become a member and gain access to our entire video library!
A Model Railroader Video Plus presentation
----
== Theory ==
This section is provided for additional background to the BEMF concept. This section can be skipped if you wish. 
As an unloaded DC motor spins, it generates a counter electromotive force which resists the current supplied to the motor. The current through the motor decreases as the rotational speed increases, hence a free-spinning motor draws very little current. The BEMF limits the maximum rotational speed while resisting the current. This makes the DC Motor a self-regulating machine. Only when a load is applied to the motor which slows the rotor will the current draw through the motor increase. 
* The torque produced by the motor is proportional to the square of the current applied.
At the maximum no load speed, VBEMF ≈ VSupply
*If a load is applied to the motor, the motor slows down. As the speed of the motor decreases, the magnitude of the Back EMF also decreases. The reduced Back EMF increases the current draw from the supply. The larger armature current creates a larger torque. Thus, the motor rotates continuously at the new speed.
* If the load on the motor is reduced, the torque of the motor is greater than the load requires. The driving torque increases the speed of the motor which increases Back EMF. The increasing Back EMF decreases the armature current. The lower armature current develops less driving torque, which equals the load. The motor will rotate uniformly at the new speed.
The Back EMF in a DC motor is expressed as:
EBEMF = VT − IArmature × RArmature 
Armature Current = IArmature = (VSupply − EBEMF) ÷ RArmature
Where EBEMF = Back EMF Voltage
* IArmature – Armature Current
* VT – Terminal Voltage
* RArmature – Resistance of Armature
Maximum torque developed by a motor is equal to the equation EBEMF = VSupply ÷ 2. 
* When the BEMF voltage equals half the supply voltage, maximum torque is achieved. 
As the load increases, the current drawn by the motor increases. When the load increases to the point where the motor cannot provide more torque, the motor stalls and the Back EMF will be zero (the rotor is stalled, so no BEMF is created), and the current drawn equals the supply voltage divided by the DC resistance of the winding. At this point the current drawn is called the Stall Current. 
=== Demonstration ===
* Works best with incandescent lights on the same circuit.
With the lights on, start a machine with a large motor, such as a table saw, air conditioner, power tool or a vacuum cleaner. The light(s) will briefly dim as the motor's current draw creates a voltage drop. The Back EMF will oppose the current as the motor spins up to speed, reducing the current draw and the voltage drop created by it.
=== Terminology ===
BEMF may also be called:
* Generator Coefficient 
* Generator Constant 
* Voltage Constant
* Counter ElectroMotive Force 
BEMF is specified in more than one way, although the end result is the same. One definition is "volts per thousand RPM," or "Volts/KRPM." A second definition is "Volts/(rad/sec)" Radians per Second.
Using the above, the decoder can measure the motor's BEMF and apply power accordingly to keep the speed constant. The result can be a train that will maintain the same speed regardless of the grade, number of cars being pulled, or condition of the track.
One of the things this can be used for is to simulate the action of a governor. That is, trains go up and down grades while maintaining the same speed. Some people like this idea while others think it's a bad idea - it is NOT prototypical. Some people just want to see trains run and don't want to be bothered by continuously throttling up and down on grades. For layouts that are primarily used for display, this could be good - set the train's speed and let it run unattended. But for people who enjoy running their trains, prototypically or otherwise, this feature can take away from that enjoyment – for those, BEMF can be disabled while programming the decoder.
BEMF is a side effect of Pulse Width Modulation. The decoder can measure the voltage generated when the power is disconnected from the motor. The decoder can then monitor the BEMF and compensate for variations in speed. It can also be used to control the sound of the prime mover of a Diesel-Electric or the chuff intensity of a steam locomotive.
=== PID ===
PID is another term that will appear in the BEMF discussion
==== What is PID ====
PID means Proportional Integral Derivative, a form of controller. The controller makes small adjustments based on the error it calculates using the real measured value and the desired value. 
One of the inspirations for this was the actions of a helmsman steering a ship, knowing how the ship will react and making corrections based on previous inputs.
=====How Does it Work? =====
Imagine PID as a spring in your car’s suspension. You can adjust the spring’s stiffness. When you hit a bump, the spring starts oscillating. If it’s very stiff, you’ll feel the bump. Make it soft, and you won’t feel it. However, the car will start oscillating as the spring stores and releases energy. To manage this, you have a shock absorber that tries to dampen the oscillation, preventing you from losing control of the car.
Applying this concept to your locomotive, when a voltage is applied to the motor, it begins to turn, with the speed proportional to the voltage. Due to the mass of the armature, it will overshoot the desired speed and then settle down. The “proportional” segment comes into play here, which represents a range or band of speed around the desired set point. The range can be large or small, depending on how the decoder handles it and may be adjustable. If the range is wide, a significant speed swing can occur. Setting it to a narrow range reduces the variation in speed.
The integral part of the equation calculates the magnitude and duration of the error between the set point and the actual speed. As a result, the control circuit begins applying a correction to move the speed towards the desired point.
The derivative part is more complex to explain, but a simple explanation is that it tries to predict how the system will behave. By doing so, it improves control and system stability.
=====Decoders and PID=====
Not all multifunction decoders incorporate Proportional-Integral-Derivative (PID) control, while others may implement it but not all of its features.
Most decoders include the Proportional and Integral components, while others may place greater emphasis on the Derivative component and reduce the significance of the Integral.
Consult the decoder’s manual to determine the appropriate tuning parameters for the BEMF and PID, as well as the available features. If a speed change results in “surging,” it indicates excessive compensation, and the corresponding control values (CVs) should be adjusted.
===Dynamic Braking===
In the real world the BEMF is both a nuisance and a blessing. While it increases the power needed to propel the locomotive, it also provides a force which can be used to slow the locomotive. This is called Dynamic Braking.
To implement this, the generator power is routed to the field coils, and the rotor coils (armature) are connected to a bank of resistors. The traction motor is now configured as a generator, and its output is dissipated by the resistor bank. Since there is resistance to the current flow, a back-emf is created in the rotor, which now wants to slow down due to the counter torque being created. This allows control of the train without using the air brake system excessively.
----
==Sound Decoders==
BEMF is used by sound decoders as well. For an internal combustion engine, it will simulate the load on the prime mover. Just like your car as you start from a stop, the engine will make noise proportional to the load, speed and throttle setting.
For external combustion, the BEMF is used to control the chuffs (or beats) of the engine under load, and the sounds like the rod clank which is heard during drifting. It simulates the effects of the throttle and cut-off, which are adjusted by the engineer as he brings the train from a stop to speed. The engineer would open the throttle and adjust the cut-off for maximum steam admission. As the engine begins to move and pick up speed, he will adjust the cut-off to reduce the amount of steam being admitted, like using a choke to richen or lean a mixture. The beats coming from the stack will change in intensity and duration in the process.
==Slow Speed Operations==
Another BEMF use is to smooth running over turnouts and other rough trackage at slow speeds. This is especially important for switchers running at very slow speeds over frogs. Some manufacturers specialize their BEMF only for this purpose - cutting out when the loco reaches a certain speed. Digitrax decoders can be set up to run at 100% BEMF for switching purposes, but does not automatically cut out at higher speeds.
==Consisting==
If you want to use BEMF when consisting, be aware that it is all but impossible to make two locos run at the exact same speed. If you couple two locos together, both having 100% BEMF control, they will fight each other. The one that is faster will want to pull the slower one, and the slower one will want to hold back the faster one. The more they pull against each other, the harder they will try - until you hear wheels scrubbing. This is the push-me-pull-you syndrome. Even if they are off by only 1/4 inch in 10 feet, it can be enough to get the syndrome started. And once started, it only intensifies. 
To counter this effect, many manufacturers have made various provisions to allow coupling BEMF controlled locos together. Some disable BEMF at speeds above switching, and others provide for disabling BEMF when locos are MUed. Other decoders may allow the operator to disable the BEMF with the press of a function button. Some multifunction decoders use CV10 (Back EMF Feedback Cutout) to control BEMF operation.
=== Consisting for Specific Multifunction Decoders ===
----
==BEMF Issues==
BEMF can cause problems with some brands of locomotives, such as Bachmann. Locomotives manufactured by Bachmann may have an RFI suppression circuit in the motor circuit. It will confuse the BEMF algorithm in the decoder and make it run poorly. The circuit is there to absorb any high frequency electrical noise created by arcing between the commutator and brushes. While this works well in a direct current environment, the RFI suppression will cause problems with BEMF and the high frequency PWM used by high frequency drive equipped decoders. 
* This circuit should be disabled.
* In the EU the RFI circuit is mandatory. Decoders made for this market are designed to work with this circuit in place, or incorporate it into the motor drive circuit.
* Some manufactures include the RFI circuit, allowing it to be sold globally without the importer having to ensure the product meets regulatory requirements.
===Speed Matching and BEMF===
With everything tuned, the ability to consist and have realistic operations is ensured.
With proper tuning, both locomotives should behave as one unit when consisted. If the BEMF is not tuned correctly, they will buck as one reacts to the other and the reactions will only get worse. By tuning them so their reactions are similar, this effect is minimized.
Some decoders, such as those by Digitrax, use a different method of motor control when consisted to minimize any issues between locomotives.
Surging when consisted is often caused by the loop gain. Correcting that requires a trial-and-error process. Refer to the manual for each decoder to determine the CV which controls PID Ki or Loop Gain. Read and record the value in the CV, then write a new value which is half the original. Run the locomotive in a consist to determine if that solved the issue. 
If not, return the CV to its initial value, and repeat the process with another locomotive from the consist until the offender has been identified. Make smaller adjustments to that locomotive's decoder until satisfactory.
If the decoder manufacturer suggests a BEMF adjustment routine, follow it. 
== Videos ==
=== ESU's Autotune ===
ESU has an Autotune feature on some of their decoders. BEMF should be enabled before running the Autotune function. 
The Autotune is enabled by setting a CV, and then activating the feature on a test track. The locomotive will take off, then stop in a few seconds. Autotune will attempt to optimize the BEMF parameters for that particular locomotive's motor and drivetrain.
ESU uses the letters KPI for various BEMF parameters, where several CVs are used to set each of these values. I is Inertia. K is power/load control. P is the reference voltage. The K and I parameters are referenced in their manuals.
 Before using Autotune on an OEM decoder, read the manual. 
=== TCS WOWDiesel Dynamic Brakes ===
==Further Reading==
* Pulse Width Modulation
=== External Links ===
* Counter Electromotive Force
* Intro to BEMF at Tony's Train Exchange 
** PDF Version
Category:Multifunction Decoder Features
Category:Programming
Category:Software
Category:Electronics
Category:Electrical