last commit before gitea mirror
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -2,3 +2,6 @@
|
|||||||
path = cm_pid_regulator
|
path = cm_pid_regulator
|
||||||
url = https://OZ1CM@bitbucket.org/oz1cm/cm_pid_regulator.git
|
url = https://OZ1CM@bitbucket.org/oz1cm/cm_pid_regulator.git
|
||||||
branch = master
|
branch = master
|
||||||
|
[submodule "cm_mppt_regulator"]
|
||||||
|
path = cm_mppt_regulator
|
||||||
|
url = https://OZ1CM@bitbucket.org/oz1cm/cm_mppt_regulator.git
|
||||||
|
|||||||
@@ -23,10 +23,10 @@
|
|||||||
|
|
||||||
|
|
||||||
// Load
|
// Load
|
||||||
#define R_LOAD 10 // Ohm
|
#define R_LOAD 10.0 // Ohm
|
||||||
|
|
||||||
// Simulation parameters
|
// Simulation parameters
|
||||||
#define SIMULATION_TIME 0.6 // Seconds
|
#define SIMULATION_TIME 2.6 // Seconds
|
||||||
|
|
||||||
|
|
||||||
// Plot specific
|
// Plot specific
|
||||||
|
|||||||
1
cm_mppt_regulator
Submodule
1
cm_mppt_regulator
Submodule
Submodule cm_mppt_regulator added at f78220273e
25
main.c
25
main.c
@@ -7,12 +7,15 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "buck_specs.h"
|
#include "buck_specs.h"
|
||||||
#include "buck_emulator.h"
|
#include "buck_emulator.h"
|
||||||
#include "cm_pid_regulator/cm_pid_regulator.h"
|
|
||||||
#include "file_print.h"
|
#include "file_print.h"
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
#include "cm_pid_regulator/cm_pid_regulator.h"
|
||||||
|
#include "cm_mppt_regulator/cm_mppt_regulator.h"
|
||||||
|
|
||||||
|
|
||||||
BuckEmulator_t buck_converter;
|
BuckEmulator_t buck_converter;
|
||||||
cm_pid_regulator_float_t Voltreg;
|
cm_pid_regulator_float_t Voltreg;
|
||||||
|
cm_mppt_regulator_t mppt_reg;
|
||||||
|
|
||||||
float kp = 0.00550;
|
float kp = 0.00550;
|
||||||
float ki = 1.0;
|
float ki = 1.0;
|
||||||
@@ -32,6 +35,21 @@ float pid_regulator(float Vout){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float mppt_regulator(float Vout){
|
||||||
|
|
||||||
|
static uint32_t run_ctr = 0;
|
||||||
|
static float duty = 0.0;
|
||||||
|
|
||||||
|
if((run_ctr++ % 10) != 0)return duty;
|
||||||
|
|
||||||
|
duty = (float)cm_mppt_regulator_Compute(&mppt_reg, Vout*1000.0, (Vout*1000.0)/R_LOAD, 200.0) / 65535.0;
|
||||||
|
|
||||||
|
printf("duty: %f \r\n",duty);
|
||||||
|
|
||||||
|
return duty;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int printResult(float duty, float Vout, float time){
|
int printResult(float duty, float Vout, float time){
|
||||||
|
|
||||||
showProcentInCmd(time, SIMULATION_TIME);
|
showProcentInCmd(time, SIMULATION_TIME);
|
||||||
@@ -45,10 +63,11 @@ int main(void){
|
|||||||
buck_emulator_init(&buck_converter,
|
buck_emulator_init(&buck_converter,
|
||||||
VIN,L_INDUCTOR,C_CAPACITOR,R_LOAD,SAMPLE_TIME, SIMULATION_TIME);
|
VIN,L_INDUCTOR,C_CAPACITOR,R_LOAD,SAMPLE_TIME, SIMULATION_TIME);
|
||||||
|
|
||||||
buck_emulator_RegRegulationEvt(&buck_converter,(regulate_evt_t)pid_regulator);
|
buck_emulator_RegRegulationEvt(&buck_converter,(regulate_evt_t)mppt_regulator);
|
||||||
buck_emulator_RegGetResultEvt(&buck_converter,(getResult_evt_t)printResult);
|
buck_emulator_RegGetResultEvt(&buck_converter,(getResult_evt_t)printResult);
|
||||||
|
|
||||||
cm_PIDRegulatorf_Init(&Voltreg, kp, ki, kd, 0.0, 1.0);
|
//cm_PIDRegulatorf_Init(&Voltreg, kp, ki, kd, 0.0, 1.0);
|
||||||
|
cm_mppt_regulator_init(&mppt_reg, (VOUT_TARGET*1000.0), 500.0);
|
||||||
|
|
||||||
cm_file_open(BUCK_OUTPUT_FILE,VOUT_TARGET);
|
cm_file_open(BUCK_OUTPUT_FILE,VOUT_TARGET);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user