NetSim Source Code Help
Loading...
Searching...
No Matches
BatteryModel.c File Reference
#include "main.h"
#include "Animation.h"
#include "BatteryModel.h"
Include dependency graph for BatteryModel.c:

Go to the source code of this file.

Data Structures

struct  stru_mode
 
struct  stru_battery
 
struct  stru_batteryMetrics
 

Macros

#define _BATTERY_MODEL_CODE_
 

Typedefs

typedef struct stru_mode BATTERYMODE
 
typedef struct stru_modeptrBATTERYMODE
 
typedef struct stru_battery BATTERY
 
typedef struct stru_batteryptrBATTERY
 
typedef struct stru_batteryMetrics BATTERYMETRICS
 
typedef struct stru_batteryMetricsptrBATTERYMETRICS
 

Functions

static void battery_add_to_animation (ptrBATTERY pb)
 
static void battery_add (ptrBATTERY b)
 
static ptrBATTERYMODE battery_find_mode (ptrBATTERY b, int mode)
 
ptrBATTERY battery_find (NETSIM_ID d, NETSIM_ID in)
 
void battery_add_new_mode (ptrBATTERY battery, int mode, double current, char *heading)
 
ptrBATTERY battery_init_new (NETSIM_ID deviceId, NETSIM_ID interfaceId, double initialEnergy, double voltage, double dRechargingCurrent)
 
void battery_free (NETSIM_ID deviceId, NETSIM_ID interfaceId, double time)
 
bool battery_set_mode (ptrBATTERY battery, int mode, double time)
 
void battery_animation ()
 
static bool isIncludedInMetricsHeading (ptrBATTERYMODE m)
 
static void addInMetricsHeading (ptrBATTERYMODE m)
 
static void prepare_mode_list (char *buf)
 
static double get_value_from_battery (ptrBATTERY b, char *mode)
 
static void add_to_mode_list (ptrBATTERY b)
 
static void add_to_table (PMETRICSNODE table, int index)
 
void battery_metrics (PMETRICSWRITER metricsWriter)
 
double battery_get_remaining_energy (ptrBATTERY battery)
 
double battery_get_consumed_energy (ptrBATTERY battery, int mode)
 

Variables

static ptrBATTERY firstBattery = NULL
 
static ptrBATTERY lastBattery = NULL
 
static ANIM_HANDLE handle
 
static ptrBATTERYMETRICS batteryMetrics = NULL
 

Macro Definition Documentation

◆ _BATTERY_MODEL_CODE_

#define _BATTERY_MODEL_CODE_

Definition at line 14 of file BatteryModel.c.

Typedef Documentation

◆ BATTERY

typedef struct stru_battery BATTERY

◆ BATTERYMETRICS

◆ BATTERYMODE

typedef struct stru_mode BATTERYMODE

◆ ptrBATTERY

typedef struct stru_battery * ptrBATTERY

◆ ptrBATTERYMETRICS

◆ ptrBATTERYMODE

typedef struct stru_mode * ptrBATTERYMODE

Function Documentation

◆ add_to_mode_list()

static void add_to_mode_list ( ptrBATTERY  b)
static

Definition at line 310 of file BatteryModel.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_to_table()

static void add_to_table ( PMETRICSNODE  table,
int  index 
)
static

Definition at line 326 of file BatteryModel.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addInMetricsHeading()

static void addInMetricsHeading ( ptrBATTERYMODE  m)
static

Definition at line 255 of file BatteryModel.c.

Here is the caller graph for this function:

◆ battery_add()

static void battery_add ( ptrBATTERY  b)
static

Definition at line 56 of file BatteryModel.c.

Here is the caller graph for this function:

◆ battery_add_new_mode()

void battery_add_new_mode ( ptrBATTERY  battery,
int  mode,
double  current,
char *  heading 
)

Definition at line 101 of file BatteryModel.c.

Here is the caller graph for this function:

◆ battery_add_to_animation()

static void battery_add_to_animation ( ptrBATTERY  pb)
static

Definition at line 198 of file BatteryModel.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ battery_animation()

void battery_animation ( )

Definition at line 223 of file BatteryModel.c.

Here is the call graph for this function:

◆ battery_find()

ptrBATTERY battery_find ( NETSIM_ID  d,
NETSIM_ID  in 
)

Definition at line 82 of file BatteryModel.c.

Here is the caller graph for this function:

◆ battery_find_mode()

static ptrBATTERYMODE battery_find_mode ( ptrBATTERY  b,
int  mode 
)
static

Definition at line 70 of file BatteryModel.c.

Here is the caller graph for this function:

◆ battery_free()

void battery_free ( NETSIM_ID  deviceId,
NETSIM_ID  interfaceId,
double  time 
)

Definition at line 145 of file BatteryModel.c.

Here is the call graph for this function:

◆ battery_get_consumed_energy()

double battery_get_consumed_energy ( ptrBATTERY  battery,
int  mode 
)

Definition at line 389 of file BatteryModel.c.

◆ battery_get_remaining_energy()

double battery_get_remaining_energy ( ptrBATTERY  battery)

Definition at line 384 of file BatteryModel.c.

◆ battery_init_new()

ptrBATTERY battery_init_new ( NETSIM_ID  deviceId,
NETSIM_ID  interfaceId,
double  initialEnergy,
double  voltage,
double  dRechargingCurrent 
)

Definition at line 117 of file BatteryModel.c.

Here is the call graph for this function:

◆ battery_metrics()

void battery_metrics ( PMETRICSWRITER  metricsWriter)

Definition at line 340 of file BatteryModel.c.

Here is the call graph for this function:

◆ battery_set_mode()

bool battery_set_mode ( ptrBATTERY  battery,
int  mode,
double  time 
)

Definition at line 158 of file BatteryModel.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_value_from_battery()

static double get_value_from_battery ( ptrBATTERY  b,
char *  mode 
)
static

Definition at line 297 of file BatteryModel.c.

Here is the caller graph for this function:

◆ isIncludedInMetricsHeading()

static bool isIncludedInMetricsHeading ( ptrBATTERYMODE  m)
static

Definition at line 243 of file BatteryModel.c.

Here is the caller graph for this function:

◆ prepare_mode_list()

static void prepare_mode_list ( char *  buf)
static

Definition at line 276 of file BatteryModel.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ batteryMetrics

ptrBATTERYMETRICS batteryMetrics = NULL
static

Definition at line 241 of file BatteryModel.c.

◆ firstBattery

ptrBATTERY firstBattery = NULL
static

Definition at line 53 of file BatteryModel.c.

◆ handle

ANIM_HANDLE handle
static

Definition at line 197 of file BatteryModel.c.

◆ lastBattery

ptrBATTERY lastBattery = NULL
static

Definition at line 54 of file BatteryModel.c.