NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
BatteryModel.h
1#pragma once
2/************************************************************************************
3* Copyright (C) 2023 *
4* TETCOS, Bangalore. India *
5* *
6* Tetcos owns the intellectual property rights in the Product and its content. *
7* The copying, redistribution, reselling or publication of any or all of the *
8* Product or its content without express prior written consent of Tetcos is *
9* prohibited. Ownership and / or any other right relating to the software and all *
10* intellectual property rights therein shall remain at all times with Tetcos. *
11* *
12* Author: Shashi Kant Suman *
13* *
14* ---------------------------------------------------------------------------------*/
15
16#ifndef _NETSIM_BATTERY_MODEL_H_
17#define _NETSIM_BATTERY_MODEL_H_
18#ifdef __cplusplus
19extern "C" {
20#endif
21typedef struct stru_mode
22{
23 int mode;
24 double current;
25 double consumedEnergy;
26 char* heading;
27}BATTERYMODE, * ptrBATTERYMODE;
28
29typedef struct stru_battery
30{
31 NETSIM_ID deviceId;
32 NETSIM_ID interfaceId;
33 double initialEnergy;
34 double consumedEnergy;
35 double remainingEnergy;
36 double voltage;
37 double rechargingCurrent;
38 int modeCount;
39 double rechargingEnergy;
40 double SumSleepEnergy;
41 double SumTransmitEnergy;
42 double SumConsumedEnergy;
43 double SumIdleEnergy;
44 double SumReceiveEnergy;
45 double SumHarvestedEnergy;
46 ptrBATTERYMODE mode;
47
48 int currentMode;
49 double modeChangedTime;
50
51 void* animHandle;
52 struct stru_battery* next;
53}BATTERY, * ptrBATTERY;
54
55#ifndef _BATTERY_MODEL_CODE_
56#pragma comment(lib,"BatteryModel.lib")
57 //typedef void* ptrBATTERY;
58#endif
59
60 _declspec(dllexport) ptrBATTERY battery_find(NETSIM_ID d,
61 NETSIM_ID in);
62 _declspec(dllexport) void battery_add_new_mode(ptrBATTERY battery,
63 int mode,
64 double current,
65 char* heading);
66 _declspec(dllexport) ptrBATTERY battery_init_new(NETSIM_ID deviceId,
67 NETSIM_ID interfaceId,
68 double initialEnergy,
69 double voltage,
70 double dRechargingCurrent);
71 _declspec(dllexport) bool battery_set_mode(ptrBATTERY battery,
72 int mode,
73 double time);
74 _declspec(dllexport) void battery_animation();
75 _declspec(dllexport) void battery_metrics(PMETRICSWRITER metricsWriter);
76 _declspec(dllexport) double battery_get_remaining_energy(ptrBATTERY battery);
77 _declspec(dllexport) double battery_get_consumed_energy(ptrBATTERY battery, int mode);
78
79 // Battery Logs
80 void init_battery_log(ptrBATTERY battery);
81 void close_battery_log();
82 bool get_protocol_log_status(char* logname);
83 void Battery_RadioMeasurements_Log(ptrBATTERY battery, double harvestedEnergy, double ConsumedEnergy, int prev_mode, int curr_mode, double mode_change_time, ptrBATTERYMODE pm);
84
85#ifdef __cplusplus
86}
87#endif
88#endif //_NETSIM_BATTERY_MODEL_H_