James4578
Hi, i am trying to calculate the amount of times my driver is pushing on the throttle pedal and brake pedal at the same time, and i was wondering on how to make the math to give me a sum value over an outing, as in if my driver crossed the pedals 40 times in a 10 lap race, the generated value will adds up and totals up to 40 at the end. Is there a way to do this ? 
Quote 0 0
RobF
James4578 wrote:
Hi, i am trying to calculate the amount of times my driver is pushing on the throttle pedal and brake pedal at the same time, and i was wondering on how to make the math to give me a sum value over an outing, as in if my driver crossed the pedals 40 times in a 10 lap race, the generated value will adds up and totals up to 40 at the end. Is there a way to do this ? 


Hi James,

You can try this:

choose ( ( [Brake Press Front] | [Brake Press Rear] ) > CONST (Braking Threshold) , 1 , 0 )
&&
choose ( [PPS1] > 10 , 1 , 0 )

The above will set the channel to 1, when braking and throttle is over 10%

You can also generate a time channel per lap

integral ( [PPS and Brake] , Hold ) 


Capture.png 
Quote 0 0
CosworthSupport
Hi James,

To convert the above into a counter, you will need to introduce registers into your maths channel. The below maths channel will produce a counter of the number of times both throttle pedal and brake pedal are pressed over an outing.

For the maths channel to work you will just need to create suitable constants that give you the threshold throttle pedal position and brake pressures above which it is deemed both pedals are being pressed at the same time (for example 10% and 10 bar). Also check the channel names match the channels you have available for throttle pedal and brake pressure.

/* Calculates total number of times both throttle pedal and brake pedal are pressed at the same time over an outing*/

register @count = 0;
register @state = 0;


//Detect moving from 0 to 1
@state = choose( [PPS]>(CONST(Pedal Threshold)) && [P_F_BRAKE]>(CONST(Brake Threshold)) > 0 && @state == 0, 1, @state);

//If moved from 0 to 1 count
@count = choose(@state == 1, @count + 1, @count);

//Move to state 2 to wait for return to 0
@state = choose( @state == 1, 2, @state);

//Detect moving from 1 to 0 and reset machine
@state = choose( ([PPS]<(CONST(Pedal Threshold)) == 1 || [P_F_BRAKE]<(CONST(Brake Threshold)) == 1 ) && @state == 2, 0, @state);

//Output count
@count
Cosworth Support
Cosworth Electronics
Quote 0 0