Skip to content

Commit bc1fb76

Browse files
author
Franz Masatoshi Yuri
committed
implemented dictionary creation
1 parent a1f8ae7 commit bc1fb76

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

data/dispersion csv files/juninho.csv

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
;;value;standard deviation;;;;;value;standard deviation;;;;;value;standard deviation;;;;;value;standard deviation
2+
Rocket Parameters:;;;;;;Motor Parameters:;;;;;;Launch and Environment;;;;;;Recuperation and eletronics;;;
3+
;rocketMass;12.96;0.648;;;;impulse;3053.198;305.3198;;;;inclination;86;1.18;;;;CdSDrogue;0.37;0.037
4+
;inertiaI;7.73;0.3867;;;;burnOut;4.488;0.8976;;;;heading;0;1.18;;;;CdSMain;1.06;0.106
5+
;inertiaZ;0.0279;0.001395;;;;nozzleRadius;0.02222;0.002222;;;;railLength;4.2;0.042;;;;lag_rec;1;0.5
6+
;radius;0.0529;0.000529;;;;throatRadius;0.00875;0.000875;;;;radiusRailPosition;0;2.5;;;;lag_se;0;0
7+
;distanceRocketNozzle;-0.91591;-0.0457955;;;;grainSeparation;0.006;0.0006;;;;ensambleMember;[0,1,2,3,4,5];;;;;;;
8+
;distanceRocketProppelant;-0.571773;-0.02858865;;;;grainDensity;1641.5;164.15;;;;windU;[3,4,5,6];;;;;;;
9+
;powerOffDrag;1;0.2;;;;grainOuterRadius;0.03596;0.003596;;;;windV;[3,4,5,6];;;;;;;
10+
;powerOnDrag;1;0.2;;;;grainInitialInnerRadius;0.01596;0.001596;;;;time;[6,12,18];;;;;;;
11+
nose;noseLength;0.41533;0.0041533;;;;grainInitialHeight;0.124;0.0124;;;;day;[23,24,25,26,27,28,29,30,31];;;;;;;
12+
;noseDistanceToCM;1.19467;0.0597335;;;;;;;;;;thetaRailPosition;[0,1,2,3,4,5,6,7,8,9,10];;;;;;;
13+
fins;finSpan;0.13;0.00065;;;;;;;;;;;;;;;;;;
14+
;finRootChord;0.12;0.0006;;;;;;;;;;;;;;;;;;
15+
;finDistanceToCM;-0.72911;0.00364555;;;;;;;;;;;;;;;;;;
16+
tail;tailDistanceToCM;-0.869;0.04345;;;;;;;;;;;;;;;;;;
17+
;tailTopRadius;0.0529;0.000529;;;;;;;;;;;;;;;;;;
18+
;tailbottomRadius;0.043296;0.00043296;;;;;;;;;;;;;;;;;;
19+
;tailLength;0.057;0.00057;;;;;;;;;;;;;;;;;;
20+
canard;canardSpan;0.062;0.00031;;;;;;;;;;;;;;;;;;
21+
;canardRootChord;0.062;0.00031;;;;;;;;;;;;;;;;;;
22+
;canardTipChord;0.062;0.00031;;;;;;;;;;;;;;;;;;
23+
;canardDistanceToCM;0.431771;0.02158855;;;;;;;;;;;;;;;;;;

rocketpy/utilities.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
__license__ = "MIT"
55

66
import numpy as np
7+
import pandas as pd
78
from scipy.integrate import solve_ivp
89

910
from .Environment import Environment
@@ -197,3 +198,64 @@ def du(z, u):
197198
velocityFunction()
198199

199200
return altitudeFunction, velocityFunction, final_sol
201+
202+
def create_dispersion_dictionary(dic):
203+
dataframe = pd.read_csv(dic,sep = ';', skiprows=[0,1], header = None)
204+
205+
206+
rocketKeys = list(dataframe[1].dropna())
207+
rocketValues = list(dataframe[2].dropna())
208+
rocketSD = list(dataframe[3])
209+
210+
motorKeys = list(dataframe[7].dropna())
211+
motorValues = list(dataframe[8].dropna())
212+
motorSD = list(dataframe[9])
213+
214+
launchKeys = list(dataframe[13].dropna())
215+
launchValues = list(dataframe[14].dropna())
216+
launchSD = list(dataframe[15])
217+
218+
parachuteKeys = list(dataframe[19].dropna())
219+
parachuteValues = list(dataframe[20].dropna())
220+
parachuteSD = list(dataframe[21])
221+
222+
223+
allValues = []
224+
# crating the dictionary
225+
226+
for i in range(0,len(rocketKeys)):
227+
228+
if pd.isnull(rocketSD[i]):
229+
allValues.append(rocketValues[i])
230+
else:
231+
allValues.append(((rocketValues[i]), (rocketSD[i])))
232+
233+
for j in range(0,len(motorKeys)):
234+
235+
if pd.isnull(motorSD[j]):
236+
allValues.append(motorValues[j])
237+
else:
238+
allValues.append(((motorValues[j]), (motorSD[j])))
239+
240+
for k in range(0,len(parachuteKeys)):
241+
242+
if pd.isnull(parachuteSD[k]):
243+
allValues.append(parachuteValues[k])
244+
else:
245+
allValues.append(((parachuteValues[k]), (parachuteSD[k])))
246+
247+
for l in range(0,len(launchKeys)):
248+
249+
if pd.isnull(launchSD[l]):
250+
allValues.append(launchValues[l])
251+
else:
252+
allValues.append(((launchValues[l]), (launchSD[l])))
253+
254+
255+
allKeys = rocketKeys + motorKeys + parachuteKeys + launchKeys
256+
257+
analysis_parameters = dict(zip(allKeys,allValues))
258+
return analysis_parameters
259+
260+
261+

0 commit comments

Comments
 (0)