Commit 4733941e authored by Jacques Labaisse's avatar Jacques Labaisse
Browse files

add possibility to change voltage reference via CAN bus

parent 541570e6
This is the OwnTech Power API Core repository.
The OwnTech Power API is modular, allowing to automatically select libraries for use with the power converter.
Using the Core repository, you can work with OwnTech Power API Libraries, which are automatically downloaded on demand.
The Power API is designed to be used with VS Code and PlatformIO.
[More information about PlatformIO on VS code](https://platformio.org/install/ide?install=vscode).
# Downloading OwnTech Power API Core
You fisrt need to clone the Core repository using the following command:
`git clone https://gitlab.laas.fr/owntech/power-api/core.git owntech_power_api`
Then, open VS Code and, if not already done, install the PlatformIO plugin.
Finall, open the newly cloned folder `owntech_power_api` using menu `File > Open Folder...`
# Working with OwnTech Power API
The hierarchy of the project is as follows:
```
owntech_power_api
└─ boards
| └─ nucleo_g474re.json
└─ src
| └─ main.cpp
| └─ owntech.ini
└─ zephyr
| └─ dts
| └─ modules
| └─ [...]
└─ LICENSE
└─ [...]
```
You will want to work in the `src` folder, other folders and files are used to configure the underlying Zephyr OS.
Power users may want to tweak them too. Is so, please checkout the [Zephyr documentation](https://docs.zephyrproject.org/latest/).
In the `src` folder, the file `main.cpp` is the entry point of the application.
The file `owntech.ini` is used to configure the Power API Libraries you want to use.
# Working with OwnTech Power API Libraries
To enable a Power API Library, edit the `src/owntech.ini` file.
In this file, you'll find various commented libraries references.
Simply uncomment a line to enable the corresponding library.
This branch gives a first solution to drive the reference voltage via a computer
by transmitting the desired reference on the CAN bus.
\ No newline at end of file
......@@ -28,8 +28,22 @@
* @author Clément Foucher <clement.foucher@laas.fr>
*/
#include <stdio.h>
#include "opalib_pid_voltage.h"
#include "opalib_quick_start.h"
float32_t v_ref = 10.0F;
void main(void)
{
opalib_quick_start_set_hardware_version(v_1_1_2);
opalib_quick_start_init_voltage(opalib_pid_voltage_calculation_and_pwm_update, 50);
opalib_pid_voltage_init_buck(v_ref, 0.000215, 2.86, 0, 50);
opalib_quick_start_launch_task();
printf("Go\n");
}
......@@ -7,6 +7,6 @@
[env]
lib_deps=
# quick_start=https://gitlab.laas.fr/owntech/power-api/opalib-quick-start.git
# pid_voltage=https://gitlab.laas.fr/owntech/power-api/opalib-pid.git
quick_start=https://gitlab.laas.fr/owntech/power-api/opalib-quick-start.git
pid_voltage=https://gitlab.laas.fr/owntech/power-api/opalib-pid.git
# pid_current=https://gitlab.laas.fr/owntech/power-api/opalib-pid-current-mode.git
......@@ -252,6 +252,7 @@ void can_pubsub_thread()
int status = ts.bin_sub(buf, 5 + rx_frame.dlc, TS_WRITE_MASK, PUBSUB_CTRL);
if (status == TS_STATUS_CHANGED) {
}
}
......
......@@ -35,15 +35,17 @@ uint32_t flash_size = LL_GetFlashSize();
uint32_t flash_page_size = FLASH_PAGE_SIZE;
char device_id[9]="owntech";
float32_t v1low_out = 0;
float32_t v1low_out = 1;
float32_t i1low_out = 0;
float32_t v2low_out = 0;
float32_t v2low_out = 1;
float32_t i2low_out = 0;
float32_t vhigh_out = 0;
float32_t ihigh_out = 0;
extern float32_t v_ref;
static float32_t load_dim = 1.0;
bool loadEnable = true;
......@@ -194,6 +196,15 @@ static DataNode data_nodes[] = {
TS_NODE_FLOAT(0x8002, "loadDim_pct", &load_dim, 2 ,
ID_OUTPUT, TS_ANY_RW, PUB_SER | PUBSUB_CTRL),
/*{
"title": {
"en": "Voltage reference"
},
"unit": "V"
}*/
TS_NODE_FLOAT(0x8003, "voltage_reference", &v_ref, 2 ,
ID_OUTPUT, TS_ANY_RW, PUB_SER | PUBSUB_CTRL),
// PUBLICATION DATA ///////////////////////////////////////////////////////
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment