477 lines
22 KiB
C
477 lines
22 KiB
C
/*
|
|
* pwm_logs.c
|
|
*
|
|
* Created on: 19 àâã. 2024 ã.
|
|
* Author: user
|
|
*/
|
|
#include <adc_tools.h>
|
|
#include <alg_simple_scalar.h>
|
|
#include <alg_uf_const.h>
|
|
#include <break_regul.h>
|
|
#include <edrk_main.h>
|
|
#include <optical_bus.h>
|
|
#include <params.h>
|
|
#include <params_norma.h>
|
|
#include <params_pwm24.h>
|
|
#include <project.h>
|
|
#include <v_pwm24_v2.h>
|
|
#include <v_rotor.h>
|
|
#include <vector.h>
|
|
#include "global_time.h"
|
|
#include "IQmathLib.h"
|
|
#include "oscil_can.h"
|
|
#include "uf_alg_ing.h"
|
|
#include "MemoryFunctions.h"
|
|
#include "RS_Functions.h"
|
|
#include "v_rotor_22220.h"
|
|
#include "log_to_memory.h"
|
|
#include "log_params.h"
|
|
#include "logs_hmi.h"
|
|
#include "vector_control.h"
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////
|
|
#pragma CODE_SECTION(prepare_data_to_logs,".fast_run");
|
|
unsigned int prepare_data_to_logs(void)
|
|
{
|
|
logsdata.logs[0] = (int16) global_time.total_seconds10full;// = 0;//(int16)(_IQtoIQ15(Izad));
|
|
logsdata.logs[1] = (int16) _IQtoIQ15(analog.iqIu_1);
|
|
logsdata.logs[2] = (int16) _IQtoIQ15(analog.iqIv_1);
|
|
logsdata.logs[3] = (int16) _IQtoIQ15(analog.iqIw_1);
|
|
|
|
logsdata.logs[4] = (int16) _IQtoIQ15(analog.iqIu_2);
|
|
logsdata.logs[5] = (int16) _IQtoIQ15(analog.iqIv_2);
|
|
logsdata.logs[6] = (int16) _IQtoIQ15(analog.iqIw_2);
|
|
|
|
logsdata.logs[7] = (int16) _IQtoIQ15(analog.iqUin_A1B1);// (int16) _IQtoIQ15(analog.iqUin_m1);
|
|
logsdata.logs[8] = (int16) _IQtoIQ15(analog.iqUin_A2B2);// (int16) _IQtoIQ15(analog.iqUin_m2);
|
|
|
|
|
|
logsdata.logs[9] = (int16) _IQtoIQ15(analog.iqU_1);
|
|
logsdata.logs[10] = (int16) _IQtoIQ15(analog.iqU_2);//11
|
|
|
|
logsdata.logs[11] = (int16) _IQtoIQ15(analog.iqIin_1);
|
|
logsdata.logs[12] = (int16) _IQtoIQ15(analog.iqIin_2);
|
|
|
|
logsdata.logs[13] = (int16) _IQtoIQ15(analog.iqIm_1);
|
|
logsdata.logs[14] = (int16) _IQtoIQ15(analog.iqIm_2);
|
|
|
|
logsdata.logs[15] = (int16) _IQtoIQ15(analog.iqIbreak_1);//(int16) _IQtoIQ15(filter.iqU_1_long);
|
|
logsdata.logs[16] = (int16) _IQtoIQ15(analog.iqIbreak_2);//(int16) _IQtoIQ15(filter.iqU_2_long);
|
|
|
|
|
|
logsdata.logs[17] = (int16)svgen_pwm24_1.Ta_0;
|
|
logsdata.logs[18] = (int16)svgen_pwm24_1.Ta_1;
|
|
logsdata.logs[19] = (int16)break_result_1;
|
|
logsdata.logs[20] = (int16)break_result_2;
|
|
// logpar.log21 = (int16)svgen_pwm24_1.Tb_1;
|
|
// logpar.log22 = (int16)svgen_pwm24_1.Tc_0;
|
|
// logpar.log23 = (int16)svgen_pwm24_1.Tc_1; //23
|
|
|
|
logsdata.logs[21] = (int16)(_IQtoIQ14(edrk.iq_power_kw_full_znak));// edrk.from_uom.iq_level_value_kwt
|
|
//(int16) _IQtoIQ15(rotor_22220.iqFdirty);
|
|
//
|
|
|
|
logsdata.logs[22] = (int16) _IQtoIQ15(WRotor.iqWRotorSumFilter2);
|
|
logsdata.logs[23] = (int16) _IQtoIQ15(WRotor.iqWRotorSumFilter);//WRotor.iqWRotorSumFilter WRotor.iqWRotorSum
|
|
logsdata.logs[24] = (int16) _IQtoIQ15(simple_scalar1.iq_decr_mzz_power);//WRotor.iqWRotorSumFilter2 WRotor.iqWRotorSumFilter3
|
|
|
|
logsdata.logs[25] = (int16) edrk.from_uom.level_value;// (int16) _IQtoIQ15(WRotor.iqWRotorSumFilter);
|
|
// logpar.log25 = (int16) _IQtoIQ15(WRotor.iqWRotorSumFilter);
|
|
// logsdata.logs[25] = (int16) _IQtoIQ15(WRotor.iqWRotorSum);
|
|
|
|
logsdata.logs[26] = (int16) edrk.power_limit.all;//_IQtoIQ15(pll1.vars.pll_Uq);
|
|
logsdata.logs[27] = (int16)(_IQtoIQ14(edrk.zadanie.iq_limit_power_zad));//(int16) _IQtoIQ15(pll1.vars.pll_Ud);//28
|
|
|
|
logsdata.logs[28] = (int16) _IQtoIQ12(edrk.master_theta);//29
|
|
logsdata.logs[29] = (int16) _IQtoIQ15(edrk.master_Uzad);//30
|
|
logsdata.logs[30] = (int16) _IQtoIQ14(edrk.f_stator);
|
|
logsdata.logs[31] = (int16) _IQtoIQ12(edrk.k_stator1);
|
|
|
|
logsdata.logs[32] = optical_read_data.data.cmd.all;
|
|
logsdata.logs[33] = optical_read_data.data.pzad_or_wzad;
|
|
logsdata.logs[34] = optical_read_data.data.angle_pwm;
|
|
logsdata.logs[35] = optical_read_data.data.iq_zad_i_zad;
|
|
|
|
logsdata.logs[36] = optical_write_data.data.cmd.all;
|
|
logsdata.logs[37] = optical_write_data.data.angle_pwm;
|
|
logsdata.logs[38] = optical_write_data.data.pzad_or_wzad;
|
|
logsdata.logs[39] = optical_write_data.data.iq_zad_i_zad;
|
|
|
|
/////////////
|
|
logsdata.logs[40] = (int16)(_IQtoIQ15(simple_scalar1.Izad));
|
|
logsdata.logs[41] = (int16)(_IQtoIQ15(simple_scalar1.mzz_zad_in2));//(int16)(_IQtoIQ15(Uze_t1));
|
|
logsdata.logs[42] = (int16)(_IQtoIQ15(simple_scalar1.pidF.OutMax));
|
|
logsdata.logs[43] = (int16)(_IQtoIQ15(simple_scalar1.mzz_zad_int));
|
|
logsdata.logs[44] = (int16)(_IQtoIQ15(simple_scalar1.Izad_from_master));
|
|
|
|
logsdata.logs[45] = (int16)(_IQtoIQ14(simple_scalar1.pidF.Fdb));
|
|
logsdata.logs[46] = (int16)(_IQtoIQ14(simple_scalar1.pidF.Ref));
|
|
logsdata.logs[47] = (int16)(_IQtoIQ14(simple_scalar1.pidF.Ui));
|
|
logsdata.logs[48] = (int16)(_IQtoIQ14(simple_scalar1.pidF.Up));
|
|
logsdata.logs[49] = (int16)(_IQtoIQ14(simple_scalar1.pidF.SatErr));
|
|
logsdata.logs[50] = (int16)(_IQtoIQ14(simple_scalar1.pidF.Out));
|
|
|
|
logsdata.logs[51] = (int16)(_IQtoIQ14(simple_scalar1.pidPower.Fdb));
|
|
logsdata.logs[52] = (int16)(_IQtoIQ14(simple_scalar1.pidPower.Ref));
|
|
logsdata.logs[53] = (int16)(_IQtoIQ14(simple_scalar1.pidPower.Ui));
|
|
logsdata.logs[54] = (int16)(_IQtoIQ14(simple_scalar1.pidPower.Up));
|
|
logsdata.logs[55] = (int16)(_IQtoIQ14(simple_scalar1.pidPower.SatErr));
|
|
logsdata.logs[56] = (int16)(_IQtoIQ14(simple_scalar1.pidPower.Out));
|
|
|
|
logsdata.logs[57] = (int16)(_IQtoIQ15(simple_scalar1.pidIm1.Fdb));
|
|
logsdata.logs[58] = (int16)(_IQtoIQ15(simple_scalar1.pidIm1.Ref));
|
|
logsdata.logs[59] = (int16)(_IQtoIQ15(simple_scalar1.pidIm1.Ui));
|
|
logsdata.logs[60] = (int16)(_IQtoIQ15(simple_scalar1.pidIm1.Up));
|
|
logsdata.logs[61] = (int16)(_IQtoIQ15(simple_scalar1.pidIm1.SatErr));
|
|
logsdata.logs[62] = (int16)(_IQtoIQ15(simple_scalar1.pidIm1.Out));
|
|
logsdata.logs[63] = (int16)(_IQtoIQ12(simple_scalar1.Uze_t1));
|
|
|
|
logsdata.logs[64] = (int16)(_IQtoIQ15(simple_scalar1.bpsi_curent));
|
|
|
|
logsdata.logs[65] = (int16)(_IQtoIQ14(simple_scalar1.iqKoefOgran));
|
|
|
|
logsdata.logs[66] = (int16)(_IQtoIQ14(simple_scalar1.Fz));
|
|
logsdata.logs[67] = (int16) (_IQtoIQ15(simple_scalar1.iq_decr_mzz_power_filter));//rotor_22220.direct_rotor
|
|
|
|
logsdata.logs[68] = (int16)(_IQtoIQ14(simple_scalar1.pidF.OutMin));//(int16)edrk.Status_Sbor;
|
|
logsdata.logs[69] = (int16)(_IQtoIQ14(simple_scalar1.pidPower.OutMax));//(int16)edrk.Stage_Sbor;
|
|
logsdata.logs[70] = (int16)(_IQtoIQ14(filter.iqUin_m1));//(int16)edrk.Sbor_Mode;
|
|
|
|
logsdata.logs[71] = (int16)edrk.from_shema.all;
|
|
logsdata.logs[72] = (int16)(_IQtoIQ15(simple_scalar1.iqKoefOgranIzad));//(int16)edrk.from_shema_filter.all;
|
|
//
|
|
logsdata.logs[73] = (int16)(_IQtoIQ14(filter.iqUin_m2));//simple_scalar1.direction;
|
|
logsdata.logs[74] = (int16)(_IQtoIQ14(edrk.iq_power_kw_full_filter_znak));//
|
|
logsdata.logs[75] = (int16)(_IQtoIQ15(edrk.iq_freq_50hz));//edrk.iq_freq_50hz
|
|
logsdata.logs[76] = (int16)(_IQtoIQ15(simple_scalar1.mzz_zad_in1));
|
|
|
|
|
|
|
|
// can regs
|
|
// logsdata.logs[77] = (int16)(((unsigned long)edrk.canes_reg >> 16) & 0x1ff);
|
|
// logsdata.logs[78] = (int16)((unsigned long)edrk.canes_reg & 0x3f);
|
|
//
|
|
// logsdata.logs[79] = (int16)(edrk.cantec_reg & 0xff);
|
|
// logsdata.logs[80] = (int16)(edrk.canrec_reg & 0xff);
|
|
|
|
logsdata.logs[77] = (int16)(_IQtoIQ14(uf_alg.Ud));
|
|
logsdata.logs[78] = (int16)(_IQtoIQ14(uf_alg.Uq));
|
|
logsdata.logs[79] = (int16)(_IQtoIQ14(edrk.all_limit_koeffs.uom_limit));//edrk.MasterSlave;
|
|
|
|
logsdata.logs[80] = (int16)(_IQtoIQ14(edrk.Kplus));
|
|
|
|
// logsdata.logs[65] = (int16)(_IQtoIQ14(edrk.all_limit_koeffs.temper_limit));
|
|
logsdata.logs[81] = (int16)(_IQtoIQ14(edrk.all_limit_koeffs.uin_freq_limit));
|
|
|
|
logsdata.logs[82] = (int16)(_IQtoIQ14(uf_alg.svgen_dq_Ta));
|
|
logsdata.logs[83] = (int16)(_IQtoIQ14(uf_alg.svgen_dq_Tb));
|
|
logsdata.logs[84] = (int16)(_IQtoIQ14(uf_alg.svgen_dq_Tc));
|
|
|
|
// uf_alg.tetta_bs
|
|
|
|
// logsdata.logs[64] = (int16)(_IQtoIQ15());
|
|
|
|
// logsdata.logs[64] = (int16)(_IQtoIQ15());
|
|
|
|
logsdata.logs[85] = edrk.from_uom.digital_line.all;
|
|
// logsdata.logs[75] = edrk.errors.e2.all;
|
|
// logsdata.logs[76] = edrk.errors.e3.all;
|
|
// logsdata.logs[77] = edrk.errors.e4.all;
|
|
// logsdata.logs[78] = edrk.errors.e5.all;
|
|
// logsdata.logs[79] = edrk.errors.e6.all;
|
|
// logsdata.logs[80] = edrk.errors.e7.all;
|
|
//
|
|
|
|
|
|
|
|
|
|
// logsdata.logs[67] = (int16) _IQtoIQ15(WRotor.iqWRotorCalcBeforeRegul1);
|
|
// logsdata.logs[68] = (int16) _IQtoIQ15(WRotor.iqWRotorCalcBeforeRegul2);
|
|
// logsdata.logs[69] = (int16) _IQtoIQ15(WRotor.iqWRotorCalc1);
|
|
|
|
// logsdata.logs[24] = (int16) _IQtoIQ15(WRotor.iqWRotorCalc2);
|
|
|
|
// logsdata.logs[70] = (int16) _IQtoIQ15(WRotor.iqWRotorSumRamp);
|
|
|
|
// logsdata.logs[72] = (int16) (WRotorPBus.RotorDirectionSlow);
|
|
// logsdata.logs[73] = (int16) (WRotorPBus.RotorDirectionSlow2);
|
|
// logsdata.logs[74] = (int16) (WRotorPBus.RotorDirectionInstant); //(int16) (WRotorPBus.);
|
|
|
|
// logsdata.logs[75] = (int16) (WRotor.iqTimeSensor1);
|
|
// logsdata.logs[76] = (int16) (WRotor.iqTimeSensor2);
|
|
//
|
|
// logsdata.logs[77] = (int16) _IQtoIQ15(WRotor.iqWRotorCalc1Ramp);
|
|
// logsdata.logs[78] = (int16) _IQtoIQ15(WRotor.iqWRotorCalc2Ramp);
|
|
//
|
|
// logsdata.logs[79] = (int16) _IQtoIQ15(WRotor.iqPrevWRotorCalc1);
|
|
// logsdata.logs[80] = (int16) _IQtoIQ15(WRotor.iqPrevWRotorCalc2);
|
|
|
|
// logsdata.logs[81] = (int16) modbus_table_can_in[124].all;//Îáîðîòû (çàäàííûå);
|
|
// logsdata.logs[82] = (int16) modbus_table_can_in[134].all;//çàïàñ ìîùíîñòè
|
|
// logsdata.logs[83] = (int16) modbus_table_can_in[125].all;//Ìîùíîñòü (çàäàííàÿ)
|
|
//
|
|
// logsdata.logs[84] = (int16) project.cds_in[0].read.pbus.data_in.all;
|
|
// logsdata.logs[85] = (int16) project.cds_in[1].read.pbus.data_in.all;
|
|
|
|
logsdata.logs[86] = (int16) _IQtoIQ15(vect_control.iqId1);
|
|
logsdata.logs[87] = (int16) _IQtoIQ15(vect_control.iqIq1);
|
|
|
|
logsdata.logs[88] = (int16) _IQtoIQ15(vect_control.iqId2);
|
|
logsdata.logs[89] = (int16) _IQtoIQ15(vect_control.iqIq2);
|
|
logsdata.logs[90] = 0;
|
|
|
|
return 90;
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
#define PAUSE_SLOW_LOG 20
|
|
|
|
void save_slow_logs(int run, int t_slow)
|
|
{
|
|
static int c_step=0;
|
|
// static int c_all = (FREQ_PWM>>2); // Ðàç â 0,125 ñ
|
|
static int c_all = (FREQ_PWM>>1); // Ðàç â 0,250 ñ
|
|
|
|
static int prev_run=0;
|
|
static unsigned int c_pause=0;
|
|
|
|
if (rs_a.RS_PrevCmd==CMD_RS232_UPLOAD)
|
|
return;
|
|
|
|
if (run==0 && c_pause>=PAUSE_SLOW_LOG)
|
|
return;
|
|
|
|
c_all = (FREQ_PWM>>(1+t_slow));
|
|
|
|
if (c_all<2)
|
|
c_all = 2;
|
|
|
|
|
|
if (c_step>=c_all)
|
|
{
|
|
test_mem_limit(SLOW_LOG, 1);
|
|
|
|
// prepare_data_to_logs();
|
|
|
|
getSlowLogs(1);
|
|
c_step = 0;
|
|
|
|
if (run==1)
|
|
c_pause = 0;
|
|
else
|
|
{
|
|
if (c_pause<PAUSE_SLOW_LOG)
|
|
c_pause++;
|
|
}
|
|
}
|
|
else
|
|
c_step++;
|
|
|
|
|
|
prev_run = run;
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////
|
|
#pragma CODE_SECTION(run_write_logs,".fast_run");
|
|
void run_write_logs(void)
|
|
{
|
|
static unsigned int count_step_run = 0;
|
|
static int count_step=0, prevGo=0;
|
|
static int log_saved_to_const_mem = 1;
|
|
int i_log, local_enable_slow_log;
|
|
|
|
|
|
prepare_data_to_logs();
|
|
|
|
if(edrk.Go == 1)
|
|
{
|
|
if (edrk.Go != prevGo)
|
|
{
|
|
// clear_mem(FAST_LOG);
|
|
// count_start_impuls = 0;
|
|
count_step = 0;
|
|
// count_step_ram_off = COUNT_SAVE_LOG_OFF;
|
|
count_step_run = 0;
|
|
}
|
|
}
|
|
|
|
prevGo = edrk.Go;
|
|
|
|
#if(_ENABLE_PWM_LINES_FOR_TESTS_PWM)
|
|
PWM_LINES_TK_23_ON;
|
|
#endif
|
|
|
|
/*
|
|
|
|
// if (oscil_can.enable_rewrite && oscil_can.global_enable)
|
|
|
|
if (oscil_can.enable_rewrite)
|
|
{
|
|
|
|
if (edrk.Go)
|
|
oscil_can.status_pwm = 1;
|
|
else
|
|
oscil_can.status_pwm = 0;
|
|
|
|
|
|
if ( (edrk.Stop == 0) && (project.controller.read.errors.all==0) )
|
|
oscil_can.status_error = 0;
|
|
else
|
|
oscil_can.status_error = 1;
|
|
|
|
oscil_can.oscil_buffer[0][oscil_can.current_position] = global_time.pwm_tics;
|
|
// if (edrk.Mode_ScalarVectorUFConst == ALG_MODE_FOC_OBOROTS || edrk.Mode_ScalarVectorUFConst == ALG_MODE_FOC_POWER) {
|
|
oscil_can.oscil_buffer[1][oscil_can.current_position] = (int16) _IQtoIQ15(filter.iqU_1_long);//xpwm_time.Ta0_0; //(int16) _IQtoIQ15(turns.pidFvect.Ui);
|
|
oscil_can.oscil_buffer[2][oscil_can.current_position] = (int16) _IQtoIQ15(filter.iqU_2_long);//xpwm_time.Ta0_1; //(int16) _IQtoIQ15(turns.pidFvect.Up);
|
|
oscil_can.oscil_buffer[3][oscil_can.current_position] = (int16) _IQtoIQ15(turns.pidFvect.Out);
|
|
oscil_can.oscil_buffer[4][oscil_can.current_position] = (int16) _IQtoIQ15(turns.pidFvect.OutMax);
|
|
oscil_can.oscil_buffer[5][oscil_can.current_position] = (int16) _IQtoIQ15(power.pidP.Out);
|
|
oscil_can.oscil_buffer[6][oscil_can.current_position] = (int16) _IQtoIQ15(power.pidP.OutMax);
|
|
// } else {
|
|
// oscil_can.oscil_buffer[1][oscil_can.current_position] = (int16) _IQtoIQ15(simple_scalar1.pidF.Ui); // count_updated_sbus;//xpwm_time.Ta0_0;
|
|
// oscil_can.oscil_buffer[2][oscil_can.current_position] = (int16) _IQtoIQ15(simple_scalar1.pidF.Up);
|
|
// oscil_can.oscil_buffer[3][oscil_can.current_position] = (int16) _IQtoIQ15(simple_scalar1.pidF.Out);//xpwm_time.Tb0_0;
|
|
// oscil_can.oscil_buffer[4][oscil_can.current_position] = (int16) _IQtoIQ15(simple_scalar1.pidF.OutMax);//xpwm_time.Tb0_1;
|
|
// oscil_can.oscil_buffer[5][oscil_can.current_position] = (int16) _IQtoIQ15(simple_scalar1.pidPower.Out);//xpwm_time.Tc0_0;
|
|
// oscil_can.oscil_buffer[6][oscil_can.current_position] = (int16) _IQtoIQ15(simple_scalar1.pidPower.OutMax); //xpwm_time.Tc0_1;
|
|
// }
|
|
|
|
|
|
oscil_can.oscil_buffer[7][oscil_can.current_position] = (int16) _IQtoIQ15(edrk.master_Uzad) ;
|
|
oscil_can.oscil_buffer[8][oscil_can.current_position] = (int16) _IQtoIQ12(edrk.master_theta);//global_time.microseconds;
|
|
|
|
oscil_can.oscil_buffer[9][oscil_can.current_position] = (int16) _IQtoIQ15(analog.iqIu_1);
|
|
oscil_can.oscil_buffer[10][oscil_can.current_position] = (int16) _IQtoIQ15(analog.iqIv_1);
|
|
oscil_can.oscil_buffer[11][oscil_can.current_position] = (int16) _IQtoIQ15(analog.iqIw_1);
|
|
|
|
oscil_can.oscil_buffer[12][oscil_can.current_position] = (int16) _IQtoIQ15(analog.iqIu_2);
|
|
oscil_can.oscil_buffer[13][oscil_can.current_position] = (int16) _IQtoIQ15(analog.iqIv_2);
|
|
oscil_can.oscil_buffer[14][oscil_can.current_position] = (int16) _IQtoIQ15(analog.iqIw_2);
|
|
|
|
oscil_can.oscil_buffer[15][oscil_can.current_position] = (int16) _IQtoIQ15(turns.Fzad_rmp); //(int16) _IQtoIQ15(analog.iqU_1);
|
|
oscil_can.oscil_buffer[16][oscil_can.current_position] = (int16) _IQtoIQ15(WRotor.iqWRotorCalcBeforeRegul1);//(int16) _IQtoIQ15(analog.iqU_2);
|
|
|
|
// oscil_can.oscil_buffer[17][oscil_can.current_position] = 0;
|
|
|
|
oscil_can.oscil_buffer[18][oscil_can.current_position] = (int16) _IQtoIQ15(analog.iqIin_2);
|
|
oscil_can.oscil_buffer[19][oscil_can.current_position] = (int16) _IQtoIQ15(vect_control.iqUdCompensation);
|
|
oscil_can.oscil_buffer[20][oscil_can.current_position] = (int16) _IQtoIQ15(vect_control.iqUqCompensation);
|
|
|
|
oscil_can.oscil_buffer[21][oscil_can.current_position] = (int16) _IQtoIQ15(edrk.f_stator);
|
|
oscil_can.oscil_buffer[22][oscil_can.current_position] = (int16) _IQtoIQ12(edrk.k_stator1);
|
|
|
|
if (edrk.Mode_ScalarVectorUFConst == ALG_MODE_FOC_OBOROTS || edrk.Mode_ScalarVectorUFConst == ALG_MODE_FOC_POWER) {
|
|
oscil_can.oscil_buffer[17][oscil_can.current_position] = (int16) _IQtoIQ15(vect_control.iqPvsi1 + vect_control.iqPvsi2);
|
|
oscil_can.oscil_buffer[23][oscil_can.current_position] = (int16) _IQtoIQ15(vect_control.iqId1);//(int16) _IQtoIQ15(WRotorPBus.iqAngle1F);
|
|
oscil_can.oscil_buffer[24][oscil_can.current_position] = (int16) _IQtoIQ15(vect_control.iqIq1);//(int16) _IQtoIQ15(WRotorPBus.iqAngle2F);
|
|
oscil_can.oscil_buffer[25][oscil_can.current_position] = (int16) _IQtoIQ15(vect_control.iqFsl);
|
|
oscil_can.oscil_buffer[26][oscil_can.current_position] = (int16) _IQtoIQ15(turns.mzz_zad_int);
|
|
oscil_can.oscil_buffer[27][oscil_can.current_position] = (int16) _IQtoIQ15(vect_control.pidD1.Out);//(int16) _IQtoIQ15(WRotorPBus.iqWRotorCalcBeforeRegul1);
|
|
oscil_can.oscil_buffer[28][oscil_can.current_position] = (int16) _IQtoIQ15(vect_control.pidQ1.Out);
|
|
oscil_can.oscil_buffer[29][oscil_can.current_position] = (int16) _IQtoIQ15(vect_control.pidD1.Ref);
|
|
} else {
|
|
oscil_can.oscil_buffer[17][oscil_can.current_position] = (int16) _IQtoIQ15(analog.PowerScalar);
|
|
oscil_can.oscil_buffer[23][oscil_can.current_position] = (int16) _IQtoIQ15(simple_scalar1.pidIm1.Ui); // count_updated_sbus;//xpwm_time.Ta0_0;
|
|
oscil_can.oscil_buffer[24][oscil_can.current_position] = (int16) _IQtoIQ15(simple_scalar1.pidIm1.Up);
|
|
oscil_can.oscil_buffer[25][oscil_can.current_position] = (int16) _IQtoIQ15(simple_scalar1.pidIm1.Out);
|
|
oscil_can.oscil_buffer[26][oscil_can.current_position] = (int16) _IQtoIQ15(simple_scalar1.mzz_zad_int);//(int16) _IQtoIQ15(WRotor.iqWRotorCalcBeforeRegul1);
|
|
oscil_can.oscil_buffer[27][oscil_can.current_position] = (int16) _IQtoIQ15(simple_scalar1.Im_regul);//(int16) _IQtoIQ15(WRotorPBus.iqWRotorCalcBeforeRegul1);
|
|
oscil_can.oscil_buffer[28][oscil_can.current_position] = (int16) _IQtoIQ15(edrk.Kplus);
|
|
oscil_can.oscil_buffer[29][oscil_can.current_position] = (int16) _IQtoIQ15(filter.iqIm);
|
|
}
|
|
|
|
|
|
// oscil_can.oscil_buffer[23][oscil_can.current_position] = (int16) _IQtoIQ15(simple_scalar1.Izad);//(int16) _IQtoIQ15(WRotorPBus.iqAngle1F);
|
|
// oscil_can.oscil_buffer[24][oscil_can.current_position] = (int16) _IQtoIQ15(simple_scalar1.Izad_from_master);//(int16) _IQtoIQ15(WRotorPBus.iqAngle2F);
|
|
// oscil_can.oscil_buffer[25][oscil_can.current_position] = (int16) _IQtoIQ15(simple_scalar1.mzz_zad);//(int16) _IQtoIQ15(WRotor.iqWRotorImpulses1);
|
|
|
|
|
|
|
|
oscil_can.oscil_buffer[30][oscil_can.current_position] = (int16) _IQtoIQ12(edrk.master_theta);//_IQtoIQ15(edrk.Uzad_to_slave);
|
|
oscil_can.oscil_buffer[31][oscil_can.current_position] = (int16) _IQtoIQ12(edrk.tetta_to_slave);
|
|
|
|
|
|
// oscil_can.oscil_buffer[26][oscil_can.current_position] = (int16) _IQtoIQ15(analog.iqUin_m1);
|
|
// oscil_can.oscil_buffer[27][oscil_can.current_position] = (int16) _IQtoIQ15(analog.iqUin_m2);
|
|
//
|
|
// oscil_can.oscil_buffer[28][oscil_can.current_position] = (int16) _IQtoIQ15(analog.iqUin_A1B1);
|
|
// oscil_can.oscil_buffer[29][oscil_can.current_position] = (int16) _IQtoIQ15(analog.iqUin_B1C1);
|
|
// oscil_can.oscil_buffer[30][oscil_can.current_position] = (int16) _IQtoIQ15(analog.iqUin_A2B2);
|
|
// oscil_can.oscil_buffer[31][oscil_can.current_position] = (int16) _IQtoIQ15(analog.iqUin_B2C2);
|
|
|
|
|
|
oscil_can.set_next_position(&oscil_can);
|
|
}
|
|
*/
|
|
|
|
|
|
// if ((m.m2.bit.LatchCrashError == 0) && (edrk.stop_logs_rs232 == 0))// && (edrk.Go == 1))
|
|
if ( (edrk.stop_logs_rs232 == 0) && f.flag_record_log)// && (edrk.Go == 1))
|
|
{
|
|
test_mem_limit(FAST_LOG, !f.Ciclelog);
|
|
|
|
count_step++;
|
|
|
|
if (count_step >= 1)//1
|
|
{
|
|
count_step_run++;
|
|
// i_led1_on_off(1);
|
|
// write_to_mem(FAST_LOG, (int16)count_step_run);
|
|
|
|
getFastLogs(!f.Ciclelog);
|
|
// for (i_log=0;i_log<72;i_log++)
|
|
// write_to_mem(FAST_LOG, (int16) logsdata.logs[i_log]);
|
|
|
|
// write_to_mem(FAST_LOG, (int16) logpar.log85);
|
|
|
|
|
|
|
|
// if (logpar.start_write_fast_log) {
|
|
// get_log_params_count();
|
|
// logpar.start_write_fast_log = 0;
|
|
// }
|
|
count_step = 0;
|
|
}
|
|
}
|
|
else {
|
|
if (f.Stop && log_params.log_saved_to_const_mem == 0) {
|
|
log_params.copy_log_to_const_memory = 1;
|
|
log_params.log_saved_to_const_mem = 1;
|
|
f.flag_send_alarm_log_to_MPU = 1;
|
|
}
|
|
}
|
|
|
|
|
|
#if(_ENABLE_PWM_LINES_FOR_TESTS_PWM)
|
|
PWM_LINES_TK_23_OFF;
|
|
#endif
|
|
|
|
if (filter.iqU_1_long>edrk.iqMIN_U_ZPT || filter.iqU_2_long>edrk.iqMIN_U_ZPT)
|
|
local_enable_slow_log = 1;
|
|
else
|
|
local_enable_slow_log = 0;
|
|
|
|
if (edrk.stop_logs_rs232 == 0 && edrk.stop_slow_log ==0 && log_to_HMI.send_log == 0)
|
|
save_slow_logs(edrk.Go || (local_enable_slow_log && edrk.Status_Ready.bits.ready_final==0), edrk.t_slow_log);
|
|
}
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|