st = "pt%s.CP_P_comm[%s]" % (str(i), str(k)) CP_P_comm[k] = float(row[st]) st = "pt%s.iSOC[0][0]" % str(i) iSOC = np.array([float(row[st])]) a.LD = LDs[i] a.r_e2b_I0 = r_e2b_I0s[i] a.CP_Isetpt = CP_Isetpt.reshape((12, 300)) a.CP_gamma = CP_gamma a.CP_P_comm = CP_P_comm a.iSOC = iSOC a.run() print "getting data for design pt", i data["%s:Dr" % str(i)] = a.Comm_BitRate.Dr.copy() data["%s:P_comm" % str(i)] = a.Comm_BitRate.P_comm.copy() data["%s:gamma" % str(i)] = a.Attitude_Roll.Gamma.copy() data["%s:SOC" % str(i)] = a.BatteryPower.SOC.copy() data["%s:O_IE" % str(i)] = a.Comm_EarthsSpinMtx.O_IE.copy() data["%s:r_e2b_I" % str(i)] = a.Comm_VectorECI.r_e2b_I.copy() # determine the total data rate scale mxdata = max([max(data["%s:Dr" % str(i)]) for i in xrange(npts)]) # create map for all data points gmap_all = pygmaps.gmap(a.lat, a.lon, 2)
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) # Add in optimization driver top.add("driver", SLSQPdriver()) # top.add("NetGain", NetGain(n)) # top.driver.workflow.add("NetGain") # top.connect("Comm_GainPattern.gain", "NetGain.gain") top.driver.add_parameter("CP_gamma", low=0, high=np.pi / 2.) # top.driver.add_objective("-NetGain.net") top.driver.add_objective("-sum(Comm_GainPattern.gain)")
st = "pt%s.CP_P_comm[%s]" % (str(i), str(k)) CP_P_comm[k] = float(row[st]) st = "pt%s.iSOC[0][0]" % str(i) iSOC = np.array([float(row[st])]) a.LD = LDs[i] a.r_e2b_I0 = r_e2b_I0s[i] a.CP_Isetpt = CP_Isetpt.reshape((12, 300)) a.CP_gamma = CP_gamma a.CP_P_comm = CP_P_comm a.iSOC = iSOC a.run() print "getting data for design pt", i data["%s:Dr" % str(i)] = a.Comm_BitRate.Dr.copy() data["%s:P_comm" % str(i)] = a.Comm_BitRate.P_comm.copy() data["%s:gamma" % str(i)] = a.Attitude_Roll.Gamma.copy() data["%s:SOC" % str(i)] = a.BatteryPower.SOC.copy() data["%s:O_IE" % str(i)] = a.Comm_EarthsSpinMtx.O_IE.copy() data["%s:r_e2b_I" % str(i)] = a.Comm_VectorECI.r_e2b_I.copy() # determine the total data rate scale mxdata = max([max(data["%s:Dr" % str(i)]) for i in xrange(npts)]) # create map for all data points gmap_all = pygmaps.gmap(a.lat, a.lon, 2)