Ejemplo n.º 1
0
        private void UpdateDisplay()
        {
            display.WriteCentered("Power management", LCDColor.Grey);
            display.Write("");
            display.WriteCentered("Solar power status", new LCDColor(1, 1, 2));
            display.Write(" Currently " + solarState.GetName());
            display.Write(" Output: " + SolarDisplay.FormatRatio(solarManager.MaxOutput, solarManager.MaxHistoricalOutput));
            display.DrawRatio(solarManager.MaxOutput, solarManager.MaxHistoricalOutput);
            display.Write("");
            display.Write("");
            display.WriteCentered("Main batteries status", new LCDColor(1, 1, 2));
            WriteBatteryStatus(mainBatteriesManager);
            display.Write("");
            display.Write("");
            display.WriteCentered("Connected batteries status", new LCDColor(1, 1, 2));
            WriteBatteryStatus(connectedBatteriesManager);
            display.Write("");
            display.Write("");
            display.WriteCentered("Time management", new LCDColor(1, 1, 2));
            TimeStruct time = dayTracker.GetTime();

            display.Write("Time of day: " + time.GetTime().ToString());
            display.Write("Length of day: " + time.GetDayLength().ToString());
            display.Write(solarManager.GetOutputHistory());
            display.Flush();
        }
Ejemplo n.º 2
0
 private void WriteBatteryStatus(BatteryManager batteryManager)
 {
     display.Write(" Charge: " + SolarDisplay.FormatRatio(batteryManager.CurrentCharge, batteryManager.MaxCharge));
     display.DrawRatio(batteryManager.CurrentCharge, batteryManager.MaxCharge);
     display.Write(" Input: " + SolarDisplay.FormatRatio(batteryManager.CurentInput, batteryManager.MaxInput));
     display.DrawRatio(batteryManager.CurentInput, batteryManager.MaxInput);
     display.Write(" Output: " + SolarDisplay.FormatRatio(batteryManager.CurentOutput, batteryManager.MaxOutput));
     display.DrawRatio(batteryManager.CurentOutput, batteryManager.MaxOutput, true);
 }
Ejemplo n.º 3
0
        private void Init()
        {
            // launch tests
            // TestSuite.AllTests.TestAll();
            // Initialization
            mainBatteriesManager      = new BatteryManager(battery => battery.CubeGrid == Me.CubeGrid);
            connectedBatteriesManager = new BatteryManager(battery => battery.CubeGrid != Me.CubeGrid);
            display      = new SolarDisplay("Main Base Solar LCD Panel", false);
            solarManager = new SolarManager("A");
            dayTracker   = new DayTracker();

            Deserializer deserializer = new Deserializer(Me.CustomData);

            solarManager.Deserialize(deserializer);
            dayTracker.Deserialize(deserializer);
            solarState = SolarState.Deserialize(deserializer.Get("solarState"));
        }