Skip to content

Commit

Permalink
Adding versions of SimPleAC to tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
1ozturkbe committed May 24, 2018
1 parent 8f5c2a8 commit 08db015
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
3 changes: 3 additions & 0 deletions TESTS
Expand Up @@ -3,3 +3,6 @@ gpkitmodels/GP/aircraft/tail/tail_tests.py
gpkitmodels/GP/aircraft/fuselage/test_fuselage.py
gpkitmodels/GP/aircraft/prop/prop_test.py
gpkitmodels/GP/aircraft/motor/motor_test.py
gpkitmodels/SP/SimPleAC/SimPleAC.py
gpkitmodels/SP/SimPleAC/SimPleAC_mission.py
gpkitmodels/SP/SimPleAC/SimPleAC_multimission.py
5 changes: 5 additions & 0 deletions gpkitmodels/SP/SimPleAC/SimPleAC.py
Expand Up @@ -87,6 +87,11 @@ def setup(self):

return constraints

def test():
m = SimPleAC()
m.cost = m['W_f']
sol = m.localsolve(verbosity = 4)

if __name__ == "__main__":
# Most basic way to execute the model
m = SimPleAC()
Expand Down
17 changes: 14 additions & 3 deletions gpkitmodels/SP/SimPleAC/SimPleAC_mission.py
Expand Up @@ -271,6 +271,20 @@ def setup(self,aircraft,Nsegments):

return constraints, state, self.aircraft, self.aircraftP

def test():
m = Mission(SimPleAC(),4)
m.substitutions.update({
'h_{cruise_m}' :5000*units('m'),
'Range_m' :3000*units('km'),
'W_{p_m}' :6250*units('N'),
'C_m' :120*units('1/hr'),
'V_{min_m}' :25*units('m/s'),
'T/O factor_m' :2,
})
m.cost = m['W_{f_m}']*units('1/N') + m['C_m']*m['t_m']
sol = m.localsolve(verbosity = 4)


if __name__ == "__main__":
# Most basic way to execute the model
m = Mission(SimPleAC(),4)
Expand All @@ -283,8 +297,5 @@ def setup(self,aircraft,Nsegments):
'T/O factor_m' :2,
})
m.cost = m['W_{f_m}']*units('1/N') + m['C_m']*m['t_m']
#m = Model(m.cost, Bounded(m))
#m_relax = relaxed_constants(m,None,None)
sol = m.localsolve(verbosity = 4)
#post_process(sol)
#print sol.table()
17 changes: 16 additions & 1 deletion gpkitmodels/SP/SimPleAC/SimPleAC_multimission.py
Expand Up @@ -5,7 +5,7 @@
import numpy as np
import matplotlib.pyplot as plt

from SimPleAC_mission4 import Mission, SimPleAC
from SimPleAC_mission import Mission, SimPleAC
from atmosphere import Atmosphere

# SimPleAC with multimission design (3.5)
Expand Down Expand Up @@ -51,6 +51,21 @@ def setup(self,aircraft,Nmissions,Nsegments):

return constraints, self.aircraft, self.missions

def test():
Nmissions = 2
Nsegments = 4
aircraft = SimPleAC()
m = Multimission(aircraft,Nmissions,Nsegments)
m.substitutions.update({
'h_{cruise_{mm}}':[5000*units('m'), 5000*units('m')],
'Range_{mm}' :[3000*units('km'), 2000*units('km')],
'W_{p_{mm}}' :[6250*units('N'), 8000*units('N')],
'C_{mm}' :[120*units('1/hr'), 360*units('1/hr')],
})
#m.cost = m['W_{f_{mm}}']*units('1/N') + sum(m.missions[i]['C_m']*m.missions[i]['t_m'] for i in range(0,Nmissions))
m.cost = (m.missions[0]['W_{f_m}']*units('1/N') + m.missions[1]['C_m']*m.missions[1]['t_m'])
sol = m.localsolve(verbosity = 4)

if __name__ == "__main__":
Nmissions = 2
Nsegments = 4
Expand Down

0 comments on commit 08db015

Please sign in to comment.