So, to demonstrate the Kalman filter steps,

we will first develop and then use a very simple but not especially accurate cell model,

and this model is described by the set of equations on this slide.

The first equation is the state equation of

this simplified model and it should look very familiar.

It's the state of charge equation that you already know about from

the enhanced self-correcting cell model that you learned about in the previous course.

So this equation models the next state of

charge equal to one times the present state of charge,

minus the present input current scaled by capacity and scaled by a factor that

turns Ampere hours into Ampere seconds so that the units work out correctly.

In this really simple cell model,

we've ignored Coulombic efficiency,

although it would be pretty straightforward to add it back in,

and we also don't have any states to describe diffusion voltages or hysteresis.

The second equation of this simplified model is

the output equation of the model and that computes an estimate of cell voltage.

This crude approximation of voltage relies on understanding

that really major part of cell voltage is

open-circuit voltage and that's a nonlinear function of state of charge.

I've plotted some example,

open-circuit voltage versus state of charge curves and the figure on this slide,

and you can see that for these different lithium ion chemistries,

the relationships are somewhat different from each

other but they can be approximated not very

well but at least partially by

the dotted black line that you can see there which is a straight line.

So, when we study nonlinear Kalman filters in future weeks,

you will see how to use the actual nonlinear OCV relationship instead of this,

but for now we're going to use the straight line

approximate OCV for the examples that we look at here.

You can verify pretty easily that the equation of

this black dash line is equal to 3.5 plus 0.7 times the state of charge.

If you look at the voltage equation of this model,

you can see now why everything is there.

So, the voltage is computed as 3.5 plus 0.7 times state of charge,

minus the ohmic voltage drop across the cell which is R0 times the input current.

So, we have really really simplified

the cell model from the one that you saw in the previous course.

We have linearized the OCV relationship,

we've omitted any description of diffusion voltages and diffusion resistor currents,

and we've also omitted any description of hysteresis.

But now we have an equation that we can use with Kalman filters.

Actually, we don't. It's not a linear model yet.

It looks linear but it isn't.

So, let's think about why.

The model is not yet linear because

the output equation has a constant value of 3.5 in it.

The form for our linear state space model

says that the output equation must be equal to some c matrix times the state,

plus some d matrix times the input.

There is no provision for some constant like 3.5 in the output equation.

So, in fact, our output equation is not linear;

it's nonlinear.

Technically, it's affine.

It's a straight line, but it's a straight line that does not pass through zero and

so does not meet the requirements for a linear dynamic system.

So, what do we do? What we're going to do is we are going to make

a synthetic measurement by taking

the actual physical measurement and subtracting 3.5 from it,

and so y_k is

a synthetic or recomputed measurement based

on the actual voltage measurement from the battery cell,

and then we use y_k in the model instead of cell voltage,

and now you can see that the output equation of the model is y_k is 0.7 times

the state minus R_0 times i and this

is a perfectly valid linear state-space equation form.

So, we've fixed our problem.

To be clear, this is a state-space model where the state x

is what we've called z here and the input u as what we've called i here.

For the sake of example,

I'm going to use some simplified constants.

So, the value of Q will be 10,000 over 3,600 which is about two amp hours.

It's a pretty reasonable number and it makes the constant multiplying input current

and the state equation equal to negative

1 over 10,000 which is a little bit nicer to write than some other possibilities.

I also choose the output resistance to be equal to 10 milliohms

which makes the numbers a little bit nicer to.

So, that gives us an overall state description where

the a matrix is 1 because new state equals 1 times prior state.

The B matrix is negative 1 times 10 to the negative 4 because the new state has

this negative 1 times 10 to the minus 4 times the input current component to it.

The C matrix is 0.7 because the measurement or

the synthetic measurement is 0.7 times the state plus something else,

and the D matrix is negative 0.01 because

the synthetic measurement is negative 0.01 times the input current plus other things.

So, those are the state-space A,

B, C, D matrices.

We also need to choose covariance matrices for

the process noise and sensor noise and here I choose these values.

Finally, we need to choose the initial state and

its uncertainty and here I'm going to set the initial state exactly equal to

0.5 and I will set the estimate also equal to 0.5

meaning that I have perfect knowledge of the state and so

my covariance is 0 in this example.