ECU accuracy

Hardware inside and outside of the ECU
Post Reply
Gorfest-n
Posts: 3
Joined: Mon May 29, 2023 3:26 pm
Github Username: Gorfest-n

ECU accuracy

Post by Gorfest-n »

Let's talk about ECU accuracy.
We have a powerful ECU that can do calculations with very high accuracy and speed. But due to flaws in the program code, the data that we give to the ECU now have a large measurement error.
Let's start with the fact that we have digital and analog inputs. We will leave the digital ones to the programmers. Let's talk about analog inputs.
The accuracy of any analog input consists of a set of errors of all elements, the accuracy of the reference voltage, and correctly selected parts. There is no ideal ADC, even two ADCs on the same chip are slightly different.
This means that we should be able to correct the readings of these input data so that the readings in the ECU correspond to the real data. And this proves to us that a single correction for everything, for example, vREF for all, is garbage!
Let's start.

What are the main analog inputs that are used in our ECUs?
The first is the battery voltage. This is a very important parameter. The accuracy of AFR and the correct operation of the ignition modules depend on it.
Then there is a CLT, an IAT (fuel mixture, ideal gas formula, and so on), an oxygen sensor (even a small difference in voltages will give a very large error), an exhaust gas temperature sensor (it is necessary to ensure maximum accuracy for it, since an error in these readings leads to a melted valve in the exhaust pipe).
Now the parameters of the sensors are set incorrectly and the accuracy is very poor. Yes, it is enough to connect, enter something, start the engine and say - that's it, I did it, I'm done, but if you want to take everything you can from the engine and not break it, you need a different approach.

What I suggest:
The first step is to add correction factors for all important analog inputs:
1. Shift to the desired voltage. For example, you see that the readings from the ecu sensor are underestimated by 0.05 volts - by introducing this correction, we will equalize the apparent and actual voltage.
2. Tilt or multiply/divide. Some op amps have different gains for different input voltages. This setting will compensate for this. For example, you see a difference of 0.05 volts at low voltage, and a difference of 0.15 volts at high voltage. This setting will help fix that.
3. If we have several different vREFs - let's adjust them too. Why do you think that the power supply of the sensors is exactly 5.000 volts, not 4.905 or 5.120v?
4. The circuit board must have test points for all analog inputs, this is a recommendation for any ECU. What are they needed for? You put a tester on it, look at the voltage, then look at what the ECU shows you in RAW voltage. If there are differences, by settings 1, 2 and 3 we achieve that the readings are the same over the entire operating range. Instead of a sensor, you can connect a voltage generator there and do it with it - it doesn't matter how it's done.

Secondly, for all these sensors it is necessary to set their parameters at several points. Now the IAT and engine CLT set by 2 or 3 points. Seriously? There are not only linear sensors, there are even sensors with a polynomial or logarithmic curve. Through 3 points they will show garbage.
What I suggest:
1. Make a table for sensors, for example, with 8-16 values, temperature is set on the X axis, resistance or voltage is set on the Y axis. In addition, this table will allow you to use any non-standard sensors, any EGT controllers, and even thermal switches, a huge freedom of choice.
2. For all analog sensors in the signal circuit and pullups, do not use SMD resistors with 5%. 1% or 0.5% would be a much better solution.

Any suggestions?
To be continued.
User avatar
AndreyB
Site Admin
Posts: 14280
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: ECU accuracy

Post by AndreyB »

I am not sure if we care for _all_ absolute values so much, we probably mostly care for lack of drift? We one area where we definitely care about precision is rusEFI WBO controller by @mck1117

We have quote a loose model of engine control which we calibrate using the same ECU, so whatever error we have gets accounted for in calibration. Whatever effort we put to gain absolute precision on CLT IAT would be in vain considering how loose the calibration would for all the IAT/CLT/etc transient states.

My understanding is that REF3333 voltage reference which most designs have is part of this strategy. We insist on WBO AFR data to arrive via CAN exactly to get precision, on the WBO controller itself some of the resistors are 0.1% aren't they?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
Dron_Gus
contributor
contributor
Posts: 448
Joined: Wed Nov 13, 2013 1:11 pm
Location: S-Pb
Github Username: dron0gus

Re: ECU accuracy

Post by Dron_Gus »

Gorfest-n wrote:
Sat Jun 03, 2023 2:44 pm
Secondly, for all these sensors it is necessary to set their parameters at several points. Now the IAT and engine CLT set by 2 or 3 points. Seriously? There are not only linear sensors, there are even sensors with a polynomial or logarithmic curve. Through 3 points they will show garbage.
https://github.com/rusefi/rusefi/blob/master/firmware/controllers/sensors/converters/thermistor_func.cpp#L11 it is not a linear approximation but Steinhart–Hart equation https://en.wikipedia.org/wiki/Steinhart%E2%80%93Hart_equation with coefficients calculated with three points. As most (all?) T sensors used in OEM for coolant and air are thermistors.
mck1117
running engine in first post
running engine in first post
Posts: 1493
Joined: Mon Jan 30, 2017 2:05 am
Location: Seattle-ish

Re: ECU accuracy

Post by mck1117 »

Gorfest-n wrote:
Sat Jun 03, 2023 2:44 pm
This means that we should be able to correct the readings of these input data so that the readings in the ECU correspond to the real data. And this proves to us that a single correction for everything, for example, vREF for all, is garbage!
This is a bold claim to pull out of nowhere on your third ever post on the board, and sort of patronizing to assume nobody has thought about this.

We care much more about repeatability and linearity than absolute accuracy. Even an inaccurate resistor fulfills both of these needs.
Gorfest-n wrote:
Sat Jun 03, 2023 2:44 pm
If we have several different vREFs - let's adjust them too.
But we just don't need to. It's overkill. Even the OEMs aren't doing 100% cal on their ECUs. You do the "calibration" in the design by specifying how much measurement error is acceptable (+-1C, +-3kPa, whatever), then designing so that even in the worst case for every component you're still inside that spec.

For example, suppose you use a 3 bar MAP sensor, so roughly 16mV per kPa. We're allowed 3kPa = 48mvt of total error on the MAP sensor input to be in spec. The voltage reference we use is accurate to +-0.15%, or 8mV at 5v. The 5v->3v dividers are 1% resistors, so the worst case is where one is 1% low and the other 1% high, so the divider ratio is 0.495 instead of 0.5. The opamp buffers are +-1mV typical. The STM32's ADC is specified to be accurate to +-5 LSB maximum, but that's sort of optimistic so let's say it comes out as a 10 bit ADC after oversampling (in reality it's 12), which gets us an accuracy of 1/1024, or roughly 6mV.

So for absolute worst case of all these errors pointed in the same direction, measuring the MAP at half scale, that's 8mV + 12mV + 1mV + 6mV = 27mV, well under our spec of 48mV. You need neither 100% calibration nor exotic components to hit specs like those. A slightly more expensive voltage reference and resistors would improve that further, but even those aren't unusual parts.
mck1117
running engine in first post
running engine in first post
Posts: 1493
Joined: Mon Jan 30, 2017 2:05 am
Location: Seattle-ish

Re: ECU accuracy

Post by mck1117 »

Gorfest-n wrote:
Sat Jun 03, 2023 2:44 pm
The first step is to add correction factors for all important analog inputs:
.....
Instead of a sensor, you can connect a voltage generator there and do it with it - it doesn't matter how it's done.
How do you propose doing that in production? This is the big reason that OEMs don't want to do 100% calibration (100% test is OK). It's so slow to have to take enough data points, then write them to the ECU to be doing 100% cal. A 100% test pass is much, much faster than a 100% cal process.

And that's not to mention that if you want to try and calibrate across ambient temperature, that requires a whole additional axis of effort.
mck1117
running engine in first post
running engine in first post
Posts: 1493
Joined: Mon Jan 30, 2017 2:05 am
Location: Seattle-ish

Re: ECU accuracy

Post by mck1117 »

AndreyB wrote:
Sun Jun 04, 2023 3:24 am
I am not sure if we care for _all_ absolute values so much, we probably mostly care for lack of drift? We one area where we definitely care about precision is rusEFI WBO controller by @mck1117
And even in the case of the wideband controller, Bosch's sensor architecture lends itself to a circuit design that doesn't need incredible accuracy to be able to produce a very accurate lambda reading.
User avatar
AndreyB
Site Admin
Posts: 14280
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: ECU accuracy

Post by AndreyB »

Anyway let's focus on VBatt for a moment? I believe we are talking 4chan rev D.

What is exact input voltage? What is exact measured voltage on the stm32 input pad / the one in the middle of the voltage divider? What is rusEFI reported VBatt?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
Post Reply