Project

General

Profile

Files » fnct.c

Frédéric Blanc, 2016-01-29 10:30

 
/**
* @brief fonction T_BATT
* @date 20/05/2014
* @author F.BLANC LAAS-CNRS
*
*/
#include "inst.h"
#include <utility.h>
#include "asynctmr.h"
#include "var.h"



/**
* @brief fnct_Discharge
* @return 0
* @date 23/05/2014
*
*/
int fnct_Discharge ()
{

float volt,curr;
volt=T_cycle[Ctrl.cycle].Vmax;
curr=T_cycle[Ctrl.cycle].curr;
switch (Ctrl.mode)
{
case MODE_SMU :
cmd_SMU_curr (volt,-1*curr);
break;
case MODE_POWER_LOAD :
case MODE_POWER_LOAD_PM :
cmd_power (0,0,0);
cmd_load (volt,curr,1);
Delay(0.3);
break;
}
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_LOAD_V,ATTR_DIMMED, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_LOAD_I,ATTR_DIMMED, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_POWER_V,ATTR_DIMMED, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_POWER_I,ATTR_DIMMED, 1);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_LOAD_V,volt);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_LOAD_I,curr);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_POWER_V,0.0);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_POWER_I,0.0);
return 0;
}


/**
* @brief fnct_Charge
* @return 0
* @date 23/05/2014
*
*/
int fnct_Charge ()
{

float volt,curr;
volt=T_cycle[Ctrl.cycle].Vmax;
curr=T_cycle[Ctrl.cycle].curr;
switch (Ctrl.mode)
{
case MODE_SMU :
cmd_SMU_curr (volt,curr);
break;
case MODE_POWER_LOAD:
case MODE_POWER_LOAD_PM :
cmd_load (0,0,0);
cmd_power (volt,curr,1);
Delay(0.3);
break;

}
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_LOAD_V,ATTR_DIMMED, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_LOAD_I,ATTR_DIMMED, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_POWER_V,ATTR_DIMMED, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_POWER_I,ATTR_DIMMED, 0);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_LOAD_V,0.0);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_LOAD_I,0.0);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_POWER_V,volt);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_POWER_I,curr);
return 0;
}


/**
* @brief fnct_ID_inst
* @return str_ID
* @date 10/12/2010
*
*/
char * fnct_ID_inst(int i,char* str)
{
switch (i)
{
case INST_POWER :
sprintf(str,"POWER");
break;
case INST_LOAD :
sprintf(str,"LOAD");
break;
case INST_SMU :
sprintf(str,"SMU");
break;
case INST_SAS :
sprintf(str,"SAS");
break;
case INST_PM :
sprintf(str,"PM");
break;
case INST_TEMP :
sprintf(str,"TEMP");
break;

}
return str;
}

/**
* @brief fnct_Ctrl_mode
* @return 0
* @date 22/05/2014
*
*/
void fnct_Ctrl_mode(int mode)
{
switch (mode)
{
case MODE_EDIT:
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM, ATTR_DIMMED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_EDIT, ATTR_CHECKED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_SIMUL, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_SMU, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_PWLOAD, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_PLPM, ATTR_CHECKED, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXTSIMUL,ATTR_VISIBLE, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_START,ATTR_VISIBLE, 0);
save_LOG("MODE_EDIT");
break;
case MODE_SIMUL:
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM, ATTR_DIMMED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_EDIT, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_SIMUL, ATTR_CHECKED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_SMU, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_PWLOAD, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_PLPM, ATTR_CHECKED, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXTSIMUL,ATTR_VISIBLE, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_START,ATTR_VISIBLE, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_START,ATTR_DIMMED, 0);
save_LOG("MODE_SIMUL");
break;
case MODE_SMU:
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM, ATTR_DIMMED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM_SMU, ATTR_DIMMED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM_POWER, ATTR_DIMMED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM_LOAD, ATTR_DIMMED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM_PM, ATTR_DIMMED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_EDIT, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_SIMUL, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_SMU, ATTR_CHECKED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_PWLOAD, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_PLPM, ATTR_CHECKED, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXTSIMUL,ATTR_VISIBLE, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXT_POWER,ATTR_VISIBLE, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXT_LOAD,ATTR_VISIBLE, 1);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXT_POWER,instrument[INST_SMU].model);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXT_LOAD,instrument[INST_SMU].model);
save_LOG("MODE_SMU");
break;
case MODE_POWER_LOAD:
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM, ATTR_DIMMED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM_SMU, ATTR_DIMMED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM_POWER, ATTR_DIMMED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM_LOAD, ATTR_DIMMED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM_PM, ATTR_DIMMED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_EDIT, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_SIMUL, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_SMU, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_PWLOAD, ATTR_CHECKED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_PLPM, ATTR_CHECKED, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXTSIMUL,ATTR_VISIBLE, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXT_POWER,ATTR_VISIBLE, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXT_LOAD,ATTR_VISIBLE, 1);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXT_POWER,instrument[INST_SMU].model);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXT_LOAD,instrument[INST_SMU].model);
save_LOG("POWER_LOAD");
break;
case MODE_POWER_LOAD_PM:
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM, ATTR_DIMMED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM_SMU, ATTR_DIMMED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM_POWER, ATTR_DIMMED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM_LOAD, ATTR_DIMMED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM_PM, ATTR_DIMMED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_EDIT, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_SIMUL, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_SMU, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_PWLOAD, ATTR_CHECKED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF_PLPM, ATTR_CHECKED, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXTSIMUL,ATTR_VISIBLE, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXT_POWER,ATTR_VISIBLE, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXT_LOAD,ATTR_VISIBLE, 1);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXT_POWER,instrument[INST_SMU].model);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEXT_LOAD,instrument[INST_SMU].model);
save_LOG("POWER_LOAD_PM");
break;
}
}
/**
* @brief Set_panel_measure_time
* @return 0
* @date 10/12/2010
*
*/
int Set_panel_measure_time_elapsed (void)
{
char buffer[1024];
struct tm *time_elapsed ;
time_elapsed = gmtime ( &Ctrl.time_elapsed );
strftime (buffer,80,"%j:%H:%M:%S\0",time_elapsed );
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_TXT_TIME,buffer);
time_elapsed = gmtime ( &Ctrl.time_cycle );
strftime (buffer,80,"%H:%M:%S\0",time_elapsed );
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_TXT_HCT,buffer);
return 0;
}
/**
* @brief fnct_stop
* @return 0
* @date 10/12/2010
*
*/
int fnct_stop (void)
{
int ctrlarray;
SetAsyncTimerAttribute (Ctrl.timer_id,ASYNC_ATTR_ENABLED,0 );//desactivation timer
switch (Ctrl.mode)
{
case MODE_SMU :
cmd_SMU_curr (0,0);
break;
case MODE_POWER_LOAD :
case MODE_POWER_LOAD_PM :
cmd_load (0,0,0);
cmd_power (0,0,0);
break;


}
if(Ctrl.verbose)
{
save_LOG("CVI_TIMER OFF");
}
if(Ctrl.file!=NULL)
{

fclose(Ctrl.file);
Ctrl.file=NULL;
}
save_LOG("STOP");
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_START,ATTR_DIMMED, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_STOP,ATTR_DIMMED, 1);
ctrlarray = GetCtrlArrayFromResourceID (T_panel[PANEL_MEASURE].panel, CTRL_MEASURE);
SetCtrlArrayAttribute (ctrlarray,ATTR_DIMMED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_FILE, ATTR_DIMMED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF, ATTR_DIMMED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM, ATTR_DIMMED, 0);
return 0;
}
/**
* @brief fnct_start
* @return 0
* @date 22/05/2014
*
*/
int fnct_start (void)
{
int ctrlarray;
int test;
Ctrl.stop=0;
Ctrl.cycle=1;
Ctrl.loop=1;
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_START,ATTR_DIMMED, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_STOP,ATTR_DIMMED, 0);
ctrlarray = GetCtrlArrayFromResourceID (T_panel[PANEL_MEASURE].panel, CTRL_MEASURE);
SetCtrlArrayAttribute (ctrlarray,ATTR_DIMMED, 0);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_FILE, ATTR_DIMMED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_CONF, ATTR_DIMMED, 1);
SetMenuBarAttribute (barre_de_menu, MENUBAR2_COM, ATTR_DIMMED, 1);
save_dir_init();
save_LOG("START");
DeleteGraphPlot (T_panel[PANEL_GRAPH].panel,P_GRAPH_GRAPH_I,-1 , VAL_IMMEDIATE_DRAW);
DeleteGraphPlot (T_panel[PANEL_GRAPH].panel,P_GRAPH_GRAPH_V,-1 , VAL_IMMEDIATE_DRAW);
DisplayPanel (T_panel[PANEL_GRAPH].panel);
GetAsyncTimerAttribute(Ctrl.timer_id,ASYNC_ATTR_ENABLED,&test );
SetAsyncTimerAttribute (Ctrl.timer_id,ASYNC_ATTR_ENABLED,1 );//activation timer
if(Ctrl.verbose)
{
if(test==0)
{
save_LOG("CVI_TIMER ON");
}else
save_LOG("CVI_TIMER FAIL");
}
Ctrl.time_elapsed=0;
Ctrl.time_cycle=0;
time (&Ctrl.time_start);
switch(T_cycle[Ctrl.cycle].mode)
{
case MODE_DISCHARGE:
fnct_Discharge ();
break;
case MODE_CHARGE:
fnct_Charge ();
break;
}
return 0;
}

/**
* @brief fnct_cycle_end
* @return 0
* @date 05/06/2014
*
*/
int fnct_cycle_end (void)
{
char message[1024];
Ctrl.Ah=0;
Ctrl.Wh=0;
Ctrl.cycle++;
if(Ctrl.verbose)
{
sprintf(message,"Cycle : %d END",Ctrl.cycle);
save_LOG(message);
}
if(Ctrl.cycle>Ctrl.nb_cycle)
{
if(Ctrl.mode_loop==1)
{
Ctrl.loop++;
if(Ctrl.nb_loop!=-1)
{
if(Ctrl.mode_loop==0)
{
fnct_stop();
return 0;
}
if(Ctrl.loop>Ctrl.nb_loop)
{
fnct_stop();
return 0;
}
}
Ctrl.cycle=1;
Ctrl.time_cycle=0;
save_file_init();
return 0;
}
fnct_stop();
return 0;
}
Ctrl.time_cycle=0;
save_file_init();
return 0;
}
/**
* @brief fnct_measure
* @return 0
* @date 23/09/2013
*
*/
int fnct_measure (void)
{

char message[1024];
double volt=0.0,curr=0.0,pow=0.0;
double volt2=0.0,curr2=0.0 ;
float temp_batt,temp_ext, rh;
switch(T_cycle[Ctrl.cycle].mode)
{
case MODE_DISCHARGE:
fnct_Discharge ();
break;
case MODE_CHARGE:
fnct_Charge ();
break;
}
//mesure
if(Ctrl.mode==MODE_SMU)
cmd_SMU_Read (&volt,&curr);
if(Ctrl.mode==MODE_POWER_LOAD_PM)
{
read_PM_YOKOGAWA (&volt,&curr,&pow,&volt2,&curr2,&pow,&pow,&pow,&pow,&pow,&pow,&pow);
if(T_cycle[Ctrl.cycle].mode==MODE_DISCHARGE )
{
volt=volt2;
curr=curr2;
}
}
Ctrl.Ah+=curr/3600;
pow=volt*curr;
Ctrl.Wh+=pow/3600;
//GRAPH
if((int)Ctrl.time_elapsed<=600 || ((int) Ctrl.time_elapsed%15==0 && (int)Ctrl.time_elapsed<=1200) || ((int)Ctrl.time_elapsed%60==0 && (int)Ctrl.time_elapsed>1200))
{
PlotPoint (T_panel[PANEL_GRAPH].panel, P_GRAPH_GRAPH_V, Ctrl.time_elapsed, volt, VAL_ASTERISK, VAL_GREEN);
PlotPoint (T_panel[PANEL_GRAPH].panel, P_GRAPH_GRAPH_I, Ctrl.time_elapsed, curr, VAL_ASTERISK, VAL_RED);

}
read_TEMP(&temp_batt,&temp_ext, &rh);
//FICHIER
if (Ctrl.save)
{
if (Ctrl.file)
{
fprintf (Ctrl.file,"%d",Ctrl.time_elapsed);
fprintf (Ctrl.file,"\t%2.4E\t%2.4E",volt,curr);
fprintf (Ctrl.file,"\t%2.4E",Ctrl.Ah);
fprintf (Ctrl.file,"\t%2.4E",Ctrl.Wh);
if(instrument[INST_TEMP].present==1)
{
fprintf (Ctrl.file,"\t%2.1f",temp_batt);
fprintf (Ctrl.file,"\t%2.1f",temp_ext);
}
fprintf (Ctrl.file,"\n");
}
}
switch(T_cycle[Ctrl.cycle].mode)
{
case MODE_DISCHARGE:
if(volt<=T_cycle[Ctrl.cycle].Vmin)
{
if(Ctrl.verbose)
{
sprintf(message,"Cycle : %d MODE_DISCHARGE: MODE_STOP_STD volt(%1.1f)<=T_cycle[Ctrl.cycle].Vmin(%1.1f)",Ctrl.cycle,volt,T_cycle[Ctrl.cycle].Vmin);
save_LOG(message);
}
if(Ctrl.vminstop==1)
{
Ctrl.stop=1;
fnct_stop();
return 0;
}
fnct_cycle_end();
return 0;
}
switch(T_cycle[Ctrl.cycle].mode_stop)
{
case MODE_STOP_STD:
break;
case MODE_STOP_CMAX:
if(fabs(Ctrl.Ah)>=fabs(T_cycle[Ctrl.cycle].Cmax))
{
if(Ctrl.verbose)
{
sprintf(message,"Cycle : %d MODE_DISCHARGE: MODE_STOP_CMAX Ctrl.Ah(%1.4f)>=T_cycle[Ctrl.cycle].Cmax(%1.4f)",Ctrl.cycle,Ctrl.Ah,T_cycle[Ctrl.cycle].Cmax);
save_LOG(message);
}
fnct_cycle_end();
return 0;
}
break;
case MODE_STOP_TIMER:
if(Ctrl.time_cycle>=T_cycle[Ctrl.cycle].Timermax)
{
if(Ctrl.verbose)
{
sprintf(message,"Cycle : %d MODE_CHARGE: MODE_STOP_TIMER Ctrl.timer(%d)>=T_cycle[Ctrl.cycle].Timermax(%d)",Ctrl.cycle,Ctrl.time_cycle,T_cycle[Ctrl.cycle].Timermax);
save_LOG(message);
}
fnct_cycle_end();
return 0;
}
break;
}
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_Ah_IN,ATTR_DIMMED, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_V_IN,ATTR_DIMMED, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_I_IN,ATTR_DIMMED, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_Ah_OUT,ATTR_DIMMED, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_V_OUT,ATTR_DIMMED, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_I_OUT,ATTR_DIMMED, 0);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_Ah_OUT,Ctrl.Ah);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_V_OUT,volt);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_I_OUT,curr);
break;
case MODE_CHARGE:
switch(T_cycle[Ctrl.cycle].mode_stop)
{
case MODE_STOP_STD:
if(curr<=T_cycle[Ctrl.cycle].Imin)
{
if(Ctrl.verbose)
{
sprintf(message,"Cycle : %d MODE_CHARGE: MODE_STOP_STD: curr(%1.4f)<=T_cycle[Ctrl.cycle].Imin(%1.4f)",Ctrl.cycle,curr,T_cycle[Ctrl.cycle].Imin);
save_LOG(message);
}
fnct_cycle_end();
return 0;
}
break;
case MODE_STOP_CMAX:
if(fabs(Ctrl.Ah)>=fabs(T_cycle[Ctrl.cycle].Cmax))
{
if(Ctrl.verbose)
{
sprintf(message,"Cycle : %d MODE_CHARGE: MODE_STOP_CMAX Ctrl.Ah(%1.4f)>=T_cycle[Ctrl.cycle].Cmax(%1.4f)",Ctrl.cycle,Ctrl.Ah,T_cycle[Ctrl.cycle].Cmax);
save_LOG(message);
}
fnct_cycle_end();
return 0;
}
break;
case MODE_STOP_TIMER:
if(Ctrl.time_cycle>=T_cycle[Ctrl.cycle].Timermax)
{
if(Ctrl.verbose)
{
sprintf(message,"Cycle : %d MODE_CHARGE: MODE_STOP_TIMER Ctrl.timer(%d)>=T_cycle[Ctrl.cycle].Timermax(%d)",Ctrl.cycle,Ctrl.time_cycle,T_cycle[Ctrl.cycle].Timermax);
save_LOG(message);
}
fnct_cycle_end();
return 0;
}
break;
}
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_Ah_IN,ATTR_DIMMED, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_V_IN,ATTR_DIMMED, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_I_IN,ATTR_DIMMED, 0);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_Ah_OUT,ATTR_DIMMED, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_V_OUT,ATTR_DIMMED, 1);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_I_OUT,ATTR_DIMMED, 1);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_Ah_IN,Ctrl.Ah);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_V_IN,volt);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_I_IN,curr);
break;
}
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_CYCLE,Ctrl.cycle);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_LOOP,Ctrl.loop);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEMP_BATT,temp_batt);
SetCtrlVal (T_panel[PANEL_MEASURE].panel,P_MEASURE_TEMP_EXT,temp_ext);
return 0;
}
/**
* @brief fnct_attente
* @param [in] temps en seconde
* @param [in] message
* @return 0
* @date 24/10/2012
*
*/
int fnct_attente (int i,char* message)
{
char message2[15];
SetCtrlVal (T_panel[PANEL_INFO].panel,P_INFO_TEXTMSG,message);
sprintf(message2,".");
DisplayPanel (T_panel[PANEL_INFO].panel);
while(i!=0)
{
strcat (message2,".");
SetCtrlVal (T_panel[PANEL_INFO].panel,P_INFO_TEXTMSG_2,message2);
Delay(1);
--i;
}
HidePanel(T_panel[PANEL_INFO].panel);
return 0;
}
(10-10/25)