115 lines
2.5 KiB
C
115 lines
2.5 KiB
C
/*
|
|
* plausibility_check.c
|
|
*
|
|
* Created on: Mar 18, 2025
|
|
* Author: janek
|
|
*/
|
|
#include "plausibility_check.h"
|
|
|
|
extern enable_gpios update_ports;
|
|
extern current_measurements current_measurements_adc_val;
|
|
volatile err_states error;
|
|
extern int inhibit_SDC;
|
|
|
|
void check_plausibility() {
|
|
if (!update_ports.portb.sdc || inhibit_SDC == 1) {error.group1.sdc_open = 1;}
|
|
else {error.group1.sdc_open = 0;}
|
|
|
|
if (update_ports.porta.acc_cooling == 1 && current_measurements_adc_val.acc_cooling == 0) {
|
|
error.group1.noload_acc_cooling = 1;
|
|
}
|
|
else {
|
|
error.group1.noload_acc_cooling = 0;
|
|
}
|
|
|
|
if (update_ports.porta.ts_cooling == 1 && current_measurements_adc_val.ts_cooling == 0) {
|
|
error.group1.noload_ts_cooling = 1;
|
|
}
|
|
else {
|
|
error.group1.noload_ts_cooling = 0;
|
|
}
|
|
|
|
if (update_ports.porta.drs == 1 && current_measurements_adc_val.drs == 0) {
|
|
error.group1.noload_drs = 1;
|
|
}
|
|
else {
|
|
error.group1.noload_drs = 0;
|
|
}
|
|
|
|
if (update_ports.porta.acu == 1 && current_measurements_adc_val.acu == 0) {
|
|
error.group1.noload_acu = 1;
|
|
}
|
|
else {
|
|
error.group1.noload_acu = 0;
|
|
}
|
|
|
|
if (update_ports.porta.epsc == 1 && current_measurements_adc_val.epsc == 0) {
|
|
error.group1.noload_epsc = 1;
|
|
}
|
|
else {
|
|
error.group1.noload_epsc = 0;
|
|
}
|
|
|
|
if (update_ports.porta.inverter == 1 && current_measurements_adc_val.inverter == 0) {
|
|
error.group1.noload_inverter = 1;
|
|
}
|
|
else {
|
|
error.group1.noload_inverter = 0;
|
|
}
|
|
|
|
if (update_ports.porta.lidar == 1 && current_measurements_adc_val.lidar == 0) {
|
|
error.group1.noload_lidar = 1;
|
|
}
|
|
else {
|
|
error.group1.noload_lidar = 0;
|
|
}
|
|
|
|
if (update_ports.porta.misc == 1 && current_measurements_adc_val.misc == 0) {
|
|
error.group2.noload_misc = 1;
|
|
}
|
|
else {
|
|
error.group2.noload_misc = 0;
|
|
}
|
|
|
|
if (update_ports.portb.alwayson == 1 && current_measurements_adc_val.alwayson == 0) {
|
|
error.group2.noload_alwayson = 1;
|
|
}
|
|
else {
|
|
error.group2.noload_alwayson = 0;
|
|
}
|
|
|
|
if (update_ports.portb.sdc == 1 && current_measurements_adc_val.sdc == 0) {
|
|
error.group2.noload_sdc = 1;
|
|
}
|
|
else {
|
|
error.group2.noload_sdc = 0;
|
|
}
|
|
|
|
if (update_ports.portb.ebs1 == 1 && current_measurements_adc_val.ebs1 == 0) {
|
|
error.group2.noload_ebs1 = 1;
|
|
}
|
|
else {
|
|
error.group2.noload_ebs1 = 0;
|
|
}
|
|
|
|
if (update_ports.portb.ebs2 == 1 && current_measurements_adc_val.ebs2 == 0) {
|
|
error.group2.noload_ebs2 = 1;
|
|
}
|
|
else {
|
|
error.group2.noload_ebs2 = 0;
|
|
}
|
|
|
|
if (update_ports.portb.ebs3 == 1 && current_measurements_adc_val.ebs3 == 0) {
|
|
error.group2.noload_ebs3 = 1;
|
|
}
|
|
else {
|
|
error.group2.noload_ebs3 = 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|