Converting Motor RPM into a 0-to-360-degree ramp signal
Rakesh K Dhawan, Power Electronics Group LLC
1.0 Abstract
This article presents a method to convert motor rotational speed (RPM) into a continuous ramp signal spanning 0 to 360 degrees, utilizing LTspice for simulation and implementation. The approach starts with foundational mathematical equations that translate mechanical RPM into electrical angular position, incorporating key conversions such as half the electrical speed in radians per second and the rotor’s angular displacement in degrees.
The LTspice implementation leverages behavioral voltage sources and integrators to generate a dynamic ramp signal that accurately reflects rotor position, adapting to positive and negative RPMs. A key insight includes the necessity of halving the electrical speed to align with trigonometric function behaviors, mainly due to the doubling frequency of the tangent function compared to sine and cosine. Simulation results validate the technique with varying RPMs and rotor pole counts, showcasing bidirectional ramp generation suitable for motor control and position tracking systems applications.
2.0 Introduction
Understanding rotor position is fundamental in electric motor control systems, especially for field-oriented control (FOC) applications, sensorless control, and real-time monitoring. One key technique is converting a motor’s rotational speed (RPM) into a continuous ramp signal that spans from 0 to 360 degrees—representing the angular position of the rotor within a single electrical revolution. This article outlines the mathematical approach and LTspice implementation to generate such a ramp, complete with practical examples and simulation results.
3.0 Foundational Mathematical Equations
First, let us look at math. Equations numbered 1 through 6 below illustrate the steps.

… Motor RPM (1)
Motor RPM (n): This is the input mechanical speed of the motor in revolutions per minute (RPM).

… (2)
Where p is the number of poles. The electrical speed is proportional to mechanical speed and the number of pole pairs.

… Half Electrical Speed in rad/s (3)
As explained later, this adjustment plays a critical role due to trigonometric frequency behavior.

… Intermediate rotor angle in Electrical rad/s (4)
Integrating half the electrical speed gives a linearly increasing (or decreasing) signal over time, essentially a “forever ramp.”

… Rotor position in Electrical radians (5)

… Rotor Position in Electrical degrees (6)
This ensures the ramp wraps around at 360 degrees, producing a clean cycle from 0 to 360 and back.
4.0 LTspice Implementation
The above equations are implemented in LTspice using B-sources—behavioral voltage sources capable of defining voltage or current based on mathematical expressions.

Figure 1: The motor speed n is modeled as a voltage source that varies with time. For example, a sinusoidal input mimics acceleration and deceleration.

Figure 2: Implementation of We Half, Half of Electrical Speed in rad/s. A behavioral voltage source calculates half of the electrical speed in rad/s using the motor RPM and the number of poles.

Figure 3: Implementation of the Integral Function to obtain θi, essentially a forever ramp. LTspice integrators accumulate the electrical speed over time, forming a ramp signal representing the rotor angle in electrical radians.

Figure 4: Implementation of θ360 ramp increments positively from 0 to 360 for positive rpm and decrements 360 to 0 for -ve rpm. The final behavioral block uses the Tan function to constrain the ramp between 0 and 360 degrees. The ramp’s direction reflects the motor RPM sign—positive for forward rotation and negative for reverse.
5.0 Why do we calculate We half – Half electrical speed?
A common question arises: Why calculate half of the electrical speed? The answer lies in the behavior of trigonometric functions. We need to look at the Sine, Cosine, and Tangent functions to answer this.

Figure 5: A plot of sine, cosine, and tangent functions reveals that the tangent function completes two cycles in the same period, whereas sine and cosine complete one. This doubling in frequency can lead to distorted position signals when interpreting ramp outputs using tangent-based decoding with We half adjustment. The resulting ramp frequency matches the expected sine/cosine-based waveforms used in most motor control algorithms by halving the electrical speed before integration.
6.0 Simulation Results

Figure 6: Zero-to-360-degree Ramp for Motor Speed of 100 RPM with 22 number of rotor poles

Figure 7: 360-to-Zero-degree ramp with -100 rpm Motor Speed.

Figure 8: Up and Down rotor position ramp with the Motor Speed varying as a Sine with 100 rpm as max speed.
7.0 Applications and Significance
This approach is highly valuable in simulation environments for validating control algorithms, sensorless estimation techniques, and hardware-in-the-loop testing. Engineers can use the 0-to-360-degree ramp as a reference input or internal signal in motor control strategies. Additionally, the modularity of the LTspice implementation allows easy adaptation to different pole counts and motor types.
8.0 Conclusion
The conversion of motor RPM into a 0-to-360-degree rotor position ramp using LTspice provides a robust and insightful method for modeling motor behavior. By leveraging a sound mathematical foundation and behavioral modeling, the approach supports accurate and dynamic simulation of electrical angle tracking. This forms a crucial building block in developing and validating modern electric motor control systems.