FreeEMS
0.2.0-SNAPSHOT-282-g9efc524
|
Global scaling values and macros. More...
Go to the source code of this file.
Macros | |
#define | ROUND(FLOATING_POINT_VALUE) ((FLOATING_POINT_VALUE) + 0.5) |
Ensures that configuration values are properly rounded and not truncated. | |
#define | IGNITION_TIMING_FACTOR 1024 |
Temporary ignition timing table scaling factor. Warning, to be changed to 8 bit! | |
#define | TEMPERATURE_K_FACTOR 100 |
Scaling factor for temperature fixed point arithmetic. | |
#define | PRESSURE_KPA_FACTOR 100 |
Scaling factor for pressure fixed point arithmetic. | |
#define | VOLTAGE_FACTOR 1000 |
Scaling factor for Voltage fixed point arithmetic. | |
#define | LAMBDA_FACTOR 32768 |
Scaling factor for EGO and Lambda fixed point arithmetic. | |
#define | RPM_FACTOR 2 |
Scaling factor for RPM fixed point arithmetic. | |
#define | ANGLE_FACTOR 50U |
Scaling factor for engine angle scheduling fixed point arithmetic. Suffix is necessary otherwise 8 bit is assumed. | |
#define | VE_FACTOR 512 |
Scaling factor for Volumetric Efficiency fixed point arithmetic. | |
#define | AFR_FACTOR 1024 |
Scaling factor for Air:Fuel Ratio fixed point arithmetic. | |
#define | FUEL_DENSITY_FACTOR 32 |
Scaling factor for fuel density (grams per litre) fixed point arithmetic. | |
#define | PW_TICK_FACTOR 1250 |
Scaling factor for raw pulse width fixed point arithmetic;. | |
#define | PERCENT_FACTOR 640 |
Scaling factor for percentage fixed point arithmetic. | |
#define | CYLINDER_VOLUME_LIMIT 2000 |
Cylinder volume, in cc, can be anything less than this. | |
#define | INJECTOR_FLOW_LIMIT 3840 |
Injector flow, in cc/min can be anything less than this. | |
#define | WARM_UP_LIMIT 400 |
Warm up enrichment percentage, can be anything less than this. | |
#define | TEMPERATURE_C_TO_K_OFFSET 273.15 |
Offset for human degrees Celsius configuration items. | |
#define | FUEL_DENSITY_UNIT_FACTOR 1000 |
Part of the original speed density mathematics, still in use. | |
#define | KPA(PRESSURE) (signed long)ROUND((PRESSURE) * (double)PRESSURE_KPA_FACTOR) |
#define | DEGREES_K(TEMPERATURE) (unsigned long)ROUND((TEMPERATURE) * (double)TEMPERATURE_K_FACTOR) |
#define | CC_PER_MINUTE(FLOW_RATE) (unsigned long)ROUND(((FLOW_RATE) / (double)INJECTOR_FLOW_LIMIT) * 65536) |
#define | CYLINDER_VOLUME(VOLUME_IN_CC) (unsigned long)ROUND(((VOLUME_IN_CC) / (double)CYLINDER_VOLUME_LIMIT) * 65536) |
#define | VOLTS(VOLTAGE) (unsigned long)ROUND((VOLTAGE) * (double)VOLTAGE_FACTOR) |
#define | LAMBDA(LAMBDA_VALUE) (unsigned long)ROUND((LAMBDA_VALUE) * (double)LAMBDA_FACTOR) |
#define | RPM(ENGINE_SPEED) (unsigned long)ROUND((ENGINE_SPEED) * (double)RPM_FACTOR) |
#define | ANGLE(CRANK_DEGREES) (unsigned long)ROUND((CRANK_DEGREES) * (double)ANGLE_FACTOR) |
#define | STOICH_AFR(AIR_FUEL_RATIO) (unsigned long)ROUND((AIR_FUEL_RATIO) * (double)AFR_FACTOR) |
#define | FUEL_DENSITY(DENSITY) (unsigned long)ROUND((DENSITY) * (double)FUEL_DENSITY_FACTOR) |
#define | PW_MS(PW_MILLISECONDS) (unsigned long)ROUND((PW_MILLISECONDS) * (double)PW_TICK_FACTOR) |
#define | PERCENT(PERCENTAGE) (unsigned long)ROUND((PERCENTAGE) * (double)PERCENT_FACTOR) |
#define | ACCEL_TIME_TOL(PERCENTAGE) (unsigned long)((100/(100 + (double)PERCENTAGE)) * 1000) |
#define | DECEL_TIME_TOL(PERCENTAGE) (unsigned long)(((100 + (double)PERCENTAGE)/100) * 1000) |
#define | SCI_BAUD_DIVISOR(BAUD) (unsigned long)ROUND(40000000 / ((double)(BAUD) * 16)) |
#define | IT(TIMING_BTDC) (unsigned long)ROUND((TIMING_BTDC) * (double)IGNITION_TIMING_FACTOR) |
#define | VE(VOLUMETRIC_EFFICIENCY) (unsigned long)ROUND((VOLUMETRIC_EFFICIENCY) * (double)VE_FACTOR) |
#define | AF(PERCENTAGE) PERCENT(PERCENTAGE) |
#define | LR(LAMBDA_RATIO) LAMBDA(LAMBDA_RATIO) |
#define | AP(AFR) LR((double)AFR / 14.7) |
#define | PC(PERCENTAGE) PERCENT(PERCENTAGE) |
#define | C(TEMPERATURE) DEGREES_C(TEMPERATURE) |
#define | V(VOLTAGE) VOLTS(VOLTAGE) |
#define | W(PERCENTAGE) (unsigned long)ROUND(((PERCENTAGE) / (double)WARM_UP_LIMIT) * 65536) |
#define | T(PW_MILLISECONDS) PW_MS(PW_MILLISECONDS) |
#define | CC_PER_MINUTE_85(FLOW_RATE) CC_PER_MINUTE((FLOW_RATE) * (100 / 85.0)) |
#define | DEGREES_C(TEMPERATURE) DEGREES_K((TEMPERATURE) + TEMPERATURE_C_TO_K_OFFSET) |
Global scaling values and macros.
A single source of internally scaled fixed point numbers.
Definition in file scalerDefines.h.
#define ROUND | ( | FLOATING_POINT_VALUE | ) | ((FLOATING_POINT_VALUE) + 0.5) |
Ensures that configuration values are properly rounded and not truncated.
Definition at line 45 of file scalerDefines.h.
#define IGNITION_TIMING_FACTOR 1024 |
Temporary ignition timing table scaling factor. Warning, to be changed to 8 bit!
Definition at line 49 of file scalerDefines.h.
#define TEMPERATURE_K_FACTOR 100 |
Scaling factor for temperature fixed point arithmetic.
Definition at line 50 of file scalerDefines.h.
#define PRESSURE_KPA_FACTOR 100 |
Scaling factor for pressure fixed point arithmetic.
Definition at line 51 of file scalerDefines.h.
#define VOLTAGE_FACTOR 1000 |
Scaling factor for Voltage fixed point arithmetic.
Definition at line 52 of file scalerDefines.h.
#define LAMBDA_FACTOR 32768 |
Scaling factor for EGO and Lambda fixed point arithmetic.
Definition at line 53 of file scalerDefines.h.
#define RPM_FACTOR 2 |
Scaling factor for RPM fixed point arithmetic.
Definition at line 54 of file scalerDefines.h.
#define ANGLE_FACTOR 50U |
Scaling factor for engine angle scheduling fixed point arithmetic. Suffix is necessary otherwise 8 bit is assumed.
Definition at line 55 of file scalerDefines.h.
Referenced by generateDerivedVars(), and PrimaryRPMISR().
#define VE_FACTOR 512 |
Scaling factor for Volumetric Efficiency fixed point arithmetic.
Definition at line 56 of file scalerDefines.h.
#define AFR_FACTOR 1024 |
Scaling factor for Air:Fuel Ratio fixed point arithmetic.
Definition at line 57 of file scalerDefines.h.
#define FUEL_DENSITY_FACTOR 32 |
Scaling factor for fuel density (grams per litre) fixed point arithmetic.
Definition at line 58 of file scalerDefines.h.
#define PW_TICK_FACTOR 1250 |
Scaling factor for raw pulse width fixed point arithmetic;.
Definition at line 59 of file scalerDefines.h.
#define PERCENT_FACTOR 640 |
Scaling factor for percentage fixed point arithmetic.
Definition at line 60 of file scalerDefines.h.
#define CYLINDER_VOLUME_LIMIT 2000 |
Cylinder volume, in cc, can be anything less than this.
Definition at line 61 of file scalerDefines.h.
#define INJECTOR_FLOW_LIMIT 3840 |
Injector flow, in cc/min can be anything less than this.
Definition at line 62 of file scalerDefines.h.
#define WARM_UP_LIMIT 400 |
Warm up enrichment percentage, can be anything less than this.
Definition at line 63 of file scalerDefines.h.
#define TEMPERATURE_C_TO_K_OFFSET 273.15 |
Offset for human degrees Celsius configuration items.
Definition at line 66 of file scalerDefines.h.
#define FUEL_DENSITY_UNIT_FACTOR 1000 |
Part of the original speed density mathematics, still in use.
Definition at line 67 of file scalerDefines.h.
Referenced by calculateFuelAndIgnition().
#define KPA | ( | PRESSURE | ) | (signed long)ROUND((PRESSURE) * (double)PRESSURE_KPA_FACTOR) |
Definition at line 74 of file scalerDefines.h.
Referenced by generateDerivedVars().
#define DEGREES_K | ( | TEMPERATURE | ) | (unsigned long)ROUND((TEMPERATURE) * (double)TEMPERATURE_K_FACTOR) |
Definition at line 75 of file scalerDefines.h.
#define CC_PER_MINUTE | ( | FLOW_RATE | ) | (unsigned long)ROUND(((FLOW_RATE) / (double)INJECTOR_FLOW_LIMIT) * 65536) |
Definition at line 76 of file scalerDefines.h.
#define CYLINDER_VOLUME | ( | VOLUME_IN_CC | ) | (unsigned long)ROUND(((VOLUME_IN_CC) / (double)CYLINDER_VOLUME_LIMIT) * 65536) |
Definition at line 77 of file scalerDefines.h.
#define VOLTS | ( | VOLTAGE | ) | (unsigned long)ROUND((VOLTAGE) * (double)VOLTAGE_FACTOR) |
Definition at line 78 of file scalerDefines.h.
Referenced by generateCoreVars().
#define LAMBDA | ( | LAMBDA_VALUE | ) | (unsigned long)ROUND((LAMBDA_VALUE) * (double)LAMBDA_FACTOR) |
Definition at line 79 of file scalerDefines.h.
Referenced by calculateFuelAndIgnition().
#define RPM | ( | ENGINE_SPEED | ) | (unsigned long)ROUND((ENGINE_SPEED) * (double)RPM_FACTOR) |
Definition at line 80 of file scalerDefines.h.
#define ANGLE | ( | CRANK_DEGREES | ) | (unsigned long)ROUND((CRANK_DEGREES) * (double)ANGLE_FACTOR) |
Definition at line 81 of file scalerDefines.h.
#define STOICH_AFR | ( | AIR_FUEL_RATIO | ) | (unsigned long)ROUND((AIR_FUEL_RATIO) * (double)AFR_FACTOR) |
Definition at line 82 of file scalerDefines.h.
#define FUEL_DENSITY | ( | DENSITY | ) | (unsigned long)ROUND((DENSITY) * (double)FUEL_DENSITY_FACTOR) |
Definition at line 83 of file scalerDefines.h.
Referenced by calculateFuelAndIgnition().
#define PW_MS | ( | PW_MILLISECONDS | ) | (unsigned long)ROUND((PW_MILLISECONDS) * (double)PW_TICK_FACTOR) |
Definition at line 84 of file scalerDefines.h.
#define PERCENT | ( | PERCENTAGE | ) | (unsigned long)ROUND((PERCENTAGE) * (double)PERCENT_FACTOR) |
Definition at line 85 of file scalerDefines.h.
Referenced by generateCoreVars().
#define ACCEL_TIME_TOL | ( | PERCENTAGE | ) | (unsigned long)((100/(100 + (double)PERCENTAGE)) * 1000) |
Definition at line 86 of file scalerDefines.h.
#define DECEL_TIME_TOL | ( | PERCENTAGE | ) | (unsigned long)(((100 + (double)PERCENTAGE)/100) * 1000) |
Definition at line 87 of file scalerDefines.h.
#define SCI_BAUD_DIVISOR | ( | BAUD | ) | (unsigned long)ROUND(40000000 / ((double)(BAUD) * 16)) |
Definition at line 90 of file scalerDefines.h.
#define IT | ( | TIMING_BTDC | ) | (unsigned long)ROUND((TIMING_BTDC) * (double)IGNITION_TIMING_FACTOR) |
Definition at line 93 of file scalerDefines.h.
#define VE | ( | VOLUMETRIC_EFFICIENCY | ) | (unsigned long)ROUND((VOLUMETRIC_EFFICIENCY) * (double)VE_FACTOR) |
Definition at line 94 of file scalerDefines.h.
Referenced by calculateFuelAndIgnition().
#define AF | ( | PERCENTAGE | ) | PERCENT(PERCENTAGE) |
Definition at line 95 of file scalerDefines.h.
#define LR | ( | LAMBDA_RATIO | ) | LAMBDA(LAMBDA_RATIO) |
Definition at line 96 of file scalerDefines.h.
#define AP | ( | AFR | ) | LR((double)AFR / 14.7) |
Definition at line 97 of file scalerDefines.h.
#define PC | ( | PERCENTAGE | ) | PERCENT(PERCENTAGE) |
Definition at line 98 of file scalerDefines.h.
#define C | ( | TEMPERATURE | ) | DEGREES_C(TEMPERATURE) |
Definition at line 99 of file scalerDefines.h.
#define V | ( | VOLTAGE | ) | VOLTS(VOLTAGE) |
Definition at line 100 of file scalerDefines.h.
#define W | ( | PERCENTAGE | ) | (unsigned long)ROUND(((PERCENTAGE) / (double)WARM_UP_LIMIT) * 65536) |
Definition at line 101 of file scalerDefines.h.
#define T | ( | PW_MILLISECONDS | ) | PW_MS(PW_MILLISECONDS) |
Definition at line 102 of file scalerDefines.h.
#define CC_PER_MINUTE_85 | ( | FLOW_RATE | ) | CC_PER_MINUTE((FLOW_RATE) * (100 / 85.0)) |
Definition at line 105 of file scalerDefines.h.
#define DEGREES_C | ( | TEMPERATURE | ) | DEGREES_K((TEMPERATURE) + TEMPERATURE_C_TO_K_OFFSET) |
Definition at line 106 of file scalerDefines.h.
Referenced by calculateFuelAndIgnition(), and generateCoreVars().