import matplotlib.pyplot as plt import numpy as np import math # additional parameters the solver needs atmosphere = Atmosphere(0) launchAngle = 84 * math.pi / 180.0 #rad launchrailLength = 8.0 #m # Initial conditions # y_0 is 0.01 instead of 0 so that the hit_ground event works. look into doing it another way # x, vx, y, vy y0 = [0., 0., 0.1, 0.] rocketFilePath = "2019_rocket_doe.csv" myRocket = Rocket(rocketFilePath) motorFilePath = "Cesaroni_N5800.eng" myMotor = Motor(motorFilePath) solver = TwoDTrajectorySolver( myRocket, myMotor, atmosphere, y0, launchAngle, launchrailLength,\ dragModel=DragModel.CoefficientsBox ) parameterKeys = ['finRootChord', 'finTipChord', 'finSpan', 'finSweepLength'] baselineParameters = {} doe_coeff = np.loadtxt('analysis/doe/lhc_n4_100samples.csv') apogeeList = [] stabilityList = []
regression_row.append(xs[i]) # x_i**2 for i in range(nParameters): regression_row.append(xs[i]**2) # x_i*x_j for i in range(0, nParameters): for j in range(1, nParameters - i): regression_row.append(xs[i] * xs[j]) return regression_row rocketFilePath = "2019_rocket_doe.csv" myRocket = Rocket(rocketFilePath) parameterKeys = ['finRootChord', 'finTipChord', 'finSpan', 'finSweepLength'] baselineParameters = {} for key in parameterKeys: baselineParameters[key] = myRocket.geometry[key] doe_coeff = np.loadtxt('analysis/doe/lhc_n4_1000samples.csv') y_apogee = np.loadtxt('analysis/doe/apogee_list_lhs1000.csv') nSamples = len(y_apogee) nParameters = len(parameterKeys) xs_regression = [] for row in doe_coeff: xs_regression.append(getRegressionXs(row)) apogeeReg = linear_model.LinearRegression()
import matplotlib.pyplot as plt import numpy as np import math from sensitivity_analysis import sensitivity_analysis_apogee atmosphere = Atmosphere(0) launchAngle = 84 * math.pi / 180.0 #rad launchrailLength = 8.0 #m # Initial conditions # y_0 is 0.01 instead of 0 so that the hit_ground event works. look into doing it another way # x, vx, y, vy y0 = [0., 0., 0.1, 0.] rocketFilePath = "2019_rocket_fineness1.csv" myRocket = Rocket(rocketFilePath) motorFilePath = "Cesaroni_N5800.eng" myMotor = Motor(motorFilePath) solver = TwoDTrajectorySolver( myRocket, myMotor, atmosphere, y0, launchAngle, launchrailLength,\ dragModel=DragModel.CoefficientsBox ) solver.solve() bApogee = solver.apogee studyParameters = ["nose_length"] start = 1 stop = 10