tomicooler / bmwe46oil

15 stars 1 forks source link

Working out oil temp #1

Closed jLynx closed 3 years ago

jLynx commented 3 years ago

Hi, first off I do apologize, I don't quite understand your working and I am wondering if you could try and breaking it down a bit further when explaining.

Using your example here: 12 2d a0 02 c3 00 00 00 00 38 00 38 99 bb b5 a7 c8 01 88 fc 4e 64 35 9c 79 88 7c 2f 7c 55 fe fe fe fe 14 47 09 76 05 05 0d 2e 90 86 c2 Can you please show step by step how you extract the temperature out of this?

From my understanding:

We then need to break the data down further, but this is where you lose me.

Where do we get:

and where does the 99 and 181 come from?

99 multiplier + offset = 30.8 181 multiplier + offset = 96.08

Thanks!

jLynx commented 3 years ago

Update:

I think I understand it now: The value at index 12 of the example is 99 (Aka, index 9 of the data) So to put that into the equation we first need to convert hex 99 to a decimal which is 153 So to complete it: 153 * 0.796098 + (-48.0137) = 73.79 C

Is this correct? and if so, where did the multiplier & offset come from?

tomicooler commented 3 years ago

Hi,

well, you almost got it.

99 and 181 are decimal numbers (the example data is in hexadecimal numbers, in the table I converted them to decimal). The multiplier and offset are the two variables that we want to find. We have two variables, so in order to find out what they are, we need to build two equations and solve them.

https://www.wolframalpha.com/input/?i=99+*+m+%2B+o+%3D+30.8%3B+181+*+m+%2B+o+%3D+96.08

I have a new project where I had to reverse engineer more data from a BMW. It could be useful for you: https://github.com/tomicooler/e46track

jLynx commented 3 years ago

Oh that's very interesting. Is the multiplier & offset different for every car? The reason being is that when I put those values into my response, I get a result that is close but not correct. It can be about +/-10c off

tomicooler commented 3 years ago

I think it could vary a bit. For example in this CAN bus project (https://www.bimmerforums.com/forum/showthread.php?1887229-E46-Can-bus-project) the offset was -48.373, which is quite similar to my finding. The 0.796 multiplier is close to 0.8.

But it is also possible that you have a slightly different response from the ECU. When I swapped my engine to an S54B32 I no longer saw the Oil temp in INPA - no idea why - and the byte pos 12 is no longer the oil temp for me on my car. Before the swap it was a 330i (MS 43.0 for M54 in INPA).

+/-10c, could it be the water temp (cooling water outlet temperature in inpa)?

If you record the data and the expected oil temperature, you could re-adjust this multiplier and offset with it. You just need 2 measurement when there is a significant difference in the oil temperature. It is also possible that the oil temp is on a different byte pos for you.

jLynx commented 3 years ago

All makes sense. Is it possible to contact you in another way (discord, Facebook)? just as I have a few questions that may be easier over IM or a call

tomicooler commented 3 years ago

I don't have Facebook. I'm on discord (nick: Tomicooler), but I use it from the browser only so the response time is not instant :).

jLynx commented 3 years ago

Ah, is there anything else you use? If not the it's no problem

tomicooler commented 3 years ago

Not really, no social media account. But if you need help where IM or call makes sense then reach me here and I will jump to discord.

jLynx commented 3 years ago

Ah so for me it was byte 14 I needed to get the oil temp. I had a sample size of 9, I used your numbers and the output was identical to INPA Just to make sure we are on the same page, here is an example of one of mine: INPA said it was 35.58 C the data stream was: 12 2D A0 00 00 00 00 00 0C 78 00 00 6D 78 69 62 B0 00 00 0B 96 85 4C B0 78 8C 80 00 80 00 00 00 00 00 00 00 07 00 07 00 00 2F A3 8C 55

Byte 14 is HEX 69, converting that to decimal is 105 So 105* 0.796098 + (-48.0137) = 35.58 C

So my question to you is, are we talking about the same byte here? (Are you starting from 0 and are you starting at the message section, or the whole thing)

jLynx commented 3 years ago

Also on a side note, 13 is coolant temperature with the values of 0.74 + -46.6

tomicooler commented 3 years ago

https://github.com/tomicooler/bmwe46oil/blob/39b3c04fb32dbc5817d75afdfbc69b12b97036ae/app/extractors.h#L18

12 byte pos inside the data part. (+ the ecu + the size), that's add up to 14. So we are talking about the same byte.

Nice!

jLynx commented 3 years ago

Thanks for your amazing help. Will close this issue as its solved now. Keep up the great work!