In our previous post Dynamic Programming: The Gold Standard, we established that DP acts as a “map” for finding the shortest path. However, for a computer to read this map, we cannot simply feed it a physical vehicle. We must provide it with Mathematical Equations.
This step is known as Mathematical Modelling. It serves as the backbone of any control systems. If the model is flawed, any subsequent optimisation results are rendered meaningless.
Today, we will translate the physical problem of an FCHEV into the language of Mathematics: State-Space representation and the Cost Function. 📐
1. System Modelling
Before managing energy, we must determine how much energy the vehicle requires to move. This is the Longitudinal Dynamics problem.
The power demand at the wheels () at any time instance is calculated based on Newton’s Second Law:
From the traction force, we can derive the electrical power required from the powertrain system (Fuel Cell + Battery), accounting for the efficiency of the electric motor and inverter:
Note: In the DP algorithm, since the driving cycle ( and ) is known a priori, acts as a disturbance input at each time step.
2. Optimisation Problem Formulation
To apply Dynamic Programming, we must structure the system into a standard Discrete-time Optimal Control format. This structure typically comprises three elements: (State), (Control), and (Disturbance).
a. State Variable ()
The state variable represents the system’s “memory.” In the EMS problem for hybrid vehicles, the most critical time-varying variable is the Battery State of Charge (SOC).
The State Transition Equation from step to is defined as:
(Do not be alarmed; this is simply the current calculation formula , rewritten based on the simplified Rint battery model).
b. Control Variable ()
This is the decision variable. We can choose to control either the battery current or the Fuel Cell power. Typically, I select the Fuel Cell Power as the control variable:
c. Power Balance Constraint
At every instant, the energy supplied must equal the energy consumed:
Consequently, the battery power () becomes a dependent variable: .
3. The Cost Function ()
The objective of DP is to find a control sequence that minimizes a global cost function .
Where:
-
(Instantaneous Cost): The cost incurred at each step. In this context, it represents the Hydrogen consumption (in grams) for that second. (The value is obtained from the Fuel Cell efficiency map).
-
(Terminal Cost): The penalty cost at the final step.
- To ensure a fair comparison, we typically enforce a Charge-Sustaining condition, where the final SOC must equal the initial SOC ().
- If the vehicle finishes the cycle with a deviated SOC, a massive penalty (Infinity) is applied to , forcing the DP algorithm to find an alternative path that satisfies the condition.
4. System Constraints
While mathematics allows to be infinite, physics does not. We must impose strict Inequality Constraints:
-
Fuel Cell Constraints:
-
Battery Constraints:
5. Numerical Example (Case Study)
To visualize how DP operates at a single time step (), let’s walk through a simplified scenario with hypothetical data.
Assumptions at time step :
- Demand: The driver steps on the pedal, requesting .
- Current State: The battery is at .
- Time Step: .
- Battery Specs: Capacity (), Open Circuit Voltage .
The DP algorithm will discretise and test 3 feasible control candidates () for the Fuel Cell and compare them:
Step 1: Power Split Calculation
Using the balance equation :
- Option A (EV Mode): Fuel Cell OFF (). Battery takes full load .
- Option B (Load Following): Fuel Cell matches demand (). Battery idle .
- Option C (Charging Mode): Fuel Cell boosts (). Excess 15kW charges battery .
Step 2: Instantaneous Cost Calculation ()
Looking up the Fuel Cell consumption map:
- Option A: .
- Option B: .
- Option C: .
Step 3: State Transition Update ()
Calculate the change in battery energy and the new . (Simplified formula: )
- Option A (Discharge 30kW): Significant energy drain. drops to .
- Option B (Idle): No energy change. remains .
- Option C (Charge 15kW): Energy gained. rises to .
Step 4: Total Cost Evaluation (Cost-to-Go + Instantaneous Cost)
This is the decisive step. DP looks not only at the present but also at the future. The future cost () is retrieved from the Cost-to-Go matrix (which was calculated backwards from the end of the cycle).
Assumption: The Cost-to-Go matrix indicates that having low SOC (59.8%) incurs a high future penalty (recharging needed later), while having high SOC (60.1%) reduces future costs.
| Candidate () | Instantaneous Fuel () | Assumed Future Cost () | TOTAL COST () |
|---|---|---|---|
| A () | 0 g (Cheapest Now) | 100 g (High penalty) | 100 g |
| B () | 0.45 g | 50 g (Medium) | 50.45 g |
| C () | 0.75 g (Most Expensive) | 49.8 g (Low penalty) | 50.55 g |
DP’s Verdict: At this specific second, Option B is the optimal choice (Lowest Total Cost of 50.45). Although Option A consumes zero Hydrogen right now, DP “foresees” that depleting the battery will cost more in the long run, so it rejects the EV mode in this specific context.
Conclusion
We have successfully “translated” a physical vehicle into mathematical equations:
- State (): Battery SOC.
- Control (): Fuel Cell Power.
- Objective (): Minimize Hydrogen consumption.
- Rules (Constraints): Physical limits of the components.
With these components in place, the remaining task is to solve the Bellman equation. But how do we implement this on a computer? How do we handle state grid discretization?
In the next post, I will share the detailed MATLAB code to solve this problem. Get your MATLAB ready! 💻