diff --git a/.gitignore b/.gitignore index 4b8e8e5a..832eea9a 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,8 @@ __pycache__ # ignore JabRef - https://www.jabref.org/ *.bak *.sav + +# Temporary Office files + +*.~* +*.~$* diff --git a/conf/fmt/README.md b/conf/fmt/README.md new file mode 100644 index 00000000..252ea295 --- /dev/null +++ b/conf/fmt/README.md @@ -0,0 +1,26 @@ +# Formatting Configurations + +This directory contains the configurations for the formatting rules applied to +the foxBMS 2 repository. + +## C + +foxBMS 2 uses [clang-format](https://clang.llvm.org/docs/ClangFormat.html) to +automatically format the code correctly. + +The formatting configuration file ``.clang-format`` is not in the directory as +clang-format has a different way of searching the configuration file +(closest configuration file to the to-be-formatted-source file is chosen). +The ``.clang-format`` is therefore stored in the repository root. + +Directories that should not be automatically formatted must include a +``.clang-format`` file to disable automatic formatting: + +**``.clang-format``** +```yaml +DisableFormat: true +SortIncludes: false +``` + +## Python +All Python formatting rules are defined in ``pyproject.toml``. diff --git a/conf/fmt/pyproject.toml b/conf/fmt/pyproject.toml index b554b7f8..69b3292c 100644 --- a/conf/fmt/pyproject.toml +++ b/conf/fmt/pyproject.toml @@ -21,6 +21,7 @@ exclude = ''' | tools/waf3-2.0.22-1241519b19b496207abef1f72bbf61c2 )/ | docs/conf.py + | tests/axivion | tools/vendor | tools/waf-tools/why.py ) diff --git a/conf/guidelines/rules.json b/conf/guidelines/rules.json index 06447b81..2d48e6bd 100644 --- a/conf/guidelines/rules.json +++ b/conf/guidelines/rules.json @@ -45,6 +45,7 @@ "tools/vendor/**", "tools/waf", "tools/waf-verify-sig.py", + "tests/axivion/**", "tests/scripts/waf-tools/f_guidelines/tests/**", "tests/scripts/waf-core/general/**", "tests/scripts/waf-core/init/**", @@ -79,7 +80,8 @@ "**/.dummy", "**/README.md", "**/wscript", - "**/__init__.py" + "**/__init__.py", + "**/.clang-format" ] }, "encoding": { diff --git a/conf/spa/README.md b/conf/spa/README.md index c43d4955..072aa60c 100644 --- a/conf/spa/README.md +++ b/conf/spa/README.md @@ -1,19 +1,22 @@ # Static Program Analysis -Do not use the cppcheck configuration in this directory for the Cppcheck GUI. Instead after running -``waf build_static_analysis`` goto build/static_analysis and use the cppcheck configuration there. +Do not use the cppcheck configuration in this directory for the Cppcheck GUI. +Instead after running ``waf build_static_analysis`` goto +``build/static_analysis`` and use the cppcheck configuration there. ## Usage in CI The CI job uses the waf task which is intended to be a pass/fail criterion. -We are masking out quite a few rules (with the intention to reduce this number). +We are masking out quite a few rules (with the intention to reduce this +number). The waf task prints only the failing rules that are NOT masked. ## Usage on your machine For using cppcheck on your local machine, please take the cppcheck-GUI. -Together with the configuration file that is generated in build/static_analysis -you should be able to comfortably have a complete list of all rule violations. +Together with the configuration file that is generated in +``build/static_analysis`` you should be able to comfortably have a complete +list of all rule violations. The GUI allows you to filter rule violations. You can configure cppcheck to send you directly into the editor of your choice diff --git a/docs/general/changelog.rst b/docs/general/changelog.rst index 74c921b3..13327b96 100644 --- a/docs/general/changelog.rst +++ b/docs/general/changelog.rst @@ -9,10 +9,12 @@ Changelog .. Comments: + Axivion is the company that builds the Axivion Bauhaus suite slaveplausibility is the old name of a plausibility module JUnit is a test system (originally for Java) .. spelling:: + Axivion slaveplausibility JUnit @@ -31,6 +33,35 @@ Versioning follows then these rules: - increasing ``MINOR`` adds functionality in a backwards compatible manner - increasing ``PATCH`` fixes bugs in a backwards compatible manner +******************** +[1.1.1] - 2021-08-06 +******************** + +Added +===== + +- All measurement values are now invalidated after startup to prevent invalid + data on CAN. +- Add a script for VS Code detection. +- Added signal data for string related CAN messages + +Changed +======= + +Deprecated +========== + +Removed +======= + +Fixed +===== + +- fixed bug, that multiplexed cell voltages 2+3 were transmitted incorrectly via + CAN (``foxBMS_CellVoltage``) +- fixed bug, that current limits were transmitted incorrectly via CAN + (``foxBMS_LimitValues``) + ******************** [1.1.0] - 2021-07-29 ******************** diff --git a/docs/general/releases.csv b/docs/general/releases.csv index f8aa91ff..a0ee1f99 100644 --- a/docs/general/releases.csv +++ b/docs/general/releases.csv @@ -1,4 +1,5 @@ foxBMS 2; Release Date; Permanent link to documentation +v1.1.1; 2021-08-06; https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/docs/html/v1.1.1/ v1.1.0; 2021-07-29; https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/docs/html/v1.1.0/ v1.0.2; 2021-04-30; https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/docs/html/v1.0.2/ v1.0.1; 2021-04-16; https://iisb-foxbms.iisb.fraunhofer.de/foxbms/gen2/docs/html/v1.0.1/ diff --git a/docs/getting-started/software-installation.rst b/docs/getting-started/software-installation.rst index fb5b7c98..52a5d9e9 100644 --- a/docs/getting-started/software-installation.rst +++ b/docs/getting-started/software-installation.rst @@ -70,9 +70,9 @@ later steps of this manual. :caption: Downloading a release :name: download-foxbms-2 - C:\Users\vulpes\Documents>curl -Ss -L -o foxbms-2-v1.1.0.zip https://github.com/foxBMS/foxbms-2/archive/v1.1.0.zip - C:\Users\vulpes\Documents>tar -x -f foxbms-2-v1.1.0.zip - C:\Users\vulpes\Documents>ren foxbms-2-1.1.0 foxbms-2 + C:\Users\vulpes\Documents>curl -Ss -L -o foxbms-2-v1.1.1.zip https://github.com/foxBMS/foxbms-2/archive/v1.1.1.zip + C:\Users\vulpes\Documents>tar -x -f foxbms-2-v1.1.1.zip + C:\Users\vulpes\Documents>ren foxbms-2-1.1.1 foxbms-2 C:\Users\vulpes\Documents>cd foxbms-2 .. note:: @@ -107,7 +107,7 @@ Software Prerequisites No software installation here should alter the ``PATH`` environment variable. When an installer asks during the setup to add something to ``PATH``, always remove that option, wether it is explicitly mentioned in - that step or not. The only exception to that rule is ``VS Code``. + that step or not. The only exception to that rule **MAY** be ``VS Code``. .. _css_install: @@ -268,7 +268,7 @@ Installing VS Code and Extensions #. Download |code| from the project website at `Visual Studio Code`_. #. Install code: |foxbms| recommends installing |code| with the ``User Installer``, which does not require elevated rights. -#. **Let the installer add code to the PATH variable.** +#. *Optional:* Let the installer add code to the PATH variable. #. Install extensions: To get the best development experience the following extensions are recommended. |code| will list these among the recommended extensions after you have run ``waf configure``. diff --git a/docs/hardware/design-resources.rst b/docs/hardware/design-resources.rst index b50ac68a..02539e65 100644 --- a/docs/hardware/design-resources.rst +++ b/docs/hardware/design-resources.rst @@ -7,8 +7,8 @@ Design Resources ################ -The hardware design packages for the |BMS-Master|, the |BMS-Extension|, the -|BMS-Interface| and the |BMS-Slaves| are available from the +The hardware design packages for the |bms-master|, the |bms-extension|, the +|bms-interface| and the |bms-slaves| are available from the |foxbms_repository|. The packages include: * Altium Designer Source Files @@ -33,7 +33,6 @@ The hardware design packages for the |BMS-Master|, the |BMS-Extension|, the To open the schematic and layout files, please use `Altium Designer `_. - .. note:: To manufacture the printed circuit boards, the BOM (Microsoft Excel file) diff --git a/docs/macros.txt b/docs/macros.txt index 3be83841..d0f8fa7d 100644 --- a/docs/macros.txt +++ b/docs/macros.txt @@ -3,7 +3,7 @@ .. |timestamp| date:: %Y-%m-%d %H:%M:%S .. |foxbms| replace:: foxBMS 2 -.. |version_foxbms| replace:: ``1.1.0`` +.. |version_foxbms| replace:: ``1.1.1`` .. |github_foxbms| replace:: https://github.com/foxBMS/ .. |foxbms_repository| replace:: https://github.com/foxBMS/foxbms-2 .. _Fraunhofer IISB: https://www.iisb.fraunhofer.de diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index b0e6c5f0..24fa5753 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -6,6 +6,8 @@ Altium armcl armnm asm +axivion +Axivion BMS boolean bugfix diff --git a/ide.bat b/ide.bat index c8a880c0..dfb32773 100644 --- a/ide.bat +++ b/ide.bat @@ -64,8 +64,23 @@ @CALL %CONDA_BASE_ENVIRONMENT_ACTIVATE_SCRIPT% %CONDA_DEVELOPMENT_ENVIRONMENT_NAME% +@REM Check for VS Code +@CALL %~dp0\tools\utils\cmd\find_vs-code.bat +@IF NOT DEFINED VS_CODE @( + @ECHO Could not find VS Code. + @ECHO VS Code can be downloaded at https://code.visualstudio.com/. + @PAUSE + @EXIT /b 2 +) +@IF %VS_CODE%=="" @( + @ECHO Could not find VS Code. + @ECHO VS Code can be downloaded at https://code.visualstudio.com/. + @PAUSE + @EXIT /b 1 +) + @PUSHD %~dp0 -@start "foxBMS Development" /b code . +@start "foxBMS Development" /b %VS_CODE% . @IF %ERRORLEVEL% NEQ 0 ( @EXIT /b %ERRORLEVEL% ) ELSE ( diff --git a/src/app/application/bms/bms.c b/src/app/application/bms/bms.c index 1dbcf6f0..89b3a2bd 100644 --- a/src/app/application/bms/bms.c +++ b/src/app/application/bms/bms.c @@ -95,7 +95,7 @@ static BMS_STATE_s bms_state = { .counter = 0u, .OscillationTimeout = 0u, .PrechargeTryCounter = 0u, - .powerline = BMS_PL_OPEN, + .powerPath = BMS_POWER_PATH_OPEN, .closedStrings = {0u}, .closedPrechargeContactors = {0u}, .numberOfClosedStrings = 0u, @@ -327,11 +327,11 @@ static uint8_t BMS_CheckCanRequests(void) { retVal = BMS_REQ_ID_NORMAL; } -#if BS_SEPARATE_POWERLINES == 1 +#if BS_SEPARATE_POWER_PATHS == 1 else if (request.stateRequestViaCan == BMS_REQ_ID_CHARGE) { /* NOLINT(readability/braces) */ retVal = BMS_REQ_ID_CHARGE; } -#endif /* BS_SEPARATE_POWERLINES == 1 */ +#endif /* BS_SEPARATE_POWER_PATHS == 1 */ return retVal; } @@ -879,7 +879,7 @@ void BMS_Trigger(void) { } } else if (bms_state.substate == BMS_CHECK_STATE_REQUESTS) { if (BMS_CheckCanRequests() == BMS_REQ_ID_NORMAL) { - bms_state.powerline = BMS_PL_0; + bms_state.powerPath = BMS_POWER_PATH_0; bms_state.nextstate = BMS_STATEMACH_DISCHARGE; bms_state.timer = BMS_STATEMACH_SHORTTIME; bms_state.state = BMS_STATEMACH_PRECHARGE; @@ -887,7 +887,7 @@ void BMS_Trigger(void) { break; } if (BMS_CheckCanRequests() == BMS_REQ_ID_CHARGE) { - bms_state.powerline = BMS_PL_1; + bms_state.powerPath = BMS_POWER_PATH_1; bms_state.nextstate = BMS_STATEMACH_CHARGE; bms_state.timer = BMS_STATEMACH_SHORTTIME; bms_state.state = BMS_STATEMACH_PRECHARGE; diff --git a/src/app/application/bms/bms.h b/src/app/application/bms/bms.h index a292f00d..16f51d19 100644 --- a/src/app/application/bms/bms.h +++ b/src/app/application/bms/bms.h @@ -170,12 +170,12 @@ typedef enum BMS_RETURN_TYPE { BMS_ILLEGAL_TASK_TYPE, /*!< Illegal */ } BMS_RETURN_TYPE_e; -/** Powerline type (discharge or charge) */ -typedef enum BMS_POWERLINE_TYPE { - BMS_PL_OPEN, /* contactors open */ - BMS_PL_0, /* discharge */ - BMS_PL_1, /* charge */ -} BMS_POWERLINE_TYPE_e; +/** Power path type (discharge or charge) */ +typedef enum BMS_POWER_PATH_TYPE { + BMS_POWER_PATH_OPEN, /* contactors open */ + BMS_POWER_PATH_0, /* power path */ + BMS_POWER_PATH_1, /* second power path */ +} BMS_POWER_PATH_TYPE_e; /** * This structure contains all the variables relevant for the CONT state @@ -197,7 +197,7 @@ typedef struct BMS_STATE { uint32_t restTimer_10ms; /*!< timer until battery system is at rest */ uint16_t OscillationTimeout; /*!< timeout to prevent oscillation of contactors */ uint8_t PrechargeTryCounter; /*!< timeout to prevent oscillation of contactors */ - BMS_POWERLINE_TYPE_e powerline; /*!< powerline type (discharge or charge) */ + BMS_POWER_PATH_TYPE_e powerPath; /*!< power path type (discharge or charge) */ uint8_t numberOfClosedStrings; /*!< number of closed strings */ uint16_t stringOpenTimeout; /*!< timeout to abort if string opening takes too long */ uint32_t nextstringclosedtimer; /*!< timer to wait if the next string was closed */ diff --git a/src/app/application/config/battery_system_cfg.h b/src/app/application/config/battery_system_cfg.h index 6a959b37..c1a97f47 100644 --- a/src/app/application/config/battery_system_cfg.h +++ b/src/app/application/config/battery_system_cfg.h @@ -277,14 +277,14 @@ typedef enum BS_STRING_ID { * @brief separation of charge and discharge power line * @ptype select(2) */ -#define BS_SEPARATE_POWERLINES (1) +#define BS_SEPARATE_POWER_PATHS (1) -#if (BS_NR_OF_CONTACTORS > 3) && (BS_SEPARATE_POWERLINES == 0) -#error "Configuration mismatch: Can't use only one powerline with more than 3 contactors" +#if (BS_NR_OF_CONTACTORS > 3) && (BS_SEPARATE_POWER_PATHS == 0) +#error "Configuration mismatch: Can't use only one power path with more than 3 contactors" #endif /* */ -#if (BS_NR_OF_CONTACTORS < 4) && (BS_SEPARATE_POWERLINES == 1) -#error "Configuration mismatch: Can't use separate powerlines with less than 4 contactors" +#if (BS_NR_OF_CONTACTORS < 4) && (BS_SEPARATE_POWER_PATHS == 1) +#error "Configuration mismatch: Can't use separate power path with less than 4 contactors" #endif /* */ /** diff --git a/src/app/application/redundancy/redundancy.c b/src/app/application/redundancy/redundancy.c index ca7acd09..660addd0 100644 --- a/src/app/application/redundancy/redundancy.c +++ b/src/app/application/redundancy/redundancy.c @@ -1066,6 +1066,31 @@ static STD_RETURN_TYPE_e MRC_UpdateCellTemperatureValidation( } /*========== Extern Function Implementations ================================*/ +extern STD_RETURN_TYPE_e MRC_Initialize(void) { + STD_RETURN_TYPE_e retval = STD_NOT_OK; + for (uint8_t s = 0u; s < BS_NR_OF_STRINGS; s++) { + for (uint8_t m = 0u; m < BS_NR_OF_MODULES; m++) { + /* Invalidate cell voltage values */ + mrc_tableCellVoltages.invalidCellVoltage[s][m] = 0xFFFFFFFFFFFFFFFFULL; + mrc_tableCellVoltages.validModuleVoltage[s][m] = false; + /* Invalidate cell temperature values */ + mrc_tableCellTemperatures.invalidCellTemperature[s][m] = 0xFFFF; + } + /* Invalidate string values */ + mrc_tablePackValues.invalidStringVoltage[s] = 0x01; + mrc_tablePackValues.invalidStringCurrent[s] = 0x01; + mrc_tablePackValues.invalidStringPower[s] = 0x01; + } + /* Invalidate pack values */ + mrc_tablePackValues.invalidPackCurrent = 0x01; /*!< bitmask if current is valid. 0->valid, 1->invalid */ + mrc_tablePackValues.invalidBatteryVoltage = 0x01; /*!< bitmask if voltage is valid. 0->valid, 1->invalid */ + mrc_tablePackValues.invalidHvBusVoltage = 0x01; /*!< bitmask if voltage is valid. 0->valid, 1->invalid */ + mrc_tablePackValues.invalidPackPower = 0x01; /*!< bitmask if power is valid. 0->valid, 1->invalid */ + + retval = DATA_WRITE_DATA(&mrc_tableCellVoltages, &mrc_tableCellTemperatures, &mrc_tablePackValues); + return retval; +} + extern STD_RETURN_TYPE_e MRC_ValidateMicMeasurement(void) { STD_RETURN_TYPE_e retval = STD_OK; diff --git a/src/app/application/redundancy/redundancy.h b/src/app/application/redundancy/redundancy.h index 422076ea..8c429460 100644 --- a/src/app/application/redundancy/redundancy.h +++ b/src/app/application/redundancy/redundancy.h @@ -123,6 +123,13 @@ typedef struct MRC_STATE { } MRC_STATE_s; /*========== Extern Function Prototypes =====================================*/ +/** + * @brief Function to initalize redundancy module + * + * @return #STD_OK if module has been initialized successfully, otherwise #STD_NOT_OK + */ +extern STD_RETURN_TYPE_e MRC_Initialize(void); + /** * @brief Function to validate the measurement between redundant measurement * values for cell voltage and cell temperature diff --git a/src/app/driver/can/cbs/can_cbs_tx_limits.c b/src/app/driver/can/cbs/can_cbs_tx_limits.c index 6b24b4f2..4cdf2daa 100644 --- a/src/app/driver/can/cbs/can_cbs_tx_limits.c +++ b/src/app/driver/can/cbs/can_cbs_tx_limits.c @@ -83,32 +83,31 @@ extern uint32_t CAN_TxLimitValues( FAS_ASSERT(pCanData != NULL_PTR); FAS_ASSERT(kpkCanShim != NULL_PTR); uint64_t message = 0; - float signalData = 0.0f; - float offset = 0.0f; - float factor = 0.0f; - uint64_t data = 0u; DATA_READ_DATA(kpkCanShim->pTableSof); /* AXIVION Disable Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ /* maximum charge current */ - signalData = (float)kpkCanShim->pTableSof->recommendedContinuousPackChargeCurrent_mA; - offset = 0.0f; - factor = 0.25f; /* convert mA to 250mA */ - signalData = (signalData + offset) * factor; - data = (int64_t)signalData; + float signalData = (float)kpkCanShim->pTableSof->recommendedContinuousPackChargeCurrent_mA; + float offset = 0.0f; + float factor = 0.004f; /* convert mA to 250mA */ + signalData = (signalData + offset) * factor; + uint64_t data = (int64_t)signalData; /* set data in CAN frame */ CAN_TxSetMessageDataWithSignalData(&message, 11u, 12u, data, endianness); /* maximum discharge current */ signalData = (float)kpkCanShim->pTableSof->recommendedContinuousPackDischargeCurrent_mA; offset = 0.0f; - factor = 0.25f; /* convert mA to 250mA */ + factor = 0.004f; /* convert mA to 250mA */ signalData = (signalData + offset) * factor; data = (int64_t)signalData; /* set data in CAN frame */ CAN_TxSetMessageDataWithSignalData(&message, 7u, 12u, data, endianness); + /* TODO: maximum charge power */ + /* TODO: maximum discharge power */ + /* minimum pack voltage */ signalData = (float)(BS_NR_OF_BAT_CELLS * BC_VOLTAGE_MIN_MSL_mV); offset = 0.0f; diff --git a/src/app/driver/can/cbs/can_cbs_tx_minmax.c b/src/app/driver/can/cbs/can_cbs_tx_minmax.c index 9db9138c..19bab85c 100644 --- a/src/app/driver/can/cbs/can_cbs_tx_minmax.c +++ b/src/app/driver/can/cbs/can_cbs_tx_minmax.c @@ -82,10 +82,6 @@ extern uint32_t CAN_TxMinimumMaximumValues( FAS_ASSERT(pCanData != NULL_PTR); FAS_ASSERT(kpkCanShim != NULL_PTR); uint64_t message = 0; - float signalData = 0.0f; - float offset = 0.0f; - float factor = 0.0f; - uint64_t data = 0u; DATA_READ_DATA(kpkCanShim->pTableMinMax); @@ -132,11 +128,11 @@ extern uint32_t CAN_TxMinimumMaximumValues( /* AXIVION Disable Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ /* Minimum cell voltage */ - signalData = (float)packMinimumVoltage_mV; - offset = 0.0f; - factor = 1.0f; - signalData = (signalData + offset) * factor; - data = (int64_t)signalData; + float signalData = (float)packMinimumVoltage_mV; + float offset = 0.0f; + float factor = 1.0f; + signalData = (signalData + offset) * factor; + uint64_t data = (int64_t)signalData; /* set data in CAN frame */ CAN_TxSetMessageDataWithSignalData(&message, 10u, 13u, data, endianness); @@ -187,13 +183,62 @@ extern uint32_t CAN_TxStringMinimumMaximumValues( FAS_ASSERT(pMuxId != NULL_PTR); FAS_ASSERT(*pMuxId < BS_NR_OF_STRINGS); FAS_ASSERT(kpkCanShim != NULL_PTR); - uint64_t message = 0; + uint64_t message = 0u; - /* STUB IMPLEMENTATION */ + /** Database entry with minimum and maximum values does not need to be read + * within this callback as it is already read by function + * #CAN_TxMinimumMaximumValues */ + const uint8_t stringNumber = *pMuxId; + + /* AXIVION Disable Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ + /* Minimum cell voltage */ + float signalData = (float)kpkCanShim->pTableMinMax->minimumCellVoltage_mV[stringNumber]; + float offset = 0.0f; + float factor = 1.0f; + signalData = (signalData + offset) * factor; + uint64_t data = (int64_t)signalData; + /* set data in CAN frame */ + CAN_TxSetMessageDataWithSignalData(&message, 18u, 13u, data, endianness); + + /* Maximum cell voltage */ + signalData = (float)kpkCanShim->pTableMinMax->maximumCellVoltage_mV[stringNumber]; + offset = 0.0f; + factor = 1.0f; + signalData = (signalData + offset) * factor; + data = (int64_t)signalData; + /* set data in CAN frame */ + CAN_TxSetMessageDataWithSignalData(&message, 15u, 13u, data, endianness); + + /* Minimum cell temperature */ + signalData = (float)kpkCanShim->pTableMinMax->minimumTemperature_ddegC[stringNumber]; + offset = 0.0f; + factor = 0.2f; /* convert ddegC to 0.5degC */ + signalData = (signalData + offset) * factor; + data = (int64_t)signalData; + /* set data in CAN frame */ + CAN_TxSetMessageDataWithSignalData(&message, 44u, 9u, data, endianness); + + /* Maximum cell temperature */ + signalData = (float)kpkCanShim->pTableMinMax->maximumTemperature_ddegC[stringNumber]; + offset = 0.0f; + factor = 0.2f; /* convert ddegC to 0.5degC */ + signalData = (signalData + offset) * factor; + data = (int64_t)signalData; + /* set data in CAN frame */ + CAN_TxSetMessageDataWithSignalData(&message, 37, 9u, data, endianness); + /* AXIVION Enable Style Generic-NoMagicNumbers: */ /* now copy data in the buffer that will be use to send data */ CAN_TxSetCanDataWithMessageData(message, pCanData, endianness); + /* Increment multiplexer for next cell */ + (*pMuxId)++; + + /* Check mux value */ + if (*pMuxId >= BS_NR_OF_STRINGS) { + *pMuxId = 0u; + } + return 0; } diff --git a/src/app/driver/can/cbs/can_cbs_tx_state.c b/src/app/driver/can/cbs/can_cbs_tx_state.c index c78081ed..fe1672a6 100644 --- a/src/app/driver/can/cbs/can_cbs_tx_state.c +++ b/src/app/driver/can/cbs/can_cbs_tx_state.c @@ -83,14 +83,12 @@ extern uint32_t CAN_TxState( FAS_ASSERT(pCanData != NULL_PTR); FAS_ASSERT(kpkCanShim != NULL_PTR); uint64_t message = 0; - float signalData = 0.0f; - uint64_t data = 0; DATA_READ_DATA(kpkCanShim->pTableErrorState, kpkCanShim->pTableInsulation, kpkCanShim->pTableMsl); /* AXIVION Disable Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ /* State */ - data = (uint64_t)BMS_GetState(); + uint64_t data = (uint64_t)BMS_GetState(); /* set data in CAN frame */ CAN_TxSetMessageDataWithSignalData(&message, 3u, 4u, data, endianness); @@ -124,9 +122,9 @@ extern uint32_t CAN_TxState( CAN_TxSetMessageDataWithSignalData(&message, 23u, 1u, data, endianness); /* Insulation resistance */ - signalData = (float)kpkCanShim->pTableInsulation->insulationResistance_kOhm; - signalData = signalData * 0.1f; /* convert kOhm to 10kOhm */ - data = (uint64_t)signalData; + float signalData = (float)kpkCanShim->pTableInsulation->insulationResistance_kOhm; + signalData = signalData * 0.1f; /* convert kOhm to 10kOhm */ + data = (uint64_t)signalData; CAN_TxSetMessageDataWithSignalData(&message, 63u, 8u, data, endianness); /* Charging complete: TODO */ diff --git a/src/app/driver/can/cbs/can_cbs_tx_state_estimation.c b/src/app/driver/can/cbs/can_cbs_tx_state_estimation.c index 9cd89e66..fbe0e695 100644 --- a/src/app/driver/can/cbs/can_cbs_tx_state_estimation.c +++ b/src/app/driver/can/cbs/can_cbs_tx_state_estimation.c @@ -83,19 +83,12 @@ extern uint32_t CAN_TxStateEstimation( FAS_ASSERT(pCanData != NULL_PTR); FAS_ASSERT(kpkCanShim != NULL_PTR); uint64_t message = 0; - float signalData = 0.0f; - float offset = 0.0f; - float factor = 0.0f; - uint64_t data = 0u; float minimumStringSoc_perc = FLT_MAX; float maximumStringSoc_perc = FLT_MIN; float minimumStringSoe_perc = FLT_MAX; float maximumStringSoe_perc = FLT_MIN; - float packSoc_perc = 0.0f; - float packSoe_perc = 0.0f; uint32_t minimumStringEnergy_Wh = UINT32_MAX; - uint32_t packEnergyLeft_Wh = 0u; DATA_READ_DATA(kpkCanShim->pTableSox); @@ -132,6 +125,10 @@ extern uint32_t CAN_TxStateEstimation( } } + float packSoc_perc = 0.0f; + float packSoe_perc = 0.0f; + uint32_t packEnergyLeft_Wh = 0u; + /* Calculate pack value */ if (BMS_GetNumberOfConnectedStrings() != 0u) { if (BMS_GetBatterySystemState() == BMS_CHARGING) { @@ -149,11 +146,11 @@ extern uint32_t CAN_TxStateEstimation( } /* SOC */ - signalData = packSoc_perc; - offset = 0.0f; - factor = 100.0f; /* convert from perc to 0.01perc */ - signalData = (signalData + offset) * factor; - data = (int64_t)signalData; + float signalData = packSoc_perc; + float offset = 0.0f; + float factor = 100.0f; /* convert from perc to 0.01perc */ + signalData = (signalData + offset) * factor; + uint64_t data = (int64_t)signalData; /* set data in CAN frame */ CAN_TxSetMessageDataWithSignalData(&message, 7u, 14u, data, endianness); @@ -205,11 +202,86 @@ extern uint32_t CAN_TxStringStateEstimation( FAS_ASSERT(kpkCanShim != NULL_PTR); uint64_t message = 0; - /* STUB IMPLEMENTATION */ + /** Database entry with state estimation values does not need to be read + * within this callback as it is already read by function + * #CAN_TxStateEstimation */ + const uint8_t stringNumber = *pMuxId; + + /* set multiplexer in CAN frame */ + /* AXIVION Disable Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ + uint64_t data = (uint64_t)stringNumber; + CAN_TxSetMessageDataWithSignalData(&message, 7u, 4u, data, endianness); + + /* Minimum SOC */ + float signalData = kpkCanShim->pTableSox->minimumSoc_perc[stringNumber]; + float offset = 0.0f; + float factor = 4.0f; /* convert from perc to 0.25perc */ + signalData = (signalData + offset) * factor; + data = (int64_t)signalData; + /* set data in CAN frame */ + CAN_TxSetMessageDataWithSignalData(&message, 3u, 9u, data, endianness); + + /* Average SOC */ + signalData = kpkCanShim->pTableSox->averageSoc_perc[stringNumber]; + offset = 0.0f; + factor = 4.0f; /* convert from perc to 0.25perc */ + signalData = (signalData + offset) * factor; + data = (int64_t)signalData; + /* set data in CAN frame */ + CAN_TxSetMessageDataWithSignalData(&message, 10u, 9u, data, endianness); + + /* Maximum SOC */ + signalData = kpkCanShim->pTableSox->maximumSoc_perc[stringNumber]; + offset = 0.0f; + factor = 4.0f; /* convert from perc to 0.25perc */ + signalData = (signalData + offset) * factor; + data = (int64_t)signalData; + /* set data in CAN frame */ + CAN_TxSetMessageDataWithSignalData(&message, 17u, 9u, data, endianness); + + /* SOE */ + if (BMS_CHARGING == BMS_GetCurrentFlowDirection(kpkCanShim->pTablePackValues->stringCurrent_mA[stringNumber])) { + signalData = kpkCanShim->pTableSox->maximumSoe_perc[stringNumber]; + } else { + signalData = kpkCanShim->pTableSox->minimumSoe_perc[stringNumber]; + } + offset = 0.0f; + factor = 4.0f; /* convert from perc to 0.25perc */ + signalData = (signalData + offset) * factor; + data = (int64_t)signalData; + /* set data in CAN frame */ + CAN_TxSetMessageDataWithSignalData(&message, 24u, 9u, data, endianness); + + /* SOH */ + signalData = 100.0f; + offset = 0.0f; + factor = 4.0f; /* convert from perc to 0.25perc */ + signalData = (signalData + offset) * factor; + data = (int64_t)signalData; + /* set data in CAN frame */ + CAN_TxSetMessageDataWithSignalData(&message, 47u, 9u, data, endianness); + + /* String energy */ + signalData = kpkCanShim->pTableSox->minimumSoe_Wh[stringNumber]; + offset = 0.0f; + factor = 0.1f; /* convert from Wh to 10Wh */ + signalData = (signalData + offset) * factor; + data = (int64_t)signalData; + /* set data in CAN frame */ + CAN_TxSetMessageDataWithSignalData(&message, 54u, 15u, data, endianness); + /* AXIVION Enable Style Generic-NoMagicNumbers: */ /* now copy data in the buffer that will be used to send data */ CAN_TxSetCanDataWithMessageData(message, pCanData, endianness); + /* Increment multiplexer for next cell */ + (*pMuxId)++; + + /* Check mux value */ + if (*pMuxId >= BS_NR_OF_STRINGS) { + *pMuxId = 0u; + } + return 0; } diff --git a/src/app/driver/can/cbs/can_cbs_tx_system_values.c b/src/app/driver/can/cbs/can_cbs_tx_system_values.c index 13993aa6..fa920b5d 100644 --- a/src/app/driver/can/cbs/can_cbs_tx_system_values.c +++ b/src/app/driver/can/cbs/can_cbs_tx_system_values.c @@ -81,21 +81,17 @@ extern uint32_t CAN_TxPackValues( FAS_ASSERT(pCanData != NULL_PTR); FAS_ASSERT(kpkCanShim != NULL_PTR); uint64_t message = 0; - float signalData = 0.0f; - float offset = 0.0f; - float factor = 0.0f; - uint64_t data = 0u; /* Read database entry */ DATA_READ_DATA(kpkCanShim->pTablePackValues); /* AXIVION Disable Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ /* Battery voltage */ - signalData = kpkCanShim->pTablePackValues->batteryVoltage_mV; - offset = 0.0f; - factor = 0.01f; /* convert mV -> 100mV */ - signalData = (signalData + offset) * factor; - data = (uint64_t)signalData; + float signalData = kpkCanShim->pTablePackValues->batteryVoltage_mV; + float offset = 0.0f; + float factor = 0.01f; /* convert mV -> 100mV */ + signalData = (signalData + offset) * factor; + uint64_t data = (uint64_t)signalData; /* set data in CAN frame */ CAN_TxSetMessageDataWithSignalData(&message, 7u, 14u, data, endianness); @@ -147,12 +143,65 @@ extern uint32_t CAN_TxStringValues( FAS_ASSERT(*pMuxId < BS_NR_OF_STRINGS); FAS_ASSERT(kpkCanShim != NULL_PTR); uint64_t message = 0; + uint64_t data = 0; + float signalData = 0.0f; + float offset = 0.0f; + float factor = 0.0f; - /* STUB IMPLEMENTATION */ + const uint8_t stringNumber = *pMuxId; + + /* First signal to transmit cell voltages: get database values */ + if (stringNumber == 0u) { + /* Do not read pTableMsl and pTableErrorState as they already are read + * with a higher frequency from CAN_TxState callback */ + DATA_READ_DATA(kpkCanShim->pTablePackValues); + } + + /* mux value */ + data = (uint64_t)stringNumber; + /* set data in CAN frame */ + /* AXIVION Disable Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ + CAN_TxSetMessageDataWithSignalData(&message, 7u, 3u, data, endianness); + + /* String voltage */ + signalData = (float)kpkCanShim->pTablePackValues->stringVoltage_mV[stringNumber]; + offset = 0.0f; + factor = 0.1f; /* convert mV to 10mV */ + signalData = (signalData + offset) * factor; + data = (int64_t)signalData; + /* set data in CAN frame */ + CAN_TxSetMessageDataWithSignalData(&message, 4u, 17u, data, endianness); + + /* String current */ + signalData = (float)kpkCanShim->pTablePackValues->stringCurrent_mA[stringNumber]; + offset = 0.0f; + factor = 0.1f; /* convert mA to 10mA */ + signalData = (signalData + offset) * factor; + data = (int64_t)signalData; + /* set data in CAN frame */ + CAN_TxSetMessageDataWithSignalData(&message, 19u, 18u, data, endianness); + + /* String power */ + signalData = (float)kpkCanShim->pTablePackValues->stringPower_W[stringNumber]; + offset = 0.0f; + factor = 0.1f; /* convert W to 10W */ + signalData = (signalData + offset) * factor; + data = (int64_t)signalData; + /* set data in CAN frame */ + CAN_TxSetMessageDataWithSignalData(&message, 33u, 18u, data, endianness); + /* AXIVION Enable Style Generic-NoMagicNumbers: */ /* now copy data in the buffer that will be used to send data */ CAN_TxSetCanDataWithMessageData(message, pCanData, endianness); + /* Increment multiplexer for next cell */ + (*pMuxId)++; + + /* Check mux value */ + if (*pMuxId >= BS_NR_OF_STRINGS) { + *pMuxId = 0u; + } + return 0; } @@ -169,13 +218,41 @@ extern uint32_t CAN_TxStringValues2( FAS_ASSERT(pMuxId != NULL_PTR); FAS_ASSERT(*pMuxId < BS_NR_OF_STRINGS); FAS_ASSERT(kpkCanShim != NULL_PTR); - uint64_t message = 0; + uint64_t message = 0u; + uint64_t signalData = 0u; + + const uint8_t stringNumber = *pMuxId; + + /* First signal to transmit cell voltages: get database values */ + if (stringNumber == 0u) { + /* Do not read pTableMsl and pTableErrorState as they already are read + * with a higher frequency from CAN_TxState callback */ + DATA_READ_DATA(kpkCanShim->pTableCurrentSensor); + } + + /* mux value */ + signalData = (uint64_t)stringNumber; + /* set data in CAN frame */ + /* AXIVION Disable Style Generic-NoMagicNumbers: Signal data defined in .dbc file. */ + CAN_TxSetMessageDataWithSignalData(&message, 7u, 4u, signalData, endianness); - /* STUB IMPLEMENTATION */ + /* String voltage */ + signalData = (int64_t)kpkCanShim->pTableCurrentSensor->energyCounter_Wh[stringNumber]; + /* set data in CAN frame */ + CAN_TxSetMessageDataWithSignalData(&message, 15u, 32u, signalData, endianness); + /* AXIVION Enable Style Generic-NoMagicNumbers: */ /* now copy data in the buffer that will be used to send data */ CAN_TxSetCanDataWithMessageData(message, pCanData, endianness); + /* Increment multiplexer for next cell */ + (*pMuxId)++; + + /* Check mux value */ + if (*pMuxId >= BS_NR_OF_STRINGS) { + *pMuxId = 0u; + } + return 0; } diff --git a/src/app/driver/can/cbs/can_cbs_tx_voltage.c b/src/app/driver/can/cbs/can_cbs_tx_voltage.c index 4e3cbfd8..4e516f32 100644 --- a/src/app/driver/can/cbs/can_cbs_tx_voltage.c +++ b/src/app/driver/can/cbs/can_cbs_tx_voltage.c @@ -73,8 +73,8 @@ static const CAN_SIGNAL_TYPE_s cellVoltage2InvalidFlag = {14u, 1u, 1.0f, 0.0f, 0 static const CAN_SIGNAL_TYPE_s cellVoltage3InvalidFlag = {15u, 1u, 1.0f, 0.0f, 0.0f, 1.0f}; static const CAN_SIGNAL_TYPE_s cellVoltage0_mV = {11u, 13u, 1.0f, 0.0f, 0.0f, 8192.0f}; static const CAN_SIGNAL_TYPE_s cellVoltage1_mV = {30u, 13u, 1.0f, 0.0f, 0.0f, 8192.0f}; -static const CAN_SIGNAL_TYPE_s cellVoltage2_mV = {52u, 13u, 1.0f, 0.0f, 0.0f, 8192.0f}; -static const CAN_SIGNAL_TYPE_s cellVoltage3_mV = {11u, 13u, 1.0f, 0.0f, 0.0f, 8192.0f}; +static const CAN_SIGNAL_TYPE_s cellVoltage2_mV = {33u, 13u, 1.0f, 0.0f, 0.0f, 8192.0f}; +static const CAN_SIGNAL_TYPE_s cellVoltage3_mV = {52u, 13u, 1.0f, 0.0f, 0.0f, 8192.0f}; /*========== Extern Constant and Variable Definitions =======================*/ diff --git a/src/app/driver/contactor/contactor.h b/src/app/driver/contactor/contactor.h index c7176108..9797cfdc 100644 --- a/src/app/driver/contactor/contactor.h +++ b/src/app/driver/contactor/contactor.h @@ -109,12 +109,12 @@ typedef enum { CONT_CHECK_REQUESTS, } CONT_STATEMACH_SUB_e; -/** @brief Names for connected powerlines */ +/** @brief Names for connected power paths */ typedef enum CONT_POWER_LINE_e { - CONT_POWER_LINE_NONE, /*!< no power line is connected, contactors are open */ - CONT_POWER_LINE_0, /*!< power line 0, e.g. used for the power train */ -#if BS_SEPARATE_POWERLINES == 1 - CONT_POWER_LINE_1, /*!< power line 1, e.g. used for charging */ + CONT_POWER_PATH_NONE, /*!< no power line is connected, contactors are open */ + CONT_POWER_PATH_0, /*!< power line 0, e.g. used for the power train */ +#if BS_SEPARATE_POWER_PATHS == 1 + CONT_POWER_PATH_1, /*!< power line 1, e.g. used for charging */ #endif } CONT_POWER_LINE_e; diff --git a/src/app/task/config/ftask_cfg.c b/src/app/task/config/ftask_cfg.c index fb82f713..e587cf62 100644 --- a/src/app/task/config/ftask_cfg.c +++ b/src/app/task/config/ftask_cfg.c @@ -165,6 +165,9 @@ extern void FTSK_InitializeUserCodePreCyclicTasks(void) { /* Init FRAM */ FRAM_Initialize(); + /* Initialize redundancy module */ + (void)MRC_Initialize(); + /* This function operates under the assumption that it is called when * the operating system is not yet running. * In this state the return value of #SYS_SetStateRequest should diff --git a/src/os/.clang-format b/src/os/.clang-format new file mode 100644 index 00000000..9d159247 --- /dev/null +++ b/src/os/.clang-format @@ -0,0 +1,2 @@ +DisableFormat: true +SortIncludes: false diff --git a/tests/can/check_implemented.py b/tests/can/check_implemented.py new file mode 100644 index 00000000..89b27d56 --- /dev/null +++ b/tests/can/check_implemented.py @@ -0,0 +1,193 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright (c) 2010 - 2021, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# We kindly request you to use one or more of the following phrases to refer to +# foxBMS in your hardware, software, documentation or advertising materials: +# +# - "This product uses parts of foxBMS®" +# - "This product includes parts of foxBMS®" +# - "This product is derived from foxBMS®" + +"""Python script to check if all callbacks defined in the .dbc file are +implemented in callback functions.""" +import os +import sys +import logging +import argparse +import re +from pathlib import Path +import cantools + +HAVE_GIT = False +try: + from git import Repo + from git.exc import InvalidGitRepositoryError + + HAVE_GIT = True +except ImportError: + pass + +FILE_RE = r"\(in:(.*):(.*)\)" +FILE_RE_COMPILED = re.compile(FILE_RE) + + +def get_git_root(path: str) -> str: + """helper function to find the repository root + + Args: + path (string): path of test_f_guidelines + + Returns: + root (string): root path of the git repository + """ + root = os.path.join(os.path.dirname(path), "..", "..", "..") + if HAVE_GIT: + try: + repo = Repo(path, search_parent_directories=True) + root = repo.git.rev_parse("--show-toplevel") + except InvalidGitRepositoryError: + pass + return root + + +ROOT = Path(get_git_root(os.path.realpath(__file__))) +BDC_DIR_REL = Path(os.path.join("tools", "dbc")) +SRC_DIR_REL = Path(os.path.join("src", "app")) + + +def evaluate_implementation(callback_file: Path, function_name: str) -> bool: + """Checks wether a function name is found in a source file or not.""" + found = False + impl = callback_file.read_text() + if function_name in impl: + logging.info(f"Found '{function_name}' in '{callback_file}'.") + found = True + else: + logging.error(f"Did not find '{function_name}' in '{callback_file}'.") + return found + + +def main(): + """This script produces a symbole file for cell voltages and temperatures""" + parser = argparse.ArgumentParser() + parser.add_argument( + "-v", + "--verbosity", + dest="verbosity", + action="count", + default=0, + help="set verbosity level", + ) + parser.add_argument( + "-i", + "--input-file", + dest="input_file", + action="store", + default=BDC_DIR_REL / "foxbms.dbc", + help="DBC file to be verified.", + ) + parser.add_argument( + "-c", + "--src-dir", + dest="src_dir", + action="store", + default=ROOT / SRC_DIR_REL, + help="Path to directory containing the callback implementations", + ) + args = parser.parse_args() + + if args.verbosity == 1: + logging.basicConfig(level=logging.INFO) + elif args.verbosity > 1: + logging.basicConfig(level=logging.DEBUG) + else: + logging.basicConfig(level=logging.ERROR) + logging.debug(args) + + if not isinstance(args.input_file, Path): + args.input_file = Path(args.input_file) + input_file = args.input_file.absolute() + can_db = cantools.database.load_file(input_file) + if not isinstance(args.src_dir, Path): + args.src_dir = Path(args.src_dir) + src_dir = args.src_dir.absolute() + source_files = list(src_dir.rglob("**/*.c")) + if not source_files: + sys.exit("Could not find any source files.") + + errors = 0 + for i in can_db.messages: + if not i.comment: + errors += 1 + logging.error( + f"Could not find any comment for message '{i.name}' ({hex(i.frame_id)})." + ) + continue + logging.info( + f"Found comment for message '{i.name}' ({hex(i.frame_id)}): '{i.comment}'." + ) + m = FILE_RE_COMPILED.search(i.comment) # pylint: disable=invalid-name + if not m: + errors += 1 + logging.error( + "Could not find comment for message " + f"'{i.name}' ({hex(i.frame_id)}) that matches '{FILE_RE}'." + ) + continue + # we found a comment should point to the correct implementation file + files = [i for i in source_files if m[1] in str(i)] + try: + search_file = files[0] + except IndexError: + errors += 1 + logging.error( + f"Could not find implementation file '{m[1]}' for " + f"message '{i.name}'." + ) + continue + if not search_file.is_file(): + errors += 1 + logging.error( + f"Path to implementation file '{search_file}' for " + f"message '{i.name}' is not a file." + ) + continue + # now we are sure, that the file that should contain the implementation + # exists, and we can evalute it. + if not evaluate_implementation(search_file, m[2]): + errors += 1 + return errors + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_command.c b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_command.c index 7cbaf7a9..6499a47c 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_command.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_command.c @@ -71,6 +71,44 @@ TEST_FILE("can_cbs_rx_command.c") /*========== Definitions and Implementations for Unit Test ==================*/ +static DATA_BLOCK_CELL_VOLTAGE_s can_tableCellVoltages = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; +static DATA_BLOCK_CELL_TEMPERATURE_s can_tableTemperatures = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE}; +static DATA_BLOCK_MIN_MAX_s can_tableMinimumMaximumValues = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; +static DATA_BLOCK_CURRENT_SENSOR_s can_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}; +static DATA_BLOCK_OPEN_WIRE_s can_tableOpenWire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; +static DATA_BLOCK_STATEREQUEST_s can_tableStateRequest = {.header.uniqueId = DATA_BLOCK_ID_STATEREQUEST}; +static DATA_BLOCK_PACK_VALUES_s can_tablePackValues = {.header.uniqueId = DATA_BLOCK_ID_PACK_VALUES}; +static DATA_BLOCK_SOF_s can_tableSof = {.header.uniqueId = DATA_BLOCK_ID_SOF}; +static DATA_BLOCK_SOX_s can_tableSox = {.header.uniqueId = DATA_BLOCK_ID_SOX}; +static DATA_BLOCK_ERRORSTATE_s can_tableErrorState = {.header.uniqueId = DATA_BLOCK_ID_ERRORSTATE}; +static DATA_BLOCK_INSULATION_MONITORING_s can_tableInsulation = { + .header.uniqueId = DATA_BLOCK_ID_INSULATION_MONITORING}; +static DATA_BLOCK_MSL_FLAG_s can_tableMslFlags = {.header.uniqueId = DATA_BLOCK_ID_MSL_FLAG}; +static DATA_BLOCK_RSL_FLAG_s can_tableRslFlags = {.header.uniqueId = DATA_BLOCK_ID_RSL_FLAG}; +static DATA_BLOCK_MOL_FLAG_s can_tableMolFlags = {.header.uniqueId = DATA_BLOCK_ID_MOL_FLAG}; + +QueueHandle_t imd_canDataQueue = NULL_PTR; + +const CAN_SHIM_s can_kShim = { + .pQueueImd = &imd_canDataQueue, + .pTableCellVoltage = &can_tableCellVoltages, + .pTableCellTemperature = &can_tableTemperatures, + .pTableMinMax = &can_tableMinimumMaximumValues, + .pTableCurrentSensor = &can_tableCurrentSensor, + .pTableOpenWire = &can_tableOpenWire, + .pTableStateRequest = &can_tableStateRequest, + .pTablePackValues = &can_tablePackValues, + .pTableSof = &can_tableSof, + .pTableSox = &can_tableSox, + .pTableErrorState = &can_tableErrorState, + .pTableInsulation = &can_tableInsulation, + .pTableMsl = &can_tableMslFlags, + .pTableRsl = &can_tableRslFlags, + .pTableMol = &can_tableMolFlags, +}; + +static uint8_t muxId = 0u; + /*========== Setup and Teardown =============================================*/ void setUp(void) { } diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_current_sensor.c b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_current_sensor.c index 4c36b57c..c559a238 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_current_sensor.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_current_sensor.c @@ -70,6 +70,44 @@ TEST_FILE("can_cbs_rx_current_sensor.c") /*========== Definitions and Implementations for Unit Test ==================*/ +static DATA_BLOCK_CELL_VOLTAGE_s can_tableCellVoltages = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; +static DATA_BLOCK_CELL_TEMPERATURE_s can_tableTemperatures = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE}; +static DATA_BLOCK_MIN_MAX_s can_tableMinimumMaximumValues = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; +static DATA_BLOCK_CURRENT_SENSOR_s can_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}; +static DATA_BLOCK_OPEN_WIRE_s can_tableOpenWire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; +static DATA_BLOCK_STATEREQUEST_s can_tableStateRequest = {.header.uniqueId = DATA_BLOCK_ID_STATEREQUEST}; +static DATA_BLOCK_PACK_VALUES_s can_tablePackValues = {.header.uniqueId = DATA_BLOCK_ID_PACK_VALUES}; +static DATA_BLOCK_SOF_s can_tableSof = {.header.uniqueId = DATA_BLOCK_ID_SOF}; +static DATA_BLOCK_SOX_s can_tableSox = {.header.uniqueId = DATA_BLOCK_ID_SOX}; +static DATA_BLOCK_ERRORSTATE_s can_tableErrorState = {.header.uniqueId = DATA_BLOCK_ID_ERRORSTATE}; +static DATA_BLOCK_INSULATION_MONITORING_s can_tableInsulation = { + .header.uniqueId = DATA_BLOCK_ID_INSULATION_MONITORING}; +static DATA_BLOCK_MSL_FLAG_s can_tableMslFlags = {.header.uniqueId = DATA_BLOCK_ID_MSL_FLAG}; +static DATA_BLOCK_RSL_FLAG_s can_tableRslFlags = {.header.uniqueId = DATA_BLOCK_ID_RSL_FLAG}; +static DATA_BLOCK_MOL_FLAG_s can_tableMolFlags = {.header.uniqueId = DATA_BLOCK_ID_MOL_FLAG}; + +QueueHandle_t imd_canDataQueue = NULL_PTR; + +const CAN_SHIM_s can_kShim = { + .pQueueImd = &imd_canDataQueue, + .pTableCellVoltage = &can_tableCellVoltages, + .pTableCellTemperature = &can_tableTemperatures, + .pTableMinMax = &can_tableMinimumMaximumValues, + .pTableCurrentSensor = &can_tableCurrentSensor, + .pTableOpenWire = &can_tableOpenWire, + .pTableStateRequest = &can_tableStateRequest, + .pTablePackValues = &can_tablePackValues, + .pTableSof = &can_tableSof, + .pTableSox = &can_tableSox, + .pTableErrorState = &can_tableErrorState, + .pTableInsulation = &can_tableInsulation, + .pTableMsl = &can_tableMslFlags, + .pTableRsl = &can_tableRslFlags, + .pTableMol = &can_tableMolFlags, +}; + +static uint8_t muxId = 0u; + /*========== Setup and Teardown =============================================*/ void setUp(void) { } diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_imd.c b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_imd.c index 5059f28e..e8c9c1de 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_imd.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_imd.c @@ -70,6 +70,44 @@ TEST_FILE("can_cbs_rx_imd.c") /*========== Definitions and Implementations for Unit Test ==================*/ +static DATA_BLOCK_CELL_VOLTAGE_s can_tableCellVoltages = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; +static DATA_BLOCK_CELL_TEMPERATURE_s can_tableTemperatures = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE}; +static DATA_BLOCK_MIN_MAX_s can_tableMinimumMaximumValues = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; +static DATA_BLOCK_CURRENT_SENSOR_s can_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}; +static DATA_BLOCK_OPEN_WIRE_s can_tableOpenWire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; +static DATA_BLOCK_STATEREQUEST_s can_tableStateRequest = {.header.uniqueId = DATA_BLOCK_ID_STATEREQUEST}; +static DATA_BLOCK_PACK_VALUES_s can_tablePackValues = {.header.uniqueId = DATA_BLOCK_ID_PACK_VALUES}; +static DATA_BLOCK_SOF_s can_tableSof = {.header.uniqueId = DATA_BLOCK_ID_SOF}; +static DATA_BLOCK_SOX_s can_tableSox = {.header.uniqueId = DATA_BLOCK_ID_SOX}; +static DATA_BLOCK_ERRORSTATE_s can_tableErrorState = {.header.uniqueId = DATA_BLOCK_ID_ERRORSTATE}; +static DATA_BLOCK_INSULATION_MONITORING_s can_tableInsulation = { + .header.uniqueId = DATA_BLOCK_ID_INSULATION_MONITORING}; +static DATA_BLOCK_MSL_FLAG_s can_tableMslFlags = {.header.uniqueId = DATA_BLOCK_ID_MSL_FLAG}; +static DATA_BLOCK_RSL_FLAG_s can_tableRslFlags = {.header.uniqueId = DATA_BLOCK_ID_RSL_FLAG}; +static DATA_BLOCK_MOL_FLAG_s can_tableMolFlags = {.header.uniqueId = DATA_BLOCK_ID_MOL_FLAG}; + +QueueHandle_t imd_canDataQueue = NULL_PTR; + +const CAN_SHIM_s can_kShim = { + .pQueueImd = &imd_canDataQueue, + .pTableCellVoltage = &can_tableCellVoltages, + .pTableCellTemperature = &can_tableTemperatures, + .pTableMinMax = &can_tableMinimumMaximumValues, + .pTableCurrentSensor = &can_tableCurrentSensor, + .pTableOpenWire = &can_tableOpenWire, + .pTableStateRequest = &can_tableStateRequest, + .pTablePackValues = &can_tablePackValues, + .pTableSof = &can_tableSof, + .pTableSox = &can_tableSox, + .pTableErrorState = &can_tableErrorState, + .pTableInsulation = &can_tableInsulation, + .pTableMsl = &can_tableMslFlags, + .pTableRsl = &can_tableRslFlags, + .pTableMol = &can_tableMolFlags, +}; + +static uint8_t muxId = 0u; + /*========== Setup and Teardown =============================================*/ void setUp(void) { } diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_misc.c b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_misc.c index 754d7c3e..cd104c98 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_rx_misc.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_rx_misc.c @@ -70,6 +70,44 @@ TEST_FILE("can_cbs_rx_misc.c") /*========== Definitions and Implementations for Unit Test ==================*/ +static DATA_BLOCK_CELL_VOLTAGE_s can_tableCellVoltages = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; +static DATA_BLOCK_CELL_TEMPERATURE_s can_tableTemperatures = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE}; +static DATA_BLOCK_MIN_MAX_s can_tableMinimumMaximumValues = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; +static DATA_BLOCK_CURRENT_SENSOR_s can_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}; +static DATA_BLOCK_OPEN_WIRE_s can_tableOpenWire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; +static DATA_BLOCK_STATEREQUEST_s can_tableStateRequest = {.header.uniqueId = DATA_BLOCK_ID_STATEREQUEST}; +static DATA_BLOCK_PACK_VALUES_s can_tablePackValues = {.header.uniqueId = DATA_BLOCK_ID_PACK_VALUES}; +static DATA_BLOCK_SOF_s can_tableSof = {.header.uniqueId = DATA_BLOCK_ID_SOF}; +static DATA_BLOCK_SOX_s can_tableSox = {.header.uniqueId = DATA_BLOCK_ID_SOX}; +static DATA_BLOCK_ERRORSTATE_s can_tableErrorState = {.header.uniqueId = DATA_BLOCK_ID_ERRORSTATE}; +static DATA_BLOCK_INSULATION_MONITORING_s can_tableInsulation = { + .header.uniqueId = DATA_BLOCK_ID_INSULATION_MONITORING}; +static DATA_BLOCK_MSL_FLAG_s can_tableMslFlags = {.header.uniqueId = DATA_BLOCK_ID_MSL_FLAG}; +static DATA_BLOCK_RSL_FLAG_s can_tableRslFlags = {.header.uniqueId = DATA_BLOCK_ID_RSL_FLAG}; +static DATA_BLOCK_MOL_FLAG_s can_tableMolFlags = {.header.uniqueId = DATA_BLOCK_ID_MOL_FLAG}; + +QueueHandle_t imd_canDataQueue = NULL_PTR; + +const CAN_SHIM_s can_kShim = { + .pQueueImd = &imd_canDataQueue, + .pTableCellVoltage = &can_tableCellVoltages, + .pTableCellTemperature = &can_tableTemperatures, + .pTableMinMax = &can_tableMinimumMaximumValues, + .pTableCurrentSensor = &can_tableCurrentSensor, + .pTableOpenWire = &can_tableOpenWire, + .pTableStateRequest = &can_tableStateRequest, + .pTablePackValues = &can_tablePackValues, + .pTableSof = &can_tableSof, + .pTableSox = &can_tableSox, + .pTableErrorState = &can_tableErrorState, + .pTableInsulation = &can_tableInsulation, + .pTableMsl = &can_tableMslFlags, + .pTableRsl = &can_tableRslFlags, + .pTableMol = &can_tableMolFlags, +}; + +static uint8_t muxId = 0u; + /*========== Setup and Teardown =============================================*/ void setUp(void) { } diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_limits.c b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_limits.c index 981271d7..fc497c53 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_limits.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_limits.c @@ -61,6 +61,7 @@ #include "Mockmpu_prototypes.h" #include "Mockos.h" +#include "battery_cell_cfg.h" #include "database_cfg.h" #include "can_cbs.h" @@ -70,6 +71,44 @@ TEST_FILE("can_cbs_tx_limits.c") /*========== Definitions and Implementations for Unit Test ==================*/ +static DATA_BLOCK_CELL_VOLTAGE_s can_tableCellVoltages = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; +static DATA_BLOCK_CELL_TEMPERATURE_s can_tableTemperatures = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE}; +static DATA_BLOCK_MIN_MAX_s can_tableMinimumMaximumValues = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; +static DATA_BLOCK_CURRENT_SENSOR_s can_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}; +static DATA_BLOCK_OPEN_WIRE_s can_tableOpenWire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; +static DATA_BLOCK_STATEREQUEST_s can_tableStateRequest = {.header.uniqueId = DATA_BLOCK_ID_STATEREQUEST}; +static DATA_BLOCK_PACK_VALUES_s can_tablePackValues = {.header.uniqueId = DATA_BLOCK_ID_PACK_VALUES}; +static DATA_BLOCK_SOF_s can_tableSof = {.header.uniqueId = DATA_BLOCK_ID_SOF}; +static DATA_BLOCK_SOX_s can_tableSox = {.header.uniqueId = DATA_BLOCK_ID_SOX}; +static DATA_BLOCK_ERRORSTATE_s can_tableErrorState = {.header.uniqueId = DATA_BLOCK_ID_ERRORSTATE}; +static DATA_BLOCK_INSULATION_MONITORING_s can_tableInsulation = { + .header.uniqueId = DATA_BLOCK_ID_INSULATION_MONITORING}; +static DATA_BLOCK_MSL_FLAG_s can_tableMslFlags = {.header.uniqueId = DATA_BLOCK_ID_MSL_FLAG}; +static DATA_BLOCK_RSL_FLAG_s can_tableRslFlags = {.header.uniqueId = DATA_BLOCK_ID_RSL_FLAG}; +static DATA_BLOCK_MOL_FLAG_s can_tableMolFlags = {.header.uniqueId = DATA_BLOCK_ID_MOL_FLAG}; + +QueueHandle_t imd_canDataQueue = NULL_PTR; + +const CAN_SHIM_s can_kShim = { + .pQueueImd = &imd_canDataQueue, + .pTableCellVoltage = &can_tableCellVoltages, + .pTableCellTemperature = &can_tableTemperatures, + .pTableMinMax = &can_tableMinimumMaximumValues, + .pTableCurrentSensor = &can_tableCurrentSensor, + .pTableOpenWire = &can_tableOpenWire, + .pTableStateRequest = &can_tableStateRequest, + .pTablePackValues = &can_tablePackValues, + .pTableSof = &can_tableSof, + .pTableSox = &can_tableSox, + .pTableErrorState = &can_tableErrorState, + .pTableInsulation = &can_tableInsulation, + .pTableMsl = &can_tableMslFlags, + .pTableRsl = &can_tableRslFlags, + .pTableMol = &can_tableMolFlags, +}; + +static uint8_t muxId = 0u; + /*========== Setup and Teardown =============================================*/ void setUp(void) { } @@ -78,5 +117,36 @@ void tearDown(void) { } /*========== Test Cases =====================================================*/ -void testDummy(void) { +void testCAN_TxLimitValues(void) { + uint8_t data[8] = {0}; + + for (uint8_t stringNumber = 0u; stringNumber < BS_NR_OF_STRINGS; stringNumber++) { + can_kShim.pTableSof->recommendedContinuousPackDischargeCurrent_mA = 270000.0f; + can_kShim.pTableSof->recommendedContinuousPackChargeCurrent_mA = 240000.0f; + } + + DATA_Read_1_DataBlock_IgnoreAndReturn(0u); + + CAN_TxLimitValues(CAN_ID_TX_LIMIT_VALUES, 8, CAN_BIG_ENDIAN, data, NULL_PTR, &can_kShim); + + /** Values of: + * max. charge current: 240A + * max. discharge current: 270A + * max. charge power: 0kW + * max. discharge power: 0kW + * max. battery voltage: 380V + * min. battery voltage: 208V + */ + + uint8_t minimumBatteryVoltage = (uint8_t)((BS_NR_OF_BAT_CELLS * BC_VOLTAGE_MIN_MSL_mV) / 4000u); + uint8_t maximumBatteryVoltage = (uint8_t)((BS_NR_OF_BAT_CELLS * BC_VOLTAGE_MAX_MSL_mV) / 4000u); + + TEST_ASSERT_EQUAL(0x43, data[0]); + TEST_ASSERT_EQUAL(0x83, data[1]); + TEST_ASSERT_EQUAL(0xC0, data[2]); + TEST_ASSERT_EQUAL(0x00, data[3]); + TEST_ASSERT_EQUAL(0x00, data[4]); + TEST_ASSERT_EQUAL(0x00, data[5]); + TEST_ASSERT_EQUAL(maximumBatteryVoltage, data[6]); /* Max battery voltage */ + TEST_ASSERT_EQUAL(minimumBatteryVoltage, data[7]); /* Minimum battery voltage */ } diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_minmax.c b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_minmax.c index 9a7085d3..766a9045 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_minmax.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_minmax.c @@ -71,6 +71,44 @@ TEST_FILE("can_cbs_tx_minmax.c") /*========== Definitions and Implementations for Unit Test ==================*/ +static DATA_BLOCK_CELL_VOLTAGE_s can_tableCellVoltages = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; +static DATA_BLOCK_CELL_TEMPERATURE_s can_tableTemperatures = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE}; +static DATA_BLOCK_MIN_MAX_s can_tableMinimumMaximumValues = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; +static DATA_BLOCK_CURRENT_SENSOR_s can_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}; +static DATA_BLOCK_OPEN_WIRE_s can_tableOpenWire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; +static DATA_BLOCK_STATEREQUEST_s can_tableStateRequest = {.header.uniqueId = DATA_BLOCK_ID_STATEREQUEST}; +static DATA_BLOCK_PACK_VALUES_s can_tablePackValues = {.header.uniqueId = DATA_BLOCK_ID_PACK_VALUES}; +static DATA_BLOCK_SOF_s can_tableSof = {.header.uniqueId = DATA_BLOCK_ID_SOF}; +static DATA_BLOCK_SOX_s can_tableSox = {.header.uniqueId = DATA_BLOCK_ID_SOX}; +static DATA_BLOCK_ERRORSTATE_s can_tableErrorState = {.header.uniqueId = DATA_BLOCK_ID_ERRORSTATE}; +static DATA_BLOCK_INSULATION_MONITORING_s can_tableInsulation = { + .header.uniqueId = DATA_BLOCK_ID_INSULATION_MONITORING}; +static DATA_BLOCK_MSL_FLAG_s can_tableMslFlags = {.header.uniqueId = DATA_BLOCK_ID_MSL_FLAG}; +static DATA_BLOCK_RSL_FLAG_s can_tableRslFlags = {.header.uniqueId = DATA_BLOCK_ID_RSL_FLAG}; +static DATA_BLOCK_MOL_FLAG_s can_tableMolFlags = {.header.uniqueId = DATA_BLOCK_ID_MOL_FLAG}; + +QueueHandle_t imd_canDataQueue = NULL_PTR; + +const CAN_SHIM_s can_kShim = { + .pQueueImd = &imd_canDataQueue, + .pTableCellVoltage = &can_tableCellVoltages, + .pTableCellTemperature = &can_tableTemperatures, + .pTableMinMax = &can_tableMinimumMaximumValues, + .pTableCurrentSensor = &can_tableCurrentSensor, + .pTableOpenWire = &can_tableOpenWire, + .pTableStateRequest = &can_tableStateRequest, + .pTablePackValues = &can_tablePackValues, + .pTableSof = &can_tableSof, + .pTableSox = &can_tableSox, + .pTableErrorState = &can_tableErrorState, + .pTableInsulation = &can_tableInsulation, + .pTableMsl = &can_tableMslFlags, + .pTableRsl = &can_tableRslFlags, + .pTableMol = &can_tableMolFlags, +}; + +static uint8_t muxId = 0u; + /*========== Setup and Teardown =============================================*/ void setUp(void) { } @@ -79,5 +117,65 @@ void tearDown(void) { } /*========== Test Cases =====================================================*/ -void testDummy(void) { +void testCAN_TxMinimumMaximumValuesAllStringsOpen(void) { + uint8_t data[8] = {0}; + + for (uint8_t stringNumber = 0u; stringNumber < BS_NR_OF_STRINGS; stringNumber++) { + can_kShim.pTableMinMax->minimumCellVoltage_mV[stringNumber] = 2000; + can_kShim.pTableMinMax->maximumCellVoltage_mV[stringNumber] = 3000; + can_kShim.pTableMinMax->minimumTemperature_ddegC[stringNumber] = -150; + can_kShim.pTableMinMax->maximumTemperature_ddegC[stringNumber] = 350; + } + + DATA_Read_1_DataBlock_IgnoreAndReturn(0u); + BMS_GetNumberOfConnectedStrings_IgnoreAndReturn(0u); + CAN_TxMinimumMaximumValues(CAN_ID_TX_MINIMUM_MAXIMUM_VALUES, 8, CAN_BIG_ENDIAN, data, NULL_PTR, &can_kShim); + + /** Values of: + * minimum cell voltage: 2000mV + * maximum cell voltage: 3000mV + * minimum temperature: -15degC + * maximum temperature: 35degC + */ + TEST_ASSERT_EQUAL(0x5D, data[0]); + TEST_ASSERT_EQUAL(0xC1, data[1]); + TEST_ASSERT_EQUAL(0xF4, data[2]); + TEST_ASSERT_EQUAL(0x00, data[3]); + TEST_ASSERT_EQUAL(0x00, data[4]); + TEST_ASSERT_EQUAL(0x00, data[5]); + TEST_ASSERT_EQUAL(0x23, data[6]); + TEST_ASSERT_EQUAL(0xF1, data[7]); +} + +void testCAN_TxMinimumMaximumValuesAllStringsClosed(void) { + uint8_t data[8] = {0}; + + for (uint8_t stringNumber = 0u; stringNumber < BS_NR_OF_STRINGS; stringNumber++) { + can_kShim.pTableMinMax->minimumCellVoltage_mV[stringNumber] = 2000 + stringNumber; + can_kShim.pTableMinMax->maximumCellVoltage_mV[stringNumber] = 3000 - stringNumber; + can_kShim.pTableMinMax->minimumTemperature_ddegC[stringNumber] = -150 + stringNumber; + can_kShim.pTableMinMax->maximumTemperature_ddegC[stringNumber] = 350 - stringNumber; + } + + DATA_Read_1_DataBlock_IgnoreAndReturn(0u); + BMS_GetNumberOfConnectedStrings_IgnoreAndReturn(BS_NR_OF_STRINGS); + for (uint8_t stringNumber = 0u; stringNumber < BS_NR_OF_STRINGS; stringNumber++) { + BMS_IsStringClosed_IgnoreAndReturn(true); + } + CAN_TxMinimumMaximumValues(CAN_ID_TX_MINIMUM_MAXIMUM_VALUES, 8, CAN_BIG_ENDIAN, data, NULL_PTR, &can_kShim); + + /** Values of: + * minimum cell voltage: 2000mV + * maximum cell voltage: 3000mV + * minimum temperature: -15degC + * maximum temperature: 35degC + */ + TEST_ASSERT_EQUAL(0x5D, data[0]); + TEST_ASSERT_EQUAL(0xC1, data[1]); + TEST_ASSERT_EQUAL(0xF4, data[2]); + TEST_ASSERT_EQUAL(0x00, data[3]); + TEST_ASSERT_EQUAL(0x00, data[4]); + TEST_ASSERT_EQUAL(0x00, data[5]); + TEST_ASSERT_EQUAL(0x23, data[6]); + TEST_ASSERT_EQUAL(0xF1, data[7]); } diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state.c b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state.c index 935e1ac2..6da99cc6 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state.c @@ -71,6 +71,44 @@ TEST_FILE("can_cbs_tx_state.c") /*========== Definitions and Implementations for Unit Test ==================*/ +static DATA_BLOCK_CELL_VOLTAGE_s can_tableCellVoltages = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; +static DATA_BLOCK_CELL_TEMPERATURE_s can_tableTemperatures = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE}; +static DATA_BLOCK_MIN_MAX_s can_tableMinimumMaximumValues = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; +static DATA_BLOCK_CURRENT_SENSOR_s can_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}; +static DATA_BLOCK_OPEN_WIRE_s can_tableOpenWire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; +static DATA_BLOCK_STATEREQUEST_s can_tableStateRequest = {.header.uniqueId = DATA_BLOCK_ID_STATEREQUEST}; +static DATA_BLOCK_PACK_VALUES_s can_tablePackValues = {.header.uniqueId = DATA_BLOCK_ID_PACK_VALUES}; +static DATA_BLOCK_SOF_s can_tableSof = {.header.uniqueId = DATA_BLOCK_ID_SOF}; +static DATA_BLOCK_SOX_s can_tableSox = {.header.uniqueId = DATA_BLOCK_ID_SOX}; +static DATA_BLOCK_ERRORSTATE_s can_tableErrorState = {.header.uniqueId = DATA_BLOCK_ID_ERRORSTATE}; +static DATA_BLOCK_INSULATION_MONITORING_s can_tableInsulation = { + .header.uniqueId = DATA_BLOCK_ID_INSULATION_MONITORING}; +static DATA_BLOCK_MSL_FLAG_s can_tableMslFlags = {.header.uniqueId = DATA_BLOCK_ID_MSL_FLAG}; +static DATA_BLOCK_RSL_FLAG_s can_tableRslFlags = {.header.uniqueId = DATA_BLOCK_ID_RSL_FLAG}; +static DATA_BLOCK_MOL_FLAG_s can_tableMolFlags = {.header.uniqueId = DATA_BLOCK_ID_MOL_FLAG}; + +QueueHandle_t imd_canDataQueue = NULL_PTR; + +const CAN_SHIM_s can_kShim = { + .pQueueImd = &imd_canDataQueue, + .pTableCellVoltage = &can_tableCellVoltages, + .pTableCellTemperature = &can_tableTemperatures, + .pTableMinMax = &can_tableMinimumMaximumValues, + .pTableCurrentSensor = &can_tableCurrentSensor, + .pTableOpenWire = &can_tableOpenWire, + .pTableStateRequest = &can_tableStateRequest, + .pTablePackValues = &can_tablePackValues, + .pTableSof = &can_tableSof, + .pTableSox = &can_tableSox, + .pTableErrorState = &can_tableErrorState, + .pTableInsulation = &can_tableInsulation, + .pTableMsl = &can_tableMslFlags, + .pTableRsl = &can_tableRslFlags, + .pTableMol = &can_tableMolFlags, +}; + +static uint8_t muxId = 0u; + /*========== Setup and Teardown =============================================*/ void setUp(void) { } diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state_estimation.c b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state_estimation.c index 73aa1bd2..818ef1e7 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state_estimation.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_state_estimation.c @@ -71,6 +71,44 @@ TEST_FILE("can_cbs_tx_state_estimation.c") /*========== Definitions and Implementations for Unit Test ==================*/ +static DATA_BLOCK_CELL_VOLTAGE_s can_tableCellVoltages = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; +static DATA_BLOCK_CELL_TEMPERATURE_s can_tableTemperatures = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE}; +static DATA_BLOCK_MIN_MAX_s can_tableMinimumMaximumValues = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; +static DATA_BLOCK_CURRENT_SENSOR_s can_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}; +static DATA_BLOCK_OPEN_WIRE_s can_tableOpenWire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; +static DATA_BLOCK_STATEREQUEST_s can_tableStateRequest = {.header.uniqueId = DATA_BLOCK_ID_STATEREQUEST}; +static DATA_BLOCK_PACK_VALUES_s can_tablePackValues = {.header.uniqueId = DATA_BLOCK_ID_PACK_VALUES}; +static DATA_BLOCK_SOF_s can_tableSof = {.header.uniqueId = DATA_BLOCK_ID_SOF}; +static DATA_BLOCK_SOX_s can_tableSox = {.header.uniqueId = DATA_BLOCK_ID_SOX}; +static DATA_BLOCK_ERRORSTATE_s can_tableErrorState = {.header.uniqueId = DATA_BLOCK_ID_ERRORSTATE}; +static DATA_BLOCK_INSULATION_MONITORING_s can_tableInsulation = { + .header.uniqueId = DATA_BLOCK_ID_INSULATION_MONITORING}; +static DATA_BLOCK_MSL_FLAG_s can_tableMslFlags = {.header.uniqueId = DATA_BLOCK_ID_MSL_FLAG}; +static DATA_BLOCK_RSL_FLAG_s can_tableRslFlags = {.header.uniqueId = DATA_BLOCK_ID_RSL_FLAG}; +static DATA_BLOCK_MOL_FLAG_s can_tableMolFlags = {.header.uniqueId = DATA_BLOCK_ID_MOL_FLAG}; + +QueueHandle_t imd_canDataQueue = NULL_PTR; + +const CAN_SHIM_s can_kShim = { + .pQueueImd = &imd_canDataQueue, + .pTableCellVoltage = &can_tableCellVoltages, + .pTableCellTemperature = &can_tableTemperatures, + .pTableMinMax = &can_tableMinimumMaximumValues, + .pTableCurrentSensor = &can_tableCurrentSensor, + .pTableOpenWire = &can_tableOpenWire, + .pTableStateRequest = &can_tableStateRequest, + .pTablePackValues = &can_tablePackValues, + .pTableSof = &can_tableSof, + .pTableSox = &can_tableSox, + .pTableErrorState = &can_tableErrorState, + .pTableInsulation = &can_tableInsulation, + .pTableMsl = &can_tableMslFlags, + .pTableRsl = &can_tableRslFlags, + .pTableMol = &can_tableMolFlags, +}; + +static uint8_t muxId = 0u; + /*========== Setup and Teardown =============================================*/ void setUp(void) { } @@ -79,5 +117,86 @@ void tearDown(void) { } /*========== Test Cases =====================================================*/ -void testDummy(void) { +void testCAN_TxStateEstimationCharging(void) { + uint8_t data[8] = {0}; + + for (uint8_t stringNumber = 0u; stringNumber < BS_NR_OF_STRINGS; stringNumber++) { + can_kShim.pTableSox->minimumSoc_perc[stringNumber] = 71.2f; + can_kShim.pTableSox->maximumSoc_perc[stringNumber] = 74.2f; + can_kShim.pTableSox->minimumSoe_perc[stringNumber] = 74.6f; + can_kShim.pTableSox->maximumSoe_perc[stringNumber] = 78.1f; + can_kShim.pTableSox->minimumSoe_Wh[stringNumber] = 19200 / BS_NR_OF_STRINGS; + } + + DATA_Read_1_DataBlock_IgnoreAndReturn(0u); + /* System is currently charging */ + BMS_GetBatterySystemState_IgnoreAndReturn(BMS_CHARGING); + /* All strings connected */ + for (uint8_t s = 0; s < BS_NR_OF_STRINGS; s++) { + BMS_IsStringClosed_IgnoreAndReturn(true); + } + BMS_GetNumberOfConnectedStrings_IgnoreAndReturn(BS_NR_OF_STRINGS); + BMS_GetBatterySystemState_IgnoreAndReturn(BMS_CHARGING); + BMS_GetNumberOfConnectedStrings_IgnoreAndReturn(BS_NR_OF_STRINGS); + BMS_GetNumberOfConnectedStrings_IgnoreAndReturn(BS_NR_OF_STRINGS); + BMS_GetNumberOfConnectedStrings_IgnoreAndReturn(BS_NR_OF_STRINGS); + + CAN_TxStateEstimation(CAN_ID_TX_PACK_STATE_ESTIMATION, 8, CAN_BIG_ENDIAN, data, NULL_PTR, &can_kShim); + + /** Values of: + * pack SOC: 74.2% + * pack SOE: 78.1% + * pack Energy: 19.2kWh + * pack SOH: 100.0% + */ + TEST_ASSERT_EQUAL(0x73, data[0]); + TEST_ASSERT_EQUAL(0xED, data[1]); + TEST_ASSERT_EQUAL(0xE8, data[2]); + TEST_ASSERT_EQUAL(0x2F, data[3]); + TEST_ASSERT_EQUAL(0xA0, data[4]); + TEST_ASSERT_EQUAL(0x00, data[5]); + TEST_ASSERT_EQUAL(0x07, data[6]); + TEST_ASSERT_EQUAL(0x80, data[7]); +} + +void testCAN_TxStateEstimationDischarging(void) { + uint8_t data[8] = {0}; + + for (uint8_t stringNumber = 0u; stringNumber < BS_NR_OF_STRINGS; stringNumber++) { + can_kShim.pTableSox->minimumSoc_perc[stringNumber] = 74.2f; + can_kShim.pTableSox->maximumSoc_perc[stringNumber] = 78.2f; + can_kShim.pTableSox->minimumSoe_perc[stringNumber] = 78.1f; + can_kShim.pTableSox->maximumSoe_perc[stringNumber] = 83.1f; + can_kShim.pTableSox->minimumSoe_Wh[stringNumber] = 19200 / BS_NR_OF_STRINGS; + } + + DATA_Read_1_DataBlock_IgnoreAndReturn(0u); + /* System is currently charging */ + BMS_GetBatterySystemState_IgnoreAndReturn(BMS_DISCHARGING); + /* All strings connected */ + for (uint8_t s = 0; s < BS_NR_OF_STRINGS; s++) { + BMS_IsStringClosed_IgnoreAndReturn(true); + } + BMS_GetNumberOfConnectedStrings_IgnoreAndReturn(BS_NR_OF_STRINGS); + BMS_GetBatterySystemState_IgnoreAndReturn(BMS_DISCHARGING); + BMS_GetNumberOfConnectedStrings_IgnoreAndReturn(BS_NR_OF_STRINGS); + BMS_GetNumberOfConnectedStrings_IgnoreAndReturn(BS_NR_OF_STRINGS); + BMS_GetNumberOfConnectedStrings_IgnoreAndReturn(BS_NR_OF_STRINGS); + + CAN_TxStateEstimation(CAN_ID_TX_PACK_STATE_ESTIMATION, 8, CAN_BIG_ENDIAN, data, NULL_PTR, &can_kShim); + + /** Values of: + * pack SOC: 74.2% + * pack SOE: 78.1% + * pack Energy: 19.2kWh + * pack SOH: 100.0% + */ + TEST_ASSERT_EQUAL(0x73, data[0]); + TEST_ASSERT_EQUAL(0xED, data[1]); + TEST_ASSERT_EQUAL(0xE8, data[2]); + TEST_ASSERT_EQUAL(0x2F, data[3]); + TEST_ASSERT_EQUAL(0xA0, data[4]); + TEST_ASSERT_EQUAL(0x00, data[5]); + TEST_ASSERT_EQUAL(0x07, data[6]); + TEST_ASSERT_EQUAL(0x80, data[7]); } diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_system_values.c b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_system_values.c index 6cc32742..11eb90c8 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_system_values.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_system_values.c @@ -70,6 +70,44 @@ TEST_FILE("can_cbs_tx_system_values.c") /*========== Definitions and Implementations for Unit Test ==================*/ +static DATA_BLOCK_CELL_VOLTAGE_s can_tableCellVoltages = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; +static DATA_BLOCK_CELL_TEMPERATURE_s can_tableTemperatures = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE}; +static DATA_BLOCK_MIN_MAX_s can_tableMinimumMaximumValues = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; +static DATA_BLOCK_CURRENT_SENSOR_s can_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}; +static DATA_BLOCK_OPEN_WIRE_s can_tableOpenWire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; +static DATA_BLOCK_STATEREQUEST_s can_tableStateRequest = {.header.uniqueId = DATA_BLOCK_ID_STATEREQUEST}; +static DATA_BLOCK_PACK_VALUES_s can_tablePackValues = {.header.uniqueId = DATA_BLOCK_ID_PACK_VALUES}; +static DATA_BLOCK_SOF_s can_tableSof = {.header.uniqueId = DATA_BLOCK_ID_SOF}; +static DATA_BLOCK_SOX_s can_tableSox = {.header.uniqueId = DATA_BLOCK_ID_SOX}; +static DATA_BLOCK_ERRORSTATE_s can_tableErrorState = {.header.uniqueId = DATA_BLOCK_ID_ERRORSTATE}; +static DATA_BLOCK_INSULATION_MONITORING_s can_tableInsulation = { + .header.uniqueId = DATA_BLOCK_ID_INSULATION_MONITORING}; +static DATA_BLOCK_MSL_FLAG_s can_tableMslFlags = {.header.uniqueId = DATA_BLOCK_ID_MSL_FLAG}; +static DATA_BLOCK_RSL_FLAG_s can_tableRslFlags = {.header.uniqueId = DATA_BLOCK_ID_RSL_FLAG}; +static DATA_BLOCK_MOL_FLAG_s can_tableMolFlags = {.header.uniqueId = DATA_BLOCK_ID_MOL_FLAG}; + +QueueHandle_t imd_canDataQueue = NULL_PTR; + +const CAN_SHIM_s can_kShim = { + .pQueueImd = &imd_canDataQueue, + .pTableCellVoltage = &can_tableCellVoltages, + .pTableCellTemperature = &can_tableTemperatures, + .pTableMinMax = &can_tableMinimumMaximumValues, + .pTableCurrentSensor = &can_tableCurrentSensor, + .pTableOpenWire = &can_tableOpenWire, + .pTableStateRequest = &can_tableStateRequest, + .pTablePackValues = &can_tablePackValues, + .pTableSof = &can_tableSof, + .pTableSox = &can_tableSox, + .pTableErrorState = &can_tableErrorState, + .pTableInsulation = &can_tableInsulation, + .pTableMsl = &can_tableMslFlags, + .pTableRsl = &can_tableRslFlags, + .pTableMol = &can_tableMolFlags, +}; + +static uint8_t muxId = 0u; + /*========== Setup and Teardown =============================================*/ void setUp(void) { } @@ -78,5 +116,29 @@ void tearDown(void) { } /*========== Test Cases =====================================================*/ -void testDummy(void) { +void testCAN_TxPackValues(void) { + uint8_t data[8] = {0}; + + can_kShim.pTablePackValues->packCurrent_mA = -200500; + can_kShim.pTablePackValues->batteryVoltage_mV = 324800; + can_kShim.pTablePackValues->highVoltageBusVoltage_mV = 325100; + can_kShim.pTablePackValues->packPower_W = -65100; + + DATA_Read_1_DataBlock_IgnoreAndReturn(0u); + CAN_TxPackValues(CAN_ID_TX_PACK_VALUES, 8, CAN_BIG_ENDIAN, data, NULL_PTR, &can_kShim); + + /** Values of: + * pack current: -200.5A + * battery voltage: 324.8V + * bus voltage: 325.1V + * pack power: -65.1kW + */ + TEST_ASSERT_EQUAL(0x32, data[0]); + TEST_ASSERT_EQUAL(0xC0, data[1]); + TEST_ASSERT_EQUAL(0xCB, data[2]); + TEST_ASSERT_EQUAL(0x3F, data[3]); + TEST_ASSERT_EQUAL(0x9A, data[4]); + TEST_ASSERT_EQUAL(0x4B, data[5]); + TEST_ASSERT_EQUAL(0xB1, data[6]); + TEST_ASSERT_EQUAL(0xAE, data[7]); } diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_temperature.c b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_temperature.c index 47671fd0..4ead390b 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_temperature.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_temperature.c @@ -71,12 +71,21 @@ TEST_FILE("can_cbs_tx_temperature.c") /*========== Definitions and Implementations for Unit Test ==================*/ -static DATA_BLOCK_CELL_VOLTAGE_s can_tableCellVoltages = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; -static DATA_BLOCK_CELL_TEMPERATURE_s can_tableTemperatures = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE}; -static DATA_BLOCK_MIN_MAX_s can_tableMinimumMaximumValues = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; -static DATA_BLOCK_CURRENT_SENSOR_s can_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}; -static DATA_BLOCK_OPEN_WIRE_s can_tableOpenWire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; -static DATA_BLOCK_STATEREQUEST_s can_tableStateRequest = {.header.uniqueId = DATA_BLOCK_ID_STATEREQUEST}; +static DATA_BLOCK_CELL_VOLTAGE_s can_tableCellVoltages = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; +static DATA_BLOCK_CELL_TEMPERATURE_s can_tableTemperatures = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE}; +static DATA_BLOCK_MIN_MAX_s can_tableMinimumMaximumValues = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; +static DATA_BLOCK_CURRENT_SENSOR_s can_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}; +static DATA_BLOCK_OPEN_WIRE_s can_tableOpenWire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; +static DATA_BLOCK_STATEREQUEST_s can_tableStateRequest = {.header.uniqueId = DATA_BLOCK_ID_STATEREQUEST}; +static DATA_BLOCK_PACK_VALUES_s can_tablePackValues = {.header.uniqueId = DATA_BLOCK_ID_PACK_VALUES}; +static DATA_BLOCK_SOF_s can_tableSof = {.header.uniqueId = DATA_BLOCK_ID_SOF}; +static DATA_BLOCK_SOX_s can_tableSox = {.header.uniqueId = DATA_BLOCK_ID_SOX}; +static DATA_BLOCK_ERRORSTATE_s can_tableErrorState = {.header.uniqueId = DATA_BLOCK_ID_ERRORSTATE}; +static DATA_BLOCK_INSULATION_MONITORING_s can_tableInsulation = { + .header.uniqueId = DATA_BLOCK_ID_INSULATION_MONITORING}; +static DATA_BLOCK_MSL_FLAG_s can_tableMslFlags = {.header.uniqueId = DATA_BLOCK_ID_MSL_FLAG}; +static DATA_BLOCK_RSL_FLAG_s can_tableRslFlags = {.header.uniqueId = DATA_BLOCK_ID_RSL_FLAG}; +static DATA_BLOCK_MOL_FLAG_s can_tableMolFlags = {.header.uniqueId = DATA_BLOCK_ID_MOL_FLAG}; QueueHandle_t imd_canDataQueue = NULL_PTR; @@ -88,6 +97,14 @@ const CAN_SHIM_s can_kShim = { .pTableCurrentSensor = &can_tableCurrentSensor, .pTableOpenWire = &can_tableOpenWire, .pTableStateRequest = &can_tableStateRequest, + .pTablePackValues = &can_tablePackValues, + .pTableSof = &can_tableSof, + .pTableSox = &can_tableSox, + .pTableErrorState = &can_tableErrorState, + .pTableInsulation = &can_tableInsulation, + .pTableMsl = &can_tableMslFlags, + .pTableRsl = &can_tableRslFlags, + .pTableMol = &can_tableMolFlags, }; static uint8_t muxId = 0u; diff --git a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_voltage.c b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_voltage.c index bb9b1656..f7c3a773 100644 --- a/tests/unit/app/driver/can/cbs/test_can_cbs_tx_voltage.c +++ b/tests/unit/app/driver/can/cbs/test_can_cbs_tx_voltage.c @@ -71,12 +71,21 @@ TEST_FILE("can_cbs_tx_voltage.c") /*========== Definitions and Implementations for Unit Test ==================*/ -static DATA_BLOCK_CELL_VOLTAGE_s can_tableCellVoltages = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; -static DATA_BLOCK_CELL_TEMPERATURE_s can_tableTemperatures = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE}; -static DATA_BLOCK_MIN_MAX_s can_tableMinimumMaximumValues = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; -static DATA_BLOCK_CURRENT_SENSOR_s can_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}; -static DATA_BLOCK_OPEN_WIRE_s can_tableOpenWire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; -static DATA_BLOCK_STATEREQUEST_s can_tableStateRequest = {.header.uniqueId = DATA_BLOCK_ID_STATEREQUEST}; +static DATA_BLOCK_CELL_VOLTAGE_s can_tableCellVoltages = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE}; +static DATA_BLOCK_CELL_TEMPERATURE_s can_tableTemperatures = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE}; +static DATA_BLOCK_MIN_MAX_s can_tableMinimumMaximumValues = {.header.uniqueId = DATA_BLOCK_ID_MIN_MAX}; +static DATA_BLOCK_CURRENT_SENSOR_s can_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}; +static DATA_BLOCK_OPEN_WIRE_s can_tableOpenWire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}; +static DATA_BLOCK_STATEREQUEST_s can_tableStateRequest = {.header.uniqueId = DATA_BLOCK_ID_STATEREQUEST}; +static DATA_BLOCK_PACK_VALUES_s can_tablePackValues = {.header.uniqueId = DATA_BLOCK_ID_PACK_VALUES}; +static DATA_BLOCK_SOF_s can_tableSof = {.header.uniqueId = DATA_BLOCK_ID_SOF}; +static DATA_BLOCK_SOX_s can_tableSox = {.header.uniqueId = DATA_BLOCK_ID_SOX}; +static DATA_BLOCK_ERRORSTATE_s can_tableErrorState = {.header.uniqueId = DATA_BLOCK_ID_ERRORSTATE}; +static DATA_BLOCK_INSULATION_MONITORING_s can_tableInsulation = { + .header.uniqueId = DATA_BLOCK_ID_INSULATION_MONITORING}; +static DATA_BLOCK_MSL_FLAG_s can_tableMslFlags = {.header.uniqueId = DATA_BLOCK_ID_MSL_FLAG}; +static DATA_BLOCK_RSL_FLAG_s can_tableRslFlags = {.header.uniqueId = DATA_BLOCK_ID_RSL_FLAG}; +static DATA_BLOCK_MOL_FLAG_s can_tableMolFlags = {.header.uniqueId = DATA_BLOCK_ID_MOL_FLAG}; QueueHandle_t imd_canDataQueue = NULL_PTR; @@ -88,6 +97,14 @@ const CAN_SHIM_s can_kShim = { .pTableCurrentSensor = &can_tableCurrentSensor, .pTableOpenWire = &can_tableOpenWire, .pTableStateRequest = &can_tableStateRequest, + .pTablePackValues = &can_tablePackValues, + .pTableSof = &can_tableSof, + .pTableSox = &can_tableSox, + .pTableErrorState = &can_tableErrorState, + .pTableInsulation = &can_tableInsulation, + .pTableMsl = &can_tableMslFlags, + .pTableRsl = &can_tableRslFlags, + .pTableMol = &can_tableMolFlags, }; static uint8_t muxId = 0u; @@ -110,18 +127,22 @@ void testCAN_TxVoltage(void) { can_kShim.pTableCellVoltage->cellVoltage_mV[stringNumber][1] = 2100; can_kShim.pTableCellVoltage->cellVoltage_mV[stringNumber][2] = 3000; can_kShim.pTableCellVoltage->cellVoltage_mV[stringNumber][3] = 3700; - can_kShim.pTableCellVoltage->cellVoltage_mV[stringNumber][4] = 4000; - can_kShim.pTableCellVoltage->cellVoltage_mV[stringNumber][5] = 1000; } - CAN_TxVoltage(0x111, 8, CAN_BIG_ENDIAN, data, &muxId, &can_kShim); - - TEST_ASSERT_EQUAL(0, data[0]); - TEST_ASSERT_EQUAL(7, data[1]); - TEST_ASSERT_EQUAL(250, data[2]); - TEST_ASSERT_EQUAL(32, data[3]); - TEST_ASSERT_EQUAL(208, data[4]); - TEST_ASSERT_EQUAL(0, data[5]); - TEST_ASSERT_EQUAL(11, data[6]); - TEST_ASSERT_EQUAL(184, data[7]); + CAN_TxVoltage(CAN_ID_TX_VOLTAGES, 8, CAN_BIG_ENDIAN, data, &muxId, &can_kShim); + + /* MuxID: 0 + * Cell voltage 0: 2000mV + * Cell voltage 1: 2100mV + * Cell voltage 2: 3000mV + * Cell voltage 3: 3700mV + */ + TEST_ASSERT_EQUAL(0x00, data[0]); + TEST_ASSERT_EQUAL(0x03, data[1]); + TEST_ASSERT_EQUAL(0xE8, data[2]); + TEST_ASSERT_EQUAL(0x20, data[3]); + TEST_ASSERT_EQUAL(0xD1, data[4]); + TEST_ASSERT_EQUAL(0x77, data[5]); + TEST_ASSERT_EQUAL(0x0E, data[6]); + TEST_ASSERT_EQUAL(0x74, data[7]); } diff --git a/tools/dbc/foxbms.dbc b/tools/dbc/foxbms.dbc index c5b31b18..91288501 100644 --- a/tools/dbc/foxbms.dbc +++ b/tools/dbc/foxbms.dbc @@ -48,8 +48,8 @@ SG_ foxBMS_String2_power m2 : 33|18@0- (0.01,0) [-1310.72|1310.71] "kW" Vector__ BO_ 643 foxBMS_StringValues2: 8 Vector__XXX SG_ foxBMS_StringValues2_Mux M : 7|4@0+ (1,0) [0|0] "" Vector__XXX SG_ String0_energyCount m0 : 15|32@0- (1,0) [-2147483648|2147483647] "Wh" Vector__XXX -SG_ String1_energyCount1 m1 : 15|32@0- (1,0) [-2147483648|2147483647] "Wh" Vector__XXX -SG_ String1_energyCount2 m2 : 15|32@0- (1,0) [-2147483648|2147483647] "Wh" Vector__XXX +SG_ String1_energyCount m1 : 15|32@0- (1,0) [-2147483648|2147483647] "Wh" Vector__XXX +SG_ String2_energyCount m2 : 15|32@0- (1,0) [-2147483648|2147483647] "Wh" Vector__XXX BO_ 549 foxBMS_PackStateEstimation: 8 Vector__XXX @@ -1076,22 +1076,22 @@ BO_ 642 foxBMS_StringStateEstimation: 8 Vector__XXX SG_ foxBMS_StringStateEstimation_Mux M : 7|4@0+ (1,0) [0|0] "" Vector__XXX SG_ String0_minimumSOC m0 : 3|9@0+ (0.25,0) [0|127.75] "%" Vector__XXX SG_ String0_averageSOC m0 : 10|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX -SG_ String0_maximumSOC m0 : 17|8@0+ (0.25,0) [0|63.75] "%" Vector__XXX -SG_ String0_SOE m0 : 25|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX -SG_ String0_Energy_kWh m0 : 55|16@0+ (0.01,0) [0|655.35] "kWh" Vector__XXX -SG_ String0_SOH m0 : 32|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX +SG_ String0_maximumSOC m0 : 17|9@0+ (0.25,0) [0|63.75] "%" Vector__XXX +SG_ String0_SOE m0 : 24|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX +SG_ String0_Energy_kWh m0 : 54|15@0+ (0.01,0) [0|327.67] "kWh" Vector__XXX +SG_ String0_SOH m0 : 47|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX SG_ String1_minimumSOC m1 : 3|9@0+ (0.25,0) [0|127.75] "%" Vector__XXX SG_ String1_averageSOC m1 : 10|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX -SG_ String1_maximumSOC m1 : 17|8@0+ (0.25,0) [0|63.75] "%" Vector__XXX -SG_ String1_SOE m1 : 25|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX -SG_ String1_Energy_kWh m1 : 55|16@0+ (0.01,0) [0|655.35] "kWh" Vector__XXX -SG_ String1_SOH m1 : 32|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX +SG_ String1_maximumSOC m1 : 17|9@0+ (0.25,0) [0|63.75] "%" Vector__XXX +SG_ String1_SOE m1 : 24|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX +SG_ String1_Energy_kWh m1 : 54|15@0+ (0.01,0) [0|327.67] "kWh" Vector__XXX +SG_ String1_SOH m1 : 47|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX SG_ String2_minimumSOC m2 : 3|9@0+ (0.25,0) [0|127.75] "%" Vector__XXX SG_ String2_averageSOC m2 : 10|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX -SG_ String2_maximumSOC m2 : 17|8@0+ (0.25,0) [0|63.75] "%" Vector__XXX -SG_ String2_SOE m2 : 25|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX -SG_ String2_Energy_kWh m2 : 55|16@0+ (0.01,0) [0|655.35] "kWh" Vector__XXX -SG_ String2_SOH m2 : 32|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX +SG_ String2_maximumSOC m2 : 17|9@0+ (0.25,0) [0|63.75] "%" Vector__XXX +SG_ String2_SOE m2 : 24|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX +SG_ String2_Energy_kWh m2 : 54|15@0+ (0.01,0) [0|327.67] "kWh" Vector__XXX +SG_ String2_SOH m2 : 47|9@0+ (0.25,0) [0|127.5] "%" Vector__XXX BO_ 512 foxBMS_Debug: 8 Vector__XXX @@ -1128,13 +1128,13 @@ SG_ IVT0_Result_U2_mV : 23|32@0- (1,0) [-2147483648|2147483647] "mV" Vector__XXX BO_ 1316 IVT0_Msg_Result_U3: 6 Vector__XXX -SG_ IVT_Result_U3_systemError : 15|1@0+ (1,0) [0|1] "" Vector__XXX -SG_ IVT_Result_U3_OCS : 12|1@0+ (1,0) [0|1] "" Vector__XXX -SG_ IVT_Result_U3_overallMeasError : 14|1@0+ (1,0) [0|1] "" Vector__XXX -SG_ IVT_Result_U3_channelMeasError : 13|1@0+ (1,0) [0|1] "" Vector__XXX -SG_ IVT_ID_Result_U3 : 7|8@0+ (1,0) [3|3] "" Vector__XXX -SG_ IVT_MsgCount_Result_U3 : 11|4@0+ (1,0) [0|15] "" Vector__XXX -SG_ IVT_Result_U3_mV : 23|32@0- (1,0) [-2147483648|2147483647] "mV" Vector__XXX +SG_ IVT0_Result_U3_systemError : 15|1@0+ (1,0) [0|1] "" Vector__XXX +SG_ IVT0_Result_U3_OCS : 12|1@0+ (1,0) [0|1] "" Vector__XXX +SG_ IVT0_Result_U3_overallMeasError : 14|1@0+ (1,0) [0|1] "" Vector__XXX +SG_ IVT0_Result_U3_channelMeasError : 13|1@0+ (1,0) [0|1] "" Vector__XXX +SG_ IVT0_ID_Result_U3 : 7|8@0+ (1,0) [3|3] "" Vector__XXX +SG_ IVT0_MsgCount_Result_U3 : 11|4@0+ (1,0) [0|15] "" Vector__XXX +SG_ IVT0_Result_U3_mV : 23|32@0- (1,0) [-2147483648|2147483647] "mV" Vector__XXX BO_ 1317 IVT0_Msg_Result_T: 6 Vector__XXX @@ -1208,13 +1208,13 @@ SG_ IVT1_Result_U2_mV : 23|32@0- (1,0) [-2147483648|2147483647] "mV" Vector__XXX BO_ 1572 IVT1_Msg_Result_U3: 6 Vector__XXX -SG_ IVT_Result_U3_systemError : 15|1@0+ (1,0) [0|1] "" Vector__XXX -SG_ IVT_Result_U3_OCS : 12|1@0+ (1,0) [0|1] "" Vector__XXX -SG_ IVT_Result_U3_overallMeasError : 14|1@0+ (1,0) [0|1] "" Vector__XXX -SG_ IVT_Result_U3_channelMeasError : 13|1@0+ (1,0) [0|1] "" Vector__XXX -SG_ IVT_ID_Result_U3 : 7|8@0+ (1,0) [3|3] "" Vector__XXX -SG_ IVT_MsgCount_Result_U3 : 11|4@0+ (1,0) [0|15] "" Vector__XXX -SG_ IVT_Result_U3_mV : 23|32@0- (1,0) [-2147483648|2147483647] "mV" Vector__XXX +SG_ IVT1_Result_U3_systemError : 15|1@0+ (1,0) [0|1] "" Vector__XXX +SG_ IVT1_Result_U3_OCS : 12|1@0+ (1,0) [0|1] "" Vector__XXX +SG_ IVT1_Result_U3_overallMeasError : 14|1@0+ (1,0) [0|1] "" Vector__XXX +SG_ IVT1_Result_U3_channelMeasError : 13|1@0+ (1,0) [0|1] "" Vector__XXX +SG_ IVT1_ID_Result_U3 : 7|8@0+ (1,0) [3|3] "" Vector__XXX +SG_ IVT1_MsgCount_Result_U3 : 11|4@0+ (1,0) [0|15] "" Vector__XXX +SG_ IVT1_Result_U3_mV : 23|32@0- (1,0) [-2147483648|2147483647] "mV" Vector__XXX BO_ 1573 IVT1_Msg_Result_T: 6 Vector__XXX @@ -1288,13 +1288,13 @@ SG_ IVT2_Result_U2_mV : 23|32@0- (1,0) [-2147483648|2147483647] "mV" Vector__XXX BO_ 1828 IVT2_Msg_Result_U3: 6 Vector__XXX -SG_ IVT_Result_U3_systemError : 15|1@0+ (1,0) [0|1] "" Vector__XXX -SG_ IVT_Result_U3_OCS : 12|1@0+ (1,0) [0|1] "" Vector__XXX -SG_ IVT_Result_U3_overallMeasError : 14|1@0+ (1,0) [0|1] "" Vector__XXX -SG_ IVT_Result_U3_channelMeasError : 13|1@0+ (1,0) [0|1] "" Vector__XXX -SG_ IVT_ID_Result_U3 : 7|8@0+ (1,0) [3|3] "" Vector__XXX -SG_ IVT_MsgCount_Result_U3 : 11|4@0+ (1,0) [0|15] "" Vector__XXX -SG_ IVT_Result_U3_mV : 23|32@0- (1,0) [-2147483648|2147483647] "mV" Vector__XXX +SG_ IVT2_Result_U3_systemError : 15|1@0+ (1,0) [0|1] "" Vector__XXX +SG_ IVT2_Result_U3_OCS : 12|1@0+ (1,0) [0|1] "" Vector__XXX +SG_ IVT2_Result_U3_overallMeasError : 14|1@0+ (1,0) [0|1] "" Vector__XXX +SG_ IVT2_Result_U3_channelMeasError : 13|1@0+ (1,0) [0|1] "" Vector__XXX +SG_ IVT2_ID_Result_U3 : 7|8@0+ (1,0) [3|3] "" Vector__XXX +SG_ IVT2_MsgCount_Result_U3 : 11|4@0+ (1,0) [0|15] "" Vector__XXX +SG_ IVT2_Result_U3_mV : 23|32@0- (1,0) [-2147483648|2147483647] "mV" Vector__XXX BO_ 1829 IVT2_Msg_Result_T: 6 Vector__XXX @@ -1348,24 +1348,31 @@ SG_ foxBMS_releaseDistance : 31|5@0+ (1,0) [0|31] "" Vector__XXX SG_ foxBMS_releaseDistanceOverflow : 26|1@1+ (1,0) [0|1] "" Vector__XXX +CM_ BO_ 546 "(in:can_cbs_tx_system_values.c:CAN_TxPackValues)"; CM_ SG_ 546 foxBMS_packCurrent "Battery pack current"; CM_ SG_ 546 foxBMS_batteryVoltage "Battery voltage between negative and positive pole of the battery"; CM_ SG_ 546 foxBMS_busVoltage "Battery voltage between negative pole and after main positive contactor"; CM_ SG_ 546 foxBMS_packPower "Battery power"; +CM_ BO_ 548 "(in:can_cbs_tx_limits.c:CAN_TxLimitValues)"; CM_ SG_ 548 foxBMS_maxChargeCurrent "Maximum battery pack charge current"; CM_ SG_ 548 foxBMS_maxDischargeCurrent "Maximum battery pack discharge current"; +CM_ BO_ 547 "(in:can_cbs_tx_minmax.c:CAN_TxMinimumMaximumValues)"; CM_ SG_ 547 foxBMS_minimumCellVoltage "Minimum cell voltage of all connected strings, if no string connected maximum value of whole system is transmitted"; CM_ SG_ 547 foxBMS_maximumCellVoltage "Maximum cell voltage of all connected strings, if no string connected maximum value of whole system is transmitted"; CM_ SG_ 547 foxBMS_maximumCellTemp "Maximum cell temperature of all connected strings, if no string connected maximum value of whole system is transmitted"; CM_ SG_ 547 foxBMS_minimumCellTemp "Minium cell temperature of all connected string, if no string connected maximum value of whole system is transmitted"; -CM_ BO_ 640 "Message contains string voltage, current and power"; -CM_ BO_ 643 "Message contains energy counting value"; +CM_ BO_ 640 "Message contains string voltage, current and power (in:can_cbs_tx_system_values.c:CAN_TxStringValues)"; +CM_ BO_ 643 "Message contains energy counting value (in:can_cbs_tx_system_values.c:CAN_TxStringValues2)"; CM_ SG_ 643 String0_energyCount "Current sensor string 0 energy counting value"; -CM_ SG_ 643 String1_energyCount1 "Current sensor string 1 energy counting value"; -CM_ SG_ 643 String1_energyCount2 "Current sensor string 2 energy counting value"; +CM_ SG_ 643 String1_energyCount "Current sensor string 1 energy counting value"; +CM_ SG_ 643 String2_energyCount "Current sensor string 2 energy counting value"; +CM_ BO_ 549 "(in:can_cbs_tx_state_estimation.c:CAN_TxStateEstimation)"; CM_ SG_ 549 foxBMS_packSoc "SOC currently connected to HV bus (100% if all strings connected and all strings at 100%)"; CM_ SG_ 549 foxBMS_packSoe "SOE currently connected to HV bus (100% if all strings connected and all strings at 100%)"; CM_ SG_ 549 foxBMS_packEnergy "Energy left in Wh that is currently connected to HV bus"; +CM_ BO_ 576 "(in:can_cbs_tx_voltage.c:CAN_TxVoltage)"; +CM_ BO_ 592 "(in:can_cbs_tx_temperature.c:CAN_TxCellTemperature)"; +CM_ BO_ 560 "(in:can_cbs_rx_command.c:CAN_RxRequest)"; CM_ SG_ 560 foxBMS_modeRequest "0x0: Disconnect strings from HV bus, 0x01: Connect strings to HV bus to start discharge, 0x02: Connect strings to HV bus to start charging"; CM_ SG_ 560 foxBMS_activateBalancing "0: Deactivate balancing, 1: Activate balancing"; CM_ SG_ 560 foxBMS_balancingThreshold "Required voltage difference to minimum cell voltage to activate balancing"; @@ -1375,7 +1382,7 @@ CM_ SG_ 560 foxBMS_chargerConnected "0x00: charger not connected, 0x01: charger CM_ SG_ 560 foxBMS_disableInsulationMon "0x00: Check battery system insulation, 0x01: Do not check insulation of battery system"; CM_ SG_ 560 foxBMS_heaterOverride_ON "0: no override active, 1: override active -> force heater on"; CM_ SG_ 560 foxBMS_heaterOverride_OFF "0: no override active, 1: override active -> force heater off"; -CM_ BO_ 544 "Message contains foxBMS state"; +CM_ BO_ 544 "Message contains foxBMS state (in:can_cbs_tx_state.c:CAN_TxState)"; CM_ SG_ 544 foxBMS_generalError "0x00: No error detected, 0x01: Error detected"; CM_ SG_ 544 foxBMS_generalWarning "0x00: No warning detected, 0x01: Warning detected"; CM_ SG_ 544 foxBMS_Error_dieTemperatureMCU "0x00: No error, 0x01: Error detected"; @@ -1394,7 +1401,7 @@ CM_ SG_ 544 foxBMS_Error_Insulation "0x00: No error, 0x01: Error detected"; CM_ SG_ 544 foxBMS_Error_Cantiming "0x00: No error, 0x01: Error detected"; CM_ SG_ 544 foxBMS_Error_PackOvercurr_Charge "0x00: No error, 0x01: Error detected"; CM_ SG_ 544 foxBMS_Error_PackOvercur_Dischrg "0x00: No error, 0x01: Error detected"; -CM_ BO_ 545 "Message contains string related error and warning flags"; +CM_ BO_ 545 "Message contains string related error and warning flags (in:can_cbs_tx_state.c:CAN_TxStringState)"; CM_ SG_ 545 String0_stringConnected "0x00: String not connected, 0x01: String connected to HV bus"; CM_ SG_ 545 String0_balancing_active "0x00: No balancing active, 0x01: Balancing in this string active"; CM_ SG_ 545 String0_Err_overtemp_charge "0x00: No error, 0x01: Error: Flag will be set if maximum cell temperature is above 45 degree celsius."; @@ -1488,7 +1495,7 @@ CM_ SG_ 545 String2_Err_CS_coulombCountMeas "0x00: No error, 0x01: Error"; CM_ SG_ 545 String2_Err_CS_energyCountMeas "0x00: No error, 0x01: Error"; CM_ SG_ 545 String2_Err_plaus_volt_spread "0x00: No error, 0x01: Error"; CM_ SG_ 545 String2_Err_plaus_temp_spread "0x00: No error, 0x01: Error"; -CM_ BO_ 641 "Message contains minimum and maximum cell temperature and cell voltage values of respective string"; +CM_ BO_ 641 "Message contains minimum and maximum cell temperature and cell voltage values of respective string (in:can_cbs_tx_minmax.c:CAN_TxStringMinimumMaximumValues)"; CM_ SG_ 641 String0_minimumCellVoltage "Minimum cell voltage in this string"; CM_ SG_ 641 String0_maximumCellVoltage "Maximum cell voltage in this string"; CM_ SG_ 641 String0_maximumCellTemperature "Maximum cell temperature in this string"; @@ -1501,38 +1508,39 @@ CM_ SG_ 641 String2_minimumCellVoltage "Minimum cell voltage in this string"; CM_ SG_ 641 String2_maximumCellVoltage "Maximum cell voltage in this string"; CM_ SG_ 641 String2_maximumCellTemperature "Maximum cell temperature in this string"; CM_ SG_ 641 String2_minimumCellTemperature "Minium cell temperature in this string"; -CM_ BO_ 642 "Message contains SOC, SOE and SOH state estimations"; +CM_ BO_ 642 "Message contains SOC, SOE and SOH state estimations (in:can_cbs_tx_state_estimation.c:CAN_TxStringStateEstimation)"; CM_ SG_ 642 String0_SOE "SOE is depending on current direction, if battery system is charging: SOE_max is transmitted, else SOE_min"; CM_ SG_ 642 String0_Energy_kWh "Remaining energy left in this string"; CM_ SG_ 642 String1_SOE "SOE is depending on current direction, if battery system is charging: SOE_max is transmitted, else SOE_min"; CM_ SG_ 642 String1_Energy_kWh "Remaining energy left in this string"; CM_ SG_ 642 String2_SOE "SOE is depending on current direction, if battery system is charging: SOE_max is transmitted, else SOE_min"; CM_ SG_ 642 String2_Energy_kWh "Remaining energy left in this string"; -CM_ BO_ 512 "Reserved - for debug/development purpose only"; -CM_ BO_ 1313 "Current sensor string 0: current"; -CM_ BO_ 1314 "Current sensor string 0: voltage 1"; -CM_ BO_ 1315 "Current sensor string 0: voltage 2"; -CM_ BO_ 1316 "Current sensor string 0: voltage 3"; -CM_ BO_ 1317 "Current sensor string 0: temperature"; -CM_ BO_ 1318 "Current sensor string 0: power"; -CM_ BO_ 1319 "Current sensor string 0: coulomb counting"; -CM_ BO_ 1320 "Current sensor string 0: energy counting"; -CM_ BO_ 1569 "Current sensor string 1: current"; -CM_ BO_ 1570 "Current sensor string 1: voltage 1"; -CM_ BO_ 1571 "Current sensor string 1: voltage 2"; -CM_ BO_ 1572 "Current sensor string 1: voltage 3"; -CM_ BO_ 1573 "Current sensor string 1: temperature"; -CM_ BO_ 1574 "Current sensor string 1: power"; -CM_ BO_ 1575 "Current sensor string 1: coulomb counting"; -CM_ BO_ 1576 "Current sensor string 1: energy counting"; -CM_ BO_ 1825 "Current sensor string 2: current"; -CM_ BO_ 1826 "Current sensor string 2: voltage 1"; -CM_ BO_ 1827 "Current sensor string 2: voltage 2"; -CM_ BO_ 1828 "Current sensor string 2: voltage 3"; -CM_ BO_ 1829 "Current sensor string 2: temperature"; -CM_ BO_ 1830 "Current sensor string 2: power"; -CM_ BO_ 1831 "Current sensor string 2: coulomb counting"; -CM_ BO_ 1832 "Current sensor string 2: energy counting"; +CM_ BO_ 512 "Reserved - for debug/development purpose only (in:can_cbs_rx_misc.c:CAN_RxDebug)"; +CM_ BO_ 1313 "Current sensor string 0: current (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1314 "Current sensor string 0: voltage 1 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1315 "Current sensor string 0: voltage 2 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1316 "Current sensor string 0: voltage 3 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1317 "Current sensor string 0: temperature (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1318 "Current sensor string 0: power (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1319 "Current sensor string 0: coulomb counting (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1320 "Current sensor string 0: energy counting (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1569 "Current sensor string 1: current (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1570 "Current sensor string 1: voltage 1 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1571 "Current sensor string 1: voltage 2 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1572 "Current sensor string 1: voltage 3 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1573 "Current sensor string 1: temperature (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1574 "Current sensor string 1: power (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1575 "Current sensor string 1: coulomb counting (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1576 "Current sensor string 1: energy counting (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1825 "Current sensor string 2: current (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1826 "Current sensor string 2: voltage 1 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1827 "Current sensor string 2: voltage 2 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1828 "Current sensor string 2: voltage 3 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1829 "Current sensor string 2: temperature (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1830 "Current sensor string 2: power (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1831 "Current sensor string 2: coulomb counting (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 1832 "Current sensor string 2: energy counting (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor)"; +CM_ BO_ 409 "(in:can.c:CAN_TransmitBootMessage)"; CM_ SG_ 409 foxBMS_uniqueId "Content of Device Identification Register (DEVID)"; BA_DEF_ "BusType" STRING ; @@ -1569,8 +1577,8 @@ BA_ "GenSigStartValue" SG_ 640 foxBMS_String2_current 0; BA_ "GenSigStartValue" SG_ 640 foxBMS_String2_voltage 0; BA_ "GenSigStartValue" SG_ 640 foxBMS_String2_power 0; BA_ "GenSigStartValue" SG_ 643 String0_energyCount 0; -BA_ "GenSigStartValue" SG_ 643 String1_energyCount1 0; -BA_ "GenSigStartValue" SG_ 643 String1_energyCount2 0; +BA_ "GenSigStartValue" SG_ 643 String1_energyCount 0; +BA_ "GenSigStartValue" SG_ 643 String2_energyCount 0; BA_ "GenSigStartValue" SG_ 549 foxBMS_packSoc 0; BA_ "GenSigStartValue" SG_ 549 foxBMS_packSoe 0; BA_ "GenSigStartValue" SG_ 549 foxBMS_packEnergy 0; @@ -2605,13 +2613,13 @@ BA_ "GenSigStartValue" SG_ 1315 IVT0_Result_U2_channelMeasError 0; BA_ "GenSigStartValue" SG_ 1315 IVT0_ID_Result_U2 2; BA_ "GenSigStartValue" SG_ 1315 IVT0_MsgCount_Result_U2 0; BA_ "GenSigStartValue" SG_ 1315 IVT0_Result_U2_mV 0; -BA_ "GenSigStartValue" SG_ 1316 IVT_Result_U3_systemError 0; -BA_ "GenSigStartValue" SG_ 1316 IVT_Result_U3_OCS 0; -BA_ "GenSigStartValue" SG_ 1316 IVT_Result_U3_overallMeasError 0; -BA_ "GenSigStartValue" SG_ 1316 IVT_Result_U3_channelMeasError 0; -BA_ "GenSigStartValue" SG_ 1316 IVT_ID_Result_U3 3; -BA_ "GenSigStartValue" SG_ 1316 IVT_MsgCount_Result_U3 0; -BA_ "GenSigStartValue" SG_ 1316 IVT_Result_U3_mV 0; +BA_ "GenSigStartValue" SG_ 1316 IVT0_Result_U3_systemError 0; +BA_ "GenSigStartValue" SG_ 1316 IVT0_Result_U3_OCS 0; +BA_ "GenSigStartValue" SG_ 1316 IVT0_Result_U3_overallMeasError 0; +BA_ "GenSigStartValue" SG_ 1316 IVT0_Result_U3_channelMeasError 0; +BA_ "GenSigStartValue" SG_ 1316 IVT0_ID_Result_U3 3; +BA_ "GenSigStartValue" SG_ 1316 IVT0_MsgCount_Result_U3 0; +BA_ "GenSigStartValue" SG_ 1316 IVT0_Result_U3_mV 0; BA_ "GenSigStartValue" SG_ 1317 IVT0_Result_T_systemError 0; BA_ "GenSigStartValue" SG_ 1317 IVT0_Result_T_OCS 0; BA_ "GenSigStartValue" SG_ 1317 IVT0_Result_T_overallMeasError 0; @@ -2661,13 +2669,13 @@ BA_ "GenSigStartValue" SG_ 1571 IVT1_Result_U2_channelMeasError 0; BA_ "GenSigStartValue" SG_ 1571 IVT1_ID_Result_U2 2; BA_ "GenSigStartValue" SG_ 1571 IVT1_MsgCount_Result_U2 0; BA_ "GenSigStartValue" SG_ 1571 IVT1_Result_U2_mV 0; -BA_ "GenSigStartValue" SG_ 1572 IVT_Result_U3_systemError 0; -BA_ "GenSigStartValue" SG_ 1572 IVT_Result_U3_OCS 0; -BA_ "GenSigStartValue" SG_ 1572 IVT_Result_U3_overallMeasError 0; -BA_ "GenSigStartValue" SG_ 1572 IVT_Result_U3_channelMeasError 0; -BA_ "GenSigStartValue" SG_ 1572 IVT_ID_Result_U3 3; -BA_ "GenSigStartValue" SG_ 1572 IVT_MsgCount_Result_U3 0; -BA_ "GenSigStartValue" SG_ 1572 IVT_Result_U3_mV 0; +BA_ "GenSigStartValue" SG_ 1572 IVT1_Result_U3_systemError 0; +BA_ "GenSigStartValue" SG_ 1572 IVT1_Result_U3_OCS 0; +BA_ "GenSigStartValue" SG_ 1572 IVT1_Result_U3_overallMeasError 0; +BA_ "GenSigStartValue" SG_ 1572 IVT1_Result_U3_channelMeasError 0; +BA_ "GenSigStartValue" SG_ 1572 IVT1_ID_Result_U3 3; +BA_ "GenSigStartValue" SG_ 1572 IVT1_MsgCount_Result_U3 0; +BA_ "GenSigStartValue" SG_ 1572 IVT1_Result_U3_mV 0; BA_ "GenSigStartValue" SG_ 1573 IVT1_Result_T_systemError 0; BA_ "GenSigStartValue" SG_ 1573 IVT1_Result_T_OCS 0; BA_ "GenSigStartValue" SG_ 1573 IVT1_Result_T_overallMeasError 0; @@ -2717,13 +2725,13 @@ BA_ "GenSigStartValue" SG_ 1827 IVT2_Result_U2_channelMeasError 0; BA_ "GenSigStartValue" SG_ 1827 IVT2_ID_Result_U2 2; BA_ "GenSigStartValue" SG_ 1827 IVT2_MsgCount_Result_U2 0; BA_ "GenSigStartValue" SG_ 1827 IVT2_Result_U2_mV 0; -BA_ "GenSigStartValue" SG_ 1828 IVT_Result_U3_systemError 0; -BA_ "GenSigStartValue" SG_ 1828 IVT_Result_U3_OCS 0; -BA_ "GenSigStartValue" SG_ 1828 IVT_Result_U3_overallMeasError 0; -BA_ "GenSigStartValue" SG_ 1828 IVT_Result_U3_channelMeasError 0; -BA_ "GenSigStartValue" SG_ 1828 IVT_ID_Result_U3 3; -BA_ "GenSigStartValue" SG_ 1828 IVT_MsgCount_Result_U3 0; -BA_ "GenSigStartValue" SG_ 1828 IVT_Result_U3_mV 0; +BA_ "GenSigStartValue" SG_ 1828 IVT2_Result_U3_systemError 0; +BA_ "GenSigStartValue" SG_ 1828 IVT2_Result_U3_OCS 0; +BA_ "GenSigStartValue" SG_ 1828 IVT2_Result_U3_overallMeasError 0; +BA_ "GenSigStartValue" SG_ 1828 IVT2_Result_U3_channelMeasError 0; +BA_ "GenSigStartValue" SG_ 1828 IVT2_ID_Result_U3 3; +BA_ "GenSigStartValue" SG_ 1828 IVT2_MsgCount_Result_U3 0; +BA_ "GenSigStartValue" SG_ 1828 IVT2_Result_U3_mV 0; BA_ "GenSigStartValue" SG_ 1829 IVT2_Result_T_systemError 0; BA_ "GenSigStartValue" SG_ 1829 IVT2_Result_T_OCS 0; BA_ "GenSigStartValue" SG_ 1829 IVT2_Result_T_overallMeasError 0; @@ -2770,5 +2778,5 @@ VAL_ 545 foxBMS_StringState_Mux 0 "mux_stateString0" 1 "mux_stateString1" 2 "mux VAL_ 641 foxBMS_StringMinMaxValues_Mux 0 "mux_minMaxValuesString0" 1 "mux_minMaxValuesString1" 2 "mux_minMaxValuesString2" ; VAL_ 642 foxBMS_StringStateEstimation_Mux 0 "mux_String0_SOC_SOE" 1 "mux_String1_SOC_SOE" 2 "mux_String2_SOC_SOE" ; VAL_ 560 foxBMS_modeRequest 0 "mode_Standby" 1 "mode_Discharge" 2 "mode_Charge" ; -VAL_ 544 foxBMS_State 0 "BMS_UNINITIALIZED" 1 "BMS_INITIALIZATION" 2 "BMS_INITIALIZED" 3 "BMS_IDLE" 4 "BMS_OPENCONTACTORS" 5 "BMS_STANDBY" 6 "BMS_PRECHARGE" 7 "BMS_NORMAL" 8 "BMS_DISCHARGE" 9 "BMS_CHARGE" 10 "BMS_ERROR" 11 "BMS_UNDEFINED" ; +VAL_ 544 foxBMS_State 0 "BMS_UNINITIALIZED" 1 "BMS_INITIALIZATION" 2 "BMS_INITIALIZED" 3 "BMS_IDLE" 4 "BMS_OPEN_CONTACTORS" 5 "BMS_STANDBY" 6 "BMS_PRECHARGE" 7 "BMS_NORMAL" 8 "BMS_DISCHARGE" 9 "BMS_CHARGE" 10 "BMS_ERROR" 11 "BMS_UNDEFINED" ; diff --git a/tools/dbc/foxbms.sym b/tools/dbc/foxbms.sym index 46798d66..17390e5b 100644 --- a/tools/dbc/foxbms.sym +++ b/tools/dbc/foxbms.sym @@ -5,15 +5,18 @@ Title="foxBMS" enum modeRequest_e(0="mode_Standby", // Disconnect strings from HV bus 1="mode_Discharge", // Connect strings to HV bus to start discharge 2="mode_Charge") // Connect strings to HV bus to start charging -enum state_e(0="BMS_UNINITIALIZED", 1="BMS_INITIALIZATION", - 2="BMS_INITIALIZED", 3="BMS_IDLE", 4="BMS_OPENCONTACTORS", 5="BMS_STANDBY", - 6="BMS_PRECHARGE", 7="BMS_NORMAL", 8="BMS_DISCHARGE", 9="BMS_CHARGE", - 10="BMS_ERROR", 11="BMS_UNDEFINED") +// Possible states (i.e., values) the BMS state machine can have +enum state_e(0="BMS_UNINITIALIZED", // BMS state machine is uninitialized + 1="BMS_INITIALIZATION", // BMS state machine is currently trying to initialize + 2="BMS_INITIALIZED", // BMS state machine is initialized + 3="BMS_IDLE", // BMS state machine is idling + 4="BMS_OPEN_CONTACTORS", 5="BMS_STANDBY", 6="BMS_PRECHARGE", 7="BMS_NORMAL", + 8="BMS_DISCHARGE", 9="BMS_CHARGE", 10="BMS_ERROR", 11="BMS_UNDEFINED") {SENDRECEIVE} [foxBMS_PackValues] -ID=222h +ID=222h // (in:can_cbs_tx_system_values.c:CAN_TxPackValues) DLC=8 Var=foxBMS_packCurrent signed 46,18 -m /u:A /f:0.01 // Battery pack current Var=foxBMS_batteryVoltage unsigned 0,14 -m /u:V /f:0.1 // Battery voltage between negative and positive pole of the battery @@ -21,7 +24,7 @@ Var=foxBMS_busVoltage unsigned 14,14 -m /u:V /f:0.1 // Battery voltage between n Var=foxBMS_packPower signed 28,18 -m /u:kW /f:0.01 // Battery power [foxBMS_LimitValues] -ID=224h +ID=224h // (in:can_cbs_tx_limits.c:CAN_TxLimitValues) DLC=8 Var=foxBMS_maxChargeCurrent unsigned 12,12 -m /u:A /f:0.25 // Maximum battery pack charge current Var=foxBMS_maxDischargeCurrent unsigned 0,12 -m /u:A /f:0.25 // Maximum battery pack discharge current @@ -31,7 +34,7 @@ Var=foxBMS_maxBatteryVoltage unsigned 48,8 -m /u:V /f:4 Var=foxBMS_minBatteryVoltage unsigned 56,8 -m /u:V /f:4 [foxBMS_MinimumMaximumValues] -ID=223h +ID=223h // (in:can_cbs_tx_minmax.c:CAN_TxMinimumMaximumValues) DLC=8 Var=foxBMS_minimumCellVoltage unsigned 13,13 -m /u:mV // Minimum cell voltage of all connected strings, if no string connected maximum value of whole system is transmitted Var=foxBMS_maximumCellVoltage unsigned 0,13 -m /u:mV // Maximum cell voltage of all connected strings, if no string connected maximum value of whole system is transmitted @@ -41,7 +44,7 @@ Var=foxBMS_inletTemperature signed 32,8 -m /u:degC Var=foxBMS_outletTemperature signed 40,8 -m /u:degC [foxBMS_StringValues] -ID=280h // Message contains string voltage, current and power +ID=280h // Message contains string voltage, current and power (in:can_cbs_tx_system_values.c:CAN_TxStringValues) DLC=8 Mux=mux_valuesString_0 0,3 0 -m Var=foxBMS_String0_current signed 20,18 -m /u:A /f:0.01 @@ -63,7 +66,7 @@ Var=foxBMS_String2_voltage unsigned 3,17 -m /u:V /f:0.01 Var=foxBMS_String2_power signed 38,18 -m /u:kW /f:0.01 [foxBMS_StringValues2] -ID=283h // Message contains energy counting value +ID=283h // Message contains energy counting value (in:can_cbs_tx_system_values.c:CAN_TxStringValues2) DLC=8 Mux=mux_values2String_0 0,4 0 -m Var=String0_energyCount signed 8,32 -m /u:Wh // Current sensor string 0 energy counting value @@ -76,10 +79,10 @@ Var=String1_energyCount signed 8,32 -m /u:Wh // Current sensor string 1 energy c [foxBMS_StringValues2] DLC=8 Mux=mux_values2String_2 0,4 2 -m -Var=String1_energyCount signed 8,32 -m /u:Wh // Current sensor string 2 energy counting value +Var=String2_energyCount signed 8,32 -m /u:Wh // Current sensor string 2 energy counting value [foxBMS_PackStateEstimation] -ID=225h +ID=225h // (in:can_cbs_tx_state_estimation.c:CAN_TxStateEstimation) DLC=8 Var=foxBMS_packSoc unsigned 0,14 -m /u:% /f:0.01 /d:0 // SOC currently connected to HV bus (100% if all strings connected and all strings at 100%) Var=foxBMS_packSoe unsigned 14,14 -m /u:% /f:0.01 /d:0 // SOE currently connected to HV bus (100% if all strings connected and all strings at 100%) @@ -87,7 +90,7 @@ Var=foxBMS_packEnergy unsigned 40,24 -m /u:kWh /f:0.01 // Energy left in Wh that Var=foxBMS_packSoh unsigned 28,12 -m /u:% /f:0.025 [foxBMS_CellVoltage] -ID=240h +ID=240h // (in:can_cbs_tx_voltage.c:CAN_TxVoltage) DLC=8 Mux=mux_cellVoltage_000_003 0,8 0 -m Var=cellVoltage_000_invalidFlag unsigned 11,1 -m @@ -736,7 +739,7 @@ Var=cellVoltage_214 unsigned 38,13 -m /u:mV Var=cellVoltage_215 unsigned 51,13 -m /u:mV [foxBMS_CellTemperature] -ID=250h +ID=250h // (in:can_cbs_tx_temperature.c:CAN_TxCellTemperature) DLC=8 Mux=mux_cellTemperature_000_005 0,8 0 -m Var=cellTemperature_000_invalidFlag unsigned 15,1 -m @@ -1217,7 +1220,7 @@ Var=cellTemperature_178 signed 48,8 -m /u:degC Var=cellTemperature_179 signed 56,8 -m /u:degC [foxBMS_Command] -ID=230h +ID=230h // (in:can_cbs_rx_command.c:CAN_RxRequest) DLC=8 Var=foxBMS_modeRequest unsigned 6,2 -m /e:modeRequest_e // 0x0: Disconnect strings from HV bus, 0x01: Connect strings to HV bus to start discharge, 0x02: Connect strings to HV bus to start charging Var=foxBMS_activateBalancing bit 15,1 -m // 0: Deactivate balancing, 1: Activate balancing @@ -1230,7 +1233,7 @@ Var=foxBMS_heaterOverride_ON bit 6,1 // 0: no override active, 1: override activ Var=foxBMS_heaterOverride_OFF unsigned 7,1 // 0: no override active, 1: override active -> force heater off [foxBMS_State] -ID=220h // Message contains foxBMS state +ID=220h // Message contains foxBMS state (in:can_cbs_tx_state.c:CAN_TxState) DLC=8 Var=foxBMS_State unsigned 4,4 -m /e:state_e Var=BMS_nrOfConnectedStrings unsigned 0,4 -m @@ -1256,7 +1259,7 @@ Var=foxBMS_Error_PackOvercurr_Charge bit 30,1 -m // 0x00: No error, 0x01: Error Var=foxBMS_Error_PackOvercur_Dischrg bit 29,1 -m // 0x00: No error, 0x01: Error detected [foxBMS_StringState] -ID=221h // Message contains string related error and warning flags +ID=221h // Message contains string related error and warning flags (in:can_cbs_tx_state.c:CAN_TxStringState) DLC=8 Mux=mux_stateString0 4,4 0 -m Var=String0_stringConnected bit 3,1 -m // 0x00: String not connected, 0x01: String connected to HV bus @@ -1425,7 +1428,7 @@ Var=String2_Err_CS_voltage2Meas bit 47,1 Var=String2_Err_CS_voltage3Meas bit 48,1 [foxBMS_StringMinMaxValues] -ID=281h // Message contains minimum and maximum cell temperature and cell voltage values of respective string +ID=281h // Message contains minimum and maximum cell temperature and cell voltage values of respective string (in:can_cbs_tx_minmax.c:CAN_TxStringMinimumMaximumValues) DLC=8 Mux=mux_minMaxValuesString0 4,4 0 -m Var=String0_minimumCellVoltage unsigned 21,13 -m /u:mV // Minimum cell voltage in this string @@ -1450,42 +1453,42 @@ Var=String2_maximumCellTemperature signed 34,9 -m /u:degC /f:0.5 // Maximum cell Var=String2_minimumCellTemperature signed 43,9 -m /u:degC /f:0.5 // Minium cell temperature in this string [foxBMS_StringStateEstimation] -ID=282h // Message contains SOC, SOE and SOH state estimations +ID=282h // Message contains SOC, SOE and SOH state estimations (in:can_cbs_tx_state_estimation.c:CAN_TxStringStateEstimation) DLC=8 Mux=mux_String0_SOC_SOE 0,4 0 -m Var=String0_minimumSOC unsigned 4,9 -m /u:% /f:0.25 /d:0 Var=String0_averageSOC unsigned 13,9 -m /u:% /f:0.25 /max:127.5 /d:0 -Var=String0_maximumSOC unsigned 22,8 -m /u:% /f:0.25 /d:0 -Var=String0_SOE unsigned 30,9 -m /u:% /f:0.25 /max:127.5 /d:0 // SOE is depending on current direction, if battery system is charging: SOE_max is transmitted, else SOE_min -Var=String0_Energy_kWh unsigned 48,16 -m /u:kWh /f:0.01 // Remaining energy left in this string -Var=String0_SOH unsigned 39,9 -m /u:% /f:0.25 /max:127.5 +Var=String0_maximumSOC unsigned 22,9 -m /u:% /f:0.25 /max:63.75 /d:0 +Var=String0_SOE unsigned 31,9 -m /u:% /f:0.25 /max:127.5 /d:0 // SOE is depending on current direction, if battery system is charging: SOE_max is transmitted, else SOE_min +Var=String0_Energy_kWh unsigned 49,15 -m /u:kWh /f:0.01 // Remaining energy left in this string +Var=String0_SOH unsigned 40,9 -m /u:% /f:0.25 /max:127.5 [foxBMS_StringStateEstimation] DLC=8 Mux=mux_String1_SOC_SOE 0,4 1 -m Var=String1_minimumSOC unsigned 4,9 -m /u:% /f:0.25 /d:0 Var=String1_averageSOC unsigned 13,9 -m /u:% /f:0.25 /max:127.5 /d:0 -Var=String1_maximumSOC unsigned 22,8 -m /u:% /f:0.25 /d:0 -Var=String1_SOE unsigned 30,9 -m /u:% /f:0.25 /max:127.5 /d:0 // SOE is depending on current direction, if battery system is charging: SOE_max is transmitted, else SOE_min -Var=String1_Energy_kWh unsigned 48,16 -m /u:kWh /f:0.01 // Remaining energy left in this string -Var=String1_SOH unsigned 39,9 -m /u:% /f:0.25 /max:127.5 +Var=String1_maximumSOC unsigned 22,9 -m /u:% /f:0.25 /max:63.75 /d:0 +Var=String1_SOE unsigned 31,9 -m /u:% /f:0.25 /max:127.5 /d:0 // SOE is depending on current direction, if battery system is charging: SOE_max is transmitted, else SOE_min +Var=String1_Energy_kWh unsigned 49,15 -m /u:kWh /f:0.01 // Remaining energy left in this string +Var=String1_SOH unsigned 40,9 -m /u:% /f:0.25 /max:127.5 [foxBMS_StringStateEstimation] DLC=8 Mux=mux_String2_SOC_SOE 0,4 2 -m Var=String2_minimumSOC unsigned 4,9 -m /u:% /f:0.25 /d:0 Var=String2_averageSOC unsigned 13,9 -m /u:% /f:0.25 /max:127.5 /d:0 -Var=String2_maximumSOC unsigned 22,8 -m /u:% /f:0.25 /d:0 -Var=String2_SOE unsigned 30,9 -m /u:% /f:0.25 /max:127.5 /d:0 // SOE is depending on current direction, if battery system is charging: SOE_max is transmitted, else SOE_min -Var=String2_Energy_kWh unsigned 48,16 -m /u:kWh /f:0.01 // Remaining energy left in this string -Var=String2_SOH unsigned 39,9 -m /u:% /f:0.25 /max:127.5 +Var=String2_maximumSOC unsigned 22,9 -m /u:% /f:0.25 /max:63.75 /d:0 +Var=String2_SOE unsigned 31,9 -m /u:% /f:0.25 /max:127.5 /d:0 // SOE is depending on current direction, if battery system is charging: SOE_max is transmitted, else SOE_min +Var=String2_Energy_kWh unsigned 49,15 -m /u:kWh /f:0.01 // Remaining energy left in this string +Var=String2_SOH unsigned 40,9 -m /u:% /f:0.25 /max:127.5 [foxBMS_Debug] -ID=200h // Reserved - for debug/development purpose only +ID=200h // Reserved - for debug/development purpose only (in:can_cbs_rx_misc.c:CAN_RxDebug) DLC=8 [IVT0_Msg_Result_I] -ID=521h // Current sensor string 0: current +ID=521h // Current sensor string 0: current (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT0_Result_I_systemError bit 8,1 -m Var=IVT0_Result_I_OCS bit 11,1 -m @@ -1496,7 +1499,7 @@ Var=IVT0_MsgCount_Result_I unsigned 12,4 -m Var=IVT0_Result_I_mA signed 16,32 -m /u:mA [IVT0_Msg_Result_U1] -ID=522h // Current sensor string 0: voltage 1 +ID=522h // Current sensor string 0: voltage 1 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT0_Result_U1_systemError bit 8,1 -m Var=IVT0_Result_U1_overallMeasError bit 9,1 -m @@ -1507,7 +1510,7 @@ Var=IVT0_MsgCount_Result_U1 unsigned 12,4 -m Var=IVT0_Result_U1_mV signed 16,32 -m /u:mV [IVT0_Msg_Result_U2] -ID=523h // Current sensor string 0: voltage 2 +ID=523h // Current sensor string 0: voltage 2 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT0_Result_U2_systemError bit 8,1 -m Var=IVT0_Result_U2_OCS bit 11,1 -m @@ -1518,18 +1521,18 @@ Var=IVT0_MsgCount_Result_U2 unsigned 12,4 -m Var=IVT0_Result_U2_mV signed 16,32 -m /u:mV [IVT0_Msg_Result_U3] -ID=524h // Current sensor string 0: voltage 3 +ID=524h // Current sensor string 0: voltage 3 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 -Var=IVT_Result_U3_systemError bit 8,1 -m -Var=IVT_Result_U3_OCS bit 11,1 -m -Var=IVT_Result_U3_overallMeasError bit 9,1 -m -Var=IVT_Result_U3_channelMeasError bit 10,1 -m -Var=IVT_ID_Result_U3 unsigned 0,8 -m /min:3 /max:3 /d:3 -Var=IVT_MsgCount_Result_U3 unsigned 12,4 -m -Var=IVT_Result_U3_mV signed 16,32 -m /u:mV +Var=IVT0_Result_U3_systemError bit 8,1 -m +Var=IVT0_Result_U3_OCS bit 11,1 -m +Var=IVT0_Result_U3_overallMeasError bit 9,1 -m +Var=IVT0_Result_U3_channelMeasError bit 10,1 -m +Var=IVT0_ID_Result_U3 unsigned 0,8 -m /min:3 /max:3 /d:3 +Var=IVT0_MsgCount_Result_U3 unsigned 12,4 -m +Var=IVT0_Result_U3_mV signed 16,32 -m /u:mV [IVT0_Msg_Result_T] -ID=525h // Current sensor string 0: temperature +ID=525h // Current sensor string 0: temperature (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT0_Result_T_systemError bit 8,1 -m Var=IVT0_Result_T_OCS bit 11,1 -m @@ -1540,7 +1543,7 @@ Var=IVT0_MsgCount_Result_T unsigned 12,4 -m Var=IVT0_Result_T_ddegC signed 16,32 -m /u:ddegC /f:0.1 /d:0 [IVT0_Msg_Result_W] -ID=526h // Current sensor string 0: power +ID=526h // Current sensor string 0: power (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT0_Result_W_systemError bit 8,1 -m Var=IVT0_Result_W_OCS bit 11,1 -m @@ -1551,7 +1554,7 @@ Var=IVT0_MsgCount_Result_W unsigned 12,4 -m Var=IVT0_ID_Result_W unsigned 0,8 -m /min:5 /max:5 /d:5 [IVT0_Msg_Result_As] -ID=527h // Current sensor string 0: coulomb counting +ID=527h // Current sensor string 0: coulomb counting (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT0_Result_As_systemError bit 8,1 -m Var=IVT0_Result_As_OCS bit 11,1 -m @@ -1562,7 +1565,7 @@ Var=IVT0_MsgCount_Result_As unsigned 12,4 -m Var=IVT0_ID_Result_As unsigned 0,8 -m /min:6 /max:6 /d:6 [IVT0_Msg_Result_Wh] -ID=528h // Current sensor string 0: energy counting +ID=528h // Current sensor string 0: energy counting (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT0_Result_Wh_systemError bit 8,1 -m Var=IVT0_Result_Wh_OCS bit 11,1 -m @@ -1573,7 +1576,7 @@ Var=IVT0_MsgCount_Result_Wh unsigned 12,4 -m Var=IVT0_ID_Result_Wh unsigned 0,8 -m /min:7 /max:7 /d:7 [IVT1_Msg_Result_I] -ID=621h // Current sensor string 1: current +ID=621h // Current sensor string 1: current (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT1_Result_I_systemError bit 8,1 -m Var=IVT1_Result_I_OCS bit 11,1 -m @@ -1584,7 +1587,7 @@ Var=IVT1_MsgCount_Result_I unsigned 12,4 -m Var=IVT1_Result_I_mA signed 16,32 -m /u:mA [IVT1_Msg_Result_U1] -ID=622h // Current sensor string 1: voltage 1 +ID=622h // Current sensor string 1: voltage 1 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT1_Result_U1_systemError bit 8,1 -m Var=IVT1_Result_U1_overallMeasError bit 9,1 -m @@ -1595,7 +1598,7 @@ Var=IVT1_MsgCount_Result_U1 unsigned 12,4 -m Var=IVT1_Result_U1_mV signed 16,32 -m /u:mV [IVT1_Msg_Result_U2] -ID=623h // Current sensor string 1: voltage 2 +ID=623h // Current sensor string 1: voltage 2 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT1_Result_U2_systemError bit 8,1 -m Var=IVT1_Result_U2_OCS bit 11,1 -m @@ -1606,18 +1609,18 @@ Var=IVT1_MsgCount_Result_U2 unsigned 12,4 -m Var=IVT1_Result_U2_mV signed 16,32 -m /u:mV [IVT1_Msg_Result_U3] -ID=624h // Current sensor string 1: voltage 3 +ID=624h // Current sensor string 1: voltage 3 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 -Var=IVT_Result_U3_systemError bit 8,1 -m -Var=IVT_Result_U3_OCS bit 11,1 -m -Var=IVT_Result_U3_overallMeasError bit 9,1 -m -Var=IVT_Result_U3_channelMeasError bit 10,1 -m -Var=IVT_ID_Result_U3 unsigned 0,8 -m /min:3 /max:3 /d:3 -Var=IVT_MsgCount_Result_U3 unsigned 12,4 -m -Var=IVT_Result_U3_mV signed 16,32 -m /u:mV +Var=IVT1_Result_U3_systemError bit 8,1 -m +Var=IVT1_Result_U3_OCS bit 11,1 -m +Var=IVT1_Result_U3_overallMeasError bit 9,1 -m +Var=IVT1_Result_U3_channelMeasError bit 10,1 -m +Var=IVT1_ID_Result_U3 unsigned 0,8 -m /min:3 /max:3 /d:3 +Var=IVT1_MsgCount_Result_U3 unsigned 12,4 -m +Var=IVT1_Result_U3_mV signed 16,32 -m /u:mV [IVT1_Msg_Result_T] -ID=625h // Current sensor string 1: temperature +ID=625h // Current sensor string 1: temperature (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT1_Result_T_systemError bit 8,1 -m Var=IVT1_Result_T_OCS bit 11,1 -m @@ -1628,7 +1631,7 @@ Var=IVT1_MsgCount_Result_T unsigned 12,4 -m Var=IVT1_Result_T_ddegC signed 16,32 -m /u:ddegC /f:0.1 /d:0 [IVT1_Msg_Result_W] -ID=626h // Current sensor string 1: power +ID=626h // Current sensor string 1: power (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT1_Result_W_systemError bit 8,1 -m Var=IVT1_Result_W_OCS bit 11,1 -m @@ -1639,7 +1642,7 @@ Var=IVT1_MsgCount_Result_W unsigned 12,4 -m Var=IVT1_ID_Result_W unsigned 0,8 -m /min:5 /max:5 /d:5 [IVT1_Msg_Result_As] -ID=627h // Current sensor string 1: coulomb counting +ID=627h // Current sensor string 1: coulomb counting (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT1_Result_As_systemError bit 8,1 -m Var=IVT1_Result_As_OCS bit 11,1 -m @@ -1650,7 +1653,7 @@ Var=IVT1_MsgCount_Result_As unsigned 12,4 -m Var=IVT1_ID_Result_As unsigned 0,8 -m /min:6 /max:6 /d:6 [IVT1_Msg_Result_Wh] -ID=628h // Current sensor string 1: energy counting +ID=628h // Current sensor string 1: energy counting (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT1_Result_Wh_systemError bit 8,1 -m Var=IVT1_Result_Wh_OCS bit 11,1 -m @@ -1661,7 +1664,7 @@ Var=IVT1_MsgCount_Result_Wh unsigned 12,4 -m Var=IVT1_ID_Result_Wh unsigned 0,8 -m /min:7 /max:7 /d:7 [IVT2_Msg_Result_I] -ID=721h // Current sensor string 2: current +ID=721h // Current sensor string 2: current (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT2_Result_I_systemError bit 8,1 -m Var=IVT2_Result_I_OCS bit 11,1 -m @@ -1672,7 +1675,7 @@ Var=IVT2_MsgCount_Result_I unsigned 12,4 -m Var=IVT2_Result_I_mA signed 16,32 -m /u:mA [IVT2_Msg_Result_U1] -ID=722h // Current sensor string 2: voltage 1 +ID=722h // Current sensor string 2: voltage 1 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT2_Result_U1_systemError bit 8,1 -m Var=IVT2_Result_U1_overallMeasError bit 9,1 -m @@ -1683,7 +1686,7 @@ Var=IVT2_MsgCount_Result_U1 unsigned 12,4 -m Var=IVT2_Result_U1_mV signed 16,32 -m /u:mV [IVT2_Msg_Result_U2] -ID=723h // Current sensor string 2: voltage 2 +ID=723h // Current sensor string 2: voltage 2 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT2_Result_U2_systemError bit 8,1 -m Var=IVT2_Result_U2_OCS bit 11,1 -m @@ -1694,18 +1697,18 @@ Var=IVT2_MsgCount_Result_U2 unsigned 12,4 -m Var=IVT2_Result_U2_mV signed 16,32 -m /u:mV [IVT2_Msg_Result_U3] -ID=724h // Current sensor string 2: voltage 3 +ID=724h // Current sensor string 2: voltage 3 (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 -Var=IVT_Result_U3_systemError bit 8,1 -m -Var=IVT_Result_U3_OCS bit 11,1 -m -Var=IVT_Result_U3_overallMeasError bit 9,1 -m -Var=IVT_Result_U3_channelMeasError bit 10,1 -m -Var=IVT_ID_Result_U3 unsigned 0,8 -m /min:3 /max:3 /d:3 -Var=IVT_MsgCount_Result_U3 unsigned 12,4 -m -Var=IVT_Result_U3_mV signed 16,32 -m /u:mV +Var=IVT2_Result_U3_systemError bit 8,1 -m +Var=IVT2_Result_U3_OCS bit 11,1 -m +Var=IVT2_Result_U3_overallMeasError bit 9,1 -m +Var=IVT2_Result_U3_channelMeasError bit 10,1 -m +Var=IVT2_ID_Result_U3 unsigned 0,8 -m /min:3 /max:3 /d:3 +Var=IVT2_MsgCount_Result_U3 unsigned 12,4 -m +Var=IVT2_Result_U3_mV signed 16,32 -m /u:mV [IVT2_Msg_Result_T] -ID=725h // Current sensor string 2: temperature +ID=725h // Current sensor string 2: temperature (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT2_Result_T_systemError bit 8,1 -m Var=IVT2_Result_T_OCS bit 11,1 -m @@ -1716,7 +1719,7 @@ Var=IVT2_MsgCount_Result_T unsigned 12,4 -m Var=IVT2_Result_T_ddegC signed 16,32 -m /u:ddegC /f:0.1 /d:0 [IVT2_Msg_Result_W] -ID=726h // Current sensor string 2: power +ID=726h // Current sensor string 2: power (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT2_Result_W_systemError bit 8,1 -m Var=IVT2_Result_W_OCS bit 11,1 -m @@ -1727,7 +1730,7 @@ Var=IVT2_MsgCount_Result_W unsigned 12,4 -m Var=IVT2_ID_Result_W unsigned 0,8 -m /min:5 /max:5 /d:5 [IVT2_Msg_Result_As] -ID=727h // Current sensor string 2: coulomb counting +ID=727h // Current sensor string 2: coulomb counting (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT2_Result_As_systemError bit 8,1 -m Var=IVT2_Result_As_OCS bit 11,1 -m @@ -1738,7 +1741,7 @@ Var=IVT2_MsgCount_Result_As unsigned 12,4 -m Var=IVT2_ID_Result_As unsigned 0,8 -m /min:6 /max:6 /d:6 [IVT2_Msg_Result_Wh] -ID=728h // Current sensor string 2: energy counting +ID=728h // Current sensor string 2: energy counting (in:can_cbs_rx_current_sensor.c:CAN_RxCurrentSensor) DLC=6 Var=IVT2_Result_Wh_systemError bit 8,1 -m Var=IVT2_Result_Wh_OCS bit 11,1 -m @@ -1749,7 +1752,7 @@ Var=IVT2_MsgCount_Result_Wh unsigned 12,4 -m Var=IVT2_ID_Result_Wh unsigned 0,8 -m /min:7 /max:7 /d:7 [foxBMS_Startup] -ID=199h +ID=199h // (in:can.c:CAN_TransmitBootMessage) DLC=8 Var=foxBMS_majorVersionNumber unsigned 0,8 -m Var=foxBMS_minorVersionNumber unsigned 8,8 -m diff --git a/tools/gui/fgui/__init__.py b/tools/gui/fgui/__init__.py index 4814faf8..a8c56b99 100644 --- a/tools/gui/fgui/__init__.py +++ b/tools/gui/fgui/__init__.py @@ -40,7 +40,7 @@ """sets the version package etc.""" -__version__ = "1.1.0" +__version__ = "1.1.1" __appname__ = "foxBMS 2" __author__ = "The foxBMS Team" __copyright__ = "(c) 2010 - 2021 foxBMS" diff --git a/tools/ide/vscode/cspell.json.jinja2 b/tools/ide/vscode/cspell.json.jinja2 index eb6ef641..212d16fc 100644 --- a/tools/ide/vscode/cspell.json.jinja2 +++ b/tools/ide/vscode/cspell.json.jinja2 @@ -24,6 +24,7 @@ "overvoltage", "parens", "phosphane", + "precharged", "prepending", "recurse", "readmes", @@ -343,6 +344,8 @@ "epcos", "vishay", "ntcalug", // temperature sensor form vishay + // Axivion + "axivion", "preinc", "dashserver", "localbuild", @@ -588,6 +591,10 @@ "src/app/driver/sbc/fs8x_driver/**", "src/app/driver/mic/ltc/common/ltc_pec.*", "src/os/**", + "tests/axivion/*.preinc", + "tests/axivion/ci_config.json", + "tools/dbc/*.dbc", + "tools/dbc/*.sym", "tools/debugger/lauterbach/*.in", "tools/debugger/ozone/*.jdebug.*", // waf diff --git a/tools/utils/cmd/find_vs-code.bat b/tools/utils/cmd/find_vs-code.bat new file mode 100644 index 00000000..323f8844 --- /dev/null +++ b/tools/utils/cmd/find_vs-code.bat @@ -0,0 +1,86 @@ +@REM Copyright (c) 2010 - 2021, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. +@REM All rights reserved. +@REM +@REM SPDX-License-Identifier: BSD-3-Clause +@REM +@REM Redistribution and use in source and binary forms, with or without +@REM modification, are permitted provided that the following conditions are met: +@REM +@REM 1. Redistributions of source code must retain the above copyright notice, this +@REM list of conditions and the following disclaimer. +@REM +@REM 2. Redistributions in binary form must reproduce the above copyright notice, +@REM this list of conditions and the following disclaimer in the documentation +@REM and/or other materials provided with the distribution. +@REM +@REM 3. Neither the name of the copyright holder nor the names of its +@REM contributors may be used to endorse or promote products derived from +@REM this software without specific prior written permission. +@REM +@REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +@REM AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +@REM IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +@REM DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +@REM FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +@REM DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +@REM SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +@REM CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +@REM OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +@REM OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +@REM +@REM We kindly request you to use one or more of the following phrases to refer to +@REM foxBMS in your hardware, software, documentation or advertising materials: +@REM +@REM - "This product uses parts of foxBMS®" +@REM - "This product includes parts of foxBMS®" +@REM - "This product is derived from foxBMS®" + +@SETLOCAL EnableDelayedExpansion +@SET VS_CODE= + +@where /q code +@IF %ERRORLEVEL% GEQ 1 ( + @SET NO_VS_CODE=1 +) ELSE ( + @SET VS_CODE_CMD=code + @SET NO_VS_CODE=0 +) + +@REM reset errorlevel +@cd 2>&1 > nul + +@REM Search in user instllation directory first +@IF %NO_VS_CODE% GEQ 1 ( + @pushd "%LOCALAPPDATA%\Programs\Microsoft VS Code\bin" + @IF !ERRORLEVEL! EQU 0 ( + @where /q code + @IF %ERRORLEVEL% GEQ 1 ( + @SET NO_VS_CODE=1 + @SET VS_CODE_CMD= + ) ELSE ( + @SET VS_CODE_CMD="%LOCALAPPDATA%\Programs\Microsoft VS Code\bin\code.cmd" + @SET NO_VS_CODE=0 + ) + ) +) + +@REM reset errorlevel +@cd 2>&1 > nul + +@IF %NO_VS_CODE% GEQ 1 ( + @pushd "%PROGRAMFILES%\Microsoft VS Code\bin" + @IF !ERRORLEVEL! EQU 0 ( + @where /q code + @IF %ERRORLEVEL% GEQ 1 ( + @SET NO_VS_CODE=1 + @SET VS_CODE_CMD= + ) ELSE ( + @SET VS_CODE_CMD="%PROGRAMFILES%\Microsoft VS Code\bin\code.cmd" + @SET NO_VS_CODE=0 + ) + ) +) + +@ENDLOCAL & ( + @SET "VS_CODE=%VS_CODE_CMD%" +) diff --git a/wscript b/wscript index dc435ae0..38b9d077 100644 --- a/wscript +++ b/wscript @@ -86,7 +86,7 @@ top = "." # pylint:disable=invalid-name APPNAME = "foxBMS" """name of the application. This is used in various waf functions""" -VERSION = "1.1.0" +VERSION = "1.1.1" """version of the application. This is used in various waf functions. This version must match the version number defined in ``macros.txt``. Otherwise a configuration error is thrown."""