#ifndef __IES1000_H__ #define __IES1000_H__ enum ies1000_cmd_t{ CMD_ies1000_set_dev_aps = 0, CMD_ies1000_set_dev_startcmd, CMD_ies1000_set_dev_stopcmd, CMD_ies1000_set_dev_idlecmd, CMD_ies1000_set_dev_resetcmd, }; enum ies1000_runstat_t{ IES1000_RUNSTAT_STOP = 0, IES1000_RUNSTAT_IDLE = 1, IES1000_RUNSTAT_DHG = 2, IES1000_RUNSTAT_CHG = 3, }; enum ies1000_runmod_t{ IES1000_RUNMOD_ONGRID = 0, IES1000_RUNMOD_OFFGRID = 1, IES1000_RUNMOD_ONOFFGRID = 2, }; struct ies1000_t{ //int chan_idx; char szinfo[32]; char szmodel[32]; int model; //int adr; // modbus rtu addr, by cfg struct tick_t bsytik; struct power_t pow; struct comm_t comm; //struct dac_t dac; struct statemachine_t sm; int cmd; // sm cmd /* F0 basic param */ int cmdsrc; char szcmdsrc[16]; int runmod; char szrunmod[16]; int workmod; char szworkmod[16]; //int onoff_grid_dft; int switch_initmod; char szswitch_initmod[16]; int offgrid_freq; char szoffgrid_freq[16]; int offgrid_vol_set; int reactive_p_set_mod; char szreactive_p_set_mod[16]; int active_p_set; /* sync to active_p_set of the ies1000 device */ int reactive_p_set; int cv_v_set; /* constant voltage mode voltage set */ int cc_c_set; /* constant current mode current set */ int pow_set_src; /* power cmd source */ char szpow_set_src[8]; int ins_det; /* insulation detect */ /* F1 system info */ int dc_ovp; /* 母线过压保护值 */ int dc_uvp; /* 母线欠压保护值 */ int dc_dfp; /* dc bus voltage difference protetion */ int dc_ocp; /* 直流侧过流保护值 */ int env_otp; /* over environment temp protection */ int reactor_otp; /* diankangqi */ int igbt_otp; /* F4 start stop param */ int startcmd; int stopcmd; int idlecmd; int err_rstcmd; /* F5 IES1000 control param */ int gridfreq_autoadj; int pow_adjrate_en; int pow_adjrate_set; int isl_det; /* FH user param */ int sync_year; int sync_month; int sync_day; int sync_hour; int sync_min; int sync_sec; /* FU monitor param */ int runstatus; /*IES1000运行状态*/ char szrunstatus[16]; int dc_v; /* 电池电压 */ int dc_c; /* 直流电流 */ double grid_freq; /* 电网频率 */ double grid_v; /* 电网电压 */ double ac_c; /* 交流电流 */ double ua; double ub; double uc; double ia; double ib; double ic; int ap; /* 输出总有功功率 */ int dc_p; /* 直流功率 */ int ac_breaker; /* 交流断路器状态 */ int dc_breaker; /* 直流断路器状态 */ int dcbuf_cont; int emg_btn; /* emergence button */ double chg_e_day; /*今日充电量*/ double dhg_e_day; /* 今日放电量 */ double chg_e_total; /*累计充电量*/ double dhg_e_total; /*累计放电量*/ int temp_igbt_a; int temp_igbt_b; int temp_igbt_c; int temp_reactor; int temp_env; int errstatus; /*IES1000故障状态*/ unsigned short faults[6 + 1]; // fault state word 1 - 6 unsigned short warns[6 + 1]; // warning state word 1 - 6 }; extern struct ies1000_t ies1000[IES1000_NBR_MAX + 1]; int ies1000_init(); int ies1000_send_sm_cmd( int idx, int cmd ); int ies1000_get_ap( int idx ); int ies1000_get_ac_brk( int idx ); int ies1000_get_dc_brk( int idx ); int ies1000_get_errstat( int idx ); int ies1000_get_emg_btn( int idx ); double ies1000_get_ua( int idx ); double ies1000_get_ub( int idx ); double ies1000_get_uc( int idx ); double ies1000_get_ia( int idx ); double ies1000_get_ib( int idx ); double ies1000_get_ic( int idx ); int ies1000_get_temp_igbt_a( int idx ); int ies1000_get_temp_igbt_b( int idx ); int ies1000_get_temp_igbt_c( int idx ); int ies1000_get_temp_reactor( int idx ); int ies1000_get_temp_env( int idx ); int ies1000_get_state( int idx ); int ies1000_get_step( int idx ); int ies1000_get_tick( int idx ); double ies1000_get_tick_ave( int idx ); double ies1000_get_tick_cur( int idx ); double ies1000_get_tick_max( int idx ); char* ies1000_get_state_str( int idx ); char* ies1000_get_err_str( int idx ); int ies1000_chk_state( int idx, int stat ); int ies1000_load_params( int idx ); int ies1000_set_aps( int idx, int aps); int ies1000_get_aps(int idx); int ies1000_reset_aps(int idx); int ies1000_get_runstat( int idx ); char* ies1000_get_runstat_str( int idx ); int ies1000_get_dcv( int idx ); int ies1000_get_dcc( int idx ); int ies1000_get_dc_dfp( int idx ); int ies1000_set_dev_startcmd( int idx ); int ies1000_set_dev_stopcmd( int idx ); int ies1000_set_dev_idlecmd( int idx ); int ies1000_set_dev_resetcmd( int idx ); int ies1000_reset_bsytikchk(int idx); int ies1000_is_bsytikchk_timeout(int idx); int ies1000_set_bsytikchk_en(int idx, int val); int ies1000_get_bsytikchk_en(int idx); int ies1000_get_bsytikchk_from_host(int idx); int ies1000_set_bsytik(int idx); int ies1000_get_dev_aps( int idx ); int ies1000_get_cmd( int idx ); void ies1000_reset_cmd( int idx ); int ies1000_is_aps_changed(int idx); int ies1000_get_last_aps(int idx); int ies1000_set_dac_param_en(int idx, int val); double ies1000_get_gridv( int idx ); double ies1000_get_gridc( int idx ); int ies1000_get_comm_st(int idx); int ies1000_get_runmod( int idx ); int ies1000_get_chan_idx(int idx); int ies1000_get_adr(int idx); char* ies1000_get_comm_state_str(int idx); double ies1000_get_dac_ave(int idx); double ies1000_get_dac_cur(int idx); double ies1000_get_dac_max(int idx); int ies1000_get_dc_ovp( int idx ); int ies1000_get_dc_uvp( int idx ); int ies1000_get_env_otp( int idx ); int ies1000_get_reactor_otp( int idx ); int ies1000_get_igbt_otp( int idx ); double ies1000_get_grid_freq( int idx ); int ies1000_get_dcp( int idx ); int ies1000_get_breaker_ac( int idx ); int ies1000_get_breaker_dc( int idx ); int ies1000_get_dcbuf_cont( int idx ); unsigned short* ies1000_get_faults(int idx); unsigned short* ies1000_get_warns(int idx); int ies1000_get_dac_param_en(int idx); char* ies1000_get_info_str(int idx); double ies1000_get_chg_e_total(int idx); double ies1000_get_dhg_e_total(int idx); int ies1000_get_tool_data(int idx,char* buf); int ies1000_get_tbmqtt_main_data(int idx,char* buf); int ies1000_get_tbmqtt_secondy_data(int idx,char* buf); int ies1000_get_cloud_main_data(int cnt_idx,int idx,char* buf); int ies1000_get_cloud_secondy_data(int cnt_idx,int idx,char* buf); int ies1000_get_bkds_data(int idx,char* buf); #endif