123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #ifndef __CTN_CAL_H
- #define __CTN_CAL_H
- #include "plt.h"
- enum ctn_cal_err_t{
- CTN_CALERR_NONE = 0,
- CTN_CALERR_LAUNCH_GET_DATA_LINE_NBR = 1,
- CTN_CALERR_LAUNCH_GET_RECORD_DATA_ERR = 2,
- CTN_CALERR_LAUNCH_GET_CYCLE = 3,
- CTN_CALERR_LAUNCH_INSERT_ONE_LINR_DATA = 4,
- CTN_CALERR_RUN_UPDATE_SOC = 5,
- };
- struct ctn_cal_soc_t{
- double a1_chg;
- double b1_chg;
- double a2_chg;
- double b2_chg;
-
- double a1_dhg;
- double b1_dhg;
- double a2_dhg;
- double b2_dhg;
- double extre_p;
-
- double soc_base;
- double soc;
-
- double dhg_energy_basic;
- double dhg_energy_p;
- double dhg_energy_pr;
- double meter_neg_energy_base;
-
- double chg_energy_basic;
- double chg_energy_p;
- double chg_energy_pr;
- double meter_pos_energy_base;
-
- double last_p;
- int last_ctn_state;
- long long ts_last;
- };
- struct ctn_cal_t{
- struct ctn_cal_soc_t cal_soc;
- double cycle;
- int meter_model;
- char szmeter_model[20];
- int meter_idx;
- sqlite3* db;
- int cmd;
- struct statemachine_t sm;
- double meter_neg_energy_last;
- double soh;
- };
- int ctn_cal_init();
- int ctn_cal_get_tool_data(char* buf);
- int ctn_cal_set_cmd(int cmd);
- int ctn_cal_get_cmd( void );
- int ctn_cal_get_tb_data(char* data);
- int ctn_cal_get_state( void );
- int ctn_cal_set_soc(double soc);
- int ctn_cal_set_cycle(double soc);
- int ctn_cal_set_chg_param(double a1_chg,double b1_chg,double a2_chg,double b2_chg);
- int ctn_cal_set_dhg_param(double a1_dhg,double b1_dhg,double a2_dhg,double b2_dhg);
- int ctn_cal_set_soh(double soh);
- int ctn_cat_get_soc(void);
- int ctn_cal_get_cycle(void);
- #endif
|