generated from jsphuebner/stm32-template
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fe97f8
commit 0aec57f
Showing
17 changed files
with
858 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* This file is part of the tumanako_vc project. | ||
* | ||
* Copyright (C) 2018 Johannes Huebner <dev@johanneshuebner.com> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef BMSALGO_H | ||
#define BMSALGO_H | ||
|
||
#include <stdint.h> | ||
|
||
class BmsAlgo | ||
{ | ||
public: | ||
static float EstimateSocFromVoltage(float lowestVoltage); | ||
static float CalculateSocFromIntegration(float lastSoc, float asDiff); | ||
static float GetChargeCurrent(float soc); | ||
static float LimitMaximumCellVoltage(float maxVoltage); | ||
static float LimitMinumumCellVoltage(float minVoltage); | ||
static void SetNominalCapacity(float c) { nominalCapacity = c; } | ||
|
||
private: | ||
static float nominalCapacity; | ||
static uint16_t voltageToSoc[11]; | ||
static uint16_t socToChargeCurrent[11]; | ||
}; | ||
|
||
#endif // BMSALGO_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* This file is part of the FlyingAdcBms project. | ||
* | ||
* Copyright (C) 2023 Johannes Huebner <openinverter.org> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef BMSFSM_H | ||
#define BMSFSM_H | ||
#include "canmap.h" | ||
#include "canhardware.h" | ||
#include "params.h" | ||
|
||
class BmsFsm: public CanCallback | ||
{ | ||
public: | ||
enum bmsstate { BOOT, GET_ADDR, SET_ADDR, INIT, RUN, RUNBALANCE }; | ||
|
||
BmsFsm(CanMap* cm); | ||
bmsstate Run(bmsstate currentState); | ||
int GetNumberOfModules() { return numModules; } | ||
Param::PARAM_NUM GetDataItem(Param::PARAM_NUM baseItem, int modNum = -1); | ||
bool HandleRx(uint32_t canId, uint32_t data[2]); | ||
void HandleClear(); | ||
bool IsFirst(); | ||
|
||
private: | ||
void MapCanSubmodule(); | ||
void MapCanMainmodule(); | ||
|
||
CanMap *canMap; | ||
bool recvBoot; | ||
bool isMain; | ||
uint8_t recvAddr; | ||
uint8_t ourAddr; | ||
uint8_t numModules; | ||
uint32_t cycles; | ||
}; | ||
|
||
#endif // BMSFSM_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.