CTS-SAT-1-OBC-Firmware
Loading...
Searching...
No Matches
eps_power_management.c File Reference
#include "eps_drivers/eps_power_management.h"
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include "rtos_tasks/rtos_eps_tasks.h"
#include "eps_drivers/eps_types_to_json.h"
#include "eps_drivers/eps_commands.h"
#include "log/log.h"
Include dependency graph for eps_power_management.c:

Functions

uint8_t EPS_monitor_and_disable_overcurrent_channels ()
 Monitors the power consumption of each channel and logs the data in JSON format.
 
uint8_t EPS_log_pdu_json (const EPS_struct_pdu_housekeeping_data_eng_t *EPS_pdu_housekeeping_data_eng)
 Logs the PDU housekeeping data in JSON format.
 
void EPS_channel_management (const EPS_struct_pdu_housekeeping_data_eng_t *EPS_pdu_housekeeping_data_eng)
 Monitor the power consumption of each channel and disable any channels that exceed a certain threshold.
 
void EPS_CMD_power_management_set_current_threshold (uint8_t channel, uint16_t threshold)
 

Variables

uint16_t EPS_current_mA_threshhold [32]
 

Function Documentation

◆ EPS_channel_management()

void EPS_channel_management ( const EPS_struct_pdu_housekeeping_data_eng_t * EPS_pdu_housekeeping_data_eng)

Monitor the power consumption of each channel and disable any channels that exceed a certain threshold.

Parameters
[in]EPS_pdu_housekeeping_data_engPDU housekeeping data with the current power consumption of each channel
[in]prev_EPS_pdu_housekeeping_data_engPrevious PDU housekeeping data with the previous power consumption of each chan///
Note
This function will iterate over each channel and check if the power consumption has increased or decreased by more than a certain threshold. If the power consumption has increased or decreased by more than the threshold, the channel will be disabled. The function will log an error message if the channel is disabled due to a power issue.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EPS_CMD_power_management_set_current_threshold()

void EPS_CMD_power_management_set_current_threshold ( uint8_t channel,
uint16_t threshold )
Here is the caller graph for this function:

◆ EPS_log_pdu_json()

uint8_t EPS_log_pdu_json ( const EPS_struct_pdu_housekeeping_data_eng_t * EPS_pdu_housekeeping_data_eng)

Logs the PDU housekeeping data in JSON format.

Parameters
[in]EPS_pdu_housekeeping_data_engPDU housekeeping data to be logged
Note
This function will log the PDU housekeeping data in JSON format to the error log.
If the conversion to JSON fails, it will log an error with the error status.
Otherwise, it will log the JSON string to the error log.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EPS_monitor_and_disable_overcurrent_channels()

uint8_t EPS_monitor_and_disable_overcurrent_channels ( )

Monitors the power consumption of each channel and logs the data in JSON format.

This function will obtain the PDU housekeeping data and log the data in JSON format. If this is the first time the function is called, it will save the data for future comparisons. It will then check if the power consumption has increased or decreased by more than a certain threshold. If it has, it will disable the channel and log an error message. The function will log an error message if the channel is disabled due to a power issue.

Returns
0 if the function was successful, 1 if there was an error.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ EPS_current_mA_threshhold

uint16_t EPS_current_mA_threshhold[32]