Live Loops Algorithm
This algorithm is primarily designed for live loops. It is possible to use this algorithm for race routes but it may take a very long time to simulate/optimize and future data (like weather) may not be as accurate. Because this is a live algorithm, it is best for short routes using immediate future data (a few hours in advance)
Goals/Sub-projects
Loop specifics (What actions for the driver to take and when)
Binary decision (on whether or not we should do the loop)
Notes:
The loop specifics sub-project is basically a simulation of the loop (think of something like numerical analysis, but optimizing/using our model instead of some differential equation)
The binary decision sub-project requires data from the loop + external data. This makes this sub-project dependent on the loop specifics sub-project
Driver Inputs
Driver inputs are all actions that the driver can take:
Drive at x speed
Accelerate/Decelerate to x speed
Coast (Keep current velocity) → May require the driver to accelerate/decelerate to keep a constant velocity
Stop
Turn x degrees → Use a 360 model for the turning degree to quantify data for the algorithm. 0°/360° is forward/straight, 90° is turn right, 180° is turn around, 270° is turn left, etc…
Algorithm Design
Assume that we have a segment that has a start point and an endpoint that is separated by some distance. The start point and end point can be represented by some coordinates. A loop is composed of many smaller segments (but for now, we focus on the smaller segments).
This means we have 5 types of data that we have to consider:
Input data: Data that we have when at the “start” of the segment. This includes things like initial velocity, initial battery charge
Segment data: This is constant data about the segment itself. This includes the elevation gain, speed limit, expected charge from solar panels, etc. This data is constant for the segment itself, but may not be constant for the loop (since a loop is composed of many segments). For example, the segment will always have the same weather conditions but this is not true for the loop weather conditions. Using a programming analogy, this is basically a local constant
Loop data: This is constant data about the loop. This data will almost never change (and if it does, it is very rare) for the loop and each segment “inherits” this data. Using a programming analogy, this is basically a global constant
Variable data: These are the variables that we want to optimize (or calculate for) using some model. Types of variable data that we would want to optimize for include minimal/minimum energy use, maximal/maximum velocity, etc. Variable data is what we use to tell the driver what to do (such as increase speed to x)
Output data: This data is calculated using our variable data. This includes things like final velocity, final battery charge, etc. This output data would be the new input data for the next segment
The design of the algorithm somewhat mimics the idea of a numerical analysis algorithm where we have some input, use that input to calculate the output, then use that output as the input at the next “step”. Instead of “steps”, we have segments. And a loop is made of many of these segments. The algorithm design is as follows:
Get all input, segment, and loop data for our current segment
Using that data, determine the values of our variable data (this is the optimizing step)
Option 1: Optimize for a single variable (ie. max velocity) and determine what values our other variable data need to be such that our optimizing variable is optimized (easier method)
Option 2: Multivariable optimization such that all our variable data values are optimized → Some variable data may be dependent on each other (hard method, will need to come up with an optimization model)
Calculate output data using our optimized variable data
Use output data as the input data for the next segment and repeat this algorithm on that segment
Variables for each type of data
Types of variables that each type of data can have. If some data can be calculated/derived by some other data, it will be noted in parathesis. This section is blocked by SoC, car model, etc
Input Data
Initial time
Initial elevation
Segment Data
Placeholder
Loop Data
Placeholder
Variable Data
Placeholder
Output Data
Final time
Final elevation
How to calculate/derive data
Our optimization model
Notes
Since we have data from different sources, the data points may not exactly have a similar/consistent format (ie. we may have weather data in 100m intervals and elevation data in 200m intervals). In such as case, we can just use piecewise linear interpolation to calculate missing data
Using piecewise linear interpolation works fine if we assume that the data is linear (which is for the most part) and assumes that the interpolation data points are close to each other
We can also use quadratic, but this adds complexity to the algorithm and isn’t significantly better unless the interpolation data points are far apart
Most (if not all) data points represent the average or total value for the data point. For example, the elevation data for a segment of 1km will be the total elevation gain. Smaller segments/intervals will always yield more accurate data
Confidence and uncertain intervals?