/* * another_bs.c * * Created on: 13 нояб. 2024 г. * Author: Evgeniy_Sokolov */ #include #include #include #include #include #include #include #include "IQmathLib.h" #include "mathlib.h" #include #include "adc_tools.h" #include "CAN_project.h" #include "CAN_Setup.h" #include "global_time.h" #include "v_rotor.h" #include "ukss_tools.h" #include "another_bs.h" #include "control_station_project.h" #include "control_station.h" #include "can_bs2bs.h" #include "sync_tools.h" #include "vector_control.h" #include "master_slave.h" #include "digital_filters.h" ////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// void read_data_from_bs(void) { int g; if (control_station.alive_control_station[CONTROL_STATION_ANOTHER_BS]) { g = Unites[ANOTHER_BSU1_CAN_DEVICE][5]; edrk.int_koef_ogran_power_another_bs = g; edrk.iq_koef_ogran_power_another_bs = ((float)edrk.int_koef_ogran_power_another_bs); g = Unites[ANOTHER_BSU1_CAN_DEVICE][6]; edrk.power_kw_another_bs = g; edrk.iq_power_kw_another_bs = _IQ(((float)edrk.power_kw_another_bs * 1000.0)/NORMA_ACP/NORMA_ACP); g = Unites[ANOTHER_BSU1_CAN_DEVICE][7]; edrk.active_post_upravl_another_bs = g; g = Unites[ANOTHER_BSU1_CAN_DEVICE][9]; edrk.Ready1_another_bs = g; g = Unites[ANOTHER_BSU1_CAN_DEVICE][10]; edrk.Ready2_another_bs = g; g = Unites[ANOTHER_BSU1_CAN_DEVICE][11]; edrk.MasterSlave_another_bs = g; g = Unites[ANOTHER_BSU1_CAN_DEVICE][3] & 0x1; edrk.ump_cmd_another_bs = g; g = (Unites[ANOTHER_BSU1_CAN_DEVICE][3] & 0x2) >> 1; edrk.qtv_cmd_another_bs = g; g = Unites[ANOTHER_BSU1_CAN_DEVICE][13]; edrk.errors_another_bs_from_can = g; } else { edrk.errors_another_bs_from_can = 0; } } ////////////////////////////////////////////////////////// unsigned int read_cmd_sbor_from_bs(void) { unsigned int g; g = Unites[ANOTHER_BSU1_CAN_DEVICE][4]; return g; } void UpdateTableSecondBS(void) { int cmd; int i,k; static unsigned int counter_sum_errors = 0; Unites2SecondBS[0]++; Unites2SecondBS[1] = global_time.miliseconds; Unites2SecondBS[2] = edrk.flag_second_PCH; Unites2SecondBS[3] = (edrk.to_shema.bits.QTV_ON_OFF << 1) | (edrk.to_shema.bits.UMP_ON_OFF); Unites2SecondBS[4] = edrk.SumSbor; Unites2SecondBS[5] = edrk.int_koef_ogran_power; Unites2SecondBS[6] = (int)edrk.power_kw; Unites2SecondBS[7] = (int)edrk.active_post_upravl; Unites2SecondBS[8] = (int)edrk.power_kw; Unites2SecondBS[9] = edrk.Status_Ready.bits.ready1; Unites2SecondBS[10] = edrk.Status_Ready.bits.ready_final; Unites2SecondBS[11] = edrk.MasterSlave; Unites2SecondBS[12] = _IQtoF(vect_control.iqId_min) * NORMA_ACP; Unites2SecondBS[13] = pause_detect_error(&counter_sum_errors, 10, edrk.summ_errors); for (i=0;i