forked from FernFCT/Model
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0034a4b
commit 3b301ef
Showing
5 changed files
with
4,270 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from openmdao.api import ExplicitComponent | ||
|
||
rho = 1.225 #density, [kg/m**3] | ||
|
||
|
||
class WeightComp(ExplicitComponent): | ||
|
||
|
||
def setup(self): | ||
self.add_input('W',desc='Weight of aircraft') | ||
self.add_input('Cd',desc='coefficient of drag') | ||
self.add_input('Cl',desc='coefficient of lift') | ||
self.add_input('AR',desc='Aspect Ratio') | ||
self.add_input('S',desc='Refernce Area') | ||
self.add_input('V',desc='Airspeed') | ||
|
||
self.add_output('P_C',desc='Power required for cruise') | ||
|
||
self.declare_partials(of='*', wrt='*', method='fd') | ||
|
||
|
||
|
||
def compute(self,inputs,outputs): | ||
outputs['P_C'] = (( (2*(inputs['W']**3)*(inputs['Cd']**2))/(inputs['S']*rho*(inputs['Cl']**3)) )**.5)/1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from openmdao.api import ExplicitComponent | ||
|
||
B_density = 400 # [Wh/kg] | ||
FAA = 0.5 # [hr], flight time required by FAA for emergency | ||
LO_time = 90/3600 # [hr], time to reach cruise alt | ||
res = 0.80 # 20% battery reserve for healthy and happy battery :) | ||
class RangeComp(ExplicitComponent): | ||
|
||
|
||
def setup(self): | ||
self.add_input('B_W',desc='Battery Weight') | ||
self.add_input('P_L',desc='Power Required @ Liftoff') | ||
self.add_input('P_C',desc='Power Required @ Cruise') | ||
self.add_input('V',desc='Speed flying @ cruise') | ||
|
||
self.add_output('R',desc='Max Range W/Reserve & Emergency 30min') | ||
self.add_output('t',desc='Time flying @ max range') | ||
|
||
self.declare_partials(of='*', wrt='*', method='fd') | ||
|
||
def compute(self,inputs,outputs): | ||
LO_Wh = inputs['P_L']*LO_time*1000 # Energy spent on liftoff | ||
time = ( (B_density*inputs['B_W']*res)-LO_Wh-(LO_Wh/2) ) / (1000*inputs['P_C']) | ||
dist = (time-FAA)*inputs['V'] | ||
|
||
outputs['R'] = dist | ||
outputs['t'] = time |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from openmdao.api import ExplicitComponent | ||
|
||
|
||
class GrossWeightComp(ExplicitComponent): | ||
|
||
def setup(self): | ||
self.add_input('Wp') # weight of payload (passangers) | ||
self.add_input('Wb') # weight of battery | ||
self.add_input('We/W0') # empty over gross | ||
self.add_output('W0') # gross weight | ||
self.declare_partials('*', '*') | ||
|
||
def compute(self, inputs, outputs): | ||
Wp = inputs['Wp'] | ||
Wb = inputs['Wb'] | ||
We_W0 = inputs['We/W0'] | ||
outputs['W0'] = (Wp + Wb) / (1 - We_W0) | ||
|
||
def compute_partials(self, inputs, partials): | ||
Wp = inputs['Wp'] | ||
Wb = inputs['Wb'] | ||
We_W0 = inputs['We/W0'] | ||
partials['W0', 'Wp'] = 1. / (1 - We_W0) | ||
partials['W0', 'Wb'] = 1. / (1 - We_W0) | ||
partials['W0', 'We/W0'] = (Wp + Wb) / (1 - We_W0) ** 2 |
Oops, something went wrong.