27.11.2012 Views

Diseño y construcción de tricicleta solar - GEA - Universidad ...

Diseño y construcción de tricicleta solar - GEA - Universidad ...

Diseño y construcción de tricicleta solar - GEA - Universidad ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

{<br />

acelerador<br />

//verifica la carga <strong>de</strong> los ultracapacitores y fija referencia <strong>de</strong>l PWM0<br />

if(KMED2*( *( *(float)readChannel(2) *(<br />

> 36.0){ ){<br />

ref[0]= ]= ]=0.0; ]= //referencia tensión en barra DC<br />

PWM0=0; //apaga PWM0<br />

led(2); ); //apaga led PWM0<br />

}else{<br />

ref[0]= ]= ]=36.0; ]= //referencia tensión en barra DC<br />

led(1); ); );//encien<strong>de</strong> );<br />

led PWM0<br />

}<br />

led(10); ); );//apaga ); led <strong>de</strong> carga <strong>de</strong> los ultracapacitores<br />

ref[1]= ]= ]=0.0; ]=<br />

//referencia lazo <strong>de</strong> corriente motor<br />

ref[2]= ]= ]=0.0; ]=<br />

//referencia lazo <strong>de</strong> corriente generador<br />

lazoControl(); (); ();//calcula ();<br />

actuacion con ecuacion recursiva<br />

PWM0=KPWM0*up[0]; ]; ];<br />

PWM2=0;<br />

led(6); ); );//apaga ); led PWM2<br />

//umbral <strong>de</strong> encendido <strong>de</strong>l PWM1 con un minimo <strong>de</strong> un 20/1024*100=1.9% <strong>de</strong>l<br />

if(readChannel(5) >= >= >= 20 ){<br />

){<br />

PWM1=KPWM1*up[1]; ]; ];<br />

led(3); ); );//encien<strong>de</strong> );<br />

led PWM1<br />

}else{<br />

PWM1=0;<br />

led(4); ); );//apaga ); led PWM1<br />

}<br />

//Detecta si la potencia <strong>de</strong>l panel cae bajo el MPP un 5% cuando acelera y<br />

activa el banco <strong>de</strong> baterias<br />

Vpanel=KMED1*readChannel(1); ); );//almacena );<br />

el valor <strong>de</strong> tension <strong>de</strong>l panel<br />

Pmotor=KMED3*readChannel(3)* )* )*KMED4*(<br />

)* *( *(readChannel(4)-410);<br />

*(<br />

); );//potencia );<br />

<strong>de</strong>l motor<br />

if(Vpanel < Vpanel_ant)//cuando cae la tension en el panel fotovoltaico<br />

{<br />

flag1=1;<br />

}<br />

Vpanel_ant = Vpanel;//guarda el valor anterior <strong>de</strong> la tension <strong>de</strong>l panel<br />

if(Pmotor < Pmotor_ant)//cuando cae la potencia en el panel fotovoltaico<br />

{<br />

flag2=1;<br />

}<br />

Pmotor_ant=Pmotor;//almacena el valor anterior <strong>de</strong> la potencia en el motor<br />

//Almacena el valor máximo <strong>de</strong> potencia<br />

if(Pmotor >= >= Pmax)<br />

{<br />

Pmax = Pmotor;<br />

}<br />

if(flag1 == == 1 && && flag2 == == 1)<br />

{<br />

//<strong>de</strong>tecta si cae la potencia un 5% respecto a la máxima<br />

if((( ((( (((Pmax-Pmotor)/<br />

(((<br />

)/ )/Pmax) )/ > 0.05)<br />

{<br />

interruptor(1); ); );//conecta );<br />

banco <strong>de</strong> baterias para suplir potencia<br />

requerida<br />

}<br />

}<br />

//Cuando la potencia <strong>de</strong>l motor esta bajo un 50% <strong>de</strong> la potencia máxima almacenada las<br />

condiciones 1 y 2 se reinician para <strong>de</strong>tectar el MPP<br />

if(Pmotor

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!