|
|
@@ -27,14 +27,6 @@ static int can_GBT27930_send_stop(GBT27930_t* dev, int REASON)
|
|
|
return can_GBT27930_send_CST(dev, &dev->cst);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-//接收补充设置
|
|
|
-void pgn_run(GBT27930_t* dev,int pgn)
|
|
|
-{
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
static int can_GBT27930_send_timeout(GBT27930_t* dev, int STATE)
|
|
|
{
|
|
|
ccu_port_t *ccu = (ccu_port_t*)dev->ccu;
|
|
|
@@ -339,19 +331,28 @@ static int can_GBT27930_PreCharge(GBT27930_t* dev)
|
|
|
return GBT_27930_2015_ERROR;
|
|
|
}
|
|
|
//GB18487.1-2023.B.4.4
|
|
|
- if(((dev->bcp.bmsVoltage*1.05) < (uint16_t)(secc->VMeters*10 + 0.5))|| ((dev->bcp.bmsVoltage*0.95) > (uint16_t)(secc->VMeters*10 + 0.5)))
|
|
|
- {
|
|
|
- can_GBT27930_send_stop(dev, GBT_27930_STOP_VOLTAGE_MISTACH);
|
|
|
- secc_set_error(secc, GUN_PRECHARGE_FAULT);
|
|
|
- printd("SECC(%d) BMS Battery Voltage exceed the range of SECC\n", secc->config->connectorId);
|
|
|
- return GBT_27930_2015_ERROR;
|
|
|
- }
|
|
|
+ //2秒钟延时,使获取电表电压准确
|
|
|
+ WAIT_CONDI(
|
|
|
+ wait_time,2000,
|
|
|
+ SPILTE(
|
|
|
+ can_GBT27930_send_stop(dev, GBT_27930_STOP_VOLTAGE_MISTACH);
|
|
|
+ secc_set_error(secc, GUN_PRECHARGE_FAULT);
|
|
|
+ printccui("SECC(%d) BMS Battery Voltage exceed the range of SECC\n", (uint16_t)(secc->VMeters*10 + 0.5));
|
|
|
+ return GBT_27930_2015_ERROR;
|
|
|
+ ),
|
|
|
+ printd(" PreCharging.maxVoltage:%f,minVoltage:%f, maxCurrent:%f, minCurrent:%f\n", secc->SECC_maxV, secc->SECC_minV, secc->SECC_maxI, secc->SECC_minI);
|
|
|
+ if(((dev->bcp.bmsVoltage*1.05) >(uint16_t)(secc->VMeters*10+0.5))&& ((dev->bcp.bmsVoltage*0.95) < (uint16_t)(secc->VMeters*10+0.5)))
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ );
|
|
|
//GB18487.1-2023.B.4.4
|
|
|
- if(((uint16_t)(secc->VMeters*10 + 0.5) >secc->SECC_maxV) ||(((uint16_t)(secc->VMeters*10 + 0.5) <secc->SECC_minV)))
|
|
|
+ if(((uint16_t)(secc->VMeters) >secc->SECC_maxV) ||(((uint16_t)(secc->VMeters) <secc->SECC_minV)))
|
|
|
{
|
|
|
can_GBT27930_send_stop(dev, GBT_27930_STOP_VOLTAGE_MISTACH);
|
|
|
secc_set_error(secc, GUN_PRECHARGE_FAULT);
|
|
|
- printd("SECC(%d) BMS Battery Voltage exceed the range of SECC\n", secc->config->connectorId);
|
|
|
+ printccui("secc->SECC_maxV =%f,secc->SECC_minV=%f\n",secc->SECC_maxV,secc->SECC_minV);
|
|
|
+ printccui("SECC(%d) BMS Battery Voltage exceed the range of SECC\n", (uint16_t)(secc->VMeters*10 + 0.5));
|
|
|
return GBT_27930_2015_ERROR;
|
|
|
}
|
|
|
printccui("step\n");
|
|
|
@@ -365,7 +366,7 @@ static int can_GBT27930_PreCharge(GBT27930_t* dev)
|
|
|
|
|
|
APPLY(GBT_27930_2015_BRO);
|
|
|
WAIT_CONDI(
|
|
|
- wait_time,60000,
|
|
|
+ wait_time,wait_time,
|
|
|
,
|
|
|
RECV_BMS_1(dev,GBT_27930_2015_BRO);
|
|
|
TIME_OUT(dev,GBT_27930_2015_BRO);
|
|
|
@@ -375,7 +376,7 @@ static int can_GBT27930_PreCharge(GBT27930_t* dev)
|
|
|
can_GBT27930_send_CML(dev, &dev->cml);
|
|
|
dev->bro.status = 0x00;//清零
|
|
|
WAIT_CONDI(
|
|
|
- wait_time,wait_time,
|
|
|
+ wait_time,wait_time+59000,
|
|
|
SPILTE(
|
|
|
can_GBT27930_send_timeout(dev, GBT_27930_2015_BRO);
|
|
|
secc_set_state(secc, GUN_COMFALUT);
|
|
|
@@ -423,7 +424,6 @@ static int can_GBT27930_PreCharge(GBT27930_t* dev)
|
|
|
secc_set_state(secc, GUN_EMERGRNCY_STOP);
|
|
|
return GBT_27930_2015_ERROR;
|
|
|
}
|
|
|
- msleep(200);
|
|
|
);
|
|
|
printccui("step\n");
|
|
|
secc_set_error(secc, GUN_PRECHARGE_FAULT);
|
|
|
@@ -491,11 +491,35 @@ static int can_GBT27930_Charging(GBT27930_t* dev)
|
|
|
{
|
|
|
float voltage = (((float)dev->bcl.bmsVoltage_request) / 10);
|
|
|
float current = (((float)dev->bcl.bmsCurrent_request) / 10);
|
|
|
+
|
|
|
+
|
|
|
//printi("SECC(%d) BCL voltage:%f, current:%f, mode:%d\n", secc->config->connectorId, voltage, current, dev->bcl.bmsChargeMode);
|
|
|
//printccui("SBCL secc->VMeters:%f, secc->VGround:%f,secc->I=IMeters:%f\n",secc->VMeters, secc->VGround,secc->IMeters);
|
|
|
printccui("SECC(%d) BCL voltage:%f, current:%f, mode:%d\n", secc->config->connectorId, voltage, current, dev->bcl.bmsChargeMode);
|
|
|
- if (dev->bcl.bmsChargeMode == 1) { secc_request_power(secc, POWER_REQUEST_CONST_VOLTAGE, voltage, current); }
|
|
|
- if (dev->bcl.bmsChargeMode == 2) { secc_request_power(secc, POWER_REQUEST_CONST_CURRENT, voltage, current); }
|
|
|
+ if (dev->bcl.bmsChargeMode == 1) {
|
|
|
+ //NB33001-7.8.8
|
|
|
+ float diff_vol = voltage - secc->VMeters;
|
|
|
+ if(diff_vol>0){
|
|
|
+ voltage = (diff_vol/2 >5)?(voltage+5):(voltage+ diff_vol/2); // 最多补偿5V避免,避免电表失真导致输出异常
|
|
|
+ }else{
|
|
|
+ voltage = (diff_vol/2 <-5)?(voltage-5):(voltage+ diff_vol/2);
|
|
|
+ }
|
|
|
+ secc_request_power(secc, POWER_REQUEST_CONST_VOLTAGE, voltage, current);
|
|
|
+ }
|
|
|
+ if (dev->bcl.bmsChargeMode == 2) {
|
|
|
+ //NB33001-7.8.9
|
|
|
+ float diff_I = current - secc->IMeters;
|
|
|
+ float comp_max = 0;
|
|
|
+ if(current >30)comp_max = current/100;
|
|
|
+ if(current <=30)comp_max =0.3;
|
|
|
+ if(diff_I>0){
|
|
|
+ voltage = (diff_I/2 >comp_max)?(voltage+comp_max):(voltage+ diff_I/2); // 最多补偿5V避免,避免电表失真导致输出异常
|
|
|
+ }else{
|
|
|
+ diff_I = fabsf(diff_I);
|
|
|
+ voltage = (diff_I/2 >comp_max)?(voltage-comp_max):(voltage- diff_I/2);
|
|
|
+ }
|
|
|
+ secc_request_power(secc, POWER_REQUEST_CONST_CURRENT, voltage, current);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|