Exemple #1
0
    def execute(self):
        self.net = sum(self.gain)

    def list_deriv_vars(self):
        input_keys = ('gain', )
        output_keys = ('net', )
        return input_keys, output_keys

    def apply_derivT(self, arg, result):
        if 'gain' in result and 'net' in arg:
            result['gain'] += arg['net'] * np.ones(self.n)


n, m = 1500, 150
top = CADRE(n, m)

# orbit initial position and velocity
r_e2b_I0 = [-4969.91222,  4624.84149,
            1135.9414,  0.1874654, -1.62801666,  7.4302362]

# number of days since launch
LD = 5417.5

top.set("LD", LD)
top.set("r_e2b_I0", r_e2b_I0)

# Run model to get baseline net gain value
top.run()

obj1 = sum(top.Comm_GainPattern.gain)
# get values for design vars common to each design point

row = rows[-1]

cellInstd = np.zeros((7, 12))
for i in xrange(7):
    for k in xrange(12):
        st = "pt0.cellInstd[%s]" % str(i * k)
        cellInstd[i, k] = float(row[st])
st = "pt0.finAngle[0]"
finAngle = float(row[st])
st = "pt0.antAngle[0]"
antAngle = float(row[st])

a = CADRE(1500, 300)
a.lat = -77.85
a.lon = 166.666667
a.alt = 2.835
a.cellInstd = cellInstd
a.finAngle = finAngle
a.antAngle = antAngle

# get values for design vars that are different for each design point
for i in xrange(npts):
    CP_Isetpt = np.zeros(12 * 300)
    CP_gamma = np.zeros((300, ))
    CP_P_comm = np.zeros((300, ))

    for j in xrange(12 * 300):
        st = "pt%s.CP_Isetpt[%s]" % (str(i), str(j))
Exemple #3
0
for key in data.keys():
    if key[0] == idx or not key[0].isdigit():
        if not key[0].isdigit():
            shortkey = key
        else:
            shortkey = key[2:]
        # set floats correctly
        if data[key].shape == (1, ) and shortkey != "iSOC":
            setd[shortkey] = data[key][0]
        else:
            setd[shortkey] = data[key]

n = setd['P_comm'].size
m = setd['CP_P_comm'].size

assembly = set_as_top(CADRE(n, m))

setd['r_e2b_I0'] = np.zeros(6)
setd['r_e2b_I0'][:3] = data[idx + ":r_e2b_I0"]
setd['r_e2b_I0'][3:] = data[idx + ":v_e2b_I0"]
setd['Gamma'] = data[idx + ":gamma"]

assembly.CP_P_comm = setd['CP_P_comm']
assembly.LD = setd['LD']
assembly.cellInstd = setd['cellInstd']
assembly.CP_gamma = setd['CP_gamma']
assembly.finAngle = setd['finAngle']
assembly.lon = setd['lon']
assembly.CP_Isetpt = setd['CP_Isetpt']
assembly.antAngle = setd['antAngle']
assembly.t = setd['t']
Exemple #4
0
# get values for design vars common to each design point

row = rows[-1]

cellInstd = np.zeros((7, 12))
for i in xrange(7):
    for k in xrange(12):
        st = "pt0.cellInstd[%s]" % str(i * k)
        cellInstd[i, k] = float(row[st])
st = "pt0.finAngle[0]"
finAngle = float(row[st])
st = "pt0.antAngle[0]"
antAngle = float(row[st])


a = CADRE(1500, 300)
a.lat = -77.85
a.lon = 166.666667
a.alt = 2.835
a.cellInstd = cellInstd
a.finAngle = finAngle
a.antAngle = antAngle

# get values for design vars that are different for each design point
for i in xrange(npts):
    CP_Isetpt = np.zeros(12 * 300)
    CP_gamma = np.zeros((300,))
    CP_P_comm = np.zeros((300,))

    for j in xrange(12 * 300):
        st = "pt%s.CP_Isetpt[%s]" % (str(i), str(j))