@@ -38,13 +38,43 @@ class Dispersion:
3838 The name of the file containing the data to be used in the analysis.
3939
4040 Attributes
41- ---------- # TODO: add "Dispersion" at the beginning of each attribute
42- filename : string
43- The name of the file containing the data to be used in the analysis.
44- num_of_loaded_sims : int
45- The number of simulations loaded from the file.
46- num_of_sims : int
47- The number of simulations to be performed.
41+ ---------- # TODO: finish documentation
42+ Dispersion.filename : string
43+ Directory and name of dispersion files. When running a new simulation,
44+ this parameter represents the initial part of the export filenames
45+ (e.g. 'filename.disp_outputs.txt'). When analyzing the results of a
46+ previous simulation, this parameter shall be the .txt filename containing
47+ the outputs of a previous ran dispersion analysis.
48+ Dispersion.inputs_dict : dict
49+ Contains information regarding the input arguments of the
50+ classes. Its keys refers to each of the classes that must be defined during
51+ the simulation. Its values are dictionaries where the keys are the input
52+ arguments of each class and the values are either the string "required"
53+ (meaning it is not an optional argument) or the default value if that argument
54+ is optional.
55+ Dispersion.dispersion_results : dict
56+ Holds dispersion results.
57+ Dispersion.dispersion_dictionary : dict
58+ Contains inputs to run dispersion
59+ Dispersion.nose_names = []
60+ Dispersion.finSet_names = []
61+ Dispersion.tail_names = []
62+ Dispersion.parachute_names = []
63+ Dispersion.distributionFunc = None
64+ Dispersion.distribution_type = None
65+ Dispersion.environment = None
66+ Dispersion.flight = None
67+ Dispersion.motor = None
68+ Dispersion.rocket = None
69+ Dispersion.rocket_dispersion = None
70+ Dispersion.number_of_simulations = 0
71+ Dispersion.num_of_loaded_sims = 0
72+ Dispersion.start_time = 0
73+
74+ Dispersion.num_of_loaded_sims : int
75+ The number of simulations loaded from the file.
76+ Dispersion.num_of_sims : int
77+ The number of simulations to be performed.
4878 """
4979
5080 def __init__ (
@@ -522,7 +552,6 @@ def __process_aerodynamic_surfaces_from_dict(self, dictionary):
522552 self .tail_names = list (set (self .tail_names ))
523553
524554 # Check if there are enough arguments for each kind of aero surface
525-
526555 # Iterate through nose names
527556 for name in self .nose_names :
528557 # Iterate through aerodynamic surface available at rocket object
@@ -1142,38 +1171,66 @@ def run_dispersion(
11421171 export_list = None ,
11431172 append = False ,
11441173 ):
1145- """Runs the given number of simulations and saves the data
1174+ """Runs the dispersion simulation and saves all data. For the simulation to be run
1175+ all classes must be defined. This can happen either trough the dispersion_dictionary
1176+ or by inputing objects
11461177
11471178 Parameters
11481179 ----------
11491180 number_of_simulations : int
1150- Number of simulations desired, must be non negative.
1151- This is needed when running a new simulation. Default is zero.
1181+ Number of simulations to be run, must be non negative.
11521182 dispersion_dictionary : dict
1153- The dictionary with the parameters to be analyzed. This includes the
1154- mean and standard deviation of the parameters.
1183+ The dictionary with the parameters to be analyzed. The keys must be the
1184+ names of the attributes that will be used in the dispersion simulation.
1185+ The values can either be a tuple, containing the nominal values of that
1186+ parameter and its standard deviation, a list, containing the possible
1187+ values to be randomly chosen in each simulation, or a single value (int
1188+ or float), being the standard deviation of that parameter. See example
1189+ for further explanations.
11551190 environment : Environment, optional
1156- The environment object. Default is None.
1191+ Environment object that will be used in the simulations. Default is None.
1192+ If none, environment must be defined via passing its attributes in the
1193+ dispersion_dictionary. Arguments related to environment will only vary
1194+ according to the distribution method if the standard deviation for the
1195+ desired attributes are on the dispersion_dictionary.
11571196 flight : Flight, optional
1158- Original rocket's flight with nominal values. Parameter needed to run
1159- a new flight simulation when environment, motor and rocket remain
1160- unchanged. By default None.
1197+ Flight object that will be used in the simulations. Default is None.
1198+ If none, Flight must be defined via passing its attributes in the
1199+ dispersion_dictionary. Arguments related to Flight will only vary
1200+ according to the distribution method if the standard deviation for the
1201+ desired attributes are on the dispersion_dictionary.
11611202 motor : Motor, optional
1162- The motor object of the rocket. Default is None.
1203+ Motor object that will be used in the simulations. Default is None.
1204+ If none, Motor must be defined via passing its attributes in the
1205+ dispersion_dictionary. Arguments related to Motor will only vary
1206+ according to the distribution method if the standard deviation for the
1207+ desired attributes are on the dispersion_dictionary.
11631208 rocket : Rocket, optional
1164- The rocket object. Default is None.
1209+ Rocket object that will be used in the simulations. Default is None.
1210+ If none, Rocket must be defined via passing its attributes in the
1211+ dispersion_dictionary. Arguments related to Rocket will only vary
1212+ according to the distribution method if the standard deviation for the
1213+ desired attributes are on the dispersion_dictionary.
11651214 distribution_type : str, optional
11661215 The probability distribution function to be used in the analysis,
1167- by default "normal"
1168- exported_variables : list, optional
1169- A list containing the variables to be exported. By default None.
1216+ by default "normal". Options are any numpy.ramdom distributions
1217+ export_list : list, optional
1218+ A list containing the name of the attributes to be saved on the dispersion
1219+ outputs file. See Examples for all possible attribues
11701220 append : bool, optional
11711221 If True, the results will be appended to the existing files. If False,
11721222 the files will be overwritten. By default False.
11731223
11741224 Returns
11751225 -------
11761226 None
1227+
1228+ Examples
1229+ --------
1230+
1231+ TODO: add list of all possible attributes in dispersion_dictionaries and
1232+ all possible attributes in export_list
1233+
11771234 """
11781235
11791236 # Saving the arguments as attributes
0 commit comments