Last Post 12 Apr 2015 07:32 PM by  Reanimotion Battery voltage correction on DPR ??  4 Replies Sort: Oldest First Most Recent First
 You are not authorized to post a reply.
 Author Messages
Reanimotion
System Designer Basic Member
Posts:125  05 Apr 2015 06:14 PM Ok, math time. As we are supplying a constant current to the DPR to adjust the mixture, we should be referencing all our calculations to battery voltage as Voltage is a factor in Ohms law Where P = power in watts E = voltage in volts I = current in amps R = resistance in ohms I = E / R I = P / E I = sqrt( P / R ) so in this case I = Battery Volts / 65 Ohms so we have 200 steps or 0.5% duty resolution and 13 volts giving 200mA at 100% duty through 65 Ohms so 200 / 13 gives 15.384615mA per volt and 15.384615 / 200 gives 0.076923 ma per 0.5% duty step per volt so our step correction factor for battery voltage should be 0.077 and referenced to a base of 13v additive below 13 and subtractive above
sbeaven New Member
Posts:2  11 Apr 2015 05:22 AM Hi Steve, Since your doing a ratio of 200 steps for 200 mA, wouldn't your objective be to keep adjust duty steps for to maintain mA. So for example, a VE setting of 110 would translate a duty cycle of 10/200 (10 steps of 200), or 10ma. With a decrease in voltage you would have to change the duty to maintain mA using the formula 10 * (v1 / v2) where v1 is 13v, and v2 is the current voltage. An example if voltage dropped to 12v. 10 * (13v/12v) / 200= 10.83 steps To confirm with Ohms law we shouldhave the same mA result: Base mA calc with 13v 10 * (13v/13v)/200 * 13v / 65ohm = 0.01A or 10mA Adjusted mA calc with 12v 10 * (13v/12v)/200 * 12v / 65ohm = 0.01A or 10mA Given there is a simple relationship between VE settings and the +-200 steps the following simple formula should address voltage (DPR calc considered here): If VE >= 100 PWMDTY1 = (VE-100) * (13v / curV) PWMDTY2 = 0 Else (VE <100) PWMDTY1 = 0 PWMDTY2 = (100-VE) * (13v / curV) where VE = adjusted VE based on other calculation factors curV = current battery voltage PWMDTY1 /2 = duty setting out of 200 steps for INJ 1 and 2. This is for discussion only, and I'm still not yet 100% sure how your duty calcs are done. Let me know your thoughts. Steve P.S. wanted to be first to post in your forum. Reanimotion
System Designer Basic Member
Posts:125  11 Apr 2015 06:36 PM Yes, that should work nicely, and follows our simple multiply for each correction factor. e.g. correction = outpc.vecurr1 / 10; correction = correction * outpc.gammae / 100; if (ram4.loadopts & 0x8) { correction = correction * outpc.egocor1 / 1000; } if (ram4.FlexFuel & 0x01) { correction = correction * outpc.fuelcor / 100; } the above are all working against the VE table number based at 100 we then subtract the base giving a positive or negative mA equivalent correction = correction - 100; so at this point we do a few sanity checks and then go if (correction >= 0) { KJet_CP_ctl_duty = correction; KJet_CP_ctl_dutyI2 = 0; outpc.inj_dpr_val = 100 + KJet_CP_ctl_duty; } else { KJet_CP_ctl_dutyI2 = correction * -1; KJet_CP_ctl_duty = 0; outpc.inj_dpr_val = 100 - KJet_CP_ctl_dutyI2; } so correction = (correction * ( 1300 / curV )) / 100 Thanks sbeaven New Member
Posts:2  11 Apr 2015 11:09 PM Okay, I get what your doing, Thanks. I see that voltage is factored times 100, so 13v is actually 1300. If this is the case then you don't need to divide by 100 since in the example of curV = 12v the calculation would be correction = correction * (1300/1200), and if divided by 100 as well, would give you a very small number (ie. correction = 50 * (1300/1200) /100 = 0.542) Also, I think the adjustment has to be applied after subtracting 100 from the correction, otherwise the adjustment would factored wrong, and negative corrections would be adjusting in the wrong direction. Does this makes sense? Thanks Steve
Reanimotion
System Designer Basic Member
Posts:125  12 Apr 2015 07:32 PM Yep, makes sense the divide by 100 after (1300/curV) is required as curV is actual volts unfactored and the /100 is left to last to preserve decimal precision to 2 places during the calculation. it's actually now correction = (correction * ( 1300 / outpc.batt )) / 10 ; as outpc.batt is voltage * 10 in the megasquirt code the calculation is after correction = correction - 100;
 You are not authorized to post a reply. FrankenCIS Hardware Information --Frequently Asked Questions --FrankenCIS WUR based --FrankenCIS DPR / EHA based Installations and Tuning --Installs and Projects ----may the Schwarz be with you --Tuning and related discussion --Other Hardware and software FrankenCIS Development --Firmware and Software --Hardware --Franken8 ECU project Distributors and Dealers --Dkubus - (Distributor)