<s> from scipy . interpolate import interp1d <EOL> from openmdao . main . api import Component <EOL> from openmdao . lib . datatypes . api import Float <EOL> class Pump ( Component ) : <EOL> """<STR_LIT>""" <EOL> Pt_out = Float ( <NUM_LIT:1000> , iotype = "<STR_LIT>" , units = "<STR_LIT>" , desc = "<STR_LIT>" ) <EOL> Pt_in = Float ( <NUM_LIT:100> , iotype = "<STR_LIT>" , units = "<STR_LIT>" , desc = "<STR_LIT>" ) <EOL> Tt = Float ( <NUM_LIT> , iotype = "<STR_LIT>" , units = "<STR_LIT>" , desc = "<STR_LIT>" ) <EOL> W = Float ( <NUM_LIT> , iotype = "<STR_LIT>" , units = "<STR_LIT>" , desc = "<STR_LIT>" ) <EOL> eff = Float ( <NUM_LIT> , iotype = "<STR_LIT>" , desc = "<STR_LIT>" ) <EOL> pwr_req = Float ( iotype = "<STR_LIT>" , units = "<STR_LIT>" , desc = "<STR_LIT>" ) <EOL> def __init__ ( self ) : <EOL> super ( Pump , self ) . __init__ ( ) <EOL> _temps = [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] <EOL> _rhos = [ <NUM_LIT> , <NUM_LIT:1000> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] <EOL> self . _rho = interp1d ( _temps , _rhos ) <EOL> def execute ( self ) : <EOL> _rho = self . _rho ( self . Tt ) <EOL> self . pwr_req = self . W / _rho * ( self . Pt_out - self . Pt_in ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> from openmdao . main . api import set_as_top <EOL> p = set_as_top ( Pump ( ) ) <EOL> p . run ( ) <EOL> print p . pwr_req </s>
