Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* LibreEMS - the community driven open source engine management system
- *
- * Copyright 2014 Sean Keys
- *
- * This file is part of the LibreEMS project.
- *
- * LibreEMS software is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * LibreEMS software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with any LibreEMS software. If not, see http://www.gnu.org/licenses/
- *
- * Thank you for choosing LibreEMS to run your engine!
- */
- /** @file
- *
- * @ingroup Configuration
- *
- */
- #ifndef FILE_ENGINE_CONFIGURATION_H_SEEN
- #define FILE_ENGINE_CONFIGURATION_H_SEEN
- //Ducati ST2
- /* Engine Config */
- #define ENGINE_CYLINDER_COUNT 2
- #define CRANKSHAFT_REVS_PER_CYCLE 2 /* Four stroke/Camsignal 48-2 */
- #define NUM_OF_PRECISON_OUTPUTS 12 /* Total number of fuel and ignition channels */
- #define INJECTOR_FLOW_RATE 270 /* Flow rate in cc/min */
- #define SECONDARY_INJ_FLOW_RATE 0 /* secondary injector flow rate */
- #define ANTICIPATED_STOICH_AFR 14.7 /* Normal Gass */
- #define MAX_INJ_DUTY_CYCLE 85.0 /* Percent */
- #define MAX_INJ_DC_SECONDARY 85.0 /* Percent */
- #define INJECTION_STRATEGY SEQUENTIAL
- #define PRIMARY_FUELING_ALGORITHM ALPHA_N
- #define MAX_RPM_CRANKING 800 /* Max RPM at which the ECU will consider it to be in cranking mode */
- #define PRIMARY_SKIP_EDGES 0
- #define PRIMARY_INPUT_TOLLERANCE 80.0 /* Difference allowed in percentage */
- #define PRIMARY_INPUT_TOLLERANCE_CRANKING 20.0 /* Difference allowed in percentage */
- #define FILTER_ENABLE_RPM 2000.0 /* RPM to start filtering tach signal */
- #define MAP_MAXIMUM 00
- #define MAP_MINIMUM 00
- #define FUEL_PUMP_RUNTIME 2 /* Minimum fuel pump run time, in seconds */
- /* Fuel Algorithm settings */
- #define FLEX_FUEL DISABLED
- #define MASS_AIR DISABLED
- #define SPEED_DENSITY DISABLED
- #define ALPHA_N ENABLED
- #define ALPHA_SD_BLEND DISABLED
- #define DELTA_AE ENABLED
- /* Advanced Scheduling Settings */
- #define VIRTUAL_ANGLES DISABLED
- #define MAX_HARD_ANGLE_SPREAD 10.0 /* Max angle between input teeth, before virtual angles are created */
- #define IDLE_TYPE NO_IDLE
- #define IDLE_IAC_STEPS 0
- #define IDLE_IAC_PW 0
- #define IDLE_IAC_CHA 0
- #define IDLE_IAC_CHB 0
- #define PWM_CHANNEL 0
- /* Chassis Config */
- #define VSS DISABLED /* Vehicle speed sensor input */
- #define VSS_DIVISOR 30
- #define ECT0_CAPTURE_RISING TRUE
- #define ECT0_CAPTURE_FALLING FALSE
- #define ECT1_CAPTURE_RISING FALSE
- #define ECT1_CAPTURE_FALLING TRUE
- #define ECT2_CAPTURE_RISING TRUE
- #define ECT2_CAPTURE_FALLING TRUE
- #define ECT3_CAPTURE_RISING TRUE
- #define ECT3_CAPTURE_FALLING TRUE
- #define ECT4_CAPTURE_RISING TRUE /* No effect reserved by XGate */
- #define ECT4_CAPTURE_FALLING TRUE /* No effect reserved by XGate */
- #define ECT5_CAPTURE_RISING TRUE
- #define ECT5_CAPTURE_FALLING TRUE
- #define ECT6_CAPTURE_RISING TRUE
- #define ECT6_CAPTURE_FALLING TRUE
- #define ECT7_CAPTURE_RISING TRUE
- #define ECT7_CAPTURE_FALLING TRUE
- /* Ultimate Limits */
- #define RPM_FUEL_DISABLE 9500 /* Max RPM allowed before fuel is cut */
- #define RPM_FUEL_REENABLE 9350 /* RPM to re-enable fueling */
- #define RPM_IGNITION_DISABLE 9550 /* Max RPM allowed before igntion is cut */
- #define RPM_IGNTTION_REENABLE 9400 /* RPM at which to re-enable ignition */
- #define MAP_MAX_FUEL_DISABLE 0 /* Max KPA allowed before fuel is cut */
- #define MAP_FUEL_RENABLE 0 /* KPA at which to re-enable fueling */
- #define MAP_MAX_IGNITION_DISABLE 0 /* Max KPA before igntion is cut */
- #define MAP_IGNITION_REENABLE 0 /* KPA to re-enable igntion */
- /* First De-rate Limits */
- #define DERATE_L1_RPM_FUEL_DISABLE 4500
- #define DERATE_L1_RPM_FUEL_REENABLE 4200
- #define DERATE_L1_RPM_IGNITION_DISABLE 4600
- #define DERATE_L1_RPM_IGNTTION_REENABLE 4300
- #define DERATE_L1_MAP_MAX_FUEL_DISABLE 105
- #define DERATE_L1_MAP_FUEL_RENABLE 100
- #define DERATE_L1_MAP_MAX_IGNITION_DISABLE 110
- #define DERATE_L1_MAP_IGNITION_REENABLE 101
- #define INPUT_OFFSET ENGINE_ANGLE_S(10.0)
- #define ENGINE_CYL_VOLUME CC_VOLUME_S(472)
- #define SPECIFIED_OPERATING_LEVELS 3
- /*
- *
- * Engine angle specific settings
- *
- */
- #define CYL_1_TDC_ANGLE 270 /* TDC angle */
- #define CYL_1_INJ_ANGLE 240 /* Angle to inject Fuel */
- #define CYL_1_READ_ANGLE 45 /* Angle to sample sensors */
- #define CYL_1_IGN_CH 1 /* XGate ignition channel */
- #define CYL_1_PRIMARY_INJ_CH 8 /* XGate primary fuel channel */
- #define CYL_1_SECONDARY_INJ_CH 0 /* XGate secondary fuel channel */
- #define CYL_2_TDC_ANGLE 360 /* TDC angle */
- #define CYL_2_INJ_ANGLE 330 /* Angle to inject Fuel */
- #define CYL_2_READ_ANGLE 225 /* Angle to sample sensors */
- #define CYL_2_IGN_CH 2 /* XGate ignition channel */
- #define CYL_2_PRIMARY_INJ_CH 9 /* XGate primary fuel channel */
- #define CYL_2_SECONDARY_INJ_CH 0 /* XGate secondary fuel channel */
- #define CYL_3_TDC_ANGLE 0 /* TDC angle */
- #define CYL_3_INJ_ANGLE 0 /* Angle to inject Fuel */
- #define CYL_3_READ_ANGLE 0 /* Angle to sample sensors */
- #define CYL_3_IGN_CH 0 /* XGate ignition channel */
- #define CYL_3_PRIMARY_INJ_CH 0 /* XGate primary fuel channel */
- #define CYL_3_SECONDARY_INJ_CH 0 /* XGate secondary fuel channel */
- #define CYL_4_TDC_ANGLE 0 /* TDC angle */
- #define CYL_4_INJ_ANGLE 0 /* Angle to inject Fuel */
- #define CYL_4_READ_ANGLE 0 /* Angle to sample sensors */
- #define CYL_4_IGN_CH 0 /* XGate ignition channel */
- #define CYL_4_PRIMARY_INJ_CH 0 /* XGate primary fuel channel */
- #define CYL_4_SECONDARY_INJ_CH 0 /* XGate secondary fuel channel */
- /* We just zero the rest of the cyl parameters, the ENGINE_CYLINDER_COUNT macro controls what gets processed */
- #define CYL_5_TDC_ANGLE 0 /* TDC angle */
- #define CYL_5_INJ_ANGLE 0 /* Angle to inject Fuel */
- #define CYL_5_READ_ANGLE 0 /* Angle to sample sensors */
- #define CYL_5_IGN_CH 0 /* XGate ignition channel */
- #define CYL_5_PRIMARY_INJ_CH 0 /* XGate primary fuel channel */
- #define CYL_5_SECONDARY_INJ_CH 0 /* XGate secondary fuel channel */
- #define CYL_6_TDC_ANGLE 0 /* TDC angle */
- #define CYL_6_INJ_ANGLE 0 /* Angle to inject Fuel */
- #define CYL_6_READ_ANGLE 0 /* Angle to sample sensors */
- #define CYL_6_IGN_CH 0 /* XGate ignition channel */
- #define CYL_6_PRIMARY_INJ_CH 0 /* XGate primary fuel channel */
- #define CYL_6_SECONDARY_INJ_CH 0 /* XGate secondary fuel channel */
- #define CYL_7_TDC_ANGLE 0 /* TDC angle */
- #define CYL_7_INJ_ANGLE 0 /* Angle to inject Fuel */
- #define CYL_7_READ_ANGLE 0 /* Angle to sample sensors */
- #define CYL_7_IGN_CH 0 /* XGate ignition channel */
- #define CYL_7_PRIMARY_INJ_CH 0 /* XGate primary fuel channel */
- #define CYL_7_SECONDARY_INJ_CH 0 /* XGate secondary fuel channel */
- #define CYL_8_TDC_ANGLE 0 /* TDC angle */
- #define CYL_8_INJ_ANGLE 0 /* Angle to inject Fuel */
- #define CYL_8_READ_ANGLE 0 /* Angle to sample sensors */
- #define CYL_8_IGN_CH 0 /* XGate ignition channel */
- #define CYL_8_PRIMARY_INJ_CH 0 /* XGate primary fuel channel */
- #define CYL_8_SECONDARY_INJ_CH 0 /* XGate secondary fuel channel */
- #define CYL_9_TDC_ANGLE 0 /* TDC angle */
- #define CYL_9_INJ_ANGLE 0 /* Angle to inject Fuel */
- #define CYL_9_READ_ANGLE 0 /* Angle to sample sensors */
- #define CYL_9_IGN_CH 0 /* XGate ignition channel */
- #define CYL_9_PRIMARY_INJ_CH 0 /* XGate primary fuel channel */
- #define CYL_9_SECONDARY_INJ_CH 0 /* XGate secondary fuel channel */
- #define CYL_10_TDC_ANGLE 0 /* TDC angle */
- #define CYL_10_INJ_ANGLE 0 /* Angle to inject Fuel */
- #define CYL_10_READ_ANGLE 0 /* Angle to sample sensors */
- #define CYL_10_IGN_CH 0 /* XGate ignition channel */
- #define CYL_10_PRIMARY_INJ_CH 0 /* XGate primary fuel channel */
- #define CYL_10_SECONDARY_INJ_CH 0 /* XGate secondary fuel channel */
- #define CYL_11_TDC_ANGLE 0 /* TDC angle */
- #define CYL_11_INJ_ANGLE 0 /* Angle to inject Fuel */
- #define CYL_11_READ_ANGLE 0 /* Angle to sample sensors */
- #define CYL_11_IGN_CH 0 /* XGate ignition channel */
- #define CYL_11_PRIMARY_INJ_CH 0 /* XGate primary fuel channel */
- #define CYL_11_SECONDARY_INJ_CH 0 /* XGate secondary fuel channel */
- #define CYL_12_TDC_ANGLE 0 /* TDC angle */
- #define CYL_12_INJ_ANGLE 0 /* Angle to inject Fuel */
- #define CYL_12_READ_ANGLE 0 /* Angle to sample sensors */
- #define CYL_12_IGN_CH 0 /* XGate ignition channel */
- #define CYL_12_PRIMARY_INJ_CH 0 /* XGate primary fuel channel */
- #define CYL_12_SECONDARY_INJ_CH 0 /* XGate secondary fuel channel */
- /* Primary Fan */
- #define GPIO_0_ENABLED TRUE
- #define GPIO_0_VARIABLE &CoreVars_g.CHT
- #define GPIO_0_UPPER_BOUNDARY DEGREES_C(95)
- #define GPIO_0_LOWER_BOUNDARY DEGREES_C(80)
- #define GPIO_0_REGISTER (uint8_t*)&PORTK
- #define GPIO_0_BIT_MASK BIT4
- #define GPIO_0_TRIGGER_HIGH TRUE
- #define GPIO_0_OUTPUT_POLARITY GPO_POLARITY_ENABLED_HIGH
- #define GPIO_0_IS_PARENT TRUE
- #define GPIO_0_DERATE FALSE
- #define GPIO_0_DERATE_LEVEL 0 /* Ignored since derate is false */
- #define GPIO_0_CHILD_ID 3 /* GPIO CH3 condition must also be true */
- #define GPIO_0_IS_OUTPUT TRUE
- #define GPIO_0_HAS_CHILD TRUE
- /* Secondary Fan */
- #define GPIO_1_ENABLED FALSE
- #define GPIO_1_VARIABLE &CoreVars_g.CHT
- #define GPIO_1_UPPER_BOUNDARY DEGREES_C(100)
- #define GPIO_1_LOWER_BOUNDARY DEGREES_C(90)
- #define GPIO_1_REGISTER (uint8_t*)&PORTK
- #define GPIO_1_BIT_MASK BIT5
- #define GPIO_1_TRIGGER_HIGH TRUE
- #define GPIO_1_OUTPUT_POLARITY GPO_POLARITY_ENABLED_HIGH
- #define GPIO_1_IS_PARENT TRUE
- #define GPIO_1_DERATE FALSE
- #define GPIO_1_DERATE_LEVEL 0 /* Ignored since derate is false */
- #define GPIO_1_CHILD_ID 3
- #define GPIO_1_IS_OUTPUT TRUE
- #define GPIO_1_HAS_CHILD TRUE
- /* Over temperature derate */
- #define GPIO_2_ENABLED TRUE
- #define GPIO_2_VARIABLE &CoreVars_g.CHT
- #define GPIO_2_UPPER_BOUNDARY DEGREES_C(105)
- #define GPIO_2_LOWER_BOUNDARY DEGREES_C(101)
- #define GPIO_2_REGISTER (uint8_t*)&PORTK
- #define GPIO_2_BIT_MASK BIT5
- #define GPIO_2_TRIGGER_HIGH TRUE
- #define GPIO_2_OUTPUT_POLARITY GPO_POLARITY_ENABLED_HIGH
- #define GPIO_2_IS_PARENT TRUE
- #define GPIO_2_DERATE TRUE
- #define GPIO_2_DERATE_LEVEL DERATE_LEVEL_ONE_LIMITS_INDEX /* Ignored since derate is false */
- #define GPIO_2_CHILD_ID 0
- #define GPIO_2_IS_OUTPUT TRUE
- #define GPIO_2_HAS_CHILD FALSE
- /* Secondary RPM condition for the Fans */
- #define GPIO_3_ENABLED TRUE
- #define GPIO_3_VARIABLE &CoreVars_g.RPM
- #define GPIO_3_UPPER_BOUNDARY RPM(700)
- #define GPIO_3_LOWER_BOUNDARY RPM(600)
- #define GPIO_3_REGISTER GPO_NULL_REGISTER_ADDRESS
- #define GPIO_3_BIT_MASK 0
- #define GPIO_3_TRIGGER_HIGH TRUE
- #define GPIO_3_OUTPUT_POLARITY GPO_POLARITY_ENABLED_HIGH
- #define GPIO_3_IS_PARENT FALSE /* The chain stops here */
- #define GPIO_3_DERATE FALSE
- #define GPIO_3_DERATE_LEVEL 0 /* Ignored since derate is false */
- #define GPIO_3_CHILD_ID 3 /* Ignored by setting this value to the same as ourselves */
- #define GPIO_3_IS_OUTPUT TRUE
- #define GPIO_3_HAS_CHILD FALSE
- /* Under temperature de-rate */
- #define GPIO_4_ENABLED TRUE
- #define GPIO_4_VARIABLE &CoreVars_g.CHT
- #define GPIO_4_UPPER_BOUNDARY DEGREES_C(65)
- #define GPIO_4_LOWER_BOUNDARY DEGREES_C(60)
- #define GPIO_4_REGISTER GPO_NULL_REGISTER_ADDRESS
- #define GPIO_4_BIT_MASK BIT5
- #define GPIO_4_TRIGGER_HIGH FALSE
- #define GPIO_4_OUTPUT_POLARITY GPO_POLARITY_ENABLED_HIGH
- #define GPIO_4_IS_PARENT TRUE
- #define GPIO_4_DERATE TRUE
- #define GPIO_4_DERATE_LEVEL DERATE_LEVEL_ONE_LIMITS_INDEX /* Ignored since derate is false */
- #define GPIO_4_CHILD_ID 0
- #define GPIO_4_IS_OUTPUT TRUE
- #define GPIO_4_HAS_CHILD FALSE
- /* Sensor Ranges */
- #define TPS_MINIMUM (0)
- #define TPS_MAXIMUM (1024 - 1)
- /* 2D LUTs */
- #define FUEL_DELTA_PERCENTS { FD(110.0), FD(150.0), FD(175.0), FD(200.0), FD(250.0), FD(300), FD(400), FD(500)}
- #define FUEL_DELTA_ADDER { FA(100.0), FA(120.0), FA(125.0), FA(150.0), FA(175.0), FA(200), FA(250), FA(300)}
- #define ARRAY_OF_16_IGN_IAT { IT(0), IT(0), IT(.5), IT(1), IT(3), IT(4), IT(5), IT(5.5), IT(6), IT(6.5), IT(7), IT(7.5), IT(8), IT(9), IT(10), IT(11)}
- #define ARRAY_OF_16_IGN_IAT_TEMPS { C(70), C(75), C(80), C(85), C(90), C(95), C(100), C(105), C(110), C(115), C(120), C(125), C(130), C(135), C(140), C(145)}
- #define ARRAY_OF_16_IGN_CLT_TEMPS { C(-30), C(-20), C(-10), C(0), C(10), C(20), C(30), C(40), C(50), C(60), C(70), C(80), C(90), C(100), C(110), C(120)}
- #define ARRAY_OF_16_IGN_CLT { IT(6), IT(5.5), IT(5), IT(4.5), IT(4.25), IT(4.0), IT(3.5), IT(3), IT(2), IT(1), IT(0), IT(0), IT(0), IT(0), IT(0), IT(0)}
- #define ARRAY_OF_16_ETHPERCENTS { EP(0), EP(5), EP(10), EP(15), EP(20), EP(30), EP(35), EP(40), EP(45), EP(55), EP(65), EP(75), EP(85), EP(90), EP(95), EP(100)}
- #define ARRAY_OF_16_IGN_ETH { IT(0), IT(0), IT(0), IT(0.5), IT(1.0), IT(1.25), IT(1.5), IT(2.0), IT(2.5), IT(3.0), IT(3.5), IT(4.0), IT(4.5), IT(5.0), IT(5.5), IT(6.0)}
- #define MAIN_DWELL_LOOKUP { AV(6.1), AV(7.3), AV(8.5), AV(9.1), AV(9.7), AV(10.3), AV(10.9), AV(11.4), AV(12.1), AV(12.7), AV(13.3), AV(13.9), AV(14.5), AV(17.9), AV(21.1), AV(24.5)}
- #define MAIN_DWELL_VALUES { MS(5.5), MS(5.5), MS(5.5), MS(5.5), MS(5.5), MS(5.5), MS(5.5), MS(5.5), MS(5.5), MS(5.5), MS(5.5), MS(5.5), MS(5.5), MS(5.5), MS(5.5), MS(5.5)}
- /* TODO move deadtimes to a lib file since they are constant across the same part numbers */
- #define DEAD_TIME_LOOKUP { AV(6.1), AV(7.3), AV(8.5), AV(9.1), AV(9.7), AV(10.3), AV(10.9), AV(11.4), AV(12.1), AV(12.7), AV(13.3), AV(13.9), AV(14.5), AV(17.9), AV(21.1), AV(24.5)}
- #define DEAD_TIME_VALUES { MS(2.91), MS(2.30), MS(1.86), MS(1.70), MS(1.58), MS(1.47), MS(1.39), MS(1.30), MS(1.23), MS(1.15), MS(1.10), MS(1.04), MS(0.99), MS(0.76), MS(0.57), MS(0.40)}
- // For Stepper Motor Idle Air Control
- #define ARRAY_OF_8_RPMS { RPM(500), RPM(700), RPM(900), RPM(1000), RPM(1200), RPM(1400), RPM(1600), RPM(1800) }
- #define ARRAY_OF_8_TEMPS { C(-30), C(-10), C(0), C(20), C(40), C(60), C(80), C(90) }
- #define ARRAY_OF_8_STEPS { 160, 120, 90, 70, 50, 40, 30, 10 }
- /* MAF table, likely always custom */
- #define MAF_LOOKUP {AV( 1.3), AV(1.403), AV(1.506), AV(1.609), AV(1.712), AV(1.816), AV(1.919), AV(2.022), AV(2.125), AV(2.22), AV(2.332), AV(2.435), AV(2.538), AV(2.641), AV(2.745), AV(2.848), AV(2.951), AV(3.054), AV(3.158), AV(3.261), AV( 3.364), AV(3.467), AV(3.570), AV(3.674), AV(3.777), AV(3.880), AV(3.983), AV(4.087), AV(4.190), AV(4.293), AV(4.396), AV(4.500)}
- #define MAF_GS {GS( 0 ), GS(0.207), GS(0.563), GS(0.832), GS(1.110), GS(1.300), GS(2.445), GS(3.040), GS(3.641), GS(4.08), GS(6.256), GS(9.614), GS(11.882), GS(15.216), GS(17.805), GS(24.467), GS(34.042), GS(36.973), GS(52.511), GS(60.216), GS(66.248), GS(70.653), GS(75.139), GS(84.066), GS(96.694), GS(120.055), GS(132.184), GS(156.114), GS(163.880), GS(170.516), GS(180.055), GS(199.532)}
- /* Pressure Sensors */
- #include "../data/tables/sensorLUTs/pressure.h"
- #define KPA_MAP KPA_MPX4250A
- #define LOOKUP_MAP AV_MPX4350A
- #define KPA_AAP KPA_DENSOR1
- #define LOOKUP_AAP AV_DENSOR1
- /* Primary EGO table LC2 */
- #define EGO_LAMBDA { LR(0.0), LR(0.50), LR(0.704), LR(0.908), LR(1.112), LR(1.316), LR(1.520), LR(1.99)}
- #define EGO_LOOKUP { AV(0.0), AV(0.50), AV(1.300), AV(2.100), AV(2.900), AV(3.700), AV(4.500), AV(5.00)}
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement