Skip to content

Commit

Permalink
closed loop control
Browse files Browse the repository at this point in the history
  • Loading branch information
Known4225 committed Oct 18, 2024
1 parent f837df2 commit 66cb833
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sdk/app_cpu1/user/usr/user_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

// Enable support for AMDS (Advanced Motor Drive Sensing) platform
// set to 1 for enabled, 0 for disabled
#define USER_CONFIG_ENABLE_AMDS_SUPPORT (0)
#define USER_CONFIG_ENABLE_AMDS_SUPPORT (1)

// Scheduler Interval Tolerance Override
// as of AMDC Firmware v1.3, all timing variables for tasks (runtime, loop time, etc)
Expand Down
5 changes: 5 additions & 0 deletions sdk/app_cpu1/user/usr/vsiApp/app_vsiApp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
#include "usr/vsiApp/app_vsiApp.h"
#include "usr/vsiApp/cmd/cmd_vsiApp.h"
#include "usr/vsiApp/task_vsiApp.h"
#include "drv/timing_manager.h"
#include "drv/gp3io_mux.h"

void app_vsiApp_init(void)
{
// Register "vsi" command with system
gp3io_mux_set_device(GP3IO_MUX_1_BASE_ADDR, GP3IO_MUX_DEVICE1);
// Enable data sampling for AMDS on GPIO Port 1
timing_manager_enable_sensor(AMDS_1);
cmd_vsiApp_register();

// task_vsiApp_init();
Expand Down
4 changes: 2 additions & 2 deletions sdk/app_cpu1/user/usr/vsiApp/task_vsiApp.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void task_vsiApp_callback(void *arg)
LOG_voltage_b = (duty_b - 0.5) * 20;
LOG_voltage_c = (duty_c - 0.5) * 20;

circularBuffer[circularBufferIndex] = LOG_current_a;
circularBuffer[circularBufferIndex] = LOG_current_b;
circularBufferIndex++;
if (circularBufferIndex >= CIRCULAR_BUFFER_LENGTH) {
circularBufferIndex = 0;
Expand All @@ -121,7 +121,7 @@ double calculateRMS() {
average += circularBuffer[i] * circularBuffer[i];
}
average /= CIRCULAR_BUFFER_LENGTH;
return sqrt(average);
return sqrt(average) * 2;
}

int task_vsiApp_amplitude(double amplitude) {
Expand Down
1 change: 1 addition & 0 deletions sdk/temp_xsdb_launch_script.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set xsdb_idle_timeout -1;source C:/Xilinx/SDK/2019.1/scripts/xsdb/xsdb/xsdb-server.tcl

0 comments on commit 66cb833

Please sign in to comment.