Добавлены некоторые IO и изменены стеки задач
This commit is contained in:
parent
180eadea87
commit
af6260fc86
95
Model_Task.c
95
Model_Task.c
|
|
@ -11,6 +11,31 @@
|
||||||
#define LOG_SIGN "ModelTask"
|
#define LOG_SIGN "ModelTask"
|
||||||
#define LOGGER env->logger
|
#define LOGGER env->logger
|
||||||
|
|
||||||
|
tStatus_Sensor_For_Model model_Status_Sensor_For_Model_input;
|
||||||
|
tStatus_Actuator_For_Model model_Status_Actuator_DoorsActuator_For_Model_input;
|
||||||
|
tStatus_Duct_Tgt_For_Model model_Status_Duct_Tgt_For_Model_input;
|
||||||
|
tStatus_Eva_Tgt_For_Model model_Status_Eva_Tgt_For_Model_input;
|
||||||
|
tStatus_IO_For_Model model_Status_IO_For_Model_input;
|
||||||
|
tStatus_Pwm_For_Model model_Status_Pwm_For_Model_input;
|
||||||
|
tStatus_eComp_For_Model model_Status_eComp_For_Model_input;
|
||||||
|
tStatus_External_For_Model model_Status_External_For_Model_input;
|
||||||
|
tStatus_EMS_For_Model model_Status_EMS_For_Model_input;
|
||||||
|
tStatus_Ionizer_Aroma_For_Model model_Status_Ionizer_Aroma_For_Model_input;
|
||||||
|
tStatus_Duct_Select_For_Model model_Status_Duct_Select_For_Model_input;
|
||||||
|
|
||||||
|
tStatus_Set_For_Model model_Status_Set_For_Model_output;
|
||||||
|
tStatus_Actuator_For_Model model_Status_Actuator_DoorsActuator_For_Model_output;
|
||||||
|
tStatus_Duct_Tgt_For_Model model_Status_Duct_Tgt_For_Model_output;
|
||||||
|
tStatus_Eva_Tgt_For_Model model_Status_Eva_Tgt_For_Model_output;
|
||||||
|
tStatus_IO_For_Model model_Status_IO_For_Model_output;
|
||||||
|
tStatus_Pwm_For_Model model_Status_Pwm_For_Model_output;
|
||||||
|
tStatus_eComp_For_Model model_Status_eComp_For_Model_output;
|
||||||
|
tStatus_External_For_Model model_Status_External_For_Model_output;
|
||||||
|
tStatus_EMS_For_Model model_Status_EMS_For_Model_output;
|
||||||
|
tStatus_Ionizer_Aroma_For_Model model_Status_Ionizer_Aroma_For_Model_output;
|
||||||
|
tStatus_Duct_Select_For_Model model_Status_Duct_Select_For_Model_output;
|
||||||
|
|
||||||
|
|
||||||
void ModelTask_Init(
|
void ModelTask_Init(
|
||||||
tModelTask *env,
|
tModelTask *env,
|
||||||
tLinTaskActuator *linTaskActuator1,
|
tLinTaskActuator *linTaskActuator1,
|
||||||
|
|
@ -32,6 +57,8 @@ void ModelTask_Init(
|
||||||
tCanSpamDebugTransmitter *canSpamDebugTransmitter,
|
tCanSpamDebugTransmitter *canSpamDebugTransmitter,
|
||||||
tDiagnostic *diagnostic,
|
tDiagnostic *diagnostic,
|
||||||
|
|
||||||
|
tCanUds *canUds,
|
||||||
|
|
||||||
tLoggerInterface *logger
|
tLoggerInterface *logger
|
||||||
) {
|
) {
|
||||||
HVAC_model_initialize();
|
HVAC_model_initialize();
|
||||||
|
|
@ -46,6 +73,8 @@ void ModelTask_Init(
|
||||||
env->pwms = pwms;
|
env->pwms = pwms;
|
||||||
env->gpios = gpios;
|
env->gpios = gpios;
|
||||||
|
|
||||||
|
env->canUds = canUds;
|
||||||
|
|
||||||
env->adc0Task = adc0Task;
|
env->adc0Task = adc0Task;
|
||||||
env->adc1Task = adc1Task;
|
env->adc1Task = adc1Task;
|
||||||
|
|
||||||
|
|
@ -261,19 +290,35 @@ static _Noreturn void ModelTask_Thread(tModelTask *env) {
|
||||||
getCmdBusADC2Data(env->adc1Task, (CmdBusADC2Data *)&rtDW.ADC_Data_Model.VN7008AJ_DIAG_FrontLINActuatorPowerDriverAB);
|
getCmdBusADC2Data(env->adc1Task, (CmdBusADC2Data *)&rtDW.ADC_Data_Model.VN7008AJ_DIAG_FrontLINActuatorPowerDriverAB);
|
||||||
|
|
||||||
|
|
||||||
|
//начало--------------------------------------------------PWM-----------------------------------------------------------
|
||||||
PWM_Get.pwmPercentFront = env->pwms->pwmFrontCaptureIO.getPwm(env->pwms->pwmFrontCaptureIO.env);
|
PWM_Get.pwmPercentFront = env->pwms->pwmFrontCaptureIO.getPwm(env->pwms->pwmFrontCaptureIO.env);
|
||||||
PWM_Get.pwmPercentRear = env->pwms->pwmRearCaptureIO.getPwm(env->pwms->pwmRearCaptureIO.env);
|
PWM_Get.pwmPercentRear = env->pwms->pwmRearCaptureIO.getPwm(env->pwms->pwmRearCaptureIO.env);
|
||||||
PWM_Get.pwmPercentFrontReserved = env->pwms->pwmFrontCaptureIO.getPwm(env->pwms->pwmFrontReservedCaptureIO.env);
|
PWM_Get.pwmPercentFrontReserved = env->pwms->pwmFrontCaptureIO.getPwm(env->pwms->pwmFrontReservedCaptureIO.env);
|
||||||
PWM_Get.pwmPercentRearReserved = env->pwms->pwmRearCaptureIO.getPwm(env->pwms->pwmRearReservedCaptureIO.env);
|
PWM_Get.pwmPercentRearReserved = env->pwms->pwmRearCaptureIO.getPwm(env->pwms->pwmRearReservedCaptureIO.env);
|
||||||
|
|
||||||
|
model_Status_Pwm_For_Model_input.Pwm_Front = PWM_Get.pwmPercentFront * 10;
|
||||||
|
model_Status_Pwm_For_Model_input.Pwm_Rear = PWM_Get.pwmPercentRear * 10;
|
||||||
|
//конец--------------------------------------------------PWM------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
//начало--------------------------------------------------CAN-----------------------------------------------------------
|
||||||
get_CanSpamReceiver(env->canSpamReceiver);
|
get_CanSpamReceiver(env->canSpamReceiver);
|
||||||
|
|
||||||
|
if (model_Status_Set_For_Model_output.EMS == 1) {
|
||||||
|
rtDW.CCUCAN_EMS_HVC_REQ_MSG_MODEL.EMS_eCompChiller_Req = model_Status_EMS_For_Model_output.EMS_Chiller_Req;
|
||||||
|
}
|
||||||
|
|
||||||
|
model_Status_EMS_For_Model_input.EMS_Chiller_Req = rtDW.CCUCAN_EMS_HVC_REQ_MSG_MODEL.EMS_eCompChiller_Req;
|
||||||
|
//конец--------------------------------------------------CAN------------------------------------------------------------
|
||||||
|
|
||||||
Lin4_Output_Get_From_Model(env->lin4TaskSensor);
|
Lin4_Output_Get_From_Model(env->lin4TaskSensor);
|
||||||
Lin5_Output_Get_From_Model(env->lin5TaskSensor);
|
Lin5_Output_Get_From_Model(env->lin5TaskSensor);
|
||||||
|
|
||||||
HVAC_model_step();
|
HVAC_model_step();
|
||||||
|
|
||||||
|
CanUdsInput_Set_Model(env->canUds);
|
||||||
|
CanUdsOutput_Get_Model(env->canUds);
|
||||||
|
|
||||||
setActuatorBusy(env);
|
setActuatorBusy(env);
|
||||||
|
|
||||||
// Включение 5V (0 - ВКЛ)
|
// Включение 5V (0 - ВКЛ)
|
||||||
|
|
@ -315,18 +360,64 @@ static _Noreturn void ModelTask_Thread(tModelTask *env) {
|
||||||
GpioPinSet(&env->gpios->power.BTS5120_2EKA_ShutoffValvePowerTXV.ShutOffTXV_EN_Diag, true);
|
GpioPinSet(&env->gpios->power.BTS5120_2EKA_ShutoffValvePowerTXV.ShutOffTXV_EN_Diag, true);
|
||||||
GpioPinSet(&env->gpios->power.BTS5120_2EKA_ShutoffValvePowerTXV.ShutOffTXV2_EN, rtY.PowerEnable_Model.ShutOffTXV2_EN);
|
GpioPinSet(&env->gpios->power.BTS5120_2EKA_ShutoffValvePowerTXV.ShutOffTXV2_EN, rtY.PowerEnable_Model.ShutOffTXV2_EN);
|
||||||
|
|
||||||
|
//начало--------------------------------------------------PWM-----------------------------------------------------------
|
||||||
|
if (model_Status_Set_For_Model_output.Pwm == 1) {
|
||||||
|
rtY.PWM_Get_f.pwmPercentFront = model_Status_Pwm_For_Model_output.Pwm_Front / 10;
|
||||||
|
rtY.PWM_Get_f.pwmPercentRear = model_Status_Pwm_For_Model_output.Pwm_Rear / 10;
|
||||||
|
}
|
||||||
|
|
||||||
env->pwms->pwmFrontIo.setActivePercent(env->pwms->pwmFrontIo.env, rtY.PWM_Get_f.pwmPercentFront);
|
env->pwms->pwmFrontIo.setActivePercent(env->pwms->pwmFrontIo.env, rtY.PWM_Get_f.pwmPercentFront);
|
||||||
env->pwms->pwmRearIo.setActivePercent(env->pwms->pwmRearIo.env, rtY.PWM_Get_f.pwmPercentRear);
|
env->pwms->pwmRearIo.setActivePercent(env->pwms->pwmRearIo.env, rtY.PWM_Get_f.pwmPercentRear);
|
||||||
env->pwms->pwmFrontReservedIo.setActivePercent(env->pwms->pwmFrontReservedIo.env, rtY.PWM_Get_f.pwmPercentFrontReserved);
|
env->pwms->pwmFrontReservedIo.setActivePercent(env->pwms->pwmFrontReservedIo.env, rtY.PWM_Get_f.pwmPercentFrontReserved);
|
||||||
env->pwms->pwmRearReservedIo.setActivePercent(env->pwms->pwmRearReservedIo.env, rtY.PWM_Get_f.pwmPercentRearReserved);
|
env->pwms->pwmRearReservedIo.setActivePercent(env->pwms->pwmRearReservedIo.env, rtY.PWM_Get_f.pwmPercentRearReserved);
|
||||||
|
//конец--------------------------------------------------PWM------------------------------------------------------------
|
||||||
|
|
||||||
|
//начало--------------------------------------------------CAN-----------------------------------------------------------
|
||||||
memcpy(&env->ccu_candb_tx.CCU_Errors, &rtY.CCU_Errors_model, sizeof(env->ccu_candb_tx.CCU_Errors));
|
memcpy(&env->ccu_candb_tx.CCU_Errors, &rtY.CCU_Errors_model, sizeof(env->ccu_candb_tx.CCU_Errors));
|
||||||
memcpy(&env->ccu_candb_tx.CCU_Stat1, &rtY.CCU_Stat1_model, sizeof(env->ccu_candb_tx.CCU_Stat1));
|
memcpy(&env->ccu_candb_tx.CCU_Stat1, &rtY.CCU_Stat1_model, sizeof(env->ccu_candb_tx.CCU_Stat1));
|
||||||
memcpy(&env->ccu_candb_tx.CCU_Stat2, &rtY.CCU_Stat2_model, sizeof(env->ccu_candb_tx.CCU_Stat2));
|
memcpy(&env->ccu_candb_tx.CCU_Stat2, &rtY.CCU_Stat2_model, sizeof(env->ccu_candb_tx.CCU_Stat2));
|
||||||
memcpy(&env->ccu_candb_tx.CCU_HVC_Req_Msg, &rtY.CCUCAN_HVC_REQ_MSG_MODEL, sizeof(env->ccu_candb_tx.CCU_HVC_Req_Msg));
|
memcpy(&env->ccu_candb_tx.CCU_HVC_Req_Msg, &rtY.CCUCAN_HVC_REQ_MSG_MODEL, sizeof(env->ccu_candb_tx.CCU_HVC_Req_Msg));
|
||||||
memcpy(&env->ccu_candb_tx.CCU_Msg3, &rtY.CCU_Msg3_model, sizeof(env->ccu_candb_tx.CCU_Msg3));
|
memcpy(&env->ccu_candb_tx.CCU_Msg3, &rtY.CCU_Msg3_model, sizeof(env->ccu_candb_tx.CCU_Msg3));
|
||||||
memcpy(&env->ccu_candb_tx.CCU_Msg1, &rtY.CCU_Msg1_model, sizeof(env->ccu_candb_tx.CCU_Msg1));
|
memcpy(&env->ccu_candb_tx.CCU_Msg1, &rtY.CCU_Msg1_model, sizeof(env->ccu_candb_tx.CCU_Msg1));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (model_Status_Set_For_Model_output.eComp == 1) {
|
||||||
|
env->ccu_candb_tx.CCU_HVC_Req_Msg.CCU_eCompSpeedReq_Val_ro = model_Status_eComp_For_Model_output.Pwm_Front;
|
||||||
|
|
||||||
|
// request to EMS for closing the low temperature circuit valve
|
||||||
|
// 2 : "Open Valve request"
|
||||||
|
// 1 : "Close Valve request"
|
||||||
|
// 0 : "No request"
|
||||||
|
if (model_Status_eComp_For_Model_output.LowTempValve == 0) {
|
||||||
|
env->ccu_candb_tx.CCU_HVC_Req_Msg.CCU_LowTempValve_Req = 1;
|
||||||
|
} else {
|
||||||
|
env->ccu_candb_tx.CCU_HVC_Req_Msg.CCU_LowTempValve_Req = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0 = Off!0 = On
|
||||||
|
//1 Byte
|
||||||
|
//[0x00] Off
|
||||||
|
//[0x01..0xFF] On; Inverse value: 0x01
|
||||||
|
if (model_Status_eComp_For_Model_output.eComp_Statue_Request == 0) {
|
||||||
|
env->ccu_candb_tx.CCU_HVC_Req_Msg.CCU_eCompReq_Stat = 0;
|
||||||
|
} else {
|
||||||
|
env->ccu_candb_tx.CCU_HVC_Req_Msg.CCU_eCompReq_Stat = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
model_Status_eComp_For_Model_input.Pwm_Front = env->ccu_candb_tx.CCU_HVC_Req_Msg.CCU_eCompSpeedReq_Val_ro;
|
||||||
|
model_Status_eComp_For_Model_input.LowTempValve = env->ccu_candb_tx.CCU_HVC_Req_Msg.CCU_LowTempValve_Req;
|
||||||
|
model_Status_eComp_For_Model_input.eComp_Statue_Request = env->ccu_candb_tx.CCU_HVC_Req_Msg.CCU_eCompReq_Stat;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (model_Status_Set_For_Model_output.External == 1) {
|
||||||
|
env->ccu_candb_tx.CCU_Msg3.CCU_FAN_Req = model_Status_External_For_Model_output.CoolingFan / 10;
|
||||||
|
}
|
||||||
|
model_Status_External_For_Model_input.CoolingFan = env->ccu_candb_tx.CCU_Msg3.CCU_FAN_Req;
|
||||||
|
|
||||||
|
|
||||||
set_CanSpamTransmitter(env->canSpamTransmitter, &env->ccu_candb_tx);
|
set_CanSpamTransmitter(env->canSpamTransmitter, &env->ccu_candb_tx);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -348,7 +439,7 @@ static _Noreturn void ModelTask_Thread(tModelTask *env) {
|
||||||
memcpy(&env->ccu_candb_dbg_tx.dbg_Auto_Duct, &rtY.dbgCAN_Auto_Duct_model, sizeof(env->ccu_candb_dbg_tx.dbg_Auto_Duct));
|
memcpy(&env->ccu_candb_dbg_tx.dbg_Auto_Duct, &rtY.dbgCAN_Auto_Duct_model, sizeof(env->ccu_candb_dbg_tx.dbg_Auto_Duct));
|
||||||
|
|
||||||
memcpy(&env->ccu_candb_dbg_tx.dbg_Logic_Valve, &rtY.dbg_Logic_Valve_model, sizeof(env->ccu_candb_dbg_tx.dbg_Logic_Valve));
|
memcpy(&env->ccu_candb_dbg_tx.dbg_Logic_Valve, &rtY.dbg_Logic_Valve_model, sizeof(env->ccu_candb_dbg_tx.dbg_Logic_Valve));
|
||||||
|
//конец--------------------------------------------------CAN------------------------------------------------------------
|
||||||
|
|
||||||
memcpy(&env->ccu_candb_dbg_tx.dbg_Drs, &rtY.dbg_Drs_t_model, sizeof(env->ccu_candb_dbg_tx.dbg_Drs));
|
memcpy(&env->ccu_candb_dbg_tx.dbg_Drs, &rtY.dbg_Drs_t_model, sizeof(env->ccu_candb_dbg_tx.dbg_Drs));
|
||||||
memcpy(&env->ccu_candb_dbg_tx.dbg_LIN_AirQS_Stat, &rtY.dbg_LIN_AirQS_Stat_t_model, sizeof(env->ccu_candb_dbg_tx.dbg_Logic_Valve));
|
memcpy(&env->ccu_candb_dbg_tx.dbg_LIN_AirQS_Stat, &rtY.dbg_LIN_AirQS_Stat_t_model, sizeof(env->ccu_candb_dbg_tx.dbg_Logic_Valve));
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
#include "CanSpamReceiver.h"
|
#include "CanSpamReceiver.h"
|
||||||
#include "DiagnosticTask.h"
|
#include "DiagnosticTask.h"
|
||||||
#include "LinSensorTasks.h"
|
#include "LinSensorTasks.h"
|
||||||
|
#include "CanUds.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
|
|
@ -48,6 +49,8 @@ typedef struct {
|
||||||
tLin4TaskSensor *lin4TaskSensor;
|
tLin4TaskSensor *lin4TaskSensor;
|
||||||
tLin5TaskSensor *lin5TaskSensor;
|
tLin5TaskSensor *lin5TaskSensor;
|
||||||
|
|
||||||
|
tCanUds *canUds;
|
||||||
|
|
||||||
bool triggerCommand1;
|
bool triggerCommand1;
|
||||||
bool triggerCommand2;
|
bool triggerCommand2;
|
||||||
bool triggerCommand3;
|
bool triggerCommand3;
|
||||||
|
|
@ -81,6 +84,7 @@ void ModelTask_Init(
|
||||||
tCanSpamTransmitter *canSpamTransmitter,
|
tCanSpamTransmitter *canSpamTransmitter,
|
||||||
tCanSpamDebugTransmitter *canSpamDebugTransmitter,
|
tCanSpamDebugTransmitter *canSpamDebugTransmitter,
|
||||||
tDiagnostic *diagnostic,
|
tDiagnostic *diagnostic,
|
||||||
|
tCanUds *canUds,
|
||||||
tLoggerInterface *logger
|
tLoggerInterface *logger
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue