main.cpp 2.56 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Copyright (c) 2021 LAAS-CNRS
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published by
 *   the Free Software Foundation, either version 2.1 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 Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public License
 *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 * SPDX-License-Identifier: LGLPV2.1
 */

/**
 * @brief   This file it the main entry point of the
 *          OwnTech Power API. Please check the README.md
 *          file at the root of this project for basic
 *          information on how to use the Power API,
 *          or refer the the wiki for detailed information.
 *          Wiki: https://gitlab.laas.fr/owntech/power-api/core/-/wikis/home
 *
 * @author  Clément Foucher <clement.foucher@laas.fr>
 */

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "opalib_pid.h"
#include "opalib_quick_start.h"
//#include "data_conversion.h"

// void data_parameters_init(){

//     float32_t v1_low_gain = 0.0 ; 
//     float32_t v1_low_offset = 0.0;

//     v1_low_parameters_set(v1_low_gain, v1_low_offset);

//     float32_t v2_low_gain = 0.0; 
//     float32_t v2_low_offset = 0.0;

//     v2_low_parameters_set(v1_low_gain, v1_low_offset);

//     float32_t v_high_gain = 0.0;
//     float32_t v_high_offset = 0.0;

//     v_high_parameters_set(v1_low_gain, v1_low_offset);

//     float32_t i1_low_gain = 0.0;
//     float32_t i1_low_offset = 0.0;

//     i1_low_parameters_set(v1_low_gain, v1_low_offset);

//     float32_t i2_low_gain  = 0.0;
//     float32_t i2_low_offset = 0.0;

//     i2_low_parameters_set(v1_low_gain, v1_low_offset);

//     float32_t i_high_gain = 0.0; 
//     float32_t i_high_offset = 0.0;

//     i_high_parameters_set(v1_low_gain, v1_low_offset);

//     float32_t temp_gain = 0.0; 
//     float32_t temp_offset = 0.0;

//     temp_parameters_set(v1_low_gain, v1_low_offset);

// }
73
74
75

void main(void)
{
76
77
78
79
80
81
82
83
84
    uint32_t interruption_length = 50; // length of the interruption micro-seconds
    opalib_quick_start_init_voltage(pid_calculation_and_pwm_update, interruption_length);

    float32_t target_voltage = 12;
    float32_t kp = -0.00000235;
    float32_t ki = -0.117;
    float32_t kd = 0.0;

    pid_init_buck(target_voltage, kp, ki, kd);
85
86

}