PK1 = 0.15; (* Structural Mounting Factor *)
PK2 = 0.10; (* Clamping Overload *)
PPwrOpAct = 80; (* operating power of the actuator *)
PPwrOpEce = 300; (* operating power of the electronics *)
PPwrIdleEce = 300; (* idle power of the electronics *)
PInsolation = 1358; (* incidence of solar radiation *)

PPwrOp = PPwrOpAct +  PPwrOpEce; (* operating power *)
PPwrIdle = PPwrIdleEce; (* power consumption when idle *)

(* some constants *)
PNuAr = 0.13 (* efficiency of solar array *)
PNuPwrReg = 0.95; (* efficiency of power regulator *)
PNuDCDC = 0.9; (* efficiency of dc-dc converter *)
PNuAmps = 0.85; (* efficiency of actuator *)
PNuCharge = 0.9; (* efficiency of charging the battery *)
PNuDisCharge = 0.95; (* efficiency of battery during discharge *)

PArDens = 1/40; (* density of solar array *)


PPwrBatIn = (1/(PNuCharge*PNuDisCharge))*
		((PPwrOpEce/PNuDCDC)+(PPwrOpAct/PNuAmps));

PPwr = (1/PNuPwrReg)*((PPwrIdle/PNuDCDC)+ PPwrBatIn); 
(* total power consumption *)

PArArea = PPwr/(PNuAr*PInsolation); (* area of the solar array *)

PMAr = PArArea * PArDens; (* Mass of the solar array *)
PMAct = 5.2; (* mass of the actuator *)
PGamma = 0.15; (* a constant *)
PMBearing = 1.0+PMAr*PGamma; (* mass of the bearing *)
PMPwrReg = 4; (* mass of power regulator *)
PPwrDCDC = 20; (* power of the dc-dc convertor *)

PMassDCDC = 0.2; (* mass of one dc-dc convertor *)
PMDCDC = (PPwrOpEce * 1.5 * PMassDCDC)/PPwrDCDC; 
(* mass of all the dc-dc converters *)

PMPwrRegRaw = PMPwrReg / (1 + PK1); 
(* mass of power regulator w/o mounting *)
PMBatt = PMBattRaw(1 + PK1); (* mass of battery including mounting *)
PHarnessLen = 1.5; (* length of harness *)
PHarnessDens = 1/200; (* density of harness *)
PMHarness = PHarnessLen * PHarnessDens * (1 + PK2); (* mass of harness *)
PMAmps = PNAmps * 0.25; (* mass of amplifiers *)

PM = PMAr + PMAct + PMBearing + PMPwrReg + 
		PMDCDC + PMAmps + PMHarness + PMBatt; 
(* total mass of power system *) 


(* ************************* Battery Sizing ************************* *)

PNAmps = 10; (* number of amplifiers *)
PPwrAmpMax = 100; (* maximum power of each amplifier *)
PPwrOpEceMax = 444; (* maximum operating power of the electronics *)
PPwrOpActMax = 150; (* maximum operating power of the actuator *)

PPwrOpMax = PPwrOpActMax/PNuAmps + PPwrOpEceMax/PNuDCDC; 
(* maximum operating power *)

PBattEnergyDens = 40; (* energy density of the battery *)

PDisCharge = 0.75; (* depth of discharge *)
PVAvg = 0.3; (* average velocity *)
PDistance = 2000000; (* distance to be travelled *)
PDistCyc = 200; (* distance per cycle *)
PNumCyc = PDistance/PDistCyc; (* number of cycles *)
PCycTime = PDistCyc/PVAvg; (* time taken for 1 cycle *)
PEnergyCyc = PPwrOp * PCycTime / PNuDisCharge; (* energy per cycle *)
PBattEnergy = PEnergyCyc/PDisCharge; (* energy capacity of battery *)

PMBattDisCharge = PBattEnergy/(PBattEnergyDens * 3600); 
(* min mass of battery reqd for discharge capability *)

PK3 = 1.2; (* factor of safety *)
PBattPwrDens = 100; (* power density of battery *)
PChargeDens = 30; (* charge density of battery *)
PMBattPwr = (PPwrOpMax * PK3) / PBattPwrDens; 
(* min mass of battery  to generate the reqd power *)

PDutyCyc = 0.5; (* duty cycle *)
PK4 = 1.5; (* factor of safety *)

PMBattCharge = (PPwrOp * PK4)/ (PDutyCyc * 2 * PNuCharge *
PNuDisCharge * PChargeDens);
(* min mass of battery for the reqd charging capability *)

PMBattRaw = Max[PMBattCharge,PMBattDisCharge,PMBattPwr];
(* mass of battery reqd taking all factors into account *)




(* for debugging purposes

Print["Mass of Battery C = ",PMBattCharge];
Print["Mass of Battery D = ",PMBattDisCharge];
Print["Mass of Battery P = ",PMBattPwr]; *)


(* some outputs *)
Print["Mass of Battery = ",PMBatt];
Print["Mass of Rover = ",PM];
Print["Energy of Battery = ",PBattEnergy];



