You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
359 lines
14 KiB
C++
359 lines
14 KiB
C++
7 months ago
|
/*
|
||
|
* Hardcode.cpp
|
||
|
*
|
||
|
* Author: Aleksey Gerasimenko
|
||
|
* gerasimenko.aleksey.n@gmail.com
|
||
|
*/
|
||
|
|
||
|
#include "SYSCTRL/SystemControl.h"
|
||
|
|
||
|
namespace SYSCTRL
|
||
|
{
|
||
|
|
||
|
void SystemControl::get_hard_code_setup()
|
||
|
{
|
||
|
m_system_setup.time_sample_control = 400.0e-6;
|
||
|
m_system_setup.time_prescale_slow = 5;
|
||
|
m_system_setup.time_prescale_additional = 1;
|
||
|
|
||
|
|
||
|
//
|
||
|
// Relative
|
||
|
//
|
||
|
m_system_setup.relative_voltage_input.time_sample = m_system_setup.time_sample_control;
|
||
|
|
||
|
//
|
||
|
}//hard_code_setup()
|
||
|
//
|
||
|
void SystemControl::upload_configuration()
|
||
|
{
|
||
|
m_fram_db.upload_configuration(&m_system_configuration);
|
||
|
//m_system_configuration.selfupdata();
|
||
|
//
|
||
|
}//
|
||
|
//
|
||
|
void SystemControl::get_hard_code_configuration()
|
||
|
{
|
||
|
|
||
|
//
|
||
|
// References
|
||
|
//
|
||
|
m_system_configuration.reference_current_limit_rms = 100.0;
|
||
|
m_system_configuration.reference_current_pfc_rms = 0.0;
|
||
|
m_system_configuration.reference_voltage_rms = 240.0;
|
||
|
m_system_configuration.reference_voltage_dc = 900.0;
|
||
|
|
||
|
m_system_configuration.algorithm_control.signal.enable_current_limit = true;
|
||
|
m_system_configuration.algorithm_control.signal.enable_pfc = false;
|
||
|
m_system_configuration.algorithm_control.signal.enable_harmonica = false;
|
||
|
m_system_configuration.algorithm_control.signal.enable_auto_offset = true;
|
||
|
|
||
|
|
||
|
//
|
||
|
// High Voltage Cell
|
||
|
//
|
||
|
//m_system_configuration.hardware.switching_freq = SWITCHING_FREQ_2500;
|
||
|
m_system_configuration.hardware.cell_level = 1;
|
||
|
m_system_configuration.hardware.version.pwm = 210;
|
||
|
m_system_configuration.hardware.version.cell = 211;
|
||
|
m_system_configuration.hardware.version.cpu_cpld = 202;
|
||
|
//
|
||
|
|
||
|
m_system_configuration.minimal_input_voltage_level = 10.0;
|
||
|
|
||
|
//
|
||
|
// Scale Analog Signals
|
||
|
//
|
||
|
m_system_configuration.scale_voltage_input_a = 0.0227386411;//0.0233486816;
|
||
|
m_system_configuration.scale_voltage_input_b = 0.0227597337;//0.0234651081;
|
||
|
m_system_configuration.scale_voltage_input_c = 0.02278281;//0.0236082859;
|
||
|
//
|
||
|
m_system_configuration.scale_current_input_a = 0.00666328007;
|
||
|
m_system_configuration.scale_current_input_b = 0.00667025521;
|
||
|
m_system_configuration.scale_current_input_c = 0.00665952405;
|
||
|
//
|
||
|
m_system_configuration.scale_current_cell_a = 0.0123311505;//0.00665648002;
|
||
|
m_system_configuration.scale_current_cell_b = 0.0123670474;//0.00667640707;
|
||
|
m_system_configuration.scale_current_cell_c = 0.0124070868;//0.00666095456;
|
||
|
//
|
||
|
m_system_configuration.scale_voltage_load_a = 0.0227408651;//0.0232194811;
|
||
|
m_system_configuration.scale_voltage_load_b = 0.0227707103;//0.0233941432;
|
||
|
m_system_configuration.scale_voltage_load_c = 0.0229060184;//0.0234934501;
|
||
|
//
|
||
|
m_system_configuration.scale_current_load_a = 0.00622544903;//0.00668919506;
|
||
|
m_system_configuration.scale_current_load_b = 0.00623486936;//0.00669770781;
|
||
|
m_system_configuration.scale_current_load_c = 0.00624710508;//0.00670575583;
|
||
|
//
|
||
|
m_system_configuration.scale_current_bypass_a = 0.0063;
|
||
|
m_system_configuration.scale_current_bypass_b = 0.0063;
|
||
|
m_system_configuration.scale_current_bypass_c = 0.0063;
|
||
|
|
||
|
|
||
|
//
|
||
|
// Amplitude Filter Parameters
|
||
|
//
|
||
|
m_system_configuration.ampl_filter_current.time = 20.0e-3;
|
||
|
m_system_configuration.ampl_filter_current.a3 = 3.0;
|
||
|
m_system_configuration.ampl_filter_current.a2 = 4.25;
|
||
|
m_system_configuration.ampl_filter_current.a1 = 3.0;
|
||
|
|
||
|
//
|
||
|
// RMS Filter Parameters
|
||
|
//
|
||
|
m_system_configuration.rms_filter_analog_signal.time = 10.0e-3;
|
||
|
m_system_configuration.rms_filter_analog_signal.a3 = 3.0;
|
||
|
m_system_configuration.rms_filter_analog_signal.a2 = 4.25;
|
||
|
m_system_configuration.rms_filter_analog_signal.a1 = 3.0;
|
||
|
|
||
|
|
||
|
//
|
||
|
// Zero Drift Current Input
|
||
|
//
|
||
|
m_system_configuration.zero_filter.time = 1333.0e-3;
|
||
|
|
||
|
|
||
|
//
|
||
|
// Cell DC Voltage Filter
|
||
|
//
|
||
|
m_system_configuration.cell_dc_voltage_filter.time = 3.0e-3;
|
||
|
m_system_configuration.cell_dc_voltage_filter.a3 = 3.0;
|
||
|
m_system_configuration.cell_dc_voltage_filter.a2 = 4.25;
|
||
|
m_system_configuration.cell_dc_voltage_filter.a1 = 3.0;
|
||
|
|
||
|
|
||
|
//
|
||
|
// Signal Decompose
|
||
|
//
|
||
|
m_system_configuration.signal_decompose.projection_filter.time = 10.0e-3;
|
||
|
m_system_configuration.signal_decompose.projection_filter.a3 = 2.61313;//3.0;
|
||
|
m_system_configuration.signal_decompose.projection_filter.a2 = 3.41422;//4.25;
|
||
|
m_system_configuration.signal_decompose.projection_filter.a1 = 2.61313;//3.0;
|
||
|
|
||
|
|
||
|
//
|
||
|
// Relative
|
||
|
//
|
||
|
m_system_configuration.relative_voltage_input.minimal_amplitude_level = 0.1;
|
||
|
m_system_configuration.relative_voltage_input.limit_relative_high = 1.1;
|
||
|
m_system_configuration.relative_voltage_input.limit_relative_low = -1.1;
|
||
|
m_system_configuration.relative_voltage_input.amplitude_filter.time = (float)(1.0/2.0/FP_PI/10.0);
|
||
|
m_system_configuration.relative_voltage_input.amplitude_filter.a3 = 3.0;
|
||
|
m_system_configuration.relative_voltage_input.amplitude_filter.a2 = 4.25;
|
||
|
m_system_configuration.relative_voltage_input.amplitude_filter.a1 = 3.0;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
// Voltage PLL-ABC Parameters
|
||
|
//
|
||
|
#define PLLABC_FREQUENCY_NOMINAL (float)(2.0*FP_PI*50.0)
|
||
|
#define PLLABC_FREQUENCY_CUT (float)(2.0*FP_PI*10.0)
|
||
|
#define PLLABC_FREQUENCY_LIMIT_HI PLLABC_FREQUENCY_CUT
|
||
|
#define PLLABC_FREQUENCY_LIMIT_LOW -PLLABC_FREQUENCY_CUT
|
||
|
m_system_configuration.pll_abc_input_voltage.frequency_nominal = PLLABC_FREQUENCY_NOMINAL;
|
||
|
m_system_configuration.pll_abc_input_voltage.filter.time = 1.0/PLLABC_FREQUENCY_CUT;
|
||
|
m_system_configuration.pll_abc_input_voltage.controller.gain = PLLABC_FREQUENCY_CUT/2.0;
|
||
|
m_system_configuration.pll_abc_input_voltage.controller.time = 4.0/PLLABC_FREQUENCY_CUT;
|
||
|
m_system_configuration.pll_abc_input_voltage.controller.low_saturation = PLLABC_FREQUENCY_LIMIT_LOW;
|
||
|
m_system_configuration.pll_abc_input_voltage.controller.high_saturation = PLLABC_FREQUENCY_LIMIT_HI;
|
||
|
m_system_configuration.pll_abc_input_voltage.position.time = 1.0;
|
||
|
m_system_configuration.pll_abc_input_voltage.position.low_saturation = FP_ZERO;
|
||
|
m_system_configuration.pll_abc_input_voltage.position.high_saturation = 2.0 * FP_PI;
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
// System Alarm
|
||
|
//
|
||
|
// exceed voltage level 1
|
||
|
m_system_configuration.phase_alert_monitor.voltage_exceed_level_1.level = 264.5;//253.0;
|
||
|
m_system_configuration.phase_alert_monitor.voltage_exceed_level_1.period = 10.0;
|
||
|
//
|
||
|
// exceed voltage level 2
|
||
|
m_system_configuration.phase_alert_monitor.voltage_exceed_level_2.level = 276.0;//264.5;
|
||
|
m_system_configuration.phase_alert_monitor.voltage_exceed_level_2.period = 5.0;
|
||
|
//
|
||
|
// exceed voltage level 3
|
||
|
m_system_configuration.phase_alert_monitor.voltage_exceed_level_3.level = 290.0;//276.0;
|
||
|
m_system_configuration.phase_alert_monitor.voltage_exceed_level_3.period = 2.0;
|
||
|
//
|
||
|
// exceed voltage level 4
|
||
|
m_system_configuration.phase_alert_monitor.voltage_exceed_level_4.level = 345.0;
|
||
|
m_system_configuration.phase_alert_monitor.voltage_exceed_level_4.period = 0.001;//1.0;
|
||
|
//
|
||
|
// decrease voltage level 1
|
||
|
m_system_configuration.phase_alert_monitor.voltage_decrease_level_1.level = 200.0;//218.5;//195.5;
|
||
|
m_system_configuration.phase_alert_monitor.voltage_decrease_level_1.period = 10.0;
|
||
|
//
|
||
|
// decrease voltage level 2
|
||
|
m_system_configuration.phase_alert_monitor.voltage_decrease_level_2.level = 170.0;//207.0;//172.5;
|
||
|
m_system_configuration.phase_alert_monitor.voltage_decrease_level_2.period = 5.0;
|
||
|
//
|
||
|
// decrease voltage level 3
|
||
|
m_system_configuration.phase_alert_monitor.voltage_decrease_level_3.level = 149.5;
|
||
|
m_system_configuration.phase_alert_monitor.voltage_decrease_level_3.period = 2.0;
|
||
|
//
|
||
|
// current overload level 1 120% 60s
|
||
|
m_system_configuration.phase_alert_monitor.current_overload_level_1.level = 3.0 * 14.4;
|
||
|
m_system_configuration.phase_alert_monitor.current_overload_level_1.period = 60.0;
|
||
|
//
|
||
|
// current overload level 2 130% 10s
|
||
|
m_system_configuration.phase_alert_monitor.current_overload_level_2.level = 3.0 * 15.6;
|
||
|
m_system_configuration.phase_alert_monitor.current_overload_level_2.period = 10.0;
|
||
|
//
|
||
|
// current overload level 3 150% 1ms
|
||
|
m_system_configuration.phase_alert_monitor.current_overload_level_3.level = 3.0 * 18.0;
|
||
|
m_system_configuration.phase_alert_monitor.current_overload_level_3.period = 0.001;
|
||
|
//
|
||
|
// current invertor overload level 1 110% 60s
|
||
|
m_system_configuration.phase_alert_monitor.current_invertor_overload_level_1.level = 13.2;
|
||
|
m_system_configuration.phase_alert_monitor.current_invertor_overload_level_1.period = 60.0;
|
||
|
//
|
||
|
// current invertor overload level 2 130% 10s
|
||
|
m_system_configuration.phase_alert_monitor.current_invertor_overload_level_2.level = 15.6;
|
||
|
m_system_configuration.phase_alert_monitor.current_invertor_overload_level_2.period = 10.0;
|
||
|
//
|
||
|
// current invertor overload level 3 150% 1ms
|
||
|
m_system_configuration.phase_alert_monitor.current_invertor_overload_level_3.level = 18.0;
|
||
|
m_system_configuration.phase_alert_monitor.current_invertor_overload_level_3.period = 0.001;
|
||
|
|
||
|
|
||
|
//
|
||
|
//DIGITAL INPUTS
|
||
|
//
|
||
|
m_system_configuration.digital_input_config.period = 200.0e-3; //3001 - 3020
|
||
|
|
||
|
//
|
||
|
// FAN CONTROL
|
||
|
//
|
||
|
m_system_configuration.fan_control.timer_period = 5.0*60.0;
|
||
|
|
||
|
|
||
|
//
|
||
|
// Generator ABC
|
||
|
//
|
||
|
m_system_configuration.generator_abc.amplitude = 1.0;
|
||
|
m_system_configuration.generator_abc.frequency = 2.0*FP_PI*50.0;
|
||
|
m_system_configuration.generator_abc.phase_shift = 0.0;
|
||
|
|
||
|
|
||
|
//
|
||
|
// Reference PWM-Generator
|
||
|
//
|
||
|
//m_system_configuration.generator_pwm.frequency = 2.0*FP_PI*1.0;
|
||
|
//m_system_configuration.generator_abc.phase_shift = 0.0;
|
||
|
|
||
|
//m_system_configuration.gen_inp_volt.amplitude.direct.d = 220.0;
|
||
|
//
|
||
|
//m_system_configuration.gen_out_volt.amplitude.direct.d = 220.0;
|
||
|
//m_system_configuration.gen_out_volt.phase.direct.phase = 0.122756;//FP_PI/4.0;
|
||
|
//
|
||
|
//m_system_configuration.gen_out_current.amplitude.direct.d = 50.0;
|
||
|
//m_system_configuration.gen_out_current.phase.direct.phase = 0.122756;//FP_PI/3.0;
|
||
|
|
||
|
|
||
|
//
|
||
|
// Harmonica Analyzer
|
||
|
//
|
||
|
m_system_configuration.ph_harmonica_5.time = 50.0e-3;
|
||
|
m_system_configuration.ph_harmonica_5.a3 = 3.0;
|
||
|
m_system_configuration.ph_harmonica_5.a2 = 4.25;
|
||
|
m_system_configuration.ph_harmonica_5.a1 = 3.0;
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
// Reference Intensity Idref Iqref in Start Mode
|
||
|
//
|
||
|
m_system_configuration.intensity_id_iq_references.damp_factor = 0.7071;
|
||
|
m_system_configuration.intensity_id_iq_references.time = 20.0e-3;
|
||
|
|
||
|
|
||
|
//
|
||
|
// Regulators
|
||
|
//
|
||
|
#if TYPECONTROL == VECTORCONTROL
|
||
|
//
|
||
|
m_system_configuration.regulator_voltage_load_dq.gain = 0.25;
|
||
|
m_system_configuration.regulator_voltage_load_dq.time = 40.0e-3;
|
||
|
m_system_configuration.regulator_voltage_load_dq.high_saturation = 950.0;
|
||
|
m_system_configuration.regulator_voltage_load_dq.low_saturation = -950.0;
|
||
|
//
|
||
|
//m_system_configuration. = 1.0;
|
||
|
m_system_configuration.integrator_voltage_dq.time = 1.0;
|
||
|
m_system_configuration.integrator_voltage_dq.high_saturation = 1.0;;
|
||
|
m_system_configuration.integrator_voltage_dq.low_saturation = -1.0;
|
||
|
//
|
||
|
//m_system_configuration. = 1.0;
|
||
|
//m_system_configuration. = 1.0;
|
||
|
//m_system_configuration. = 1.0;
|
||
|
//m_system_configuration. = -1.0;
|
||
|
//
|
||
|
m_system_configuration.regulator_current_load_dq.gain = 1.0;
|
||
|
// m_system_configuration.regulator_current_load_dq.time = 0.016;
|
||
|
m_system_configuration.regulator_current_load_dq.high_saturation = 200.0;
|
||
|
m_system_configuration.regulator_current_load_dq.low_saturation = -200.0;
|
||
|
//
|
||
|
//m_system_configuration. = 1.0;
|
||
|
//m_system_configuration. = 0.016;
|
||
|
//m_system_configuration. = 200.0;
|
||
|
//m_system_configuration. = -200.0;
|
||
|
//
|
||
|
//m_system_configuration. = 1.0;
|
||
|
m_system_configuration.referencer_current_bypass_dq.time = 0.016;
|
||
|
m_system_configuration.referencer_current_bypass_dq.high_saturation = 200.0;
|
||
|
m_system_configuration.referencer_current_bypass_dq.low_saturation = -200.0;
|
||
|
//
|
||
|
#endif
|
||
|
|
||
|
#if TYPECONTROL == SCALARCONTROL
|
||
|
//
|
||
|
m_system_configuration.regulator_voltage_load_active_reactive.gain = 0.25;
|
||
|
m_system_configuration.regulator_voltage_load_active_reactive.time = 40.0e-3;
|
||
|
m_system_configuration.regulator_voltage_load_active_reactive.high_saturation = 950.0;
|
||
|
m_system_configuration.regulator_voltage_load_active_reactive.low_saturation = -950.0;
|
||
|
//
|
||
|
m_system_configuration.regulator_current_limit.gain = 1.0;
|
||
|
m_system_configuration.regulator_current_limit.time = 1.0;
|
||
|
m_system_configuration.regulator_current_limit.high_saturation = 1.0;;
|
||
|
m_system_configuration.regulator_current_limit.low_saturation = -1.0;
|
||
|
//
|
||
|
m_system_configuration.regulator_current_pfc.gain = 1.0;
|
||
|
m_system_configuration.regulator_current_pfc.time = 1.0;
|
||
|
m_system_configuration.regulator_current_pfc.high_saturation = 1.0;
|
||
|
m_system_configuration.regulator_current_pfc.low_saturation = -1.0;
|
||
|
//
|
||
|
m_system_configuration.current_regulator_active.gain = 1.0;
|
||
|
m_system_configuration.current_regulator_active.time = 0.016;
|
||
|
m_system_configuration.current_regulator_active.high_saturation = 200.0;
|
||
|
m_system_configuration.current_regulator_active.low_saturation = -200.0;
|
||
|
//
|
||
|
m_system_configuration.current_regulator_reactive.gain = 1.0;
|
||
|
m_system_configuration.current_regulator_reactive.time = 0.016;
|
||
|
m_system_configuration.current_regulator_reactive.high_saturation = 200.0;
|
||
|
m_system_configuration.current_regulator_reactive.low_saturation = -200.0;
|
||
|
//
|
||
|
m_system_configuration.current_referencer.gain = 1.0;
|
||
|
m_system_configuration.current_referencer.time = 0.016;
|
||
|
m_system_configuration.current_referencer.high_saturation = 200.0;
|
||
|
m_system_configuration.current_referencer.low_saturation = -200.0;
|
||
|
//
|
||
|
#endif
|
||
|
//<>
|
||
|
|
||
|
|
||
|
//
|
||
|
// Timers
|
||
|
//
|
||
|
m_system_configuration.timer_start.period = 2.0;
|
||
|
m_system_configuration.timer_stop.period = 2.0;
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
}//hard_code_configuration()
|
||
|
//
|
||
|
} /* namespace SYSCTRL */
|
||
|
|