auto-sync
This commit is contained in:
parent
2dba0e0a71
commit
37f52a6930
|
@ -1,25 +0,0 @@
|
|||
/**
|
||||
* @file can_header.h
|
||||
*
|
||||
* @date Dec 21, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2016
|
||||
*/
|
||||
|
||||
#ifndef CAN_HEADER_H_
|
||||
#define CAN_HEADER_H_
|
||||
|
||||
#include "rusefi_enums.h"
|
||||
|
||||
/**
|
||||
* Net Body Computer types
|
||||
*/
|
||||
typedef enum {
|
||||
CAN_BUS_NBC_BMW = 0,
|
||||
CAN_BUS_NBC_FIAT = 1,
|
||||
CAN_BUS_NBC_VAG = 2,
|
||||
CAN_BUS_MAZDA_RX8 = 3,
|
||||
|
||||
Internal_ForceMyEnumIntSize_can_nbc = ENUM_32_BITS,
|
||||
} can_nbc_e;
|
||||
|
||||
#endif /* CAN_HEADER_H_ */
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "efifeatures.h"
|
||||
#include "crc.h"
|
||||
#include "can_header.h"
|
||||
#include "rusefi_enums.h"
|
||||
#include "global.h"
|
||||
#include "rusefi_types.h"
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jan 14 23:21:45 EST 2016
|
||||
// begin
|
||||
|
||||
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
|
||||
#define ENGINE_CONFIGURATION_GENERATED_H_
|
||||
|
||||
#include "rusefi_types.h"
|
||||
typedef struct {
|
||||
/**
|
||||
|
@ -1607,5 +1611,6 @@ typedef struct {
|
|||
/** total size 16088*/
|
||||
} persistent_config_s;
|
||||
|
||||
#endif
|
||||
// end
|
||||
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jan 14 23:21:45 EST 2016
|
||||
|
|
|
@ -640,5 +640,16 @@ typedef enum {
|
|||
Internal_ForceMyEnumIntSize_chamber_stype = ENUM_32_BITS,
|
||||
} chamber_style_e;
|
||||
|
||||
/**
|
||||
* Net Body Computer types
|
||||
*/
|
||||
typedef enum {
|
||||
CAN_BUS_NBC_BMW = 0,
|
||||
CAN_BUS_NBC_FIAT = 1,
|
||||
CAN_BUS_NBC_VAG = 2,
|
||||
CAN_BUS_MAZDA_RX8 = 3,
|
||||
|
||||
Internal_ForceMyEnumIntSize_can_nbc = ENUM_32_BITS,
|
||||
} can_nbc_e;
|
||||
|
||||
#endif /* RUSEFI_ENUMS_H_ */
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
#include "voltage.h"
|
||||
#include "pid.h"
|
||||
|
||||
#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__)
|
||||
|
||||
|
||||
EXTERN_ENGINE
|
||||
;
|
||||
|
||||
|
@ -25,7 +28,8 @@ static Logging *logger;
|
|||
|
||||
static SimplePwm alternatorControl;
|
||||
static OutputPin alternatorPin;
|
||||
static Pid altPid(10, 0, 0, 1, 90);
|
||||
static pid_s *altPidS = &persistentState.persistentConfiguration.engineConfiguration.alternatorControl;
|
||||
static Pid altPid(altPidS, 1, 90);
|
||||
|
||||
static THD_WORKING_AREA(alternatorControlThreadStack, UTILITY_THREAD_STACK_SIZE);
|
||||
|
||||
|
@ -108,3 +112,5 @@ void initAlternatorCtrl(Logging *sharedLogger) {
|
|||
|
||||
applySettings();
|
||||
}
|
||||
|
||||
#endif /* EFI_ALTERNATOR_CONTROL */
|
||||
|
|
|
@ -54,7 +54,8 @@ static OutputPin output2 CCM_OPTIONAL;
|
|||
static OutputPin outputDirectionOpen CCM_OPTIONAL;
|
||||
static OutputPin outputDirectionClose CCM_OPTIONAL;
|
||||
|
||||
static Pid pid(1, 0, 0, 0, 100);
|
||||
static pid_s etbS;
|
||||
static Pid pid(&etbS, 0, 100);
|
||||
|
||||
static float prevTps;
|
||||
|
||||
|
|
|
@ -9,10 +9,8 @@
|
|||
|
||||
#include "pid.h"
|
||||
|
||||
Pid::Pid(float pFactor, float iFactor, float dFactor, float minResult, float maxResult) {
|
||||
this->pFactor = pFactor;
|
||||
this->iFactor = iFactor;
|
||||
this->dFactor = dFactor;
|
||||
Pid::Pid(pid_s *pid, float minResult, float maxResult) {
|
||||
this->pid = pid;
|
||||
this->minResult = minResult;
|
||||
this->maxResult = maxResult;
|
||||
|
||||
|
@ -23,9 +21,9 @@ Pid::Pid(float pFactor, float iFactor, float dFactor, float minResult, float max
|
|||
float Pid::getValue(float target, float input, float dTime) {
|
||||
float error = target - input;
|
||||
|
||||
float pTerm = pFactor * error;
|
||||
iTerm += iFactor * dTime * error;
|
||||
float dTerm = dFactor / dTime * (error - prevError);
|
||||
float pTerm = pid->pFactor * error;
|
||||
iTerm += pid->iFactor * dTime * error;
|
||||
float dTerm = pid->dFactor / dTime * (error - prevError);
|
||||
|
||||
prevError = error;
|
||||
|
||||
|
@ -41,9 +39,9 @@ float Pid::getValue(float target, float input, float dTime) {
|
|||
}
|
||||
|
||||
void Pid::updateFactors(float pFactor, float iFactor, float dFactor) {
|
||||
this->pFactor = pFactor;
|
||||
this->iFactor = iFactor;
|
||||
this->dFactor = dFactor;
|
||||
pid->pFactor = pFactor;
|
||||
pid->iFactor = iFactor;
|
||||
pid->dFactor = dFactor;
|
||||
reset();
|
||||
}
|
||||
|
||||
|
@ -53,11 +51,11 @@ void Pid::reset(void) {
|
|||
}
|
||||
|
||||
float Pid::getP(void) {
|
||||
return pFactor;
|
||||
return pid->pFactor;
|
||||
}
|
||||
|
||||
float Pid::getI(void) {
|
||||
return iFactor;
|
||||
return pid->iFactor;
|
||||
}
|
||||
|
||||
float Pid::getIntegration(void) {
|
||||
|
@ -65,7 +63,7 @@ float Pid::getIntegration(void) {
|
|||
}
|
||||
|
||||
float Pid::getD(void) {
|
||||
return dFactor;
|
||||
return pid->dFactor;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,10 +8,12 @@
|
|||
#ifndef PID_H_
|
||||
#define PID_H_
|
||||
|
||||
#include "engine_configuration_generated_structures.h"
|
||||
|
||||
class Pid {
|
||||
|
||||
public:
|
||||
Pid(float pFactor, float iFactor, float dFactor, float minResult, float maxResult);
|
||||
Pid(pid_s *pid, float minResult, float maxResult);
|
||||
float getValue(float target, float input, float dTime);
|
||||
void updateFactors(float pFactor, float iFactor, float dFactor);
|
||||
void reset(void);
|
||||
|
@ -20,15 +22,12 @@ public:
|
|||
float getIntegration(void);
|
||||
float getD(void);
|
||||
private:
|
||||
float pFactor;
|
||||
float iFactor;
|
||||
float dFactor;
|
||||
pid_s *pid;
|
||||
float minResult;
|
||||
float maxResult;
|
||||
|
||||
float iTerm;
|
||||
float prevError;
|
||||
|
||||
};
|
||||
|
||||
#endif /* PID_H_ */
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include "pin_repository.h"
|
||||
#include "engine_state.h"
|
||||
#include "can_header.h"
|
||||
#include "engine_configuration.h"
|
||||
#include "vehicle_speed.h"
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
|
|
@ -946,7 +946,7 @@ fileVersion = { 20151201 }
|
|||
gauge3 = throttleGauge
|
||||
gauge4 = mafGaugeVolts
|
||||
gauge5 = afr1Gauge
|
||||
gauge6 = tpsADCGauge
|
||||
gauge6 = VBattGauge
|
||||
gauge7 = dwellGauge
|
||||
gauge8 = ignadvGauge
|
||||
|
||||
|
@ -985,14 +985,14 @@ fileVersion = { 20151201 }
|
|||
; Channel Label Type Format
|
||||
entry = time, "Time", float, "%.3f"
|
||||
entry = rpm, "RPM", int, "%d"
|
||||
entry = coolant, "CLT", float, "%.1f"
|
||||
entry = intake, "IAT", float, "%.1f"
|
||||
entry = coolant, "CLT", float, "%.2f"
|
||||
entry = intake, "IAT", float, "%.2f"
|
||||
entry = TPS, "TPS", float, "%d"
|
||||
entry = MAF, "MAF", float, "%.2f"
|
||||
entry = MAPValue, "MAP", float, "%d"
|
||||
entry = MAPValue, "MAP", float, "%.1f"
|
||||
entry = AFRactual, "AFR", float, "%.2f"
|
||||
entry = VBatt, "vBatt", float, "%.2f"
|
||||
entry = engineLoad, "Load", float, "%d"
|
||||
entry = engineLoad, "Load", float, "%.1f"
|
||||
entry = ign_adv, "ignAdv", float, "%.2f"
|
||||
entry = knockLevel, "Knock", float, "%.2f"
|
||||
entry = vehicleSpeedKph, "speed", float, "%.2f"
|
||||
|
@ -1007,7 +1007,7 @@ fileVersion = { 20151201 }
|
|||
entry = engineLoadAccelDelta, "fuel: EL accel",float, "%.3f"
|
||||
entry = tpsAccelFuel, "fuel: tpsAccel", float, "%.3f"
|
||||
entry = iatCorrection, "fuel: IAT corr", float, "%.3f"
|
||||
entry = wallFuelCorrection, "fuel: wall corr ms", float, "%.3f"
|
||||
entry = wallFuelCorrection,"fuel: wall corr ms", float, "%.3f"
|
||||
entry = wallFuelAmount, "fuel: wall amout", float, "%.3f"
|
||||
|
||||
entry = baroCorrection "baroCorrection",float,"%.3f"
|
||||
|
|
|
@ -39,7 +39,12 @@ void testIdleController(void) {
|
|||
|
||||
void testPidController(void) {
|
||||
print("******************************************* testPidController\r\n");
|
||||
Pid pid(50, 0.5, 0, 10, 90);
|
||||
pid_s pidS;
|
||||
pidS.pFactor = 50;
|
||||
pidS.iFactor = 0.5;
|
||||
pidS.dFactor = 0;
|
||||
|
||||
Pid pid(&pidS, 10, 90);
|
||||
|
||||
assertEquals(90, pid.getValue(14, 12, 0.1));
|
||||
|
||||
|
|
Loading…
Reference in New Issue