Initial commit of 0.0.18 just as it was released!
[freeems-vanilla.git] / src / inc / fuelAndIgnitionCalcs.h
bloba7c02e078a07e8ec43a72702199e554049b3e6a9
1 /* fuelAndIgnitionCalcs.h
3 Copyright 2008 Fred Cooke
5 This file is part of the FreeEMS project.
7 FreeEMS software is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 FreeEMS software is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with any FreeEMS software. If not, see <http://www.gnu.org/licenses/>.
20 We ask that if you make any changes to this file you send them upstream to us at admin@diyefi.org
22 Thank you for choosing FreeEMS to run your engine! */
24 /* Header file multiple inclusion protection courtesy eclipse Header Template */
25 /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */
26 #ifndef FILE_FUELANDIGNITIONCALCS_H_SEEN
27 #define FILE_FUELANDIGNITIONCALCS_H_SEEN
29 #ifdef FUELANDIGNITIONCALCS_C
30 #define EXTERN
31 #else
32 #define EXTERN extern
33 #endif
35 EXTERN void calculateFuelAndIgnition(void) FPAGE_FE;
37 /*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Always show your working! &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
39 /* At least, that is what my teachers used to say 15 years ago ;-) */
41 /******************** The full calculations in an unusable form ******************/
43 /* Full calcs on a single line */
44 // final master PW = ((msToTicks * (molarMassOfAir/ molarMassOfAirDivisor) * (airPressure / airPressureDivisor) * (lookedUpVE / (lookedUpVEDivisor * VEpercentageDivisor)) * (perCylinderVolume / perCylinderVolumeDivisor)) / ((universalGasConstant / universalGasConstantDivisor) * (airInletTemp / airInletTempDivisor) * (stoichiometricAFR / stoichiometricAFRDivisor) * (desiredLambda / desiredLambdaDivisor) * (densityOfFuel / (densityOfFuelDivisor * densityOfFuelUnitDivisor)) * (injectorFlow / (injectorFlowUnitDivisor * injectorFlowDivisor))));
46 /* stripped with only variables and divisors left.*/
47 // finalMasterPulseWidth = (((airPressure / airPressureDivisor) * (lookedUpVE / (lookedUpVEDivisor * VEpercentageDivisor))) / ((airInletTemp / airInletTempDivisor) * (desiredLambda / desiredLambdaDivisor) * (densityOfFuel / (densityOfFuelDivisor * densityOfFuelUnitDivisor))));
49 /* stripped with only divisors left.*/
50 // finalMasterPulseWidth = (airInletTempDivisor * oneLambdaDivisor * densityOfFuelTotalDivisor) / (airPressureDivisor * VETotalDivisor) ;
52 /* stripped with only divisors left.*/
53 // divisors = 1;
55 /* totally stripped with no divisors */
56 // finalMasterPulseWidth = ((airPressure * lookedUpVE) / (airInletTemp * desiredLambda * densityOfFuel));
58 /**************************** The constant calculations **************************/
60 // unsigned short constant;
61 /* stripped with only constants and divisors left.*/
62 // constant = ((msToTicks * (molarMassOfAir/ molarMassOfAirDivisor) * (perCylinderVolume / perCylinderVolumeDivisor)) / ((universalGasConstant / universalGasConstantDivisor) * (stoichiometricAFR / stoichiometricAFRDivisor) * (injectorFlow / (injectorFlowUnitDivisor * injectorFlowDivisor))));
64 /* stripped with only divisors left. Top divisors go on bottom and bottom on top! */
65 // constDiv = (universalGasConstantDivisor * stoichiometricAFRDivisor * injectorFlowTotalDivisor) / (molarMassOfAirDivisor * perCylinderVolumeDivisor);
66 //1310720= (4096 * 1024 * 1024000 ) / (100 * 32768 );
68 /* stripped with only constants left.*/
69 // constant = ((msToTicks * molarMassOfAir * perCylinderVolume) / (universalGasConstant * stoichiometricAFR * injectorFlow));
70 //nstant = ((1250 * 2897 * 16384 ) / (34056 * 15053 * 4096 ));
72 /*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
74 #undef EXTERN
76 #else
77 /* let us know if we are being untidy with headers */
78 #warning "Header file FUELANDIGNITIONCALCS_H seen before, sort it out!"
79 /* end of the wrapper ifdef from the very top */
80 #endif