Introduction
OwnTech Power API Library PID Current mode provides a PID control in current mode.
This library automatically configures the driver modules required for the OwnTech Power Converter to work.
How to use
Enable the library
To enable the library, just uncomment the pid_current
library in src/owntech.ini
.
Then, include the library header in main.cpp
:
Memo: the standalone PID Current library configuration is as follows:
pid_current=https://gitlab.laas.fr/owntech/power-api/opalib-pid-current-mode.git
Using OPALIB PID Current
- Add the following line to your main:
#include "opalib_pid_current_mode.h"
. - Configure the core modules, e.g. using OPALIB Quick Start's init voltage function at the beginning of your
main()
. - Initialize the pid with
opalib_pid_current_init()
- Run the PID calculation periodically with
opalib_pid_current_periodic_task()
in order to update the duty cycle in the PWM.
Example of library use in combination with Library Quick start
#include "opalib_quick_start.h"
#include "opalib_pid_current_mode.h"
void main(void)
{
opalib_pid_current_init(15, 0.077, 4653.0, 0.0);
opalib_quick_start_init_current(opalib_pid_current_periodic_task, 50);
opalib_quick_start_launch_task();
}
Library structure
$(PROJECTDIR)/src/
opalib_pid_current_mode.c
Main source fileopalib_pid_current_mode.h
List of public functions implemented in library