@@ -108,9 +108,9 @@ class Fins:
108
108
nose cone.
109
109
Fins.cantAngle : float
110
110
Fins cant angle with respect to the rocket centerline, in degrees
111
- Fins.cantAngleList : list
112
- List of cant angles that fins are set to throughout a flight
113
- simulation. Useful for control systems
111
+ Fins.changingAttributeDict : dict
112
+ Dictionary that stores the name and the values of the attributes that may
113
+ be changed during a simulation. Useful for control systems.
114
114
Fins.cantAngleRad : float
115
115
Fins cant angle with respect to the rocket centerline, in radians
116
116
Fins.rootChord : float
@@ -252,15 +252,36 @@ def evaluateRollCoefficients(self):
252
252
self .rollParameters = [clfDelta , cldOmega , self .cantAngleRad ]
253
253
return self .rollParameters
254
254
255
- def changeCantAngle (self , cantAngle ): # TODO: make it generic def ChangeParam
256
- self .cantAngleList .append (cantAngle )
255
+ def setAttribute (self , name , value ):
256
+ """Changes an existing attribute to a new value and
257
+ reruns the evaluate methods.
257
258
258
- self .cantAngle = cantAngle
259
- self .cantAngleRad = np .radians (cantAngle )
259
+ Parameters
260
+ ----------
261
+ name : strig
262
+ Name of the attribute that will be changed.
263
+ value : any
264
+ value to which the attribute will be changed to.
260
265
266
+ Returns
267
+ -------
268
+ None
269
+ """
270
+ # Changes attribute value
271
+ self .__dict__ [name ] = value
272
+
273
+ # Add changed attribute to dict
274
+ if self .changingAttributeDict .has_key (name ):
275
+ self .changingAttributeDict [name ].append (value )
276
+ else :
277
+ self .changingAttributeDict [name ] = [value ]
278
+
279
+ # Rerun important calculations
280
+ self .evaluateCenterOfPressure ()
281
+ self .evaluateLiftCoefficient ()
261
282
self .evaluateRollCoefficients ()
262
283
263
- return self
284
+ return None
264
285
265
286
# Defines beta parameter
266
287
def _beta (_ , mach ):
@@ -447,9 +468,9 @@ class TrapezoidalFins(Fins):
447
468
nose cone.
448
469
TrapezoidalFins.cantAngle : float
449
470
Fins cant angle with respect to the rocket centerline, in degrees
450
- TrapezoidalFins.cantAngleList : list
451
- List of cant angles that fins are set to throughout a flight
452
- simulation. Useful for control systems
471
+ TrapezoidalFins.changingAttributeDict : dict
472
+ Dictionary that stores the name and the values of the attributes that may
473
+ be changed during a simulation. Useful for control systems.
453
474
TrapezoidalFins.cantAngleRad : float
454
475
Fins cant angle with respect to the rocket centerline, in radians
455
476
TrapezoidalFins.rootChord : float
@@ -601,7 +622,7 @@ def __init__(
601
622
self .airfoil = airfoil
602
623
self .distanceToCM = distanceToCM
603
624
self .cantAngle = cantAngle
604
- self .cantAngleList = [ cantAngle ]
625
+ self .changingAttributeDict = {}
605
626
self .cantAngleRad = np .radians (cantAngle )
606
627
self .rootChord = rootChord
607
628
self .tipChord = tipChord
@@ -804,9 +825,9 @@ class EllipticalFins(Fins):
804
825
nose cone.
805
826
EllipticalFins.cantAngle : float
806
827
Fins cant angle with respect to the rocket centerline, in degrees
807
- EllipticalFins.cantAngleList : list
808
- List of cant angles that fins are set to throughout a flight
809
- simulation. Useful for control systems
828
+ EllipticalFins.changingAttributeDict : dict
829
+ Dictionary that stores the name and the values of the attributes that may
830
+ be changed during a simulation. Useful for control systems.
810
831
EllipticalFins.cantAngleRad : float
811
832
Fins cant angle with respect to the rocket centerline, in radians
812
833
EllipticalFins.rootChord : float
@@ -937,7 +958,7 @@ def __init__(
937
958
self .airfoil = airfoil
938
959
self .distanceToCM = distanceToCM
939
960
self .cantAngle = cantAngle
940
- self .cantAngleList = [ cantAngle ]
961
+ self .changingAttributeDict = {}
941
962
self .cantAngleRad = np .radians (cantAngle )
942
963
self .rootChord = rootChord
943
964
self .span = span
0 commit comments