コード例 #1
0
 private static Actuals CloneActuals(Pack pack)
 {
     return(new Actuals
     {
         PackVoltage = pack.Actuals().Voltage,
         Cell1Voltage = pack[0].Actuals().Voltage,
         Cell2Voltage = pack[1].Actuals().Voltage,
         Cell3Voltage = pack[2].Actuals().Voltage,
         ActualCurrent = pack.Actuals().ActualCurrent,
         Capacity = pack.Actuals().RemainingCapacity,
         Temperature = pack.Actuals().Temperature
     });
 }
コード例 #2
0
        private static void PrintActuals(Pack pack)
        {
            var actuals = pack.Actuals();

            Console.WriteLine("Current battery conditions:");
            Console.WriteLine("Voltage:             {0} V ({1})",
                              actuals.Voltage,
                              pack.SubElements.Select((c, i) => string.Format("{0}: {1} V", i, c.Actuals().Voltage)).Join(", "));
            Console.WriteLine("Current:                  {0} mA", actuals.ActualCurrent * 1000f);
            Console.WriteLine("Average current:          {0} mA", actuals.AverageCurrent * 1000f);
            Console.WriteLine("Temperature:              {0:f2} °C", actuals.Temperature - 273.15f);
            Console.WriteLine("Remaining capacity:       {0:N0} mAh", actuals.RemainingCapacity * 1000f);
            Console.WriteLine("Absolute StateOfCharge:   {0} %", actuals.AbsoluteStateOfCharge * 100f);
            Console.WriteLine("Relative StateOfCharge:   {0} %", actuals.RelativeStateOfCharge * 100f);
            Console.WriteLine("Actual run time:          {0}", actuals.ActualRunTime);
            Console.WriteLine("Average run time:         {0}", actuals.AverageRunTime);
            //Console.WriteLine("Charging voltage:         {0}", actuals.ChargingVoltage);
            //Console.WriteLine("Charging current:         {0}", actuals.ChargingCurrent);
            Console.WriteLine();
        }