CAN ADC & Generic Sensor Inputs Precision?

Testing and development of Megasquirt 3

Moderators: jsmcortina, muythaibxr

Post Reply
MWPau
Master MS/Extra'er
Posts: 411
Joined: Thu Mar 03, 2011 6:24 pm

CAN ADC & Generic Sensor Inputs Precision?

Post by MWPau »

Hi all,

So i have some values being transmitted on to the CANBUS that i would like the MS3 to read, display in TS and log.
The values are fractional (voltages, pressures, etc), so are multiplied by 100 and transmitted in L4S.

I have CAN Reading setup with the appropriate CAN settings, with mult=1 div=100 and add=0.
Generic Sensor Inputs are setup as being RAW inputs, with 100 lag.

Why are all the readings being displayed/logged rounded down to the nearest decimal place?
For example, one of the values is battery voltage, so is a value of 13.83V, which is put on the CANBUS as 1383. It appears as 13.0V in TS and the logs.

What can i do about this?

Thanks!
Toyota Celica GT4/Alltrac with 5S-GTE stroker (2.2L I4 turbo, high CR) on E85 w/FlexFuel.
MS3 + MS3X + KnockBoard + RTC + BT + DIY CAN-IO-Board + DIY CAN Digital Dash.
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: CAN ADC & Generic Sensor Inputs Precision?

Post by jsmcortina »

Generic Sensors are one decimal place.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
MWPau
Master MS/Extra'er
Posts: 411
Joined: Thu Mar 03, 2011 6:24 pm

Re: CAN ADC & Generic Sensor Inputs Precision?

Post by MWPau »

Thanks James, but that doesn't seem to be the case.

Ive double checked... as i said, a value of 13.83V, which is put on the CANBUS as 1383. It appears as 13.0V in TS and the logs. Not 13.8 as you suggest it should.
Same goes with other similar values. They all get rounded down.

BTW, i am running MS3 pre-1.4.1 beta 4.
Toyota Celica GT4/Alltrac with 5S-GTE stroker (2.2L I4 turbo, high CR) on E85 w/FlexFuel.
MS3 + MS3X + KnockBoard + RTC + BT + DIY CAN-IO-Board + DIY CAN Digital Dash.
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: CAN ADC & Generic Sensor Inputs Precision?

Post by jsmcortina »

Sounds perhaps like a rounding error within the calculation. It is still "precise" to 1 decimal, but rounded.
Please post your MSQ.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
MWPau
Master MS/Extra'er
Posts: 411
Joined: Thu Mar 03, 2011 6:24 pm

Re: CAN ADC & Generic Sensor Inputs Precision?

Post by MWPau »

It's attached.
Thanks again James.
Toyota Celica GT4/Alltrac with 5S-GTE stroker (2.2L I4 turbo, high CR) on E85 w/FlexFuel.
MS3 + MS3X + KnockBoard + RTC + BT + DIY CAN-IO-Board + DIY CAN Digital Dash.
Alfagta
Experienced MS/Extra'er
Posts: 239
Joined: Wed Aug 21, 2013 2:54 am

Re: CAN ADC & Generic Sensor Inputs Precision?

Post by Alfagta »

Hello,

do you really send 4 bytes per Sensor?
And why?

What is the data type within you external system?

BR
Alfa 156 GTA
Alfa 75 Race Car MS III -- alway latest FW
Alfa 164 V6 Turbo
Alfa 155 2,5TD RIP
Test MS II --always latest FW
Tunerstudio V2.6.11 Registered
MegaLog Viewer V3.4.04 Registered
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: CAN ADC & Generic Sensor Inputs Precision?

Post by jsmcortina »

You could reduce CANbus traffic by sending four 16bit values per packet instead of each sensor value in its own packet.
Thanks for the MSQ, I'll try it out later.

EDIT: Thinking again, I think it is working "as expected" ish. Set it to divide by 10 and then use the generic sensors with a linear scale of 0-102.3 But I'll test later.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
MWPau
Master MS/Extra'er
Posts: 411
Joined: Thu Mar 03, 2011 6:24 pm

Re: CAN ADC & Generic Sensor Inputs Precision?

Post by MWPau »

jsmcortina wrote: EDIT: Thinking again, I think it is working "as expected" ish. Set it to divide by 10 and then use the generic sensors with a linear scale of 0-102.3 But I'll test later.
James
Ah, so internally the "CAN ADCx" are all 16bit signed int's, and the Generic Sensors are 16bit signed int's / 10?

This leaves me wondering why the "CAN ADCx" variables exist at all?
Why not go directly from CANBUS input data into the Generic Input vars?
Toyota Celica GT4/Alltrac with 5S-GTE stroker (2.2L I4 turbo, high CR) on E85 w/FlexFuel.
MS3 + MS3X + KnockBoard + RTC + BT + DIY CAN-IO-Board + DIY CAN Digital Dash.
MWPau
Master MS/Extra'er
Posts: 411
Joined: Thu Mar 03, 2011 6:24 pm

Re: CAN ADC & Generic Sensor Inputs Precision?

Post by MWPau »

James, do you mind if i send you a PM?
Toyota Celica GT4/Alltrac with 5S-GTE stroker (2.2L I4 turbo, high CR) on E85 w/FlexFuel.
MS3 + MS3X + KnockBoard + RTC + BT + DIY CAN-IO-Board + DIY CAN Digital Dash.
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: CAN ADC & Generic Sensor Inputs Precision?

Post by jsmcortina »

MWPau wrote:Ah, so internally the "CAN ADCx" are all 16bit signed int's, and the Generic Sensors are 16bit signed int's / 10?

This leaves me wondering why the "CAN ADCx" variables exist at all?
Why not go directly from CANBUS input data into the Generic Input vars?
Because they are used for other things besides generic sensors.

PM ok.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: CAN ADC & Generic Sensor Inputs Precision?

Post by jsmcortina »

In your case, you are receiving processed data instead of ADC data as it was designed for. So, an option in the CAN Receiving screen to store directly to the Generic Sensors would probably make sense.
(Allowing that is pretty simple, but checking for conflicts and cleanly enabling datalogging isn't so straighforward.)

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
Post Reply