# Introduction to Ordinary Differential Equations (ODE)

In engineering, depending on your job description, is very likely to come across ordinary differential equations (ODE’s).

For this tutorial, for simplification we are going to use the term differential equation instead of ordinary differential equation.

There are several definitions for a differential equations. We’ll try to summarize all of them in order to have a complete picture. So, a differential equation:

• is a mathematical representation of a dynamic system (mechanical, electrical, hydraulic, etc.)
• helps understanding the dynamic behavior of a system
• describes the rate of change of a variable (e.g y) function of another variable (e.g x)
• is a mathematical equation that contains at least one term which is involving a derivative of one variable (e.g. y) function of another variable (e.g. x)

Now let’s have a look at some examples where differential equations are used.

Example 1. Mechanical System

First example is describing the system from the mechanical point of view. Let’s assume that we have a car which is rolling on a road. In order to increase it’s speed (accelerate) the driver is pressing the accelerator pedal. By doing that the engine is generating more torque which end up as a traction force at the wheels.

The level of acceleration of the vehicle depends on the traction force at the wheels. We can write this relationship between the acceleration and the traction force as an equation:

Image: Moving vehicle with mass and traction force

$F = m \cdot a \tag{1}$
• F – traction force, [N]
• m – vehicle mass, [kg]
• a – vehicle acceleration, [m/s2]

Where is the differential equation? In the form we wrote it, it’s not very obvious that equation (1) is a differential equations. But what do we know about acceleration? We know that is the variation of speed in time. So if the vehicle speed increases as the driver keeps his foot on the accelerator pedal the vehicle is accelerating (positive acceleration).

If we write the acceleration a as a derivative, we get:

$a = \frac{dv}{dt} \tag{2}$

where:

• v – vehicle speed, [m/s]
• dv/dt – vehicle acceleration written as vehicle speed derivative (variation in time)

By replacing equation (2) in (1), we get the differential equation which describes the relationship between traction force and vehicle acceleration:

$F = m \cdot \frac{dv}{dt} \tag{3}$

If we want to point out which physical variables change with time we can write the same equations as:

$F(t) = m \cdot \frac{dv}{dt} \tag{4}$

The vehicle mass m doesn’t change in time, it has a constant value. The vehicle acceleration depends on the vehicle mass and traction force F(t) (which is variable in time, function of the driver’s behavior).

From equation (4) we can write the value of the acceleration dv/dt as:

$\bbox[#FFFF9D]{\frac{dv}{dt} = \frac{F(t)}{m}} \tag{5}$

Equation (5) is a differential equation describing the acceleration of a vehicle. By solving this equation we can find out how the vehicle position and speed varies in time function of the traction force F(t).

Example 2. Electrical System

Electrical systems also can be described using differential equations. In all sorts of applications: automotive, aeronautics, robotics, etc., we’ll find electrical actuators. A good example of an electrical actuator is a fuel injector, which is found in internal combustion engines.

The primary role of a fuel injector is to deliver fuel into the cylinder (combustion chamber), in order to allow the engine to run/operate. The main idea is that the fuel must be delivered into the cylinder at a specific moment (depending on the crankshaft position) and defined duration. In this way the injected fuel quantity is controlled.

Image: Gasoline Fuel Injector animation

A way of controlling an injector is by using a solenoid valve. The solenoid contains a fixed part and a mobile part (plunger). The fixed part contains a coil which, when supplied with electrical current, generates a magnetic field. The mobile part of the solenoid is actuated by the magnetic field of the fixed part.

When the engine control module decides that an injection is needed, it’s applying a voltage on the coil, a current builds up in it which generates a magnetic field. Due to the magnetic field, the mobile part is moving, the injector opens and the fuel is delivered into the cylinder.

If we want to study the dynamics of the electrical current through the coil we must write the equations describing the system. The current variation in time is very useful if we want to have an idea how fast the injector is going to open. This is very important for an internal combustion engine because at high engine speeds the injector has to do quite a lot of injection cycles so the opening and closing must be really fast.

A solenoid can be described using an equivalent electrical circuit which basically consists of a resistor (with the resistance R) connected in series with an inductor (with the inductance L):

Image: Series RL circuit describing a fuel injector solenoid

in which:

• Vin [V] – supply voltage
• I [A] – electrical current
• R [Ω] – solenoid resistance
• L [H] – solenoid inductance
• VR [V] – voltage across the resistor
• VL [V] – voltage across the inductor

The supply voltage Vin is controlled by the engine control module. If an injection is required, the supply voltage is set to battery voltage (12.4 V) and the coil is energized. When the injection needs to stop. the voltage supply is set to 0 V and the coil is de-energized.

The equation that describes the equivalent electrical circuit of the solenoid is:

$V_{in} = V_R + V_L \tag{6}$

Equation (6) is describing that the voltage across the solenoid is the sum between the voltage across the resistor and the voltage across the inductor.

The voltage across the resistor is:

$V_R = I \cdot R \tag{7}$

The voltage across the inductor is:

$V_L = L \cdot \frac{di}{dt} \tag{8}$

di/dt – electrical current variation in time through the inductor (electrical current derivative)

By replacing equations (8) and (7) in (6) we are going to obtain the differential equation that describes the dynamics of the electrical current through the solenoid.

$V_{in} = I \cdot R + L \cdot \frac{di}{dt} \tag{9}$

We can rewrite equation (9) in the following format:

$\bbox[#FFFF9D]{\frac{di}{dt} = \frac{1}{L} \cdot (V_{in} – I \cdot R)} \tag{10}$

By integrating the differential equation (10) we get i(t), which is the variation of the electrical current in time, function of the supply voltage, solenoid resistance and inductance. With this function we can analyze the dynamics of the system and decide if the electrical parameters of the solenoid are suitable for our application (fuel injector).

Example 3. Hydraulic System

Ordinary differential equations are also widely used in hydraulics. If we need to have a mathematical model of a hydraulic control system, for sure we are going to use the chamber model. This model describes the capacitive part of hydraulics and it’s used to calculate compressibility effects.

Image: Hydraulic Chamber

The formula which describes a hydraulic chamber is:

$\bbox[#FFFF9D]{\frac{dp}{dt}=\frac{\beta}{V} \cdot Q(t)} \tag{11}$

where:

• β [Pa] – bulk modulus of the hydraulic liquid
• V [m3] – chamber volume
• Q(t) [m3/s] – flow rate
• dp/dt [Pa/s] – pressure variation in time

By integration equation (11) we’ll get the pressure variation in time inside the hydraulic chamber function of the input flow.

These 3 examples regarding ordinary differential equations were just a minor view of the applicability of ODE’s in physics and engineering. If we need a mathematical model of any dynamic system, then we need to use differential equations to describe their behavior. Because of this ODE’s are very important in engineering and understanding how to solve is important.

For any questions or observations regarding this tutorial please use the comment form below.

Don’t forget to Like, Share and Subscribe!