diff --git a/.bashrc b/.bashrc index fb14e19a..06053e91 100644 --- a/.bashrc +++ b/.bashrc @@ -1,5 +1,5 @@ export CML_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -export CTEST_PARALLEL_LEVEL=10 +export CTEST_PARALLEL_LEVEL=$(nproc) export ASAN_OPTIONS="suppressions=${CML_HOME}/utility/sanitizers/asan.supp:fast_unwind_on_malloc=0" export LSAN_OPTIONS="suppressions=${CML_HOME}/utility/sanitizers/lsan.supp" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e68df939..d8959683 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,7 +20,7 @@ jobs: - name: Install system dependencies run: | sudo apt-get update - sudo apt-get install -y cmake make git libxml2 libxml2-dev perl doxygen + sudo apt-get install -y cmake make git libxml2 libxml2-dev perl doxygen graphviz - name: Checkout code uses: actions/checkout@v4 diff --git a/bin/default.yml b/bin/default.yml index 87e87261..8264b432 100644 --- a/bin/default.yml +++ b/bin/default.yml @@ -833,29 +833,6 @@ SIM_color_string_color_string: build_args: CML_OFFLINE_BUILD=1 runs: RUN_test/input.py: null -SIM_convert_double_to_words_comparison_double_to_words: - model_dir: models/utilities/double_to_words - path: models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison - build_args: CML_OFFLINE_BUILD=1 - runs: - RUN_test/input.py: - compare: - - models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/RUN_test/log_test_data.csv - vs. models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/verif_data/RUN_test/log_test_data.csv -SIM_convert_double_to_words_double_to_words: - model_dir: models/utilities/double_to_words - path: models/utilities/double_to_words/verif/SIM_convert_double_to_words - build_args: CML_OFFLINE_BUILD=1 - runs: - ERROR_test/input.py: null - RUN_test/input.py: - compare: - - models/utilities/double_to_words/verif/SIM_convert_double_to_words/RUN_test/log_test_data.csv - vs. models/utilities/double_to_words/verif/SIM_convert_double_to_words/verif_data/RUN_test/log_test_data.csv - RUN_test_warn/input.py: - compare: - - models/utilities/double_to_words/verif/SIM_convert_double_to_words/RUN_test_warn/log_test_data.csv - vs. models/utilities/double_to_words/verif/SIM_convert_double_to_words/verif_data/RUN_test_warn/log_test_data.csv SIM_correlated_state_dispersion_correlated_state_dispersion: model_dir: models/dynamics/state_initialize/correlated_state_dispersion path: models/dynamics/state_initialize/correlated_state_dispersion/verif/SIM_correlated_state_dispersion diff --git a/docs/doxygen/CMakeLists.txt b/docs/doxygen/CMakeLists.txt index 9158c5f1..761ae72c 100644 --- a/docs/doxygen/CMakeLists.txt +++ b/docs/doxygen/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(Doxygen) +find_package(Doxygen COMPONENTS doxygen dot) if (Doxygen_FOUND) # Tell Doxygen to only check the sources and headers that we're building. This diff --git a/docs/sphinx/CMakeLists.txt b/docs/sphinx/CMakeLists.txt index 906408a2..7ac91c0d 100644 --- a/docs/sphinx/CMakeLists.txt +++ b/docs/sphinx/CMakeLists.txt @@ -28,6 +28,7 @@ if (TARGET Doxygen::doxygen AND Sphinx_FOUND) models/fhw/index.rst models/interactions/index.rst models/tools/index.rst + models/utilities/convert-double-to-words.rst models/utilities/index.rst models/utilities/subscriptions.rst models/vehicle_management/index.rst diff --git a/docs/sphinx/conf.py b/docs/sphinx/conf.py index 8084ac43..369a2f5a 100644 --- a/docs/sphinx/conf.py +++ b/docs/sphinx/conf.py @@ -41,12 +41,13 @@ def _get_dependency_minimum_versions(): extensions = [ "breathe", "sphinx.ext.graphviz", + "sphinx_design" ] templates_path = ["_templates"] exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] -# Necessary for labelling a system of equations with a single equation number. +# Necessary for labeling a system of equations with a single equation number. mathjax3_config = { "tex": {"tags": "ams"} } @@ -95,4 +96,4 @@ def _get_dependency_minimum_versions(): rst_epilog = f""" .. |TrickVersionRequired| replace:: {_trick_minimum_version} .. |JEODVersionRequired| replace:: {_jeod_minimum_version} -""" \ No newline at end of file +""" diff --git a/docs/sphinx/models/utilities/convert-double-to-words.rst b/docs/sphinx/models/utilities/convert-double-to-words.rst new file mode 100644 index 00000000..7e936cc7 --- /dev/null +++ b/docs/sphinx/models/utilities/convert-double-to-words.rst @@ -0,0 +1,837 @@ +Convert Double Precision Data to Unsigned Integer Words ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. list-table:: Revision History + :widths: 15 30 30 50 + :header-rows: 1 + + * - Version + - Date + - Author + - Purpose + * - 1 + - April 2020 + - Brent Caughron + - Initial version + * - 1.1 + - June 2021 + - Tony Varesic + - Added ``bit_size`` test information + * - 2 + - September 2026 + - Nino Tarantino + - Converted to reStructuredText and major overhaul of content + +.. contents:: Table of Contents + :local: + :class: this-will-duplicate-information-and-it-is-still-useful-here + +________________________________________________________ + +.. _introduction: + +Introduction +============ + +This model provides several interfaces for converting a double-precision value to a vector of unsigned integer words. +The bit-resolution (i.e. significance of each bit), number of bits per word, and number of words to use are all +user-configurable. + +Consider a simple case, where a double-precision value must be stored in a 4-bit register with each bit representing +a resolution of 0.1. This is a common case for flight software telemetry, which tends to pack floating point numbers into +smaller buffers of known resolution per bit due to limited bandwidth. + +.. graphviz:: + + digraph register { + node [shape=plaintext]; + reg [label=< + + + + + + + + + + + + + + + +
Most Significant BitLeast Significant Bit
+ + + +
Bit 3
0.1 × 2³ = 0.8
+
+ + + +
Bit 2
0.1 × 2² = 0.4
+
+ + + +
Bit 1
0.1 × 2¹ = 0.2
+
+ + + +
Bit 0
0.1 × 2⁰ = 0.1
+
+ 4-bit register — resolution 0.1 per LSB (full scale = 1.5) +
+ >]; + } + +In this case, the value 0.9 would be stored as: + +.. graphviz:: + + digraph value_0_9 { + node [shape=plaintext]; + reg [label=< + + + + + + + + + + +
+ + + +
Bit 3
1
+
+ + + +
Bit 2
0
+
+ + + +
Bit 1
0
+
+ + + +
Bit 0
1
+
+ 0.9 stored as 1001 — (0.8 + 0.1 = 0.9) +
+ >]; + } + +This model extends this concept to allow for a user-defined word count and bits per word. Consider the case of a 4-word +register with 4 bits per word and a resolution of 0.001 bits per word. + +.. graphviz:: + + digraph word_layout { + node [shape=plaintext]; + reg [label=< + + + + + + + + + + + + + + + + + + + + + + +
Most-Significant WordLeast-Significant Word
+ + + +
Word 3
0.001 × 16³ = 4.096
+
+ + + +
Word 2
0.001 × 16² = 0.256
+
+ + + +
Word 1
0.001 × 16¹ = 0.016
+
+ + + +
Word 0
0.001 × 16⁰ = 0.001
+
+ 4-word register — 4 bits per word, resolution 0.001 (full scale = 65.535) +
+ >]; + } + +In this case, the value 5.001 would be stored as: + +.. graphviz:: + + digraph value_5_001 { + node [shape=plaintext]; + reg [label=< + + + + + + + + + + + + + + + +
+ + + +
Word 3
1
+
+ + + +
Word 2
3
+
+ + + +
Word 1
8
+
+ + + +
Word 0
9
+
+ 5.001 stored as [1, 3, 8, 9] — (1×4.096 + 3×0.256 + 8×0.016 + 9×0.001 = 5.001) +
+ >]; + } + + +________________________________________________________ + +Requirements +============ + +In addition to the value being converted into words, three user-specified inputs must be passed into the model: + +1. Resolution (i.e. significance of the least significant bit) +2. Bit-size of each word (e.g. 8-bit, 32-bit) +3. Number of words available to represent the double + +________________________________________________________ + +Model Specifications +==================== + +Model Structure +~~~~~~~~~~~~~~~ + +This model is usable as: + +- Free functions, useful for one-off conversions. +- An instantiated class, :cpp:class:`ConvertDoubleToUintWords`. Useful for when a conversion is needed as a simulation + scheduled job. + +.. doxygenfile:: convert_double_to_words.hh + +Mathematical Formulation +------------------------ + +See the :ref:`Introduction ` for a graphical representation of the conversion logic. + +________________________________________________________ + +User's Guide +============ + +.. important:: + + Regardless of the API chosen, data is returned as an array of words with word 0 corresponding to the + *least-significant word*. + +Free Function API +~~~~~~~~~~~~~~~~~ + +For one-off conversions, one of the free functions may be used. If possible, you should use the version which accepts +an ``std::vector``. + +The following demonstrates how to convert the value 5.001 to a 4-word register with 4 bits per word and a resolution of +0.001 bits per word. + +.. code-block:: cpp + + const double value = 5.001; + const unsigned int num_words = 4U; + const unsigned int bits_per_word = 4U; + const double resolution = 0.001; + + /* Vector version */ + std::vector words(num_words); + convert_double_to_uint_words(value, resolution, words, bits_per_word); + // words stores [9 8 3 1] + + /* C-style array version */ + uint32_t words[num_words]; + convert_double_to_uint_words(value, resolution, words, std::size(words), bits_per_word); + // words stores [9 8 3 1] + + +Class-Based API +~~~~~~~~~~~~~~~ + +For repeated conversions, it is recommended to create a long-lived instance of the :cpp:class:`ConvertDoubleToUintWords` +class and repeatedly use its :cpp:func:`~ConvertDoubleToUintWords::update` method. The resulting words are stored in its +:cpp:member:`~ConvertDoubleToUintWords::words` member. + +The same example shown for the free function APIs is repeated below with the class API. + +.. code-block:: cpp + + double value = 5.001; + const unsigned int num_words = 4U; + const unsigned int bits_per_word = 4U; + const double resolution = 0.001; + + ConvertDoubleToUintWords converter(value, resolution, num_words, bits_per_word); + + // converter.words stores [9 8 3 1]. + converter.update(); + + // The value has changed. Now converter.words stores [0 0 0 0]. + value = 0.0; + converter.update(); + +Extension +~~~~~~~~~ + +N/A + +________________________________________________________ + +Verification +============ + +Code Coverage +~~~~~~~~~~~~~ + +.. code-block:: text + + ------------------------------------------------------------------------------ + GCC Code Coverage Report + Directory: . + ------------------------------------------------------------------------------ + File Lines Exec Cover Missing + ------------------------------------------------------------------------------ + src/convert_double_to_uint_words.cc + 70 70 100% + ------------------------------------------------------------------------------ + TOTAL 70 70 100% + ----------------------------------------------------------------------------- + +See detailed coverage information `here `_. + +Exceptions +~~~~~~~~~~ + +N/A + +Unit-Test Cases +~~~~~~~~~~~~~~~ + +This model uses GoogleTest to test its functionality. Since the model has three different APIs, each one is tested with +the same conditions to ensure that each interface produces the same output. + +ConvertDoubleToUintWords.InvalidConfiguration +--------------------------------------------- + +This test ensures that invalid configuration options or invalid conversion values are caught and handled properly. The +following cases are checked: + +.. list-table:: + :widths: 50 50 20 + :header-rows: 1 + + * - Case + - Expected Resolution + - Result + * - ``nullptr`` passed to :cpp:func:`convert_double_to_uint_words` + - Error message emitted + - Pass + * - A word count of 0 is specified + - Error message emitted and output array of words is of size 0 + - Pass + * - A bit size of 64 is requested, which is larger than the maximum allowable 32 + - Error message emitted + - Pass + * - The value to convert is too large to be representable given the specified number of words, bits, and resolution + - Error message emitted and all bits set to 1 + - Pass + * - The value to convert is too small to be representable given the specified bit resolution + - Error message emitted and all bits set to 0 + - Pass + * - The value to convert has a specified resolution that is smaller than the distance to the next value that can be represented as a double + - Error message emitted + - Pass + +ConvertDoubleToUintWords.NoRoundoff +----------------------------------- + +A variety of cases are run where no round-off correction is required: i.e., either the value is convertible to bits with +no remainder or the remainder is less than half the bit resolution, in which case the remainder is lost due to rounding +down. + +For the following cases, all three APIs are used for each case and the expected value is checked against the output from +each. Expected values are described in detail in the test source file, so are repeated here with no explanation. + +.. list-table:: + :widths: 20 20 20 50 20 + :header-rows: 1 + + * - Value + - Resolution + - Bits Per Word + - Expected Words (Least to Most Significant) + - Result + * - 0.001 + - 0.001 + - 4 + - :math:`\begin{pmatrix} 1 & 0 & 0 & 0 \end{pmatrix}` + - Pass + * - 5.002 + - 0.001 + - 4 + - :math:`\begin{pmatrix} 10 & 8 & 3 & 1 \end{pmatrix}` + - Pass + * - 5.001 + - 0.001 + - 4 + - :math:`\begin{pmatrix} 9 & 8 & 3 & 1 \end{pmatrix}` + - Pass + * - 123456.0 + - 1.0 + - 16 + - :math:`\begin{pmatrix} 57920 & 1 & 0 & 0 \end{pmatrix}` + - Pass + * - 123457.0 + - 1.0 + - 16 + - :math:`\begin{pmatrix} 57921 & 1 & 0 & 0 \end{pmatrix}` + - Pass + * - 123458.0 + - 1.0 + - 16 + - :math:`\begin{pmatrix} 57922 & 1 & 0 & 0 \end{pmatrix}` + - Pass + * - 900987654321.181 + - 0.001 + - 16 + - :math:`\begin{pmatrix} 13341 & 35093 & 13169 & 3 \end{pmatrix}` + - Pass + +Per-case decomposition +^^^^^^^^^^^^^^^^^^^^^^ + +.. dropdown:: Case 1 — 0.001, resolution 0.001 + + .. list-table:: + :header-rows: 1 + :widths: 8 40 10 22 + + * - Word + - Significance + - Value + - Remainder + * - 3 + - :math:`0.001 \times (2^4)^3 = 4.096` + - 0 + - 0.001 + * - 2 + - :math:`0.001 \times (2^4)^2 = 0.256` + - 0 + - 0.001 + * - 1 + - :math:`0.001 \times (2^4)^1 = 0.016` + - 0 + - 0.001 + * - 0 + - :math:`0.001 \times (2^4)^0 = 0.001` + - 1 + - 0.000 + + .. math:: + + 0 \times 4.096 + 0 \times 0.256 + 0 \times 0.016 + 1 \times 0.001 = 0.001 + +.. dropdown:: Case 2 — 5.002, resolution 0.001 + + .. list-table:: + :header-rows: 1 + :widths: 8 40 10 22 + + * - Word + - Significance + - Value + - Remainder + * - 3 + - :math:`0.001 \times (2^4)^3 = 4.096` + - 1 + - 0.906 + * - 2 + - :math:`0.001 \times (2^4)^2 = 0.256` + - 3 + - 0.138 + * - 1 + - :math:`0.001 \times (2^4)^1 = 0.016` + - 8 + - 0.010 + * - 0 + - :math:`0.001 \times (2^4)^0 = 0.001` + - 10 + - 0.000 + + .. math:: + + 1 \times 4.096 + 3 \times 0.256 + 8 \times 0.016 + 10 \times 0.001 = 5.002 + +.. dropdown:: Case 3 — 5.001, resolution 0.001 + + .. list-table:: + :header-rows: 1 + :widths: 8 40 10 22 + + * - Word + - Significance + - Value + - Remainder + * - 3 + - :math:`0.001 \times (2^4)^3 = 4.096` + - 1 + - 0.905 + * - 2 + - :math:`0.001 \times (2^4)^2 = 0.256` + - 3 + - 0.137 + * - 1 + - :math:`0.001 \times (2^4)^1 = 0.016` + - 8 + - 0.009 + * - 0 + - :math:`0.001 \times (2^4)^0 = 0.001` + - 9 + - 0.000 + + .. math:: + + 1 \times 4.096 + 3 \times 0.256 + 8 \times 0.016 + 9 \times 0.001 = 5.001 + +.. dropdown:: Case 4 — 123456.0, resolution 1.0 + + .. list-table:: + :header-rows: 1 + :widths: 8 44 12 22 + + * - Word + - Significance + - Value + - Remainder + * - 3 + - :math:`1.0 \times (2^{16})^3 = 281474976710656.0` + - 0 + - 123456.0 + * - 2 + - :math:`1.0 \times (2^{16})^2 = 4294967296.0` + - 0 + - 123456.0 + * - 1 + - :math:`1.0 \times (2^{16})^1 = 65536.0` + - 1 + - 57920.0 + * - 0 + - :math:`1.0 \times (2^{16})^0 = 1.0` + - 57920 + - 0.0 + + .. math:: + + 0 \times 281474976710656.0 + 0 \times 4294967296.0 + 1 \times 65536.0 + 57920 \times 1.0 = 123456.0 + +.. dropdown:: Case 5 — 123457.0, resolution 1.0 + + .. list-table:: + :header-rows: 1 + :widths: 8 44 12 22 + + * - Word + - Significance + - Value + - Remainder + * - 3 + - :math:`1.0 \times (2^{16})^3 = 281474976710656.0` + - 0 + - 123457.0 + * - 2 + - :math:`1.0 \times (2^{16})^2 = 4294967296.0` + - 0 + - 123457.0 + * - 1 + - :math:`1.0 \times (2^{16})^1 = 65536.0` + - 1 + - 57921.0 + * - 0 + - :math:`1.0 \times (2^{16})^0 = 1.0` + - 57921 + - 0.0 + + .. math:: + + 0 \times 281474976710656.0 + 0 \times 4294967296.0 + 1 \times 65536.0 + 57921 \times 1.0 = 123457.0 + +.. dropdown:: Case 6 — 123458.0, resolution 1.0 + + .. list-table:: + :header-rows: 1 + :widths: 8 44 12 22 + + * - Word + - Significance + - Value + - Remainder + * - 3 + - :math:`1.0 \times (2^{16})^3 = 281474976710656.0` + - 0 + - 123458.0 + * - 2 + - :math:`1.0 \times (2^{16})^2 = 4294967296.0` + - 0 + - 123458.0 + * - 1 + - :math:`1.0 \times (2^{16})^1 = 65536.0` + - 1 + - 57922.0 + * - 0 + - :math:`1.0 \times (2^{16})^0 = 1.0` + - 57922 + - 0.0 + + .. math:: + + 0 \times 281474976710656.0 + 0 \times 4294967296.0 + 1 \times 65536.0 + 57922 \times 1.0 = 123458.0 + +.. dropdown:: Case 7 — 900987654321.181, resolution 0.001 + + .. list-table:: + :header-rows: 1 + :widths: 8 44 12 30 + + * - Word + - Significance + - Value + - Remainder + * - 3 + - :math:`0.001 \times (2^{16})^3 = 281474976710.656` + - 3 + - 56562724189.21301 + * - 2 + - :math:`0.001 \times (2^{16})^2 = 4294967.296` + - 13169 + - 2299868.18901062 + * - 1 + - :math:`0.001 \times (2^{16})^1 = 65.536` + - 35093 + - 13.34101061988622 + * - 0 + - :math:`0.001 \times (2^{16})^0 = 0.001` + - 13341 + - 1.061988621842147e-05 + + .. math:: + + 3 \times 281474976710.656 + 13169 \times 4294967.296 + 35093 \times 65.536 + 13341 \times 0.001 = 900987654321.18103 + + .. note:: + + The final remainder (:math:`1.06 \times 10^{-5}`) is less than half the + resolution, so no round-off correction is applied. + +ConvertDoubleToUintWords.RoundoffCorrection +------------------------------------------- + +A variety of cases are run where round-off correction is required: i.e., the value is not exactly convertible to bits +given the resolution and the remainder is greater than half the bit resolution. In that case, the least significant word +will be incremented by 1 (round-up). This has the potential to spill over into the next most significant word if the +round-up results in the least significant word surpassing its maximum value. Cases were designed to exercise the no +spillover, single spillover, and multi-word spillover scenarios. + +For the following cases, all three APIs are used for each case and the expected value is checked against the output from +each. Expected values are described in detail in the following subsection. + +.. list-table:: + :widths: 20 20 20 50 20 + :header-rows: 1 + + * - Value + - Resolution + - Bits Per Word + - Expected Words (Least to Most Significant) + - Result + * - 0.003153 + - 0.0001 + - 4 + - :math:`\begin{pmatrix} 0 & 2 & 0 & 0 \end{pmatrix}` + - Pass + * - 12287.8 + - 1.0 + - 4 + - :math:`\begin{pmatrix} 0 & 0 & 0 & 3 \end{pmatrix}` + - Pass + * - 900987654321.182 + - 0.0001 + - 16 + - :math:`\begin{pmatrix} 13342 & 35093 & 13169 & 3 \end{pmatrix}` + - Pass + +Per-case decomposition +^^^^^^^^^^^^^^^^^^^^^^ + +.. dropdown:: Case 1 — 0.003153, resolution 0.0001 + + .. list-table:: + :header-rows: 1 + :widths: 8 44 12 22 + + * - Word + - Significance + - Value + - Remainder + * - 3 + - :math:`0.0001 \times (2^4)^3 = 0.4096` + - 0 + - 0.003153 + * - 2 + - :math:`0.0001 \times (2^4)^2 = 0.0256` + - 0 + - 0.003153 + * - 1 + - :math:`0.0001 \times (2^4)^1 = 0.0016` + - 1 + - 0.001553 + * - 0 + - :math:`0.0001 \times (2^4)^0 = 0.0001` + - 15 + - 0.000053 + + .. note:: + + The final remainder (0.000053) is greater than half the resolution + (0.00005), so word 0 is incremented from 15 to 16. This overflows the + 4-bit range, spilling over to 0 and incrementing word 1 from 1 to 2. + Final words: ``[2, 0, 0, 0]`` (MSW-first). + + .. math:: + + 0 \times 0.4096 + 0 \times 0.0256 + 2 \times 0.0016 + 0 \times 0.0001 = 0.0032 + +.. dropdown:: Case 2 — 12287.8, resolution 1.0 + + .. list-table:: + :header-rows: 1 + :widths: 8 40 12 22 + + * - Word + - Significance + - Value + - Remainder + * - 3 + - :math:`1.0 \times (2^4)^3 = 4096` + - 2 + - 4095.8 + * - 2 + - :math:`1.0 \times (2^4)^2 = 256` + - 15 + - 255.8 + * - 1 + - :math:`1.0 \times (2^4)^1 = 16` + - 15 + - 15.8 + * - 0 + - :math:`1.0 \times (2^4)^0 = 1` + - 15 + - 0.8 + + .. note:: + + The final remainder (0.8) is greater than half the resolution (0.5), so + word 0 is incremented. This starts a chain of spillovers: word 0 + (15 → 16 → 0), word 1 (15 → 16 → 0), and word 2 (15 → 16 → 0) each + overflow in turn, finally incrementing word 3 from 2 to 3. + Final words: ``[3, 0, 0, 0]`` (MSW-first). + + .. math:: + + 3 \times 4096 + 0 \times 256 + 0 \times 16 + 0 \times 1 = 12288 + +.. dropdown:: Case 3 — 900987654321.182, resolution 0.001 + + .. list-table:: + :header-rows: 1 + :widths: 8 44 12 30 + + * - Word + - Significance + - Value + - Remainder + * - 3 + - :math:`0.001 \times (2^{16})^3 = 281474976710.656` + - 3 + - 56562724189.21399 + * - 2 + - :math:`0.001 \times (2^{16})^2 = 4294967.296` + - 13169 + - 2299868.1899871826 + * - 1 + - :math:`0.001 \times (2^{16})^1 = 65.536` + - 35093 + - 13.34198718238622 + * - 0 + - :math:`0.001 \times (2^{16})^0 = 0.001` + - 13341 + - 0.0009871823862184215 + + .. note:: + + The final remainder (:math:`\approx 0.000987`) is greater than half the + resolution (0.0005), so word 0 is incremented from 13341 to 13342. No + overflow occurs, so no further spillover is needed. + Final words: ``[3, 13169, 35093, 13342]`` (MSW-first). + + .. math:: + + 3 \times 281474976710.656 + 13169 \times 4294967.296 + 35093 \times 65.536 + 13342 \times 0.001 = 900987654321.18213 diff --git a/docs/sphinx/models/utilities/index.rst b/docs/sphinx/models/utilities/index.rst index d584182b..a5a221d8 100644 --- a/docs/sphinx/models/utilities/index.rst +++ b/docs/sphinx/models/utilities/index.rst @@ -10,4 +10,5 @@ really fit under other model categories. :name: utilities-models :titlesonly: - subscriptions.rst \ No newline at end of file + convert-double-to-words.rst + subscriptions.rst diff --git a/models/utilities/CMakeLists.txt b/models/utilities/CMakeLists.txt index f946e73e..788de31e 100644 --- a/models/utilities/CMakeLists.txt +++ b/models/utilities/CMakeLists.txt @@ -109,5 +109,6 @@ add_cml_tests( SOURCES cml_message/test/cml_message_test.cc + double_to_words/test/convert_double_to_words_test.cc table_interp_cpp/test/table_independent_variable_test.cc ) diff --git a/models/utilities/double_to_words/docs/README.md b/models/utilities/double_to_words/docs/README.md new file mode 100644 index 00000000..7c8ff3a2 --- /dev/null +++ b/models/utilities/double_to_words/docs/README.md @@ -0,0 +1 @@ +Read the documentation for the convert-double-to-words model [here](https://nasa.github.io/cml/models/utilities/convert-double-to-words.html). diff --git a/models/utilities/double_to_words/docs/double_to_words.odt b/models/utilities/double_to_words/docs/double_to_words.odt deleted file mode 100644 index 6cd416e8..00000000 --- a/models/utilities/double_to_words/docs/double_to_words.odt +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:727534eceee1e64a9209fc137ea15ba0653a01ffc33e9577a4ee00626641e0db -size 22478 diff --git a/models/utilities/double_to_words/docs/double_to_words.pdf b/models/utilities/double_to_words/docs/double_to_words.pdf deleted file mode 100644 index 6a50a6e6..00000000 Binary files a/models/utilities/double_to_words/docs/double_to_words.pdf and /dev/null differ diff --git a/models/utilities/double_to_words/include/convert_double_to_words.hh b/models/utilities/double_to_words/include/convert_double_to_words.hh index 57d281a0..1e2413d6 100644 --- a/models/utilities/double_to_words/include/convert_double_to_words.hh +++ b/models/utilities/double_to_words/include/convert_double_to_words.hh @@ -4,9 +4,7 @@ PURPOSE: words using a user-specified: - resolution (i.e. significance of the least significant bit) - bit-size of each word (e.g. 8-bit and 32-bit) - - number of words available to represent the double. - - This is the C++ -language version) + - number of words available to represent the double.) LIBRARY DEPENDENCY: ((../src/convert_double_to_uint_words.cc)) @@ -21,54 +19,133 @@ PROGRAMMERS: #include #include +/** + * Convert a `double` into n-bit unsigned integer words + * + * @param[in] convert_value Value to convert + * @param[in] resolution Significance of the least significant bit + * @param[in,out] words Output vector to store the converted data + * @param[in] bit_size Number of bits in each word + * + * @pre The size of `words` must be sized to the number of words that should be + * used to store the converted data. + * + * For example, convert a double-precision value to a set of four unsigned integer + * words, each of size 8 bits, with a resolution of 0.1 per bit: + * @code + * std::vector words(4); + * convert_double_to_uint_words(value, 0.1, words, 8U); + * @endcode + * + * @note `words` is returned with the _least-significant-word_ at position 0. + */ void convert_double_to_uint_words( double convert_value, double resolution, std::vector &words, unsigned int bit_size); +/** + * Convert a `double` into n-bit unsigned integer words + * + * @param[in] convert_value Value to convert + * @param[in] resolution Significance of the least significant bit + * @param[out] words Output array to store the converted data + * @param[in] array_size Size of the output array, i.e. number of words to use + * @param[in] bit_size Number of bits in each word + * + * For example, convert a double-precision value to a set of four unsigned integer + * words, each of size 8 bits, with a resolution of 0.1 per bit: + * @code + * unit32_t words[4]; + * convert_double_to_uint_words(value, 0.1, words, std::size(words), 8U); + * @endcode + * + * @note `words` is returned with the _least-significant-word_ at position 0. + */ void convert_double_to_uint_words( double convert_value, double resolution, uint32_t *words, const unsigned int array_size, unsigned int bit_size); +/** + * Provides an interface to convert a `double` into n-bit unsigned integer words + */ class ConvertDoubleToUintWords { protected: - const double & convert_value; /* (--) User inputed value to be converted - to a words value based off of specified - bit size. */ - - double resolution; /* (--) Incrementation stepping for inputed - value. */ - unsigned int word_count; /* (--) Number of words; size of the words vector. */ - unsigned int bit_size; /* (--) Determines the max possible value a word - can be. See max_uint. */ - - std::vector significance;/* (--) The amount by which the real - number being represented by the - words array will increment for every - integral increment of the word at the - same index. */ - - double max_uint{0.0}; /* (--) Max value each word can be as - determined by bit size. */ - double max_uint_f{0.0}; /* (--) max_uint - 1 */ -public: - std::vector words; /* (--) Output values, the set of integers - that represent convert_value. */ + const double & convert_value; /**< (--) User inputted value to be converted + to a words value based off of specified + bit size. */ + + double resolution; /**< (--) Incrementation stepping for inputted value. */ + unsigned int word_count; /**< (--) Number of words; size of the words vector. */ + unsigned int bit_size; /**< (--) Determines the max possible value a word + can be. @see max_uint */ + std::vector significance; /**< (--) The amount by which the real + number being represented by the + words array will increment for every + integral increment of the word at the + same index. */ + + double max_uint{0.0}; /**< (--) Max value each word can be as determined by bit size. */ + double max_uint_f{0.0}; /**< (--) #max_uint - 1 */ +public: + std::vector words; /**< (--) Output values, the set of integers + that represent #convert_value. + @note The least-significant word is at index 0. */ + /** + * Constructor + * + * @param[out] in_convert_value Reference to value to convert + * @param[in] in_resolution Significance of the least significant bit + * @param[in] in_word_count Number of words to use for the conversion + * @param[in] in_bit_size Number of bits in each word + * + * For example, set up the class to convert a double-precision value to a set + * of four unsigned integer words, each of size 8 bits, with a resolution of + * 0.1 per bit: + * @code + * ConvertDoubleToUintWords converter(value_ref, 0.1, 4U, 8U); + * @endcode + */ ConvertDoubleToUintWords( const double & in_convert_value, double in_resolution, unsigned int in_word_count, unsigned int in_bit_size); + + /** + * Copy constructor deleted. + */ + ConvertDoubleToUintWords (const ConvertDoubleToUintWords&) = delete; + + /** + * Copy assignment operator deleted. + */ + ConvertDoubleToUintWords & operator = (const ConvertDoubleToUintWords&) = delete; + + /** + * Default destructor + */ virtual ~ConvertDoubleToUintWords() = default; - ConvertDoubleToUintWords (const ConvertDoubleToUintWords& rhs) = delete; - ConvertDoubleToUintWords & operator = (const ConvertDoubleToUintWords& rhs) = delete; + /** + * Perform the conversion. + */ void update(); + + /** + * Calculates the significance of each word-array column + */ void compute_significance(); + + /** + * Checks to make sure that the value to convert is convertible + * + * @return `true` if conversion is possible, otherwise `false` + */ bool check_values(); }; diff --git a/models/utilities/double_to_words/src/convert_double_to_uint_words.cc b/models/utilities/double_to_words/src/convert_double_to_uint_words.cc index b2fe2026..ce124ee4 100644 --- a/models/utilities/double_to_words/src/convert_double_to_uint_words.cc +++ b/models/utilities/double_to_words/src/convert_double_to_uint_words.cc @@ -18,14 +18,15 @@ LIBRARY DEPENDENCIES: *******************************************************************************/ #include "../include/convert_double_to_words.hh" #include "cml/models/utilities/cml_message/include/cml_message.hh" +#include #include +#include +#include #include -/******************************************************************************* -Purpose:(Run the class function that calls the variables and creates the - words array that is populated with the converted values for - the original variable pass in format.) -*******************************************************************************/ +/** + * Instantiates a @ref ConvertDoubleToUintWords class to do the conversion. + */ void convert_double_to_uint_words( double convert_value, double resolution, uint32_t *words, @@ -52,10 +53,9 @@ void convert_double_to_uint_words( double convert_value, } } -/******************************************************************************* -Purpose:(Run the class function that calls the variables and creates the - words array that is populated with the converted values.) -*******************************************************************************/ +/** + * Instantiates a @ref ConvertDoubleToUintWords class to do the conversion. + */ void convert_double_to_uint_words( double convert_value, double resolution, std::vector &words, @@ -68,14 +68,11 @@ void convert_double_to_uint_words( double convert_value, local_conv.update(); - // Copy the class data to the output. - words = local_conv.words; + // Move the class data to the output. + words = std::move(local_conv.words); } -/******************************************************************************* -ConvertDoubleToUintWords -Purpose:(Defines the class constructor for the object local_conv.) -*******************************************************************************/ +// Constructor ConvertDoubleToUintWords::ConvertDoubleToUintWords( const double & in_convert_value, double in_resolution, unsigned int in_word_count, @@ -106,10 +103,14 @@ ConvertDoubleToUintWords::ConvertDoubleToUintWords( const double & in_convert_va } } -/******************************************************************************* -Purpose:(Check passed in values to see if they're in acceptable tolerance - or to see if they're initialized correctly.) -*******************************************************************************/ +/** + * Checks that: + * - The value to convert is at least half of the specified bit-resolution. + * - The value to convert is not too large to be representable in the number of + * words specified with the given resolution. + * - The separation between words ("resolution") is not finer than the separation + * between adjacent values representable by a double. + */ bool ConvertDoubleToUintWords::check_values() { @@ -133,13 +134,13 @@ ConvertDoubleToUintWords::check_values() // severity so that it can be viewed as wanted by the user CMLMessage::inform( __FILE__,__LINE__,"Roundoff warning:\n\n", - "inputvalue ", convert_value, " is too large to be represented by words.\n" + "input value ", convert_value, " is too large to be represented by words.\n" "The output will be the max possible value (", significance.at(word_count)-resolution, ") instead.\n"); return false; } // Check whether the specified separation between words ("resolution") is - // finer than the separation between adjacen double values. If it is, there + // finer than the separation between adjacent double values. If it is, there // will be words that are not available because they will be skipped before // reaching the next value available using the double data type. // @@ -148,18 +149,14 @@ ConvertDoubleToUintWords::check_values() // Sign bit: 1 bit // Exponent: 11 bits // Significand precision: 53 bits (52 explicitly stored) - // 2^53 = 9,007,199,254,740,992, the largest integer preresentable + // 2^53 = 9,007,199,254,740,992, the largest integer representable // in 53 bits of binary64 // // Thus the next nearest value to convert_value that can be expressed as a // double will be approximately 1 part in 9,007,199,254,740,992 away from // the current value. If that distance is larger than "resolution", then // there will be words that fit in the gap that will therefore be unusable. - // Rather than using division (and the risk of sub-normal numbers) and writing - // "if (resolution <= convert_value / 9,007,199,254,740,992)", - // the test is structured with multiplication: - if (convert_value >= (0.900719926*1e16)*resolution) { - //error message + if (convert_value >= std::ldexp(resolution, std::numeric_limits::digits)) { CMLMessage::error( __FILE__,__LINE__,"Initialization error:\n\n", "Resolution of words is lower than the resolution of double.\n " @@ -168,17 +165,14 @@ ConvertDoubleToUintWords::check_values() return true; } -/******************************************************************************* -compute_significance -Purpose:(Class function that calculates the significance at each word-array - column and is then used in calculations to convert the inputed value - into words.) -*******************************************************************************/ +/** + * Automatically called during construction. Used to convert the input value + * into words. + */ void ConvertDoubleToUintWords::compute_significance() { - - // First identify the largest value expressable by an unsigned int + // First identify the largest value expressible by an unsigned int max_uint = 2.0*static_cast(1UL<<(bit_size-1)); max_uint_f = max_uint - 1.0; @@ -201,19 +195,15 @@ ConvertDoubleToUintWords::compute_significance() } } -/******************************************************************************* -Purpose:(Class function that updates the words array with converted - variable values.) -*******************************************************************************/ +// Perform the conversion void ConvertDoubleToUintWords::update() { - if (!check_values()) { return; } // Otherwise, work backward from the most significant uint to the least - // Note that the value of the significance of the least-signifiant bit of the + // Note that the value of the significance of the least-significant bit of the // word that (is / would be) found at index max_index is larger than // convert_value, so the max_index word must be zero, and the most // significant non-zero word is at max_index -1. @@ -248,4 +238,4 @@ ConvertDoubleToUintWords::update() return; } } -} \ No newline at end of file +} diff --git a/models/utilities/double_to_words/test/convert_double_to_words_test.cc b/models/utilities/double_to_words/test/convert_double_to_words_test.cc new file mode 100644 index 00000000..b8260e41 --- /dev/null +++ b/models/utilities/double_to_words/test/convert_double_to_words_test.cc @@ -0,0 +1,275 @@ +#include "../include/convert_double_to_words.hh" +#include "mocks/cml/cml_message_mock.hh" + +#include +#include + +namespace { + +// Common interface for testing all three APIs for the double to words model. +void test_double_to_words( + const double value, + const double resolution, + const unsigned int bit_size, + const std::vector& expected) { + using testing::Eq; + using testing::Pointwise; + + constexpr unsigned int word_count = 4U; + uint32_t word_array[word_count]; + std::vector word_vector(word_count); + + convert_double_to_uint_words(value, resolution, word_vector, bit_size); + convert_double_to_uint_words(value, resolution, word_array, std::size(word_array), bit_size); + ConvertDoubleToUintWords article(value, resolution, word_count, bit_size); + article.update(); + + EXPECT_THAT(word_vector, Pointwise(Eq(), expected)); + EXPECT_THAT(word_array, Pointwise(Eq(), expected)); + EXPECT_THAT(article.words, Pointwise(Eq(), expected)); + EXPECT_EQ(article.words.size(), word_count); +} + +// Test various invalid configuration options. +TEST(ConvertDoubleToUintWords, InvalidConfiguration) { + using testing::_; + using testing::HasSubstr; + + CMLMessage::Mock cml_message_mock; + + // Passing an invalid pointer to the free function interface. + EXPECT_CALL( + cml_message_mock, + publish(CMLMessage::Error, _, _, HasSubstr("words array was passed in as NULL"))); + convert_double_to_uint_words(1.0, 1e-3, nullptr, 2, 8); + + // Invalid word count. + { + constexpr double value = 0.001; + constexpr double resolution = 0.001; + constexpr unsigned int word_count = 0U; + constexpr unsigned int bit_size = 16U; + EXPECT_CALL( + cml_message_mock, + publish(CMLMessage::Error, _, _, HasSubstr("will generate 0 words"))); + const ConvertDoubleToUintWords article(value, resolution, word_count, bit_size); + EXPECT_EQ(article.words.size(), 0); + } + + // Invalid bit size. + { + constexpr double value = 0.001; + constexpr double resolution = 0.001; + constexpr unsigned int word_count = 2U; + constexpr unsigned int bit_size = 64U; + EXPECT_CALL( + cml_message_mock, + publish(CMLMessage::Error, _, _, HasSubstr("bit_size cannot be > 32"))); + ConvertDoubleToUintWords(value, resolution, word_count, bit_size); + } + + // Value to convert is too large. + { + constexpr double value = 0.001; + constexpr double resolution = 1e-200; + constexpr unsigned int word_count = 2U; + constexpr unsigned int bit_size = 16U; + ConvertDoubleToUintWords article(value, resolution, word_count, bit_size); + EXPECT_CALL( + cml_message_mock, + publish(CMLMessage::Inform, _, _, HasSubstr("too large to be represented"))); + article.update(); + + // All bits should be set to 1. With 16 bits, expecting 2^16 - 1 = 65535. + ASSERT_EQ(article.words.size(), 2); + ASSERT_EQ(article.words[0], 65535); + ASSERT_EQ(article.words[1], 65535); + } + + // Value to convert is too small. + { + constexpr double value = 0.3; + constexpr double resolution = 1.0; + constexpr unsigned int word_count = 2U; + constexpr unsigned int bit_size = 16U; + ConvertDoubleToUintWords article(value, resolution, word_count, bit_size); + EXPECT_FALSE(article.check_values()); + ASSERT_EQ(article.words[0], 0); + ASSERT_EQ(article.words[1], 0); + } + + // Resolution is finer than the separation between double values. + { + constexpr double value = 9007199260000000.0; + constexpr double resolution = 1.0; + constexpr unsigned int word_count = 4U; + constexpr unsigned int bit_size = 16U; + ConvertDoubleToUintWords article(value, resolution, word_count, bit_size); + EXPECT_CALL( + cml_message_mock, + publish(CMLMessage::Error, _, _, HasSubstr("Resolution of words is lower than the resolution of double"))); + article.check_values(); + } +} + +// Test the double to unsigned integer conversion with values that do not require round off +// correction. +TEST(ConvertDoubleToUintWords, NoRoundoff) { + // Case 1 + // 0.001 with a resolution of 0.001. Max word value = 2^4 = 16. + // Significance values: + // Index 3: 0.001 * 16^3 = 4.096 + // Index 2: 0.001 * 16^2 = 0.256 + // Index 1: 0.001 * 16^1 = 0.016 + // Index 0: 0.001 * 16^0 = 0.001 + // + // Word 3 = 0.001 / 4.096 = 0; remainder = 0.001 + // Word 2 = 0.001 / 0.256 = 0; remainder = 0.001 + // Word 1 = 0.001 / 0.016 = 0; remainder = 0.001 + // Word 0 = 0.001 / 0.001 = 1; remainder = 0.000 + test_double_to_words(0.001, 0.001, 4U, {1U, 0U, 0U, 0U}); + + // Case 2 + // 5.002 with a resolution of 0.001. Max word value = 2^4 = 16. + // Significance values: + // Index 3: 0.001 * 16^3 = 4.096 + // Index 2: 0.001 * 16^2 = 0.256 + // Index 1: 0.001 * 16^1 = 0.016 + // Index 0: 0.001 * 16^0 = 0.001 + // + // Word 3 = 5.002 / 4.096 = 1; remainder = 0.906 + // Word 2 = 0.906 / 0.256 = 3; remainder = 0.138 + // Word 1 = 0.138 / 0.016 = 8; remainder = 0.010 + // Word 0 = 0.010 / 0.001 = 10; remainder = 0.000 + test_double_to_words(5.002, 0.001, 4U, {10U, 8U, 3U, 1U}); + + // Case 3 + // 5.001 with a resolution of 0.001. Max word value = 2^4 = 16. + // Significance values: + // Index 3: 0.001 * 16^3 = 4.096 + // Index 2: 0.001 * 16^2 = 0.256 + // Index 1: 0.001 * 16^1 = 0.016 + // Index 0: 0.001 * 16^0 = 0.001 + // + // Word 3 = 5.001 / 4.096 = 1; remainder = 0.905 + // Word 2 = 0.905 / 0.256 = 3; remainder = 0.137 + // Word 1 = 0.137 / 0.016 = 8; remainder = 0.009 + // Word 0 = 0.009 / 0.001 = 9; remainder = 0.000 + test_double_to_words(5.001, 0.001, 4U, {9U, 8U, 3U, 1U}); + + // Case 4 + // 123456.0 with a resolution of 1.0. Max word value = 2^16 = 65536. + // Significance values: + // Index 3: 1.0 * 65536^3 = 281474976710656.0 + // Index 2: 1.0 * 65536^2 = 4294967296.0 + // Index 1: 1.0 * 65536^1 = 65536.0 + // Index 0: 1.0 * 65536^0 = 1.0 + // + // Word 3 = 123456.0 / 281474976710656.0 = 0; remainder = 123456.0 + // Word 2 = 123456.0 / 4294967296.0 = 0; remainder = 123456.0 + // Word 1 = 123456.0 / 65536.0 = 1; remainder = 57920.0 + // Word 0 = 57920.0 / 1.0 = 57920; remainder = 0.0 + test_double_to_words(123456.0, 1.0, 16U, {57920U, 1U, 0U, 0U}); + + // Case 5 + // 123457.0 with a resolution of 1.0. Max word value = 2^16 = 65536. + // Significance values: + // Index 3: 1.0 * 65536^3 = 281474976710656.0 + // Index 2: 1.0 * 65536^2 = 4294967296.0 + // Index 1: 1.0 * 65536^1 = 65536.0 + // Index 0: 1.0 * 65536^0 = 1.0 + // + // Word 3 = 123457.0 / 281474976710656.0 = 0; remainder = 123457.0 + // Word 2 = 123457.0 / 4294967296.0 = 0; remainder = 123457.0 + // Word 1 = 123457.0 / 65536.0 = 1; remainder = 57921.0 + // Word 0 = 57921.0 / 1.0 = 57921; remainder = 0.0 + test_double_to_words(123457.0, 1.0, 16U, {57921U, 1U, 0U, 0U}); + + // Case 6 + // 123458.0 with a resolution of 1.0. Max word value = 2^16 = 65536. + // Significance values: + // Index 3: 1.0 * 65536^3 = 281474976710656.0 + // Index 2: 1.0 * 65536^2 = 4294967296.0 + // Index 1: 1.0 * 65536^1 = 65536.0 + // Index 0: 1.0 * 65536^0 = 1.0 + // + // Word 3 = 123458.0 / 281474976710656.0 = 0; remainder = 123458.0 + // Word 2 = 123458.0 / 4294967296.0 = 0; remainder = 123458.0 + // Word 1 = 123458.0 / 65536.0 = 1; remainder = 57922.0 + // Word 0 = 57922.0 / 1.0 = 57922; remainder = 0.0 + test_double_to_words(123458.0, 1.0, 16U, {57922U, 1U, 0U, 0U}); + + // Case 7 + // 900987654321.181 with a resolution of 0.001. Max word value = 2^16 = 65536. + // Significance values: + // Index 3: 0.001 * 65536^3 = 281474976710.656 + // Index 2: 0.001 * 65536^2 = 4294967.296 + // Index 1: 0.001 * 65536^1 = 65.536 + // Index 0: 0.001 * 65536^0 = 0.001 + // + // Word 3 = 900987654321.181 / 281474976710.656 = 3; remainder = 56562724189.21301 + // Word 2 = 56562724189.21301 / 4294967.296 = 13169; remainder = 2299868.18901062 + // Word 1 = 2299868.18901062 / 65.536 = 35093; remainder = 13.34101061988622 + // Word 0 = 13.34101061988622 / 0.001 = 13341; remainder = 1.061988621842147e-05 + // + // Remainder is less than half the resolution, so no round-off correction. + test_double_to_words(900987654321.181, 0.001, 16U, {13341U, 35093U, 13169U, 3U}); +} + +// Test cases where we need to correct for round off error. +TEST(ConvertDoubleToUintWords, RoundoffCorrection) { + // Case 1 + // 0.003153 with a resolution of 0.0001. Max word value = 2^4 = 16 + // Significance values: + // Index 3: 0.0001 * 16^3 = 0.4096 + // Index 2: 0.0001 * 16^2 = 0.0256 + // Index 1: 0.0001 * 16^1 = 0.0016 + // Index 0: 0.0001 * 16^0 = 0.0001 + // + // Word 3 = 0.003153 / 0.4096 = 0; remainder = 0.003153 + // Word 2 = 0.003153 / 0.0256 = 0; remainder = 0.003153 + // Word 1 = 0.003153 / 0.0016 = 1; remainder = 0.001553 + // Word 0 = 0.001553 / 0.0001 = 15; remainder = 0.000053 + // + // Since there's a remainder greater than half the resolution, we increment + // word 0, spilling over to 0 and incrementing word 1 by 1, rounding to the + // closer value that loses less precision. + test_double_to_words(0.003153, 0.0001, 4U, {0U, 2U, 0U, 0U}); + + // Case 2 + // 12287.8 with a resolution of 1.0. Max word value = 2^4 = 16 + // Significance values: + // Index 3: 1.0 * 16^3 = 4096 + // Index 2: 1.0 * 16^2 = 256 + // Index 1: 1.0 * 16^1 = 16 + // Index 0: 1.0 * 16^0 = 1 + // + // Word 3 = 12287.8 / 4096 = 2; remainder = 4095.8 + // Word 2 = 4095.8 / 256 = 15; remainder = 255.8 + // Word 1 = 255.8 / 16 = 15; remainder = 15.8 + // Word 0 = 15.8 / 1 = 15; remainder = 0.8 + // + // Since there's a remainder greater than half the resolution, we increment + // word 0, starting a chain reaction of spillovers until we reach word 3, + // which is incremented by 1. + test_double_to_words(12287.8, 1.0, 4U, {0U, 0U, 0U, 3U}); + + // Case 3 + // 900987654321.182 with a resolution of 0.001. Max word value = 2^16 = 65536. + // Significance values: + // Index 3: 0.001 * 65536^3 = 281474976710.656 + // Index 2: 0.001 * 65536^2 = 4294967.296 + // Index 1: 0.001 * 65536^1 = 65.536 + // Index 0: 0.001 * 65536^0 = 0.001 + // + // Word 3 = 900987654321.182 / 281474976710.656 = 3; remainder = 56562724189.21399 + // Word 2 = 56562724189.21399 / 4294967.296 = 13169; remainder = 2299868.1899871826 + // Word 1 = 2299868.1899871826 / 65.536 = 35093; remainder = 13.34198718238622 + // Word 0 = 13.34198718238622 / 0.001 = 13341; remainder = 0.0009871823862184215 + // + // Since there's a remainder greater than half the resolution, we increment + // word 0 from 13341 to 13342. + test_double_to_words(900987654321.182, 0.001, 16U, {13342U, 35093U, 13169U, 3U}); +} + +} // namespace diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/ERROR_test/input.py b/models/utilities/double_to_words/verif/SIM_convert_double_to_words/ERROR_test/input.py deleted file mode 100644 index c9eb9994..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/ERROR_test/input.py +++ /dev/null @@ -1,3 +0,0 @@ -convert_double_words.framework.enabled = False -convert_double_words.test_errors() -trick.stop(0) diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/Log_data/log_data.py b/models/utilities/double_to_words/verif/SIM_convert_double_to_words/Log_data/log_data.py deleted file mode 100644 index 2d6d3a3b..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/Log_data/log_data.py +++ /dev/null @@ -1,10 +0,0 @@ -dr_group = trick.DRAscii("test_data") -dr_group.set_cycle(1.0) -dr_group.freq = trick.DR_Always -trick.add_data_record_group(dr_group, trick.DR_Buffer) - -dr_group.add_variable("convert_double_words.convert_value" ) -dr_group.add_variable("convert_double_words.resolution" ) -dr_group.add_variable("convert_double_words.bit_size" ) -for ii in range(4) : - dr_group.add_variable("convert_double_words.warray[%d]" %ii) diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/RUN_test/input.py b/models/utilities/double_to_words/verif/SIM_convert_double_to_words/RUN_test/input.py deleted file mode 100644 index ccfb774f..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/RUN_test/input.py +++ /dev/null @@ -1,7 +0,0 @@ -exec(open("Log_data/log_data.py").read()) - -# Insert specific initial conditions in the Unit_test files: -convert_double_words.framework.data_file_name = "Unit_test_data/data_test.txt" -convert_double_words.framework.vars_file_name = "Unit_test_data/variables.txt" - -trick.stop(7) diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/RUN_test_warn/input.py b/models/utilities/double_to_words/verif/SIM_convert_double_to_words/RUN_test_warn/input.py deleted file mode 100644 index beb48f00..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/RUN_test_warn/input.py +++ /dev/null @@ -1,22 +0,0 @@ -exec(open("RUN_test/input.py").read()) -# change the data -convert_double_words.framework.data_file_name = "Unit_test_data/data_warn.txt" -# make inform messages visible -trick.CMLMessage.set_publish_level (trick.CMLMessage.Inform) -trick.add_read(3,""" -print('*******************************************') -print('Error at t=3; number cannot be represented') -print('*******************************************') -""") - -trick.add_read(4,""" -print('**********************************************************') -print('Error at t=4; resolution too small, words can be skipped') -print('**********************************************************') -""") - -trick.add_read(7,""" -print('**********************************************************') -print('Error at t=7; resolution too small, words can be skipped') -print('**********************************************************') -""") diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/S_define b/models/utilities/double_to_words/verif/SIM_convert_double_to_words/S_define deleted file mode 100644 index 3c70c91e..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/S_define +++ /dev/null @@ -1,64 +0,0 @@ -/************************************TRICK HEADER************************************************ -PURPOSE: (S_define header) -***********************************************************************************************/ -#include "sim_objects/default_trick_sys.sm" -#include "jeod_sys.sm" - -##include "cml/models/tools/unit_test/models/include/unit_test.hh" -##include "cml/models/utilities/double_to_words/include/convert_double_to_words.hh" -##include "cml/models/utilities/cml_message/include/cml_message.hh" -##include - -class ConvertDoubleToWordsSimObject : public Trick::SimObject { - public: - UnitTestFramework framework; - double convert_value; // (--) - double resolution; // (--) - unsigned int bit_size; // (--) - unsigned int warray[4]; // (--) - - ConvertDoubleToWordsSimObject() - : - convert_value(546), - resolution(200), - bit_size(16) - { - // Framework (leave this alone) - ("initialization") framework.initialize(); - (1.0, "environment") framework.update(); - - // test-specific jobs: - (1.0,"scheduled") convert_double_to_uint_words ( convert_value, - resolution, - warray, - 4, - bit_size); - } - - void test_errors() { - convert_double_to_uint_words( convert_value, - resolution, - NULL, - 4, - bit_size); - - convert_double_to_uint_words( convert_value, - resolution, - warray, - 0, - bit_size); - convert_double_to_uint_words( convert_value, - resolution, - warray, - 4, - 33); - } - - - - private: - ConvertDoubleToWordsSimObject (const ConvertDoubleToWordsSimObject&); - ConvertDoubleToWordsSimObject & operator = (const ConvertDoubleToWordsSimObject&); -}; - -ConvertDoubleToWordsSimObject convert_double_words ; \ No newline at end of file diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/S_overrides.mk b/models/utilities/double_to_words/verif/SIM_convert_double_to_words/S_overrides.mk deleted file mode 100644 index c769606d..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/S_overrides.mk +++ /dev/null @@ -1 +0,0 @@ -include ${CML_HOME}/mkspecs/internal/cml_unit_sim.mk diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/Unit_test_data/data_test.txt b/models/utilities/double_to_words/verif/SIM_convert_double_to_words/Unit_test_data/data_test.txt deleted file mode 100644 index b58a6c86..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/Unit_test_data/data_test.txt +++ /dev/null @@ -1,8 +0,0 @@ -0.001 0.001 16 -5.002 0.001 4 -5.001 0.001 4 -123456.0 1.0 16 -123457.0 1.0 16 -123458.0 1.0 16 -900987654321.181 0.001 16 -900987654321.182 0.001 16 diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/Unit_test_data/data_warn.txt b/models/utilities/double_to_words/verif/SIM_convert_double_to_words/Unit_test_data/data_warn.txt deleted file mode 100644 index e2b3115e..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/Unit_test_data/data_warn.txt +++ /dev/null @@ -1,9 +0,0 @@ -0.0001 0.001 16 -5.001 0.001 4 -5.0017 0.001 4 -700.001 0.001 4 -123456.78901234567 0.00000000001 16 -123457.0 1.0 16 -123458.0 1.0 16 -99900987654321.181 0.001 16 -99900987654321.182 0.001 16 diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/Unit_test_data/variables.txt b/models/utilities/double_to_words/verif/SIM_convert_double_to_words/Unit_test_data/variables.txt deleted file mode 100644 index 3dac17a0..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/Unit_test_data/variables.txt +++ /dev/null @@ -1,3 +0,0 @@ -convert_double_words.convert_value -convert_double_words.resolution -convert_double_words.bit_size diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/verif_data/RUN_test/log_test_data.csv b/models/utilities/double_to_words/verif/SIM_convert_double_to_words/verif_data/RUN_test/log_test_data.csv deleted file mode 100644 index 90851af5..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/verif_data/RUN_test/log_test_data.csv +++ /dev/null @@ -1,9 +0,0 @@ -sys.exec.out.time {s},convert_double_words.convert_value {--},convert_double_words.resolution {--},convert_double_words.bit_size {--},convert_double_words.warray[0] {--},convert_double_words.warray[1] {--},convert_double_words.warray[2] {--},convert_double_words.warray[3] {--} - 0, 0.001, 0.001,16,1,0,0,0 - 1, 5.002, 0.001,4,10,8,3,1 - 2, 5.001, 0.001,4,9,8,3,1 - 3, 123456, 1,16,57920,1,0,0 - 4, 123457, 1,16,57921,1,0,0 - 5, 123458, 1,16,57922,1,0,0 - 6, 900987654321.181, 0.001,16,13341,35093,13169,3 - 7, 900987654321.182, 0.001,16,13342,35093,13169,3 diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/verif_data/RUN_test_warn/log_test_data.csv b/models/utilities/double_to_words/verif/SIM_convert_double_to_words/verif_data/RUN_test_warn/log_test_data.csv deleted file mode 100644 index e5af132d..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words/verif_data/RUN_test_warn/log_test_data.csv +++ /dev/null @@ -1,9 +0,0 @@ -sys.exec.out.time {s},convert_double_words.convert_value {--},convert_double_words.resolution {--},convert_double_words.bit_size {--},convert_double_words.warray[0] {--},convert_double_words.warray[1] {--},convert_double_words.warray[2] {--},convert_double_words.warray[3] {--} - 0, 0.0001, 0.001,16,0,0,0,0 - 1, 5.001, 0.001,4,9,8,3,1 - 2, 5.0017, 0.001,4,10,8,3,1 - 3, 700.001, 0.001,4,15,15,15,15 - 4, 123456.7890123457,9.999999999999999e-12,16,19337,23915,56404,43 - 5, 123457, 1,16,57921,1,0,0 - 6, 123458, 1,16,57922,1,0,0 - 7, 99900987654321.19, 0.001,16,46121,16856,60267,354 diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/Log_data/log_data.py b/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/Log_data/log_data.py deleted file mode 100644 index f8d44855..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/Log_data/log_data.py +++ /dev/null @@ -1,8 +0,0 @@ -dr_group = trick.DRAscii("test_data") -dr_group.set_cycle(1.0) -dr_group.freq = trick.DR_Always -trick.add_data_record_group(dr_group, trick.DR_Buffer) - -dr_group.add_variable("convert_double_words.val" ) -for ii in range(4) : - dr_group.add_variable("convert_double_words.warray[%d]" %ii) diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/RUN_test/input.py b/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/RUN_test/input.py deleted file mode 100644 index 41c41a7a..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/RUN_test/input.py +++ /dev/null @@ -1,5 +0,0 @@ -exec(open("Log_data/log_data.py").read()) - -convert_double_words.sweep_val(100.0, 155.5, 0.10) - -trick.stop(555) diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/S_define b/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/S_define deleted file mode 100644 index be8e856e..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/S_define +++ /dev/null @@ -1,82 +0,0 @@ -/************************************TRICK HEADER************************************************ -PURPOSE: (S_define header) - -Unit_Test_Description: (Unit test runs all three different methods that can - be used to convert values to words in C++. Then it - compares them to make sure the models run the same - and output the same and correct values.) -***********************************************************************************************/ -#include "sim_objects/default_trick_sys.sm" -#include "jeod_sys.sm" - -##include "cml/models/tools/unit_test/models/include/unit_test.hh" -##include "cml/models/utilities/double_to_words/include/convert_double_to_words.hh" -##include "cml/models/utilities/cml_message/include/cml_message.hh" -##include -##include -##include - -class ConvertDoubleToWordsSimObject : public Trick::SimObject { - public: - UnitTestFramework framework; - double val; // (--) - double resolution; // (--) - std::vector wvector; // (--) - unsigned int warray[4]; // (--) - unsigned int bit_size; // (--) - - ConvertDoubleToUintWords dble_to_uint; - - ConvertDoubleToWordsSimObject() - : - val(100.0), - resolution(0.10), - wvector(4,0), - bit_size(4), - dble_to_uint( val, - 0.10, - 4, - 4) - { - // Framework (leave this alone) - ("initialization") framework.initialize(); - (1.0, "environment") framework.update(); - - // test-specific jobs: - // Class form - (1.0,"scheduled") dble_to_uint.update(); - - // Vector form - (1.0,"scheduled") convert_double_to_uint_words( val, - resolution, - wvector, - bit_size); - // Array form - (1.0,"scheduled") convert_double_to_uint_words (val, - resolution, - warray, - 4, - bit_size); - (1.0,"scheduled") comparison(); - } - - void sweep_val( double start, double end, double incr) { - framework.add_sweep(val, start, end, incr); - } - - private: - void comparison() { - for (unsigned int ii = 0; ii < 4; ii++) { - if (dble_to_uint.words[ii] != wvector[ii] || - dble_to_uint.words[ii] != warray[ii]) { - std::cout << "All model values are NOT equal for word "<< ii << - " for value " << val << std::endl; - } - } - } - - ConvertDoubleToWordsSimObject (const ConvertDoubleToWordsSimObject&); - ConvertDoubleToWordsSimObject & operator = (const ConvertDoubleToWordsSimObject&); -}; - -ConvertDoubleToWordsSimObject convert_double_words ; \ No newline at end of file diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/S_overrides.mk b/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/S_overrides.mk deleted file mode 100644 index c769606d..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/S_overrides.mk +++ /dev/null @@ -1 +0,0 @@ -include ${CML_HOME}/mkspecs/internal/cml_unit_sim.mk diff --git a/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/verif_data/RUN_test/log_test_data.csv b/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/verif_data/RUN_test/log_test_data.csv deleted file mode 100644 index 89d0f45b..00000000 --- a/models/utilities/double_to_words/verif/SIM_convert_double_to_words_comparison/verif_data/RUN_test/log_test_data.csv +++ /dev/null @@ -1,557 +0,0 @@ -sys.exec.out.time {s},convert_double_words.val {--},convert_double_words.warray[0] {--},convert_double_words.warray[1] {--},convert_double_words.warray[2] {--},convert_double_words.warray[3] {--} - 0, 100,8,14,3,0 - 1, 100.1,9,14,3,0 - 2, 100.2,10,14,3,0 - 3, 100.3,11,14,3,0 - 4, 100.4,12,14,3,0 - 5, 100.5,13,14,3,0 - 6, 100.6,14,14,3,0 - 7, 100.7,15,14,3,0 - 8, 100.8,0,15,3,0 - 9, 100.8999999999999,1,15,3,0 - 10, 100.9999999999999,2,15,3,0 - 11, 101.0999999999999,3,15,3,0 - 12, 101.1999999999999,4,15,3,0 - 13, 101.2999999999999,5,15,3,0 - 14, 101.3999999999999,6,15,3,0 - 15, 101.4999999999999,7,15,3,0 - 16, 101.5999999999999,8,15,3,0 - 17, 101.6999999999999,9,15,3,0 - 18, 101.7999999999999,10,15,3,0 - 19, 101.8999999999999,11,15,3,0 - 20, 101.9999999999999,12,15,3,0 - 21, 102.0999999999999,13,15,3,0 - 22, 102.1999999999999,14,15,3,0 - 23, 102.2999999999999,15,15,3,0 - 24, 102.3999999999999,0,0,4,0 - 25, 102.4999999999999,1,0,4,0 - 26, 102.5999999999999,2,0,4,0 - 27, 102.6999999999998,3,0,4,0 - 28, 102.7999999999998,4,0,4,0 - 29, 102.8999999999998,5,0,4,0 - 30, 102.9999999999998,6,0,4,0 - 31, 103.0999999999998,7,0,4,0 - 32, 103.1999999999998,8,0,4,0 - 33, 103.2999999999998,9,0,4,0 - 34, 103.3999999999998,10,0,4,0 - 35, 103.4999999999998,11,0,4,0 - 36, 103.5999999999998,12,0,4,0 - 37, 103.6999999999998,13,0,4,0 - 38, 103.7999999999998,14,0,4,0 - 39, 103.8999999999998,15,0,4,0 - 40, 103.9999999999998,0,1,4,0 - 41, 104.0999999999998,1,1,4,0 - 42, 104.1999999999998,2,1,4,0 - 43, 104.2999999999998,3,1,4,0 - 44, 104.3999999999997,4,1,4,0 - 45, 104.4999999999997,5,1,4,0 - 46, 104.5999999999997,6,1,4,0 - 47, 104.6999999999997,7,1,4,0 - 48, 104.7999999999997,8,1,4,0 - 49, 104.8999999999997,9,1,4,0 - 50, 104.9999999999997,10,1,4,0 - 51, 105.0999999999997,11,1,4,0 - 52, 105.1999999999997,12,1,4,0 - 53, 105.2999999999997,13,1,4,0 - 54, 105.3999999999997,14,1,4,0 - 55, 105.4999999999997,15,1,4,0 - 56, 105.5999999999997,0,2,4,0 - 57, 105.6999999999997,1,2,4,0 - 58, 105.7999999999997,2,2,4,0 - 59, 105.8999999999997,3,2,4,0 - 60, 105.9999999999997,4,2,4,0 - 61, 106.0999999999997,5,2,4,0 - 62, 106.1999999999996,6,2,4,0 - 63, 106.2999999999996,7,2,4,0 - 64, 106.3999999999996,8,2,4,0 - 65, 106.4999999999996,9,2,4,0 - 66, 106.5999999999996,10,2,4,0 - 67, 106.6999999999996,11,2,4,0 - 68, 106.7999999999996,12,2,4,0 - 69, 106.8999999999996,13,2,4,0 - 70, 106.9999999999996,14,2,4,0 - 71, 107.0999999999996,15,2,4,0 - 72, 107.1999999999996,0,3,4,0 - 73, 107.2999999999996,1,3,4,0 - 74, 107.3999999999996,2,3,4,0 - 75, 107.4999999999996,3,3,4,0 - 76, 107.5999999999996,4,3,4,0 - 77, 107.6999999999996,5,3,4,0 - 78, 107.7999999999996,6,3,4,0 - 79, 107.8999999999996,7,3,4,0 - 80, 107.9999999999995,8,3,4,0 - 81, 108.0999999999995,9,3,4,0 - 82, 108.1999999999995,10,3,4,0 - 83, 108.2999999999995,11,3,4,0 - 84, 108.3999999999995,12,3,4,0 - 85, 108.4999999999995,13,3,4,0 - 86, 108.5999999999995,14,3,4,0 - 87, 108.6999999999995,15,3,4,0 - 88, 108.7999999999995,0,4,4,0 - 89, 108.8999999999995,1,4,4,0 - 90, 108.9999999999995,2,4,4,0 - 91, 109.0999999999995,3,4,4,0 - 92, 109.1999999999995,4,4,4,0 - 93, 109.2999999999995,5,4,4,0 - 94, 109.3999999999995,6,4,4,0 - 95, 109.4999999999995,7,4,4,0 - 96, 109.5999999999995,8,4,4,0 - 97, 109.6999999999994,9,4,4,0 - 98, 109.7999999999994,10,4,4,0 - 99, 109.8999999999994,11,4,4,0 - 100, 109.9999999999994,12,4,4,0 - 101, 110.0999999999994,13,4,4,0 - 102, 110.1999999999994,14,4,4,0 - 103, 110.2999999999994,15,4,4,0 - 104, 110.3999999999994,0,5,4,0 - 105, 110.4999999999994,1,5,4,0 - 106, 110.5999999999994,2,5,4,0 - 107, 110.6999999999994,3,5,4,0 - 108, 110.7999999999994,4,5,4,0 - 109, 110.8999999999994,5,5,4,0 - 110, 110.9999999999994,6,5,4,0 - 111, 111.0999999999994,7,5,4,0 - 112, 111.1999999999994,8,5,4,0 - 113, 111.2999999999994,9,5,4,0 - 114, 111.3999999999994,10,5,4,0 - 115, 111.4999999999993,11,5,4,0 - 116, 111.5999999999993,12,5,4,0 - 117, 111.6999999999993,13,5,4,0 - 118, 111.7999999999993,14,5,4,0 - 119, 111.8999999999993,15,5,4,0 - 120, 111.9999999999993,0,6,4,0 - 121, 112.0999999999993,1,6,4,0 - 122, 112.1999999999993,2,6,4,0 - 123, 112.2999999999993,3,6,4,0 - 124, 112.3999999999993,4,6,4,0 - 125, 112.4999999999993,5,6,4,0 - 126, 112.5999999999993,6,6,4,0 - 127, 112.6999999999993,7,6,4,0 - 128, 112.7999999999993,8,6,4,0 - 129, 112.8999999999993,9,6,4,0 - 130, 112.9999999999993,10,6,4,0 - 131, 113.0999999999993,11,6,4,0 - 132, 113.1999999999992,12,6,4,0 - 133, 113.2999999999992,13,6,4,0 - 134, 113.3999999999992,14,6,4,0 - 135, 113.4999999999992,15,6,4,0 - 136, 113.5999999999992,0,7,4,0 - 137, 113.6999999999992,1,7,4,0 - 138, 113.7999999999992,2,7,4,0 - 139, 113.8999999999992,3,7,4,0 - 140, 113.9999999999992,4,7,4,0 - 141, 114.0999999999992,5,7,4,0 - 142, 114.1999999999992,6,7,4,0 - 143, 114.2999999999992,7,7,4,0 - 144, 114.3999999999992,8,7,4,0 - 145, 114.4999999999992,9,7,4,0 - 146, 114.5999999999992,10,7,4,0 - 147, 114.6999999999992,11,7,4,0 - 148, 114.7999999999992,12,7,4,0 - 149, 114.8999999999992,13,7,4,0 - 150, 114.9999999999991,14,7,4,0 - 151, 115.0999999999991,15,7,4,0 - 152, 115.1999999999991,0,8,4,0 - 153, 115.2999999999991,1,8,4,0 - 154, 115.3999999999991,2,8,4,0 - 155, 115.4999999999991,3,8,4,0 - 156, 115.5999999999991,4,8,4,0 - 157, 115.6999999999991,5,8,4,0 - 158, 115.7999999999991,6,8,4,0 - 159, 115.8999999999991,7,8,4,0 - 160, 115.9999999999991,8,8,4,0 - 161, 116.0999999999991,9,8,4,0 - 162, 116.1999999999991,10,8,4,0 - 163, 116.2999999999991,11,8,4,0 - 164, 116.3999999999991,12,8,4,0 - 165, 116.4999999999991,13,8,4,0 - 166, 116.5999999999991,14,8,4,0 - 167, 116.6999999999991,15,8,4,0 - 168, 116.799999999999,0,9,4,0 - 169, 116.899999999999,1,9,4,0 - 170, 116.999999999999,2,9,4,0 - 171, 117.099999999999,3,9,4,0 - 172, 117.199999999999,4,9,4,0 - 173, 117.299999999999,5,9,4,0 - 174, 117.399999999999,6,9,4,0 - 175, 117.499999999999,7,9,4,0 - 176, 117.599999999999,8,9,4,0 - 177, 117.699999999999,9,9,4,0 - 178, 117.799999999999,10,9,4,0 - 179, 117.899999999999,11,9,4,0 - 180, 117.999999999999,12,9,4,0 - 181, 118.099999999999,13,9,4,0 - 182, 118.199999999999,14,9,4,0 - 183, 118.299999999999,15,9,4,0 - 184, 118.399999999999,0,10,4,0 - 185, 118.4999999999989,1,10,4,0 - 186, 118.5999999999989,2,10,4,0 - 187, 118.6999999999989,3,10,4,0 - 188, 118.7999999999989,4,10,4,0 - 189, 118.8999999999989,5,10,4,0 - 190, 118.9999999999989,6,10,4,0 - 191, 119.0999999999989,7,10,4,0 - 192, 119.1999999999989,8,10,4,0 - 193, 119.2999999999989,9,10,4,0 - 194, 119.3999999999989,10,10,4,0 - 195, 119.4999999999989,11,10,4,0 - 196, 119.5999999999989,12,10,4,0 - 197, 119.6999999999989,13,10,4,0 - 198, 119.7999999999989,14,10,4,0 - 199, 119.8999999999989,15,10,4,0 - 200, 119.9999999999989,0,11,4,0 - 201, 120.0999999999989,1,11,4,0 - 202, 120.1999999999989,2,11,4,0 - 203, 120.2999999999988,3,11,4,0 - 204, 120.3999999999988,4,11,4,0 - 205, 120.4999999999988,5,11,4,0 - 206, 120.5999999999988,6,11,4,0 - 207, 120.6999999999988,7,11,4,0 - 208, 120.7999999999988,8,11,4,0 - 209, 120.8999999999988,9,11,4,0 - 210, 120.9999999999988,10,11,4,0 - 211, 121.0999999999988,11,11,4,0 - 212, 121.1999999999988,12,11,4,0 - 213, 121.2999999999988,13,11,4,0 - 214, 121.3999999999988,14,11,4,0 - 215, 121.4999999999988,15,11,4,0 - 216, 121.5999999999988,0,12,4,0 - 217, 121.6999999999988,1,12,4,0 - 218, 121.7999999999988,2,12,4,0 - 219, 121.8999999999988,3,12,4,0 - 220, 121.9999999999987,4,12,4,0 - 221, 122.0999999999987,5,12,4,0 - 222, 122.1999999999987,6,12,4,0 - 223, 122.2999999999987,7,12,4,0 - 224, 122.3999999999987,8,12,4,0 - 225, 122.4999999999987,9,12,4,0 - 226, 122.5999999999987,10,12,4,0 - 227, 122.6999999999987,11,12,4,0 - 228, 122.7999999999987,12,12,4,0 - 229, 122.8999999999987,13,12,4,0 - 230, 122.9999999999987,14,12,4,0 - 231, 123.0999999999987,15,12,4,0 - 232, 123.1999999999987,0,13,4,0 - 233, 123.2999999999987,1,13,4,0 - 234, 123.3999999999987,2,13,4,0 - 235, 123.4999999999987,3,13,4,0 - 236, 123.5999999999987,4,13,4,0 - 237, 123.6999999999987,5,13,4,0 - 238, 123.7999999999986,6,13,4,0 - 239, 123.8999999999986,7,13,4,0 - 240, 123.9999999999986,8,13,4,0 - 241, 124.0999999999986,9,13,4,0 - 242, 124.1999999999986,10,13,4,0 - 243, 124.2999999999986,11,13,4,0 - 244, 124.3999999999986,12,13,4,0 - 245, 124.4999999999986,13,13,4,0 - 246, 124.5999999999986,14,13,4,0 - 247, 124.6999999999986,15,13,4,0 - 248, 124.7999999999986,0,14,4,0 - 249, 124.8999999999986,1,14,4,0 - 250, 124.9999999999986,2,14,4,0 - 251, 125.0999999999986,3,14,4,0 - 252, 125.1999999999986,4,14,4,0 - 253, 125.2999999999986,5,14,4,0 - 254, 125.3999999999986,6,14,4,0 - 255, 125.4999999999986,7,14,4,0 - 256, 125.5999999999985,8,14,4,0 - 257, 125.6999999999985,9,14,4,0 - 258, 125.7999999999985,10,14,4,0 - 259, 125.8999999999985,11,14,4,0 - 260, 125.9999999999985,12,14,4,0 - 261, 126.0999999999985,13,14,4,0 - 262, 126.1999999999985,14,14,4,0 - 263, 126.2999999999985,15,14,4,0 - 264, 126.3999999999985,0,15,4,0 - 265, 126.4999999999985,1,15,4,0 - 266, 126.5999999999985,2,15,4,0 - 267, 126.6999999999985,3,15,4,0 - 268, 126.7999999999985,4,15,4,0 - 269, 126.8999999999985,5,15,4,0 - 270, 126.9999999999985,6,15,4,0 - 271, 127.0999999999985,7,15,4,0 - 272, 127.1999999999985,8,15,4,0 - 273, 127.2999999999984,9,15,4,0 - 274, 127.3999999999984,10,15,4,0 - 275, 127.4999999999984,11,15,4,0 - 276, 127.5999999999984,12,15,4,0 - 277, 127.6999999999984,13,15,4,0 - 278, 127.7999999999984,14,15,4,0 - 279, 127.8999999999984,15,15,4,0 - 280, 127.9999999999984,0,0,5,0 - 281, 128.0999999999984,1,0,5,0 - 282, 128.1999999999984,2,0,5,0 - 283, 128.2999999999984,3,0,5,0 - 284, 128.3999999999984,4,0,5,0 - 285, 128.4999999999984,5,0,5,0 - 286, 128.5999999999984,6,0,5,0 - 287, 128.6999999999984,7,0,5,0 - 288, 128.7999999999984,8,0,5,0 - 289, 128.8999999999984,9,0,5,0 - 290, 128.9999999999984,10,0,5,0 - 291, 129.0999999999983,11,0,5,0 - 292, 129.1999999999983,12,0,5,0 - 293, 129.2999999999983,13,0,5,0 - 294, 129.3999999999983,14,0,5,0 - 295, 129.4999999999983,15,0,5,0 - 296, 129.5999999999983,0,1,5,0 - 297, 129.6999999999983,1,1,5,0 - 298, 129.7999999999983,2,1,5,0 - 299, 129.8999999999983,3,1,5,0 - 300, 129.9999999999983,4,1,5,0 - 301, 130.0999999999983,5,1,5,0 - 302, 130.1999999999983,6,1,5,0 - 303, 130.2999999999983,7,1,5,0 - 304, 130.3999999999983,8,1,5,0 - 305, 130.4999999999983,9,1,5,0 - 306, 130.5999999999983,10,1,5,0 - 307, 130.6999999999983,11,1,5,0 - 308, 130.7999999999982,12,1,5,0 - 309, 130.8999999999982,13,1,5,0 - 310, 130.9999999999982,14,1,5,0 - 311, 131.0999999999982,15,1,5,0 - 312, 131.1999999999982,0,2,5,0 - 313, 131.2999999999982,1,2,5,0 - 314, 131.3999999999982,2,2,5,0 - 315, 131.4999999999982,3,2,5,0 - 316, 131.5999999999982,4,2,5,0 - 317, 131.6999999999982,5,2,5,0 - 318, 131.7999999999982,6,2,5,0 - 319, 131.8999999999982,7,2,5,0 - 320, 131.9999999999982,8,2,5,0 - 321, 132.0999999999982,9,2,5,0 - 322, 132.1999999999982,10,2,5,0 - 323, 132.2999999999982,11,2,5,0 - 324, 132.3999999999982,12,2,5,0 - 325, 132.4999999999982,13,2,5,0 - 326, 132.5999999999981,14,2,5,0 - 327, 132.6999999999981,15,2,5,0 - 328, 132.7999999999981,0,3,5,0 - 329, 132.8999999999981,1,3,5,0 - 330, 132.9999999999981,2,3,5,0 - 331, 133.0999999999981,3,3,5,0 - 332, 133.1999999999981,4,3,5,0 - 333, 133.2999999999981,5,3,5,0 - 334, 133.3999999999981,6,3,5,0 - 335, 133.4999999999981,7,3,5,0 - 336, 133.5999999999981,8,3,5,0 - 337, 133.6999999999981,9,3,5,0 - 338, 133.7999999999981,10,3,5,0 - 339, 133.8999999999981,11,3,5,0 - 340, 133.9999999999981,12,3,5,0 - 341, 134.0999999999981,13,3,5,0 - 342, 134.1999999999981,14,3,5,0 - 343, 134.2999999999981,15,3,5,0 - 344, 134.399999999998,0,4,5,0 - 345, 134.499999999998,1,4,5,0 - 346, 134.599999999998,2,4,5,0 - 347, 134.699999999998,3,4,5,0 - 348, 134.799999999998,4,4,5,0 - 349, 134.899999999998,5,4,5,0 - 350, 134.999999999998,6,4,5,0 - 351, 135.099999999998,7,4,5,0 - 352, 135.199999999998,8,4,5,0 - 353, 135.299999999998,9,4,5,0 - 354, 135.399999999998,10,4,5,0 - 355, 135.499999999998,11,4,5,0 - 356, 135.599999999998,12,4,5,0 - 357, 135.699999999998,13,4,5,0 - 358, 135.799999999998,14,4,5,0 - 359, 135.899999999998,15,4,5,0 - 360, 135.999999999998,0,5,5,0 - 361, 136.0999999999979,1,5,5,0 - 362, 136.1999999999979,2,5,5,0 - 363, 136.2999999999979,3,5,5,0 - 364, 136.3999999999979,4,5,5,0 - 365, 136.4999999999979,5,5,5,0 - 366, 136.5999999999979,6,5,5,0 - 367, 136.6999999999979,7,5,5,0 - 368, 136.7999999999979,8,5,5,0 - 369, 136.8999999999979,9,5,5,0 - 370, 136.9999999999979,10,5,5,0 - 371, 137.0999999999979,11,5,5,0 - 372, 137.1999999999979,12,5,5,0 - 373, 137.2999999999979,13,5,5,0 - 374, 137.3999999999979,14,5,5,0 - 375, 137.4999999999979,15,5,5,0 - 376, 137.5999999999979,0,6,5,0 - 377, 137.6999999999979,1,6,5,0 - 378, 137.7999999999979,2,6,5,0 - 379, 137.8999999999978,3,6,5,0 - 380, 137.9999999999978,4,6,5,0 - 381, 138.0999999999978,5,6,5,0 - 382, 138.1999999999978,6,6,5,0 - 383, 138.2999999999978,7,6,5,0 - 384, 138.3999999999978,8,6,5,0 - 385, 138.4999999999978,9,6,5,0 - 386, 138.5999999999978,10,6,5,0 - 387, 138.6999999999978,11,6,5,0 - 388, 138.7999999999978,12,6,5,0 - 389, 138.8999999999978,13,6,5,0 - 390, 138.9999999999978,14,6,5,0 - 391, 139.0999999999978,15,6,5,0 - 392, 139.1999999999978,0,7,5,0 - 393, 139.2999999999978,1,7,5,0 - 394, 139.3999999999978,2,7,5,0 - 395, 139.4999999999978,3,7,5,0 - 396, 139.5999999999977,4,7,5,0 - 397, 139.6999999999977,5,7,5,0 - 398, 139.7999999999977,6,7,5,0 - 399, 139.8999999999977,7,7,5,0 - 400, 139.9999999999977,8,7,5,0 - 401, 140.0999999999977,9,7,5,0 - 402, 140.1999999999977,10,7,5,0 - 403, 140.2999999999977,11,7,5,0 - 404, 140.3999999999977,12,7,5,0 - 405, 140.4999999999977,13,7,5,0 - 406, 140.5999999999977,14,7,5,0 - 407, 140.6999999999977,15,7,5,0 - 408, 140.7999999999977,0,8,5,0 - 409, 140.8999999999977,1,8,5,0 - 410, 140.9999999999977,2,8,5,0 - 411, 141.0999999999977,3,8,5,0 - 412, 141.1999999999977,4,8,5,0 - 413, 141.2999999999977,5,8,5,0 - 414, 141.3999999999976,6,8,5,0 - 415, 141.4999999999976,7,8,5,0 - 416, 141.5999999999976,8,8,5,0 - 417, 141.6999999999976,9,8,5,0 - 418, 141.7999999999976,10,8,5,0 - 419, 141.8999999999976,11,8,5,0 - 420, 141.9999999999976,12,8,5,0 - 421, 142.0999999999976,13,8,5,0 - 422, 142.1999999999976,14,8,5,0 - 423, 142.2999999999976,15,8,5,0 - 424, 142.3999999999976,0,9,5,0 - 425, 142.4999999999976,1,9,5,0 - 426, 142.5999999999976,2,9,5,0 - 427, 142.6999999999976,3,9,5,0 - 428, 142.7999999999976,4,9,5,0 - 429, 142.8999999999976,5,9,5,0 - 430, 142.9999999999976,6,9,5,0 - 431, 143.0999999999976,7,9,5,0 - 432, 143.1999999999975,8,9,5,0 - 433, 143.2999999999975,9,9,5,0 - 434, 143.3999999999975,10,9,5,0 - 435, 143.4999999999975,11,9,5,0 - 436, 143.5999999999975,12,9,5,0 - 437, 143.6999999999975,13,9,5,0 - 438, 143.7999999999975,14,9,5,0 - 439, 143.8999999999975,15,9,5,0 - 440, 143.9999999999975,0,10,5,0 - 441, 144.0999999999975,1,10,5,0 - 442, 144.1999999999975,2,10,5,0 - 443, 144.2999999999975,3,10,5,0 - 444, 144.3999999999975,4,10,5,0 - 445, 144.4999999999975,5,10,5,0 - 446, 144.5999999999975,6,10,5,0 - 447, 144.6999999999975,7,10,5,0 - 448, 144.7999999999975,8,10,5,0 - 449, 144.8999999999974,9,10,5,0 - 450, 144.9999999999974,10,10,5,0 - 451, 145.0999999999974,11,10,5,0 - 452, 145.1999999999974,12,10,5,0 - 453, 145.2999999999974,13,10,5,0 - 454, 145.3999999999974,14,10,5,0 - 455, 145.4999999999974,15,10,5,0 - 456, 145.5999999999974,0,11,5,0 - 457, 145.6999999999974,1,11,5,0 - 458, 145.7999999999974,2,11,5,0 - 459, 145.8999999999974,3,11,5,0 - 460, 145.9999999999974,4,11,5,0 - 461, 146.0999999999974,5,11,5,0 - 462, 146.1999999999974,6,11,5,0 - 463, 146.2999999999974,7,11,5,0 - 464, 146.3999999999974,8,11,5,0 - 465, 146.4999999999974,9,11,5,0 - 466, 146.5999999999974,10,11,5,0 - 467, 146.6999999999973,11,11,5,0 - 468, 146.7999999999973,12,11,5,0 - 469, 146.8999999999973,13,11,5,0 - 470, 146.9999999999973,14,11,5,0 - 471, 147.0999999999973,15,11,5,0 - 472, 147.1999999999973,0,12,5,0 - 473, 147.2999999999973,1,12,5,0 - 474, 147.3999999999973,2,12,5,0 - 475, 147.4999999999973,3,12,5,0 - 476, 147.5999999999973,4,12,5,0 - 477, 147.6999999999973,5,12,5,0 - 478, 147.7999999999973,6,12,5,0 - 479, 147.8999999999973,7,12,5,0 - 480, 147.9999999999973,8,12,5,0 - 481, 148.0999999999973,9,12,5,0 - 482, 148.1999999999973,10,12,5,0 - 483, 148.2999999999973,11,12,5,0 - 484, 148.3999999999972,12,12,5,0 - 485, 148.4999999999972,13,12,5,0 - 486, 148.5999999999972,14,12,5,0 - 487, 148.6999999999972,15,12,5,0 - 488, 148.7999999999972,0,13,5,0 - 489, 148.8999999999972,1,13,5,0 - 490, 148.9999999999972,2,13,5,0 - 491, 149.0999999999972,3,13,5,0 - 492, 149.1999999999972,4,13,5,0 - 493, 149.2999999999972,5,13,5,0 - 494, 149.3999999999972,6,13,5,0 - 495, 149.4999999999972,7,13,5,0 - 496, 149.5999999999972,8,13,5,0 - 497, 149.6999999999972,9,13,5,0 - 498, 149.7999999999972,10,13,5,0 - 499, 149.8999999999972,11,13,5,0 - 500, 149.9999999999972,12,13,5,0 - 501, 150.0999999999972,13,13,5,0 - 502, 150.1999999999971,14,13,5,0 - 503, 150.2999999999971,15,13,5,0 - 504, 150.3999999999971,0,14,5,0 - 505, 150.4999999999971,1,14,5,0 - 506, 150.5999999999971,2,14,5,0 - 507, 150.6999999999971,3,14,5,0 - 508, 150.7999999999971,4,14,5,0 - 509, 150.8999999999971,5,14,5,0 - 510, 150.9999999999971,6,14,5,0 - 511, 151.0999999999971,7,14,5,0 - 512, 151.1999999999971,8,14,5,0 - 513, 151.2999999999971,9,14,5,0 - 514, 151.3999999999971,10,14,5,0 - 515, 151.4999999999971,11,14,5,0 - 516, 151.5999999999971,12,14,5,0 - 517, 151.6999999999971,13,14,5,0 - 518, 151.7999999999971,14,14,5,0 - 519, 151.899999999997,15,14,5,0 - 520, 151.999999999997,0,15,5,0 - 521, 152.099999999997,1,15,5,0 - 522, 152.199999999997,2,15,5,0 - 523, 152.299999999997,3,15,5,0 - 524, 152.399999999997,4,15,5,0 - 525, 152.499999999997,5,15,5,0 - 526, 152.599999999997,6,15,5,0 - 527, 152.699999999997,7,15,5,0 - 528, 152.799999999997,8,15,5,0 - 529, 152.899999999997,9,15,5,0 - 530, 152.999999999997,10,15,5,0 - 531, 153.099999999997,11,15,5,0 - 532, 153.199999999997,12,15,5,0 - 533, 153.299999999997,13,15,5,0 - 534, 153.399999999997,14,15,5,0 - 535, 153.499999999997,15,15,5,0 - 536, 153.599999999997,0,0,6,0 - 537, 153.6999999999969,1,0,6,0 - 538, 153.7999999999969,2,0,6,0 - 539, 153.8999999999969,3,0,6,0 - 540, 153.9999999999969,4,0,6,0 - 541, 154.0999999999969,5,0,6,0 - 542, 154.1999999999969,6,0,6,0 - 543, 154.2999999999969,7,0,6,0 - 544, 154.3999999999969,8,0,6,0 - 545, 154.4999999999969,9,0,6,0 - 546, 154.5999999999969,10,0,6,0 - 547, 154.6999999999969,11,0,6,0 - 548, 154.7999999999969,12,0,6,0 - 549, 154.8999999999969,13,0,6,0 - 550, 154.9999999999969,14,0,6,0 - 551, 155.0999999999969,15,0,6,0 - 552, 155.1999999999969,0,1,6,0 - 553, 155.2999999999969,1,1,6,0 - 554, 155.3999999999969,2,1,6,0 - 555, 155.4999999999968,3,1,6,0 diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/Log_data/log_data.py b/models/utilities/double_to_words/verif/SIM_double_to_words/Log_data/log_data.py deleted file mode 100644 index 7983ac54..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/Log_data/log_data.py +++ /dev/null @@ -1,18 +0,0 @@ -def log_test_data ( log_cycle ) : - recording_group_name = "test_data" - dr_group = trick.DRAscii(recording_group_name) - dr_group.thisown = 0 - dr_group.set_cycle(log_cycle) - dr_group.freq = trick.DR_Always - - dr_group.add_variable("double_words.convert_value" ) - dr_group.add_variable("double_words.resolution" ) - dr_group.add_variable("double_words.bit_size" ) - - for ii in range(0,4) : - dr_group.add_variable("double_words.words[%d]" %ii) - - trick.add_data_record_group(dr_group, trick.DR_Buffer) - - return - diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/RUN_Null/input.py b/models/utilities/double_to_words/verif/SIM_double_to_words/RUN_Null/input.py deleted file mode 100644 index 1a81b993..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/RUN_Null/input.py +++ /dev/null @@ -1,10 +0,0 @@ -exec(open("Log_data/log_data.py").read()) -log_test_data( 1.0 ) - -double_words.null_check = True - -# Insert specific initial conditions in the Unit_test files: -double_words.framework.data_file_name = "Unit_test_data/data.txt" -double_words.framework.vars_file_name = "Unit_test_data/variables.txt" - -trick.sim_services.exec_set_terminate_time(1) diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/RUN_bit_size/input.py b/models/utilities/double_to_words/verif/SIM_double_to_words/RUN_bit_size/input.py deleted file mode 100644 index 82798ec2..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/RUN_bit_size/input.py +++ /dev/null @@ -1,6 +0,0 @@ - -# Insert specific initial conditions in the Unit_test files: -double_words.framework.data_file_name = "Unit_test_data_bit_size/data.txt" -double_words.framework.vars_file_name = "Unit_test_data_bit_size/variables.txt" - -trick.sim_services.exec_set_terminate_time(0) diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/RUN_test/input.py b/models/utilities/double_to_words/verif/SIM_double_to_words/RUN_test/input.py deleted file mode 100644 index 2beb3cd8..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/RUN_test/input.py +++ /dev/null @@ -1,8 +0,0 @@ -exec(open("Log_data/log_data.py").read()) -log_test_data( 1.0 ) - -# Insert specific initial conditions in the Unit_test files: -double_words.framework.data_file_name = "Unit_test_data/data.txt" -double_words.framework.vars_file_name = "Unit_test_data/variables.txt" - -trick.sim_services.exec_set_terminate_time(5) diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/RUN_test_warn/input.py b/models/utilities/double_to_words/verif/SIM_double_to_words/RUN_test_warn/input.py deleted file mode 100644 index 2ca1ef03..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/RUN_test_warn/input.py +++ /dev/null @@ -1,8 +0,0 @@ -exec(open("Log_data/log_data.py").read()) -log_test_data( 1.0 ) - -# Insert specific initial conditions in the Unit_test files: -double_words.framework.data_file_name = "Unit_test_data_warn/data.txt" -double_words.framework.vars_file_name = "Unit_test_data_warn/variables.txt" - -trick.sim_services.exec_set_terminate_time(4) diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/S_define b/models/utilities/double_to_words/verif/SIM_double_to_words/S_define deleted file mode 100644 index 721dbdc5..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/S_define +++ /dev/null @@ -1,48 +0,0 @@ -/*******************************TRICK HEADER************************************************ -PURPOSE: (S_define header) -***************************************************************************************/ -#include "sim_objects/default_trick_sys.sm" - -##include -##include "cml/models/utilities/double_to_words/include/double_to_words.h" -##include "cml/models/tools/unit_test/models/include/unit_test.hh" -##include "cml/models/utilities/cml_message/include/cml_message.hh" - -class DoubleToWordsSimObject : public Trick::SimObject { - public: - UnitTestFramework framework; - double convert_value; /* (--) convert value */ - double resolution; /* (--) resolution value */ - unsigned int words[4]; /* (--) words */ - unsigned int array_size; /* (--) array size */ - unsigned int bit_size; /* (--) bit size */ - bool null_check; /* (--) null_check flag */ - - DoubleToWordsSimObject() - : - convert_value(546), - resolution(200), - array_size(4), - bit_size(16), - null_check(false) - { - //Framework (leave this alone) - ("initialization") framework.initialize(); - (1.0, "environment") framework.update(); - - // test-specific jobs: - (1.0,"scheduled") double_to_uint_words (convert_value,resolution,words,array_size,bit_size); - (1.0,"scheduled") words_null_check(); - } - - private: - void words_null_check() { - if (null_check) { - double_to_uint_words(convert_value,resolution,NULL,array_size,bit_size); - } - } - DoubleToWordsSimObject (const DoubleToWordsSimObject&); - DoubleToWordsSimObject & operator = (const DoubleToWordsSimObject&); -}; - -DoubleToWordsSimObject double_words ; diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/S_overrides.mk b/models/utilities/double_to_words/verif/SIM_double_to_words/S_overrides.mk deleted file mode 100644 index c769606d..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/S_overrides.mk +++ /dev/null @@ -1 +0,0 @@ -include ${CML_HOME}/mkspecs/internal/cml_unit_sim.mk diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data/data.txt b/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data/data.txt deleted file mode 100644 index 85cd2a5d..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data/data.txt +++ /dev/null @@ -1,6 +0,0 @@ -123457.0 1.0 16 -123458.0 1.0 16 -5463.0 1.0 4 -5464.0 1.0 4 -900987654321.181 0.001 16 -900987654321.182 0.001 16 diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data/variables.txt b/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data/variables.txt deleted file mode 100644 index f7c26d98..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data/variables.txt +++ /dev/null @@ -1,3 +0,0 @@ -double_words.convert_value -double_words.resolution -double_words.bit_size diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data_bit_size/data.txt b/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data_bit_size/data.txt deleted file mode 100644 index 27a8eb12..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data_bit_size/data.txt +++ /dev/null @@ -1 +0,0 @@ -123457.0 1.0 33 diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data_bit_size/variables.txt b/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data_bit_size/variables.txt deleted file mode 100644 index f7c26d98..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data_bit_size/variables.txt +++ /dev/null @@ -1,3 +0,0 @@ -double_words.convert_value -double_words.resolution -double_words.bit_size diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data_warn/data.txt b/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data_warn/data.txt deleted file mode 100644 index 96f53775..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data_warn/data.txt +++ /dev/null @@ -1,5 +0,0 @@ -0.01 1.0 16 -70000.0 1.0 4 -4367.0 1.0 4 -4367.7 1.0 4 -9900987654321.181 0.001 16 diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data_warn/variables.txt b/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data_warn/variables.txt deleted file mode 100644 index f7c26d98..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/Unit_test_data_warn/variables.txt +++ /dev/null @@ -1,3 +0,0 @@ -double_words.convert_value -double_words.resolution -double_words.bit_size diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/RUN_Null/log_test_data.csv b/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/RUN_Null/log_test_data.csv deleted file mode 100644 index 54b4f40f..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/RUN_Null/log_test_data.csv +++ /dev/null @@ -1,3 +0,0 @@ -sys.exec.out.time {s},double_words.convert_value {--},double_words.resolution {--},double_words.bit_size {--},double_words.words[0] {--},double_words.words[1] {--},double_words.words[2] {--},double_words.words[3] {--} - 0, 123457, 1,16,57921,1,0,0 - 1, 123458, 1,16,57922,1,0,0 diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/RUN_test/log_test_data.csv b/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/RUN_test/log_test_data.csv deleted file mode 100644 index 07ca5cff..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/RUN_test/log_test_data.csv +++ /dev/null @@ -1,7 +0,0 @@ -sys.exec.out.time {s},double_words.convert_value {--},double_words.resolution {--},double_words.bit_size {--},double_words.words[0] {--},double_words.words[1] {--},double_words.words[2] {--},double_words.words[3] {--} - 0, 123457, 1,16,57921,1,0,0 - 1, 123458, 1,16,57922,1,0,0 - 2, 5463, 1,4,7,5,5,1 - 3, 5464, 1,4,8,5,5,1 - 4, 900987654321.181, 0.001,16,13341,35093,13169,3 - 5, 900987654321.182, 0.001,16,13342,35093,13169,3 diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/RUN_test_warn/log_test_data.csv b/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/RUN_test_warn/log_test_data.csv deleted file mode 100644 index 2b2c7f8e..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/RUN_test_warn/log_test_data.csv +++ /dev/null @@ -1,6 +0,0 @@ -sys.exec.out.time {s},double_words.convert_value {--},double_words.resolution {--},double_words.bit_size {--},double_words.words[0] {--},double_words.words[1] {--},double_words.words[2] {--},double_words.words[3] {--} - 0, 0.01, 1,16,0,0,0,0 - 1, 70000, 1,4,15,15,15,15 - 2, 4367, 1,4,15,0,1,1 - 3, 4367.7, 1,4,0,1,1,1 - 4, 9900987654321.182, 0.001,16,46109,21519,11493,35 diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/Unit_test_data/data.txt b/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/Unit_test_data/data.txt deleted file mode 100644 index ecab720a..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/Unit_test_data/data.txt +++ /dev/null @@ -1,4 +0,0 @@ -123457.0 1.0 16 -5463.4 1.0 4 -90123456789.123 0.001 16 -900987654321.181 0.001 16 diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/Unit_test_data/variables.txt b/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/Unit_test_data/variables.txt deleted file mode 100644 index f7c26d98..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/Unit_test_data/variables.txt +++ /dev/null @@ -1,3 +0,0 @@ -double_words.convert_value -double_words.resolution -double_words.bit_size diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/Unit_test_data_warn/data.txt b/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/Unit_test_data_warn/data.txt deleted file mode 100644 index 25ad4ba2..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/Unit_test_data_warn/data.txt +++ /dev/null @@ -1,4 +0,0 @@ -0.01 1.0 16 -70000.0 1.0 4 -990123456789.123 0.001 16 -9900987654321.181 0.001 16 diff --git a/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/Unit_test_data_warn/variables.txt b/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/Unit_test_data_warn/variables.txt deleted file mode 100644 index f7c26d98..00000000 --- a/models/utilities/double_to_words/verif/SIM_double_to_words/verif_data/Unit_test_data_warn/variables.txt +++ /dev/null @@ -1,3 +0,0 @@ -double_words.convert_value -double_words.resolution -double_words.bit_size diff --git a/pyproject.toml b/pyproject.toml index 0029d269..8a4df57f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ dependencies = [ "sphinx", "sphinx-autobuild", "sphinx-book-theme", + "sphinx-design", ] [project.urls] diff --git a/utility/doc_template/CML_Document_Template.dotx b/utility/doc_template/CML_Document_Template.dotx deleted file mode 100644 index aa5d764f..00000000 --- a/utility/doc_template/CML_Document_Template.dotx +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8ee9ddc2d06a7b56a6c1a92eccdbc148a98ddecb62b55b8bade736d2d6a58fd6 -size 3386130 diff --git a/utility/doc_template/CML_Document_Template.ott b/utility/doc_template/CML_Document_Template.ott deleted file mode 100644 index 87272f10..00000000 Binary files a/utility/doc_template/CML_Document_Template.ott and /dev/null differ diff --git a/utility/doc_template/VV_template.odp b/utility/doc_template/VV_template.odp deleted file mode 100644 index 443f0250..00000000 --- a/utility/doc_template/VV_template.odp +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0b1fe1d02f040889e9aaeabff05fa8ad22989e92b8a9a4fc98b4cdee5ca416b4 -size 1249109 diff --git a/utility/doc_template/VV_template.pptx b/utility/doc_template/VV_template.pptx deleted file mode 100644 index 3278ca5b..00000000 Binary files a/utility/doc_template/VV_template.pptx and /dev/null differ diff --git a/utility/doc_template/cml.sty b/utility/doc_template/cml.sty deleted file mode 100644 index 4dd87697..00000000 --- a/utility/doc_template/cml.sty +++ /dev/null @@ -1,88 +0,0 @@ -\usepackage[usenames,dvipsnames,svgnames,table]{xcolor} -\usepackage[top=1in, bottom=1.5in, left=1in, right=1in]{geometry} -\setlength{\parindent}{24pt} -\usepackage{indentfirst} -\setlength{\parskip}{8pt} -\usepackage{amsmath} -\usepackage{listings} - -%\newsavebox{\Ccodebox} -\lstnewenvironment{codeC} - {\lstset{basicstyle=\small\ttfamily, - language=C++, - xleftmargin=0.0in, - xrightmargin=0.0in, - backgroundcolor=\color{Apricot!60}, % 60% apricot, 40% white - escapeinside={\%*}{*)}, % .tex file characters inside %*...*) are treated as Tex commands. - } - } - { } - -\lstnewenvironment{codePython} - {\lstset{basicstyle=\small\ttfamily, - language=Python, - xleftmargin=0.0in, - xrightmargin=0.0in, - backgroundcolor=\color{Turquoise!60}, % 60% turquoise, 40% white - escapeinside={\%*}{*)}, % .tex file characters inside %*...*) are treated as Tex commands. - } - } - { } - - - -\newsavebox{\codebox} -\newenvironment{code1} - {\par - \begin{center} - \begin{lrbox}{\codebox} - \begin{minipage}{0.8\textwidth} - \fontfamily{pcr} \selectfont - \small - } - { - \end{minipage} - \end{lrbox} - \colorbox{Apricot}{\usebox{\codebox}} - \end{center} - \par - } - -\newsavebox{\codecommentbox} -\newenvironment{codecomment} - {\begin{lrbox}{\codecommentbox} - \begin{minipage}{0.8\textwidth} - \fontfamily{\familydefault} \selectfont - \small - } - { - \end{minipage} - \end{lrbox} -% \indent - \colorbox{SkyBlue!70}{\usebox{\codecommentbox}} - } - -\newcommand*{\titlePage} -{\thispagestyle{empty} - \begingroup - \centering % Center all text - \vspace*{\baselineskip} % White space at the top of the page - - \rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt} % Thick horizontal line - \rule{\textwidth}{0.4pt}\\[\baselineskip] % Thin horizontal line - {\LARGE ANTARES - CML Code Project}\\[0.2\baselineskip] % Title - \rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt} % Thin horizontal line - \rule{\textwidth}{1.6pt}\\[\baselineskip] % Thick horizontal line - - \vspace*{8\baselineskip} - {\Huge \ModelName \par} - \vfill -% \vspace*{8\baselineskip} - - \Large \ModelAuthor \\ - \vspace*{2\baselineskip} - \ModelAffiliation \\ - \vspace*{2\baselineskip} - \ModelDate \\ - \endgroup -} diff --git a/utility/doc_template/doc.rst b/utility/doc_template/doc.rst new file mode 100644 index 00000000..2ca427fa --- /dev/null +++ b/utility/doc_template/doc.rst @@ -0,0 +1,85 @@ +Model Name +++++++++++ + +.. list-table:: Revision History + :widths: 15 30 30 50 + :header-rows: 1 + + * - Version + - Date + - Author + - Purpose + * - 1 + - Month Year + - Firstname Lastname + - Initial version + +.. contents:: Table of Contents + :local: + :class: this-will-duplicate-information-and-it-is-still-useful-here + +________________________________________________________ + +Introduction +============ + + +________________________________________________________ + +Requirements +============ + + +________________________________________________________ + +Model Specifications +==================== + + +Architectural Considerations +---------------------------- + + +Existing External Capabilities +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +Model Structure +~~~~~~~~~~~~~~~ + + + +Mathematical Formulation +------------------------ + + + +________________________________________________________ + +User's Guide +============ + + + +Extension +--------- + + + +________________________________________________________ + +Verification +============ + +Code Coverage +------------- + +See detailed coverage information `here `_. + + +Exceptions +---------- + + +Unit-Test Cases +--------------- diff --git a/utility/doc_template/odt_compare_in_git b/utility/doc_template/odt_compare_in_git deleted file mode 100644 index 9d90ae8e..00000000 --- a/utility/doc_template/odt_compare_in_git +++ /dev/null @@ -1,14 +0,0 @@ -git show :./.odt > old.odt - - is previous branch, tag, hash, etc. - -then open the odt file. - -Edit -> Track Changes -> Compare Document -> old.odt - - -**** -Alternative: -Add odt2txt (public git repo) to available path for git diff, and this -should show up in MRs. -*** diff --git a/utility/doc_template/template.tex b/utility/doc_template/template.tex deleted file mode 100644 index 48353fb8..00000000 --- a/utility/doc_template/template.tex +++ /dev/null @@ -1,65 +0,0 @@ -\documentclass[11pt,fleqn]{report} -\usepackage{graphicx} -\usepackage{amssymb} -\usepackage{longtable} -\usepackage[T1]{fontenc} - -\usepackage{cml} -\lstnewenvironment{codeXML} - {\lstset{basicstyle=\small\ttfamily, - language=XML, - xleftmargin=0.0in, - xrightmargin=0.0in, - backgroundcolor=\color{Orchid!60}, % 60% orchid, 40% white - escapeinside={\%*}{*)}, % .tex file characters inside %*...*) are - % treated as Tex commands. - } - } - { } - -\newcommand{\ModelName}{TBC} -\newcommand{\ModelAuthor}{TBC} -\newcommand{\ModelAffiliation}{TBC} -\newcommand{\ModelDate}{TBC} -\pagestyle{plain} -\usepackage[parfill]{parskip} -\usepackage[margin=1.5cm]{caption} -\usepackage{subfig} - -\begin{document} -\titlePage -\clearpage % Reset page number -\pagenumbering{roman} -\tableofcontents % Print table of contents -\vfill -{\Large \textbf {Revision History}} -{\large -\begin{center} -\begin{tabular}{|l||l|l|l|} -\hline - \textbf{Version} & \textbf{Date} & \textbf{Author} & \textbf{Purpose} \\ \hline - \hline -1 & TBC-date & TBC-name & Initial Version \\ \hline -\end{tabular} -\end{center} -} - -\chapter{Introduction} % Make a "chapter" heading -\pagenumbering{arabic} % Start text with arabic 1 - -\chapter {Requirements} - -\chapter {Model Specification} -\section {Architectural Considerations} -\section {Mathematical Formulations} - -\chapter {User's Guide} -\section {Implementation} -\section {Initialization} -\section {Routine Execution} -\section {Optional Execution} -\section {Configuration} - -\chapter{Verification} - -\end{document}