# Compute the power storage requirements for a CubeSat.

Compares the requirements versus a commercial Li-Ion battery http://www.batteryspace.com/polymerli-ionbattery74v830mah614wh10-12cdischargerate.aspx

```------------------------------------------------------------------------
SolarCellPower
------------------------------------------------------------------------```

## Contents

```--------------------------------------------------------------------------
Copyright (c) 2011 Princeton Satellite Systems.
--------------------------------------------------------------------------```

## Constants

```capacity    = 7.4*0.830;        % W-hr
solarFlux   = 1367;             % W
altitude    = 500;              % km
inc         = 28.4667*pi/180;   % deg - launch from KSFC
dOD         = 0.6;              % Depth of discharge
```

## Orbit properites

```sma         = radiusEarth + altitude; % semi-major axis

% Return r,v,t for one rev in orbit defined by the orbital elements
%------------------------------------------------------------------
[r,v,t]     = RVFromKepler( [sma inc 0 0 0 0] );

m           = length(t);

% We need the date in Julian Centuries for the sun model
%-------------------------------------------------------
jD0         = Date2JD([2013 5 1 0 0 0]);
julianCent  = JD2T( jD0 + t/86400 );
```

## Data structure defining the solar panels

```d.effPowerConversion    = 0.8;
d.solarCellArea         = 0.088*0.088*[1 1 1 1 1 1 1 1 1];
d.solarCellNormal       = [1 -1  0  0  1 -1  0  0;...
0  0  1 -1  0  0  1 -1;...
0  0  0  0  0  0  0  0];
d.solarCellEff          = 0.29; % EMCORE ZTJM
```

## Initialize the input power array, eclipse time

```p                       = zeros(1,m);
dT                      = t(2) - t(1);
tE                      = 0;
```

## Compute the discrete input power over one rev in orbit

Accounts for time spent in eclipse

```for k = 1:m
[uSun, rSun]	= SunV1( julianCent(k) );
n               = Eclipse( r(:,k), rSun*uSun );
p(k)            = SolarCellPower( d, solarFlux*n*uSun );
tE              = (1-n)*dT + tE;
end
```

## Plot the input power over one orbit

```Plot2D(t,[r;p],'Time (sec)', {'x (km)' 'y (km)', 'z (km)' 'Power (W)'}, 'One Orbit' );
```

## Size the battery

Based on input power available

```pTotal          = sum(p)*dT;
pAve            = pTotal/t(end);
pStored         = pAve*tE/3600;
batteryCapacity = pStored/(1-dOD);
```

## Diplay results

```fprintf(1,'Eclipse Time       %8.1f s\n',tE);
fprintf(1,'Orbit period       %8.1f s\n',t(end));
fprintf(1,'Total power input  %8.1f Wh\n',pTotal/3600);
fprintf(1,'Depth of discharge %8.1f%%\n',dOD*100);
fprintf(1,'Battery Storage    %8.1f Wh\n',pStored);
fprintf(1,'Battery Capacity   %8.1f Wh\n',batteryCapacity);
fprintf(1,'Li-Ion Polymer     %8.1f Wh\n',capacity);
```
```Eclipse Time         2236.4 s
Orbit period         5677.0 s
Total power input       6.0 Wh
Depth of discharge     60.0%
Battery Storage         2.4 Wh
Battery Capacity        5.9 Wh
Li-Ion Polymer          6.1 Wh
```