Operating System Simulator Plugin
3.5.1
Unreal Engine plugin that simulates an Operating System Environment
|
Represents the save/load data for a portable device battery. More...
#include "OperatingSystemSaveLoad.h"
Public Member Functions | |
FORCEINLINE void | Validate (FGenericError &OutError) const |
FORCEINLINE float | GetEfficiencyLossValue () const |
FORCEINLINE float | GetBatteryHealth (const bool bNormalize) const |
FORCEINLINE float | GetTimeToFullyRechargeInSeconds () const |
FORCEINLINE EOperatingSystemBatteryHealthState | GetHealthState () const |
FORCEINLINE FString | GetHealthStateString () const |
FORCEINLINE bool | operator== (const FOperatingSystemBattery &Other) const |
FOperatingSystemBattery () | |
FOperatingSystemBattery (const FText &BatteryName, const FText &BatteryBrand) | |
Public Attributes | |
FText | BatteryName |
FText | BatteryBrand |
float | BatteryCapacity |
float | ChargeRate |
EOperatingSystemBatteryEfficiencyLoss | EfficiencyLoss |
Represents the save/load data for a portable device battery.
FOperatingSystemBattery is a struct that represents the properties and behavior of an operating system battery.
This struct stores the save/load data for a portable device battery. It includes information such as whether the battery is present, the battery level, and whether the device is a portable device or not.
|
inline |
|
inline |
|
inline |
Get the battery health value.
bNormalize | Flag indicating whether to normalize the battery health value. |
This method returns the battery health value as a float. The battery health value represents the percentage of energy loss while charging the battery. By default, the efficiency loss value is calculated using the formula ((static_cast<uint8>(EfficiencyLoss) + 1) * 100.f) / 10.f. If bNormalize is true, the efficiency loss value is normalized to a range of [0, 1] using the formula (static_cast<uint8>(EfficiencyLoss) + 1) / 10.f.
Example usage:
|
inline |
Get the efficiency loss value based on the current efficiency loss setting.
This will return a float value that represents the percentage of energy loss while charging the battery.
The possible efficiency loss settings and their corresponding efficiency loss values are as follows:
If the efficiency loss setting is not recognized, the method returns the default efficiency loss value of 10.0.
Example usage:
|
inline |
Gets the health state of the battery.
This method returns the current health state of the battery based on the efficiency loss value. The efficiency loss value is compared to predefined thresholds to determine the health state.
Unhealthy
if the efficiency loss is 10%, 20%, or 30%Poor
if the efficiency loss is 40%, 50%, or 60%Critical
if the efficiency loss is 70%, 80%, or 90%Healthy
if the efficiency loss does not match any predefined thresholds
|
inline |
Get the health state of the battery as a string representation.
This method returns a string that represents the health state of the battery. The health state is determined by the value returned by the GetHealthState() method. The possible health states and their corresponding string representations are as follows:
If the health state does not match any of the above values, the method will return "Unknown".
|
inline |
Calculate the time required to fully recharge the battery in seconds.
This method calculates the time required to fully recharge the battery in seconds based on the battery capacity, charge rate, and efficiency loss value. The formula used to calculate the time is: ((BatteryCapacity / ChargeRate) * GetEfficiencyLossValue()) / 10.f) * 3600.f
Please note that the efficiency loss value is obtained by calling the GetEfficiencyLossValue() method. The efficiency loss value represents the percentage of energy loss while charging the battery.
Example usage:
|
inline |
|
inline |
Validates the battery properties.
OutError | The error object to store the validation error. |
This method validates the battery properties and sets the OutError object with the validation error if any. The battery properties that are validated include:
If any of the above validations fail, the OutError object is set with the corresponding error message and the method returns early.
FText FOperatingSystemBattery::BatteryBrand |
Brand name of this battery.
float FOperatingSystemBattery::BatteryCapacity |
Total battery power. In milli-amp Hour units
FText FOperatingSystemBattery::BatteryName |
Battery Name
float FOperatingSystemBattery::ChargeRate |
Speed at which this battery should charge. Higher rate charges battery faster.
EOperatingSystemBatteryEfficiencyLoss FOperatingSystemBattery::EfficiencyLoss |
Simulates energy loss while charging. Higher loss means more time to charge. This can also be considered as battery health. Higher loss means less healthy. For example: A battery with 3200 mAh and charge rate of 1000 mA will take 3.2 hours to fully charge without energy loss. With 40% energy loss it would take 4.5 hours to fully charge.