00001 %this program calculates the energy of a microwave based of of this 00002 %equation: 00003 %E = [(Poff)*(1-D)+(Pon)*(D)]*(dt) 00004 % ----------------------------- @ inverse cos(.pf) 00005 % pf 00006 00007 clear; 00008 Poff = 10;%standby power in W 00009 Pon = 1000;%installed power in W 00010 pf = 0.95;%power factor 00011 D = 0.1;%demand 00012 dt = 600;%time cycle for demand in sec 00013 toff = (1-D)*dt;%amount of time the microwave is off per cycle 00014 ton = D*dt;%amount of time the microwave is on per cycle 00015 00016 00017 00018 E(1)=0+0*j;%Energy is initialized at 0 kWh 00019 for n=2:86400 00020 E(n)=E(n-1)+Pon/(3600*1000)+j*Pon*sin(acos(pf))/(3600*pf*1000); 00021 end 00022 00023 f=fopen('microwave_energy.player','w'); 00024 fprintf(f,'2000-01-01 0:00:01,%6.12f+%6.12fj\n',real(E(1)),imag(E(1))); 00025 for i=2:length(E) 00026 fprintf(f,'+1s,%6.12f+%6.12fj\n',real(E(i)),imag(E(i))); 00027 end 00028 fclose(f);