From ad9090eb18daba923f69dcc336aa3012a9a68de1 Mon Sep 17 00:00:00 2001 From: Hanspeter Schaub Date: Mon, 30 Oct 2023 20:28:02 -0600 Subject: [PATCH 1/2] fix time to nano-seconds conversion routines --- examples/BskSim/scenarios/scenario_AttModes.py | 2 +- src/utilities/macros.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/BskSim/scenarios/scenario_AttModes.py b/examples/BskSim/scenarios/scenario_AttModes.py index 6676a92630..eeed45b224 100644 --- a/examples/BskSim/scenarios/scenario_AttModes.py +++ b/examples/BskSim/scenarios/scenario_AttModes.py @@ -145,7 +145,7 @@ def runScenario(scenario): attitudeModeTime = macros.min2nano(10.) attitudeMode = ["hillPoint", "inertial3D"] - currentSimulationTime = 0. + currentSimulationTime = 0 while currentSimulationTime < simulationTime: # Configure alternating FSW mode diff --git a/src/utilities/macros.py b/src/utilities/macros.py index 31392ce573..ddd26d8f8a 100755 --- a/src/utilities/macros.py +++ b/src/utilities/macros.py @@ -21,25 +21,30 @@ import math + # function to convert seconds to an integer nanoseconds value def sec2nano(time): """convert seconds to nano-seconds""" return int(time*1E9+0.5) + # function to convert minutes to an integer nanoseconds value def min2nano(time): "convert minutes to nano-seconds" - return int((time*1E9+0.5)*60) + return int(time*1E9*60 + 0.5) + # function to convert hours to an integer nanoseconds value def hour2nano(time): """convert hours to nano-seconds""" - return int((time*1E9+0.5)*60*60) + return int(time*1E9*60*60 + 0.5) + # function to convert days to an integer nanoseconds value def day2nano(time): """convert days to nano-seconds""" - return int((time*1E9+0.5)*60*60*24) + return int(time*1E9*60*60*24 + 0.5) + # variable to convert nano-seconds to seconds NANO2SEC = 1E-9 From 532ba959a1dd70a14a1b8657e27bd5f53b7a0ef5 Mon Sep 17 00:00:00 2001 From: Hanspeter Schaub Date: Mon, 30 Oct 2023 20:28:24 -0600 Subject: [PATCH 2/2] update release notes --- docs/source/Support/bskReleaseNotes.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/Support/bskReleaseNotes.rst b/docs/source/Support/bskReleaseNotes.rst index 0c99146887..62d198cad5 100644 --- a/docs/source/Support/bskReleaseNotes.rst +++ b/docs/source/Support/bskReleaseNotes.rst @@ -72,6 +72,7 @@ Version |release| - Fixed a bug in the conanfile where the ``stderr`` output from a ``subprocess.Popen`` call was being interpreted as an error. Rather, the process return code (0 for success, and anything else for failure) indicates the success. - The ``MAX_N_CSS_MEAS`` define is increased to 32 matching the maximum number of coarse sun sensors. +- mixed bug in time to nano-seconds conversions in ``macros.py`` support file Version 2.2.0 (June 28, 2023)