From e4c03f69637b1360147a5287d565ff8af3898c27 Mon Sep 17 00:00:00 2001 From: Hanspeter Schaub Date: Sat, 21 Sep 2024 10:12:54 -0600 Subject: [PATCH 1/4] remove 1.5 multipliers to sensor noise standard deviations --- src/simulation/sensors/coarseSunSensor/coarseSunSensor.cpp | 4 ++-- src/simulation/sensors/magnetometer/magnetometer.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/simulation/sensors/coarseSunSensor/coarseSunSensor.cpp b/src/simulation/sensors/coarseSunSensor/coarseSunSensor.cpp index 2dee9fc37f..a11884bcc0 100755 --- a/src/simulation/sensors/coarseSunSensor/coarseSunSensor.cpp +++ b/src/simulation/sensors/coarseSunSensor/coarseSunSensor.cpp @@ -134,7 +134,7 @@ void CoarseSunSensor::Reset(uint64_t CurrentSimNanos) this->noiseModel.setRNGSeed(this->RNGSeed); - nMatrix(0,0) = this->senNoiseStd*1.5; + nMatrix(0,0) = this->senNoiseStd; this->noiseModel.setNoiseMatrix(nMatrix); bounds(0,0) = this->walkBounds; @@ -155,7 +155,7 @@ void CoarseSunSensor::Reset(uint64_t CurrentSimNanos) this->faultNoiseModel.setRNGSeed(this->RNGSeed+1); - nMatrixFault(0,0) = this->faultNoiseStd*1.5; // sensor noise standard dev + nMatrixFault(0,0) = this->faultNoiseStd; // sensor noise standard dev this->faultNoiseModel.setNoiseMatrix(nMatrixFault); boundsFault(0,0) = 2.0; // walk bounds diff --git a/src/simulation/sensors/magnetometer/magnetometer.cpp b/src/simulation/sensors/magnetometer/magnetometer.cpp index b10b68ed7d..391bd93163 100644 --- a/src/simulation/sensors/magnetometer/magnetometer.cpp +++ b/src/simulation/sensors/magnetometer/magnetometer.cpp @@ -68,7 +68,7 @@ void Magnetometer::Reset(uint64_t CurrentSimNanos) } this->noiseModel.setUpperBounds(this->walkBounds); - auto nMatrix = (this->senNoiseStd * 1.5).asDiagonal(); + auto nMatrix = this->senNoiseStd.asDiagonal(); this->noiseModel.setNoiseMatrix(nMatrix); this->noiseModel.setRNGSeed(this->RNGSeed); Eigen::MatrixXd satBounds; From 7849017c8fd87286aa012f410132bfbf83052e8d Mon Sep 17 00:00:00 2001 From: Hanspeter Schaub Date: Sun, 13 Oct 2024 15:40:43 +0200 Subject: [PATCH 2/4] update CSS unit tests Need to account for the changed 1.5 multiplier behavior --- .../_UnitTest/test_coarseSunSensor.py | 2 +- .../_UnitTest/test_coarseSunSensorFaults.py | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/simulation/sensors/coarseSunSensor/_UnitTest/test_coarseSunSensor.py b/src/simulation/sensors/coarseSunSensor/_UnitTest/test_coarseSunSensor.py index 056fdf8d99..0db31aff23 100644 --- a/src/simulation/sensors/coarseSunSensor/_UnitTest/test_coarseSunSensor.py +++ b/src/simulation/sensors/coarseSunSensor/_UnitTest/test_coarseSunSensor.py @@ -128,7 +128,7 @@ def setupCSS(CSS): CSS.kellyFactor = kelly CSS.scaleFactor = scaleFactor CSS.senBias = bias - CSS.senNoiseStd = noiseStd + CSS.senNoiseStd = noiseStd*1.5 # test value is adjusted after we no longer use 1.5 in the code. No impact on the test validity CSS.albedoValue = albedoValue CSS.minOutput = minIn CSS.maxOutput = maxIn diff --git a/src/simulation/sensors/coarseSunSensor/_UnitTest/test_coarseSunSensorFaults.py b/src/simulation/sensors/coarseSunSensor/_UnitTest/test_coarseSunSensorFaults.py index dbefaff094..d2e7791254 100644 --- a/src/simulation/sensors/coarseSunSensor/_UnitTest/test_coarseSunSensorFaults.py +++ b/src/simulation/sensors/coarseSunSensor/_UnitTest/test_coarseSunSensorFaults.py @@ -46,11 +46,11 @@ @pytest.mark.parametrize( "cssFault", [ - "CSSFAULT_OFF", - "CSSFAULT_STUCK_CURRENT", - "CSSFAULT_STUCK_MAX", - "CSSFAULT_STUCK_RAND", - "CSSFAULT_RAND", + "CSSFAULT_OFF", + "CSSFAULT_STUCK_CURRENT", + "CSSFAULT_STUCK_MAX", + "CSSFAULT_STUCK_RAND", + "CSSFAULT_RAND", ]) # provide a unique test method name, starting with test_ def test_coarseSunSensor(cssFault): @@ -73,7 +73,7 @@ def run(cssFault): # Create a simulation container unitTestSim = SimulationBaseClass.SimBaseClass() # unitTestSim.RNGSeed = 10 - + # Ensure simulation is empty testProc = unitTestSim.CreateNewProcess(testProcessName) testProc.addTask(unitTestSim.CreateNewTask(testTaskName, testTaskRate)) @@ -120,10 +120,10 @@ def run(cssFault): truthValue = 2.0 elif cssFault == "CSSFAULT_STUCK_RAND": cssFaultValue = coarseSunSensor.CSSFAULT_STUCK_RAND - truthValue = 1.7278304838858731 + truthValue = 1.7278304838858731/1.5 elif cssFault == "CSSFAULT_RAND": cssFaultValue = coarseSunSensor.CSSFAULT_RAND - truthValue = 0.7974448327854251 + truthValue = 0.7974448327854251/1.5 else: NotImplementedError("Fault type specified does not exist.") @@ -138,15 +138,20 @@ def run(cssFault): cssOutput = cssRecoder.OutputData[-1] print(cssOutput) print(truthValue) - + if cssFault == "CSSFAULT_OFF": if not truthValue == cssOutput: testFailCount += 1 + testMessages.append("css value didn't match") elif not unitTestSupport.isDoubleEqualRelative(cssOutput, truthValue, 1E-12): testFailCount += 1 + testMessages.append("css value didn't match") + if testFailCount: + print(testFailCount) + print(testMessages) return [testFailCount, ''.join(testMessages)] if __name__ == "__main__": - run("CSSFAULT_STUCK_MAX") + run("CSSFAULT_STUCK_RAND") From a98af22b0889b3cae17b6c0ea11718bc2df55938 Mon Sep 17 00:00:00 2001 From: Hanspeter Schaub Date: Sun, 13 Oct 2024 15:40:56 +0200 Subject: [PATCH 3/4] update known issues document --- docs/source/Support/bskKnownIssues.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/source/Support/bskKnownIssues.rst b/docs/source/Support/bskKnownIssues.rst index 58256a89a0..e3d559a3e9 100644 --- a/docs/source/Support/bskKnownIssues.rst +++ b/docs/source/Support/bskKnownIssues.rst @@ -12,7 +12,10 @@ Version |release| ----------------- - pip-based installation in editable mode using ``pip install -e .`` is not currently supported. Developers and users alike should continue to use ``python conanfile.py`` installation. - +- When using `senNoiseStd()` to set the sensor noise standard deviations + in :ref:`magnetometer` and :ref:`coarsesunsensor` + the value was being multiplied by 1.5 when creating the diagonal noise matrix. + This 1.5x multiplier has now been removed. This is corrected in current release. Version 2.5.0 ------------- From e75420f43407da098f4681fa39293f91f9982ae3 Mon Sep 17 00:00:00 2001 From: Hanspeter Schaub Date: Sun, 13 Oct 2024 15:41:08 +0200 Subject: [PATCH 4/4] update release notes --- docs/source/Support/bskReleaseNotes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/Support/bskReleaseNotes.rst b/docs/source/Support/bskReleaseNotes.rst index 46fb291f41..3d29b290e9 100644 --- a/docs/source/Support/bskReleaseNotes.rst +++ b/docs/source/Support/bskReleaseNotes.rst @@ -50,6 +50,8 @@ Version |release| - Updated :ref:`scenarioMonteCarloAttRW` to use more pythonic OOP for Monte Carlo data retention - Updated :ref:`scenarioMonteCarloSpice` to use more pythonic OOP for Monte Carlo data retention - Removed the now deprecated ``datashader_utilities.py`` in favor of the new bokeh plotting features in ``AnalysisBaseClass.py`` +- Removed the false 1.5x multiplier in :ref:`magnetometer` and :ref:`coarsesunsensor` + when setting 'senNoiseStd' Version 2.5.0 (Sept. 30, 2024)