Torque

Forums

Forums

Guest  

Show or hide header
Welcome Guest, posting in this forum require registration.




Torque » Torque OBD ECU Scanner » Torque Discussion / Ideas » Read a PID but only when ECT is above certain level

Pages: [1]
Author Topic: Read a PID but only when ECT is above certain level
stuko
Member
Posts: 5
Post Read a PID but only when ECT is above certain level
on: June 30, 2020 (GMT)

iI have a custom PID that tells me the injector correction on my Mercedes CDI diesel. I will filter and average these values as an early warning feature that should be able to detect an overfuelling injector.

Thr problem is that the correction values are only relevant once engine temperature is above 80 degC. So I dont want zeores or warmup values to be incorporated into the averaging function.

I am using my own custom BT adaptor (arduino) so I couod make it respond with NO_DATA during warmup. But will Torque resume asking for the PID after a long warmup? It seems to me Torque stops asking for PIDs that respond with NO_DATA?

Is there anything else I could do. I have access to ECT in Torque but there is no conditional branching allowed in the custom PID equation. I could make the result zero when ECT is less than 80, bit I dont want the value of zero propgating into the averaged result.

eg RAVG(inj1corr) should only operate when ECT > 80

Capp777
Member
Posts: 2993
Post Re: Read a PID but only when ECT is above certain level
on: June 30, 2020 (GMT)

Maybe something like…

lookup(Val{ECT}::0~80=0:81~215=RAVG(Val{inj1corr}))

The Val{} long names will need to match
your pid names.

stuko
Member
Posts: 5
Post Re: Read a PID but only when ECT is above certain level
on: July 1, 2020 (GMT)

Thanks. I had assumed the LOOKUP function only allowed constant results. I will give it a go.

Also do you know if Torque caches a PID response if it is used for multiple values? Like I have PID 2128 that provides 5 injector correction values in the single response. I know how to extract each of the 5 injector values individually in separate PID entries, but does that mean Torque will request the PID 5 times?

In other words, will Torque pull A into one PID from 0x2128, and B into another PID from 0x2128, without requesting 0x2128 twice from BT?

Capp777
Member
Posts: 2993
Post Re: Read a PID but only when ECT is above certain level
on: July 1, 2020 (GMT)

I am under the impression that Torque is
optimized to minimize the number of
same requests per pass. (but only Ian
knows for sure. Hopefully he will confirm
this).

stuko
Member
Posts: 5
Post Re: Read a PID but only when ECT is above certain level
on: July 7, 2020 (GMT)

Ok I have tried the conditional RAVG function using a LOOKUP as suggested. It kind of half works. The trouble is it seems to default to a large value when the condition is not met.

This can be seen by having ECT in range and the values being good values. RAVG works fine and keeps tracking the values. Then when ECT goes out of range, I have the “value” going to ‘—-‘, rather than the RAVG calc. Basically like above.

So when ECT comes back into range, the RAVG value is suddenly very large. And slowly tracks back down towards the live value. This can also be seen when using AVG as well.

Is there a way to specifically freeze the RAVG value at its last valid value? Because it seems to be going to full scale when it stops being updated. Ive just changed to a graph display for this RAVG channel, and it sits at a vaue of 55 when it is displaying ‘—-‘. The live vaules are in the range -2.0 to +2.0. So averaging in 55 into those values basically makes it useless.

cintakc
Member
Posts: 1661
Post Re: Read a PID but only when ECT is above certain level
on: July 7, 2020 (GMT)

(lookup(Val{ECT}::0~80=0:81~215=1))*RAVG(Val{inj1corr})

Capp777
Member
Posts: 2993
Post Re: Read a PID but only when ECT is above certain level
on: July 7, 2020 (GMT)

My offline testing seems to display
0 or the RAVG using random()*3 to
simulate numbers in the range you
mentioned. (1.5 to 1.6).

When I change 0 to ‘—‘ higher values
briefly flash on display but my RAVG
still seems in the ballpark as when 0
was used. (1.5 to 1.6). Something odd
with the ascii text processing and its
timing.

stuko
Member
Posts: 5
Post Re: Read a PID but only when ECT is above certain level
on: July 8, 2020 (GMT)

Thanks for all the help guys. I think I have ot working now. I think the problem was it was reading the ASCII value of ‘ from the indirect value channel I was using. So Ive chanhed it to using a direct A type value from the PID instead of a value{}. It seems to work ok now.

Pages: [1]
WP-Forum by: Fredrik Fahlstad, Version: 2.4
Page loaded in: 0.03 seconds.

  Follow me on twitter