Skip to content
Snippets Groups Projects
Commit e2d8f45c authored by Daniel Lorych's avatar Daniel Lorych :cookie:
Browse files

Add Battery class

parent 36d8f1cd
No related branches found
No related tags found
No related merge requests found
using System;
namespace Helios.Source
{
public class Battery
{
public int Capacity { get; set; }
public int Voltage { get; set; }
public double Charge { get; private set; }
public double DepthOfDischarge { get; private set; }
public Battery() { }
public Battery(int capacity, int voltage)
{
this.Capacity = capacity;
this.Voltage = voltage;
}
public double GetCharge(double powerBalence)
{
double charge;
charge = powerBalence / this.Voltage;
this.Charge = charge;
return charge;
}
public double GetDepthOfDischarge()
{
double depthOfDischarge;
depthOfDischarge = (1 - (this.Charge / this.Capacity)) * 100;
this.DepthOfDischarge = depthOfDischarge;
return depthOfDischarge;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment