Skip to content

Commit 9e7bb8b

Browse files
Tweak accuracy and timestep to improve testing
1 parent ff4be22 commit 9e7bb8b

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

src/simulation/dynamics/linearTranslationalBodies/linearTranslationBodiesNDOF/_UnitTest/test_linearTranslationNDOFStateEffector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def translatingBodyNoInput(show_plots):
308308
plt.close("all")
309309

310310
# Testing setup
311-
accuracy = 1e-12
311+
accuracy = 1e-13
312312

313313
np.testing.assert_allclose(finalOrbEnergy, initialOrbEnergy, rtol=accuracy, err_msg="Orbital energy is not constant.")
314314
np.testing.assert_allclose(finalRotEnergy, initialRotEnergy, rtol=accuracy,
@@ -556,7 +556,7 @@ def translatingBodyLockAxis(show_plots):
556556
plt.close("all")
557557

558558
# Testing setup
559-
accuracy = 1e-12
559+
accuracy = 1e-13
560560

561561
np.testing.assert_allclose(finalOrbEnergy, initialOrbEnergy, rtol=accuracy,
562562
err_msg="Orbital energy is not constant.")
@@ -797,7 +797,7 @@ def translatingBodyCommandedForce(show_plots):
797797
plt.close("all")
798798

799799
# Testing setup
800-
accuracy = 1e-12
800+
accuracy = 1e-13
801801

802802
np.testing.assert_allclose(finalOrbEnergy, initialOrbEnergy, rtol=accuracy,
803803
err_msg="Orbital energy is not constant.")

src/simulation/dynamics/linearTranslationalBodies/linearTranslationBodiesOneDOF/_UnitTest/test_linearTranslationOneDOFStateEffector.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def translatingBodyNoInput(show_plots):
9999
unitTestSim = SimulationBaseClass.SimBaseClass()
100100

101101
# Create test thread
102-
testProcessRate = macros.sec2nano(0.001) # update process rate update time
102+
testProcessRate = macros.sec2nano(0.0001) # update process rate update time
103103
testProc = unitTestSim.CreateNewProcess(unitProcessName)
104104
testProc.addTask(unitTestSim.CreateNewTask(unitTaskName, testProcessRate))
105105

@@ -255,7 +255,7 @@ def translatingBodyNoInput(show_plots):
255255
plt.close("all")
256256

257257
# Testing setup
258-
accuracy = 1e-12
258+
accuracy = 1e-13
259259

260260
np.testing.assert_allclose(finalOrbEnergy, initialOrbEnergy, rtol=accuracy, err_msg="Orbital energy is not constant.")
261261
np.testing.assert_allclose(finalRotEnergy, initialRotEnergy, rtol=accuracy, err_msg="Rotational energy is not constant.")
@@ -278,7 +278,7 @@ def translatingBodyLockFlag(show_plots):
278278
unitTestSim = SimulationBaseClass.SimBaseClass()
279279

280280
# Create test thread
281-
testProcessRate = macros.sec2nano(0.001) # update process rate update time
281+
testProcessRate = macros.sec2nano(0.0001) # update process rate update time
282282
testProc = unitTestSim.CreateNewProcess(unitProcessName)
283283
testProc.addTask(unitTestSim.CreateNewTask(unitTaskName, testProcessRate))
284284

@@ -440,7 +440,7 @@ def translatingBodyLockFlag(show_plots):
440440
plt.close("all")
441441

442442
# Testing setup
443-
accuracy = 1e-12
443+
accuracy = 1e-13
444444

445445
np.testing.assert_allclose(finalOrbEnergy, initialOrbEnergy, rtol=accuracy, err_msg="Orbital energy is not constant.")
446446
np.testing.assert_allclose(finalRotEnergy, initialRotEnergy, rtol=accuracy, err_msg="Rotational energy is not constant.")
@@ -463,7 +463,7 @@ def translatingBodyCommandedForce(show_plots, cmdForce):
463463
unitTestSim = SimulationBaseClass.SimBaseClass()
464464

465465
# Create test thread
466-
testProcessRate = macros.sec2nano(0.001) # update process rate update time
466+
testProcessRate = macros.sec2nano(0.0001) # update process rate update time
467467
testProc = unitTestSim.CreateNewProcess(unitProcessName)
468468
testProc.addTask(unitTestSim.CreateNewTask(unitTaskName, testProcessRate))
469469

@@ -615,7 +615,7 @@ def translatingBodyCommandedForce(show_plots, cmdForce):
615615
plt.close("all")
616616

617617
# Testing setup
618-
accuracy = 1e-12
618+
accuracy = 1e-13
619619

620620
np.testing.assert_allclose(finalOrbEnergy, initialOrbEnergy, rtol=accuracy, err_msg="Orbital energy is not constant.")
621621
for i in range(3):
@@ -637,7 +637,7 @@ def translatingBodyRhoReference(show_plots, rhoRef):
637637
unitTestSim = SimulationBaseClass.SimBaseClass()
638638

639639
# Create test thread
640-
testProcessRate = macros.sec2nano(0.001) # update process rate update time
640+
testProcessRate = macros.sec2nano(0.0001) # update process rate update time
641641
testProc = unitTestSim.CreateNewProcess(unitProcessName)
642642
testProc.addTask(unitTestSim.CreateNewTask(unitTaskName, testProcessRate))
643643

@@ -726,7 +726,7 @@ def translatingBodyRhoReference(show_plots, rhoRef):
726726
unitTestSim.AddModelToTask(unitTaskName, rhoData)
727727

728728
# Setup and run the simulation
729-
stopTime = 25000 * testProcessRate
729+
stopTime = 30000 * testProcessRate # needs a little more time to settle to the correct angle
730730
unitTestSim.ConfigureStopTime(stopTime)
731731
unitTestSim.ExecuteSimulation()
732732

@@ -791,7 +791,7 @@ def translatingBodyRhoReference(show_plots, rhoRef):
791791
plt.close("all")
792792

793793
# Testing setup
794-
accuracy = 1e-12
794+
accuracy = 1e-13
795795

796796
np.testing.assert_allclose(finalAngle, rhoRef, atol=0.01, err_msg="Angle doesn't settle to reference angle.")
797797
np.testing.assert_allclose(finalOrbEnergy, initialOrbEnergy, rtol=accuracy, err_msg="Orbital energy is not constant.")

src/simulation/dynamics/spinningBodies/spinningBodiesNDOF/_UnitTest/test_spinningBodyNDOFStateEffector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def spinningBodyNoInput(show_plots):
319319
plt.close("all")
320320

321321
# Testing setup
322-
accuracy = 1e-12
322+
accuracy = 1e-13
323323

324324
np.testing.assert_allclose(finalOrbEnergy, initialOrbEnergy, rtol=accuracy)
325325
np.testing.assert_allclose(finalRotEnergy, initialRotEnergy, rtol=accuracy)
@@ -578,7 +578,7 @@ def spinningBodyLockAxis(show_plots):
578578
plt.close("all")
579579

580580
# Testing setup
581-
accuracy = 1e-12
581+
accuracy = 1e-13
582582

583583
np.testing.assert_allclose(finalOrbEnergy, initialOrbEnergy, rtol=accuracy)
584584
np.testing.assert_allclose(finalRotEnergy, initialRotEnergy, rtol=accuracy)
@@ -836,7 +836,7 @@ def spinningBodyCommandedTorque(show_plots):
836836
plt.close("all")
837837

838838
# Testing setup
839-
accuracy = 1e-12
839+
accuracy = 1e-13
840840

841841
np.testing.assert_allclose(finalOrbEnergy, initialOrbEnergy, rtol=accuracy)
842842
for i in range(3):

src/simulation/dynamics/spinningBodies/spinningBodiesOneDOF/_UnitTest/test_spinningBodyOneDOFStateEffector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def spinningBody(show_plots, cmdTorque, lock, thetaRef):
166166
# Add energy and momentum variables to log
167167
scObjectLog = scObject.logger(["totOrbAngMomPntN_N", "totRotAngMomPntC_N", "totOrbEnergy", "totRotEnergy"])
168168
unitTestSim.AddModelToTask(unitTaskName, scObjectLog)
169-
169+
170170
# Initialize the simulation
171171
unitTestSim.InitializeSimulation()
172172

@@ -248,7 +248,7 @@ def spinningBody(show_plots, cmdTorque, lock, thetaRef):
248248
plt.close("all")
249249

250250
# Testing setup
251-
accuracy = 1e-12
251+
accuracy = 1e-13
252252
finalOrbAngMom = numpy.delete(finalOrbAngMom, 0, axis=1) # remove time column
253253
finalRotAngMom = numpy.delete(finalRotAngMom, 0, axis=1) # remove time column
254254
finalRotEnergy = numpy.delete(finalRotEnergy, 0, axis=1) # remove time column

src/simulation/dynamics/spinningBodies/spinningBodiesTwoDOF/_UnitTest/test_spinningBodyTwoDOFStateEffector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def spinningBody(show_plots, cmdTorque1, lock1, theta1Ref, cmdTorque2, lock2, th
192192
# Add energy and momentum variables to log
193193
scObjectLog = scObject.logger(["totOrbAngMomPntN_N", "totRotAngMomPntC_N", "totOrbEnergy", "totRotEnergy"])
194194
unitTestSim.AddModelToTask(unitTaskName, scObjectLog)
195-
195+
196196
# Initialize the simulation
197197
unitTestSim.InitializeSimulation()
198198

@@ -290,7 +290,7 @@ def spinningBody(show_plots, cmdTorque1, lock1, theta1Ref, cmdTorque2, lock2, th
290290
plt.close("all")
291291

292292
# Testing setup
293-
accuracy = 1e-12
293+
accuracy = 3e-13
294294
finalOrbAngMom = numpy.delete(finalOrbAngMom, 0, axis=1) # remove time column
295295
finalRotAngMom = numpy.delete(finalRotAngMom, 0, axis=1) # remove time column
296296
finalRotEnergy = numpy.delete(finalRotEnergy, 0, axis=1) # remove time column

0 commit comments

Comments
 (0)