예제 #1
0
        public BmsInfoMessage(byte[] payload)
        {
            payload.RequireBytes(4);

            BmsMaxCharge    = new KiloWatt((payload[0] + (payload[1] << 8)) / 100.0m);
            BmsMaxDischarge = new KiloWatt((payload[2] + (payload[3] << 8)) / 100.0m);
        }
        public PowerLimitsMessage(byte[] payload)
        {
            payload.RequireBytes(RequireBytes);

            RegenPowerLimit     = new KiloWatt(BitArrayConverter.ToUInt16(payload, 0, 16) * 0.01m);
            DischargePowerLimit = new KiloWatt(BitArrayConverter.ToUInt16(payload, 16, 16) * 0.01m);
        }
        public FastChargeLimitsMessage(byte[] payload)
        {
            payload.RequireBytes(RequireBytes);

            FastChargePowerLimit   = new KiloWatt(Math.Round(BitArrayConverter.ToUInt16(payload, 0, 13) * 0.06226m, 4));
            FastChargeCurrentLimit = new Ampere(Math.Round(BitArrayConverter.ToUInt16(payload, 16, 13) * 0.073242m, 2));
            FastChargeMaxVoltage   = new Volt(Math.Round(BitArrayConverter.ToUInt16(payload, 32, 13) * 0.073242m, 2));
            FastChargeMinVoltage   = new Volt(Math.Round(BitArrayConverter.ToUInt16(payload, 48, 13) * 0.073242m, 2));
        }
예제 #4
0
        public FrontMechPowerMessage(byte[] payload)
        {
            payload.RequireBytes(8);

            FrontMechPower     = new KiloWatt((payload[2] + ((payload[3] & 0x7) << 8) - 512 * (payload[3] & 0x4)) / 2m);
            FrontDissipation   = new KiloWatt(payload[1] * 125m / 1000m - 0.5m);
            FrontInputPower    = new KiloWatt(FrontMechPower + FrontDissipation);
            FrontStatorCurrent = new Ampere(payload[4] + ((payload[5] & 0x7) << 8));
            FrontDriveMaxPower = new KiloWatt((payload[6] & 0x3f << 5) + ((payload[5] & 0xf0) >> 3) + 1m);
        }
        public BatteryInfoMessage(byte[] payload)
        {
            payload.RequireBytes(RequireBytes);

            BmsNumberOfContactors = BitArrayConverter.ToUInt16(payload, 8, 3);
            BmsState                = BitArrayConverter.ToUInt16(payload, 11, 4);
            IsolationResistance     = new KiloOhm(BitArrayConverter.ToInt16(payload, 19, 10));
            BmsChargeStatus         = BitArrayConverter.ToUInt16(payload, 32, 3);
            BmsChargePowerAvailable = new KiloWatt(BitArrayConverter.ToUInt16(payload, 38, 11) * 0.125m);
            MinBatteryTemperature   = new Celsius(BitArrayConverter.ToUInt16(payload, 56, 8) * 0.5m - 40m);
        }
        public RearMechPowerMessage(byte[] payload)
        {
            payload.RequireBytes(RequireBytes);

            RearInverterVoltage = new Volt(payload[0] / 10m);
            RearMechPower       = new KiloWatt((payload[2] + ((payload[3] & 0x7) << 8) - 512 * (payload[3] & 0x4)) / 2m);
            RearDissipation     = new KiloWatt(payload[1] * 125m / 1000m - 0.5m);
            RearInputPower      = new KiloWatt(RearMechPower + RearDissipation);
            RearStatorCurrent   = new Ampere(payload[4] + ((payload[5] & 0x7) << 8));
            RearDriveMaxPower   = new KiloWatt((payload[6] & 0x3f << 5) + ((payload[5] & 0xf0) >> 3) + 1m);
            RearRegenMaxPower   = new KiloWatt((payload[7] << 2) - 200m);
        }