2024-08-09 06:24:48 +00:00
|
|
|
|
#include "CDZ_DATA.h"
|
|
|
|
|
|
|
|
|
|
bool Set_VCU_Charging_Allowed(enum VCU_ChrgAllowed setting_up);
|
|
|
|
|
bool Set_BMS_Working_Mode(enum VCU_Mode setting_up);
|
|
|
|
|
bool Set_BMS_Working_Status(enum BMS_WorkStatus setting_up);
|
|
|
|
|
bool Set_DCU_Charging_Allowed(enum BMS_ChrgAllow setting_up);
|
|
|
|
|
bool Set_BMS_OncConSt_Status(enum BMS_OncConSt setting_up);
|
|
|
|
|
|
|
|
|
|
bool Get_VCU_Charging_Allowed(struct Car_message* self);
|
|
|
|
|
enum VCU_Mode Get_BMS_Working_Mode(struct Car_message* self);
|
|
|
|
|
bool Get_BMS_Working_Status(struct Car_message* self);
|
|
|
|
|
bool Get_DCU_Charging_Allowed(struct Car_message* self);
|
|
|
|
|
uint8_t Get_BMS_OncConSt_Status(struct Car_message* self);
|
|
|
|
|
|
|
|
|
|
struct Car_message Car_Message = {
|
|
|
|
|
.Set_BMS_Charging_allowance = Set_DCU_Charging_Allowed,
|
|
|
|
|
.Get_BMS_Charging_allowance = Get_DCU_Charging_Allowed,
|
|
|
|
|
|
|
|
|
|
.Set_Car_Charging_allowance = Set_VCU_Charging_Allowed,
|
|
|
|
|
.Get_Car_Charging_allowance = Get_VCU_Charging_Allowed,
|
|
|
|
|
|
|
|
|
|
.Set_Car_Working_Mode = Set_BMS_Working_Mode,
|
|
|
|
|
.Get_Car_Working_Mode = Get_BMS_Working_Mode,
|
|
|
|
|
|
|
|
|
|
.Set_Car_Working_Status = Set_BMS_Working_Status,
|
|
|
|
|
.Get_Car_Working_Status = Get_BMS_Working_Status,
|
|
|
|
|
|
|
|
|
|
.Set_Car_OncConSt_Status = Set_BMS_OncConSt_Status,
|
|
|
|
|
.Get_Car_OncConSt_Status = Get_BMS_OncConSt_Status,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct BMD_TO_CDZ BMSDefaultParameters = {
|
|
|
|
|
|
|
|
|
|
.parenr = &Car_Message,
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ֵת<D6B5><D7AA><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
uint16_t ValueData__to_physical(uint16_t Data,float factor,int16_t offset)
|
|
|
|
|
{
|
|
|
|
|
return (uint16_t)(Data*factor + offset);
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ֵת<D6B5><D7AA><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
uint16_t ValuePhysical_to_Data(uint16_t Physical,float factor,int16_t offset)
|
|
|
|
|
{
|
|
|
|
|
return (uint16_t)((Physical - offset)/factor);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ֵת<D6B5><D7AA><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
int16_t Int_ValueData__to_physical(uint16_t Data,float factor,int16_t offset)
|
|
|
|
|
{
|
|
|
|
|
return (int16_t)(Data*factor + offset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ֵת<D6B5><D7AA><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
int16_t IntValuePhysical_to_Data(uint16_t Physical,float factor,int16_t offset)
|
|
|
|
|
{
|
|
|
|
|
return (int16_t)((Physical - offset)/factor);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>VCU<43><55><EFBFBD><EFBFBD>״̬
|
|
|
|
|
bool Set_VCU_Charging_Allowed(enum VCU_ChrgAllowed setting_up)
|
|
|
|
|
{
|
|
|
|
|
Car_Message.VCU_ChrgAllowed = setting_up;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ȡVCU<43><55><EFBFBD><EFBFBD>״̬
|
|
|
|
|
bool Get_VCU_Charging_Allowed(struct Car_message* self)
|
|
|
|
|
{
|
|
|
|
|
if(self->VCU_ChrgAllowed == ALLOWED)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if(self->VCU_ChrgAllowed == NOT_ALLOWED)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>BMS<4D><53><EFBFBD><EFBFBD>ģʽ
|
|
|
|
|
bool Set_BMS_Working_Mode(enum VCU_Mode setting_up)
|
|
|
|
|
{
|
|
|
|
|
Car_Message.VCU_Mode = setting_up;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ȡBMS<4D><53><EFBFBD><EFBFBD>ģʽ
|
|
|
|
|
enum VCU_Mode Get_BMS_Working_Mode(struct Car_message* self)
|
|
|
|
|
{
|
|
|
|
|
return self->VCU_Mode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>BMS<4D><53><EFBFBD><EFBFBD>״̬
|
|
|
|
|
bool Set_BMS_Working_Status(enum BMS_WorkStatus setting_up)
|
|
|
|
|
{
|
|
|
|
|
if( (setting_up != HV_finished) && (setting_up != HV_shutdown) )
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Car_Message.BMS_WorkStatus = setting_up;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ȡBMS<4D><53><EFBFBD><EFBFBD>״̬
|
|
|
|
|
bool Get_BMS_Working_Status(struct Car_message* self)
|
|
|
|
|
{
|
|
|
|
|
if(self->BMS_WorkStatus == HV_finished)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if(self->BMS_WorkStatus == HV_shutdown)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>BMS<4D><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
bool Set_DCU_Charging_Allowed(enum BMS_ChrgAllow setting_up)
|
|
|
|
|
{
|
|
|
|
|
if( (setting_up !=allow) && (setting_up != refuse) )
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Car_Message.BMS_ChrgAllowed = setting_up;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ȡBMS<4D><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
bool Get_DCU_Charging_Allowed(struct Car_message* self)
|
|
|
|
|
{
|
|
|
|
|
if(self->BMS_ChrgAllowed == allow)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if(self->BMS_ChrgAllowed == refuse)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//BMS<4D><53>ǹ<EFBFBD><C7B9><EFBFBD><EFBFBD>״̬
|
|
|
|
|
bool Set_BMS_OncConSt_Status(enum BMS_OncConSt setting_up)
|
|
|
|
|
{
|
|
|
|
|
Car_Message.BMS_OncConSt = setting_up;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint8_t Get_BMS_OncConSt_Status(struct Car_message* self)
|
|
|
|
|
{
|
|
|
|
|
return self->BMS_OncConSt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void initializeBMS_default_parameters(void)
|
|
|
|
|
{
|
|
|
|
|
BMSDefaultParameters.uBatCurSOC = 20;
|
|
|
|
|
//BHM
|
|
|
|
|
BMSDefaultParameters.BHM.Maximum_allowable_total_charging_voltage = 5000;//<2F><><EFBFBD><EFBFBD>0.1
|
|
|
|
|
|
|
|
|
|
//BRM
|
|
|
|
|
BMSDefaultParameters.BRM.VersionNumber.fields.VersionArr[0] = 0x01;
|
|
|
|
|
BMSDefaultParameters.BRM.VersionNumber.fields.VersionArr[1] = 0x01;
|
|
|
|
|
BMSDefaultParameters.BRM.VersionNumber.fields.VersionArr[2] = 0x00;
|
|
|
|
|
BMSDefaultParameters.BRM.BatteryType = LFP_battery;
|
|
|
|
|
BMSDefaultParameters.BRM.RatedCapacity = 1000;//<2F><><EFBFBD><EFBFBD>0.1
|
|
|
|
|
BMSDefaultParameters.BRM.RatedTotalVoltage = 4200;//<2F><><EFBFBD><EFBFBD>0.1<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>Ĭ<EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>ұ<EFBFBD><D2B1><EFBFBD>
|
|
|
|
|
BMSDefaultParameters.BRM.Battery_manufacturer[0] = 'B';
|
|
|
|
|
BMSDefaultParameters.BRM.Battery_manufacturer[1] = 'Y';
|
|
|
|
|
BMSDefaultParameters.BRM.Battery_manufacturer[2] = 'D';
|
|
|
|
|
BMSDefaultParameters.BRM.Battery_manufacturer[3] = 'T';
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
BMSDefaultParameters.BRM.BatterySerialNumber[0] = 0X00;
|
|
|
|
|
BMSDefaultParameters.BRM.BatterySerialNumber[1] = 0X00;
|
|
|
|
|
BMSDefaultParameters.BRM.BatterySerialNumber[2] = 0X01;
|
|
|
|
|
BMSDefaultParameters.BRM.BatterySerialNumber[3] = 0X02;
|
|
|
|
|
|
|
|
|
|
BMSDefaultParameters.BRM.Batteryack_production_dateYesr = 25;
|
|
|
|
|
BMSDefaultParameters.BRM.Batteryack_production_dateMouth = 0x0B;
|
|
|
|
|
BMSDefaultParameters.BRM.Batteryack_production_dateData = 0X0A;
|
|
|
|
|
|
|
|
|
|
BMSDefaultParameters.BRM.Battery_pack_charge_count.fields.ChargeCount[0] = 0x00;
|
|
|
|
|
BMSDefaultParameters.BRM.Battery_pack_charge_count.fields.ChargeCount[1] = 0x00;
|
|
|
|
|
BMSDefaultParameters.BRM.Battery_pack_charge_count.fields.ChargeCount[2] = 0x10;
|
|
|
|
|
|
|
|
|
|
BMSDefaultParameters.BRM.Battery_pack_property_right_identification = 0;
|
|
|
|
|
BMSDefaultParameters.BRM.reserve = 0;
|
|
|
|
|
memcpy(BMSDefaultParameters.BRM.ucCarVin,"LVPC5279XND013818",17);
|
|
|
|
|
memcpy(BMSDefaultParameters.BRM.BMS_Software_version_number,"S001H001",8);
|
|
|
|
|
|
|
|
|
|
//BCP
|
|
|
|
|
BMSDefaultParameters.BCP.MaxChargingVoltageSingle = 420;//<2F><><EFBFBD><EFBFBD>0.01
|
|
|
|
|
// BMSDefaultParameters.BCP.MaxChargingCurrent = ValuePhysical_to_Data(-400,0.1,-400);//<2F><><EFBFBD><EFBFBD>0.1 ƫ<><C6AB>-400
|
|
|
|
|
BMSDefaultParameters.BCP.MaxChargingCurrent = 500;
|
|
|
|
|
//BMSDefaultParameters.BCP.NominalTotalEnergy = 310;//31<33>ȵ<EFBFBD>
|
|
|
|
|
BMSDefaultParameters.BCP.MaxTotalChargingVoltage = 4900;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ
|
|
|
|
|
|
|
|
|
|
BMSDefaultParameters.BCP.MaxTemperature = 110;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
|
|
|
|
BMSDefaultParameters.BCP.ChargeState = 200;//<2F><><EFBFBD><EFBFBD>SOC״̬
|
|
|
|
|
BMSDefaultParameters.BCP.CurrentVoltage = 4000;//<2F><>ǰ<EFBFBD><C7B0><EFBFBD>ص<EFBFBD>ѹ
|
|
|
|
|
|
|
|
|
|
//BRO
|
|
|
|
|
BMSDefaultParameters.BRO.Whether_the_BMS_is_ready = 0;//00<30><30><EFBFBD><EFBFBD>AA
|
|
|
|
|
|
|
|
|
|
//BCL
|
|
|
|
|
BMSDefaultParameters.BCL.VoltageDemand = 4000;//<2F><><EFBFBD><EFBFBD>0.1
|
|
|
|
|
// BMSDefaultParameters.BCL.CurrentDemand = ValuePhysical_to_Data(-5,0.1,-400);//<2F><><EFBFBD><EFBFBD>0.1 ƫ<><C6AB>-400
|
|
|
|
|
BMSDefaultParameters.BCL.CurrentDemand = 600;
|
|
|
|
|
BMSDefaultParameters.BCL.Mode = ConstantCurrent;
|
|
|
|
|
|
|
|
|
|
//BCS
|
|
|
|
|
BMSDefaultParameters.BCS.ChargingVoltage = 0;
|
|
|
|
|
BMSDefaultParameters.BCS.ChargingCurrent = 0;
|
|
|
|
|
BMSDefaultParameters.BCS.MaxSingleCellVoltage.fields.voltage = 324;
|
|
|
|
|
BMSDefaultParameters.BCS.MaxSingleCellVoltage.fields.group = 1;
|
|
|
|
|
|
|
|
|
|
BMSDefaultParameters.BCS.RemainingChargeTime = 60;
|
|
|
|
|
|
|
|
|
|
//BSM
|
|
|
|
|
BMSDefaultParameters.BSM.highest_cell_voltage_number = 1;
|
|
|
|
|
BMSDefaultParameters.BSM.highest_battery_temperature = ValuePhysical_to_Data(10,0.1,-50);
|
|
|
|
|
BMSDefaultParameters.BSM.highest_temperature_detection_point = 3;
|
|
|
|
|
BMSDefaultParameters.BSM.lowest_battery_temperature = ValuePhysical_to_Data(5,0.1,-50);
|
|
|
|
|
BMSDefaultParameters.BSM.lowest_temperature_detection_point = 4;
|
|
|
|
|
|
|
|
|
|
BMSDefaultParameters.BSM.high_low_voltage_status = Normal;
|
|
|
|
|
BMSDefaultParameters.BSM.high_low_SOC_status = Normal;
|
|
|
|
|
BMSDefaultParameters.BSM.charging_overcurrent_status = Normal;
|
|
|
|
|
BMSDefaultParameters.BSM.high_temperature_status = Normal;
|
|
|
|
|
|
|
|
|
|
BMSDefaultParameters.BSM.insulation_status = Normal;
|
|
|
|
|
BMSDefaultParameters.BSM.output_connector_status = Normal;
|
|
|
|
|
BMSDefaultParameters.BSM.charging_permission = Normal;
|
|
|
|
|
|
|
|
|
|
//BST
|
|
|
|
|
BMSDefaultParameters.BST.charge_abort_reason = 01;
|
|
|
|
|
BMSDefaultParameters.BST.charge_abort_faults = 00;
|
|
|
|
|
BMSDefaultParameters.BST.charge_abort_errors = 00;
|
|
|
|
|
//BSD
|
|
|
|
|
BMSDefaultParameters.BSD.soc_abort = 100;
|
|
|
|
|
BMSDefaultParameters.BSD.min_cell_voltage = 345;
|
|
|
|
|
BMSDefaultParameters.BSD.max_cell_voltage = 355;
|
|
|
|
|
BMSDefaultParameters.BSD.min_battery_temperature = ValuePhysical_to_Data(25,0.1,-50);
|
|
|
|
|
BMSDefaultParameters.BSD.max_battery_temperature = ValuePhysical_to_Data(28,0.1,-50);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|