Tool/software:
Dear Sirs, I would like to ask you a question,
I am working with a Power System Stabilizer. I need to acquire transients of different variables. I am working with the TCM module, Transient Capture Module of C2000 Digital Control Library, v3.4.
I am able to acquire the transients but I am not able to obtain the values prior to the trigger condition. Once the trigger condition is given, the TCM acquires but the pretrigger values in the acquisition register are all zeros, this segment is the LEAD FRAME.
THE VALUES OF THE SIGNALS THAT I AM ACQUIRING DO NOT HAVE ZERO VALUE BEFORE THE TRIGGER CONDITION.
I would like to ask you if you have, to share, an example that correctly acquires the entire signal, before and after the trigger condition, or the proper way to parameterize the TCM.
This is my acquisition code:
extern s_log_f log_f = INI_LOG_F;
extern s_log_df log_df = INI_LOG_dF;
extern FDLOG A_Buf = FDLOG_DEFAULTS;
extern TCM tcm1 = TCM_DEFAULTS;
extern FDLOG B_Buf = FDLOG_DEFAULTS;
extern TCM tcm2 = TCM_DEFAULTS;
extern TCM_states tcm_state = TCM_idle;
extern DCL_REFGEN Vgen = DCL_REFGEN_DEFAULTS;
extern DCL_CSS Vgen_css = DCL_CSS_DEFAULTS;
extern DCL_REFGEN Igen = DCL_REFGEN_DEFAULTS;
extern DCL_CSS Igen_css = DCL_CSS_DEFAULTS;
// Inicialización de generador de referencia
// Generador trifásico de tensión
Vgen.css = &Vgen_css;
DCL_SET_CONTROLLER_PERIOD(&Vgen, Ts_DCL_Timer);
DCL_resetRefgen(&Vgen);
DCL_setRefgenMode(&Vgen, REFGEN_SINE3);
DCL_setRefgenFreq(&Vgen, fRed, 0.0f);
DCL_setRefgenAmpl(&Vgen, amp_vFase, 0.0f);
DCL_setRefgenRamp(&Vgen, 0.0f, 0.0f);
DCL_setRefgenClamp(&Vgen, 2.0f, -2.0f);
// Generador trifásico de corriente
Igen.css = &Igen_css;
DCL_SET_CONTROLLER_PERIOD(&Igen, Ts_DCL_Timer);
DCL_resetRefgen(&Igen);
DCL_setRefgenMode(&Igen, REFGEN_SINE3);
DCL_setRefgenFreq(&Igen, fRed, 0.0f);
DCL_setRefgenAmpl(&Igen, amp_iFase, 0.0f);
DCL_setRefgenRamp(&Igen, 0.0f, 0.0f);
DCL_setRefgenClamp(&Igen, 2.0f, -2.0f);
DCL_initLog(&A_Buf, A_vector, TCM_DATA_LENGTH_A);
DCL_clearLog(&A_Buf);
DCL_initLog(&B_Buf, B_vector, TCM_DATA_LENGTH_B);
DCL_clearLog(&B_Buf);
// initialise TCM
trigger_up_A = 50.0f;
trigger_down_A = 49.0f;
DCL_initTCM(&tcm1, A_Buf.fptr, TCM_DATA_LENGTH_A, 25, trigger_down_A, trigger_up_A);
DCL_armTCM(&tcm1);
trigger_up_B = 1e-3;
trigger_down_B = 0.5e-3;
DCL_initTCM(&tcm2, B_Buf.fptr, TCM_DATA_LENGTH_B, 25, trigger_down_B, trigger_up_B);
DCL_armTCM(&tcm2);
/*
* A_Log_Signal_Control.c
*
* Created on: 12 nov. 2024
* Author: juanm
*
* Rutina que adquiere saltos de frecuencia
*
*
*
*/
#include "B_Function_Declaration.h"
#pragma CODE_SECTION(Frecuency_log_function_A, ".TI.ramfunc");
#pragma CODE_SECTION(F_pu_log_function_A, ".TI.ramfunc");
void Frecuency_log_function_A(s_log_f *ptr_A, DCL_REFGEN *ptr_B, TCM *ptr_C, TCM_states estado)
{
static uint16_t index_3 = 0U;
static uint16_t ini_log = 0U;
if(ptr_A->start_log != 0U)
{
if(ini_log == 0U)
{
// Actualización de la frecuencia
DCL_setRefgenFreq(ptr_B, ptr_A->f_step, 0.0f);
// Reseteo de Transient Capteure Modelue
DCL_resetTCM(ptr_C);
DCL_armTCM(ptr_C);
ini_log = 1U;
}
// run the TCM
// Downsampling
if(index_3 == 9)
{
DCL_runTCM(ptr_C, ptr_A->adq_signal);
index_3 = 0;
}
index_3++;
if(ptr_C->mode == TCM_complete)
{
ptr_A->start_log = 0U;
ini_log = 0U;
}
}
}
void F_pu_log_function_A(s_log_df *ptr_A, TCM *ptr_B, TCM_states estado)
{
static uint16_t ini_log = 0U;
if(ptr_A->start_log != 0U)
{
if(ini_log == 0U)
{
// Reseteo de Transient Capteure Modelue
DCL_resetTCM(ptr_B);
DCL_armTCM(ptr_B);
ini_log = 1U;
}
// run the TCM
DCL_runTCM(ptr_B, ptr_A->adq_signal);
if(ptr_B->mode == TCM_complete)
{
ptr_A->start_log = 0U;
ini_log = 0U;
}
}
}
Thanks and regards
JuanMa