コード例 #1
0
ファイル: DaegunPacket.cs プロジェクト: gaistorn/PEIUForGrid
        public void Converter(DateTime MeasureTime, out PCSMeasurement measurement, out PCSSampleValue sample, out SensorGroupValue sensor, out StatusValue status)
        {
            measurement             = new PCSMeasurement();
            measurement.MeasureTime = MeasureTime;
            measurement.ACActPwr    = this.ActivePower;
            measurement.ACChgAccPwr = this.AccumulateCharge;
            measurement.ACDhgAccPwr = this.AccumulateDischarge;
            measurement.DCSrcCrt    = this.Dc_battery_current;
            measurement.DCSrcPwr    = this.Dc_battery_power;
            measurement.DCSrcVlt    = this.Dc_battery_voltage;
            measurement.PwrFactor   = this.PowerFactor;
            measurement.Frequency   = this.Frequency;
            RSTPacket rst = this.AC_phase_current;

            measurement.PCSCrt = new RST(rst.R, rst.S, rst.T);
            rst = this.AC_phase_voltage;
            measurement.PCSVlt = new RST(rst.R, rst.S, rst.T);
            measurement.PCSPwr = new PairPower(this.ActivePower, this.ReactivePower);

            sensor             = new SensorGroupValue();
            sensor.MeasureTime = MeasureTime;
            List <SensorValue> sensor_values = new List <SensorValue>();

            for (int i = 0; i < this.Temp.Length; i++)
            {
                sensor_values.Add(new SensorValue()
                {
                    Name = $"Temp{i + 1}", Value = this.Temp[i]
                });
            }
            sensor.Sensors = sensor_values.ToArray();

            sample             = new PCSSampleValue();
            sample.MeasureTime = MeasureTime;
            sample.Frequency   = this.Frequency;
            sample.PwrFactor   = this.PowerFactor;

            status             = new StatusValue();
            status.MeasureTime = MeasureTime;

            List <EventValue> event_values = new List <EventValue>();

            for (int i = 0; i < this.Faults.Length; i++)
            {
                event_values.Add(new EventValue()
                {
                    Name = $"Fault{i + 1}", Value = this.Faults[i]
                });
            }

            status.Faults = event_values.ToArray();
            event_values.Clear();
            for (int i = 0; i < this.Warrning.Length; i++)
            {
                event_values.Add(new EventValue()
                {
                    Name = $"Warn{i + 1}", Value = this.Warrning[i]
                });
            }
            status.Warrning = event_values.ToArray();
        }
コード例 #2
0
ファイル: DaegunPacket.cs プロジェクト: gaistorn/PEIUForGrid
        //public uint OtherError;

        public void Converter(DateTime MeasureTime, out BSCMeasurementValue measurement, out BSCSensorValue sensor, out StatusValue status)
        {
            measurement = new BSCMeasurementValue();
            measurement.BkDCChgCrtlmt  = ChargeCurrentLimit;
            measurement.BkDCDhgCrtlmt  = DischargeCurrentLimit;
            measurement.BkDCDhgPwrlmt  = ChargePowerLimit;
            measurement.BkHiCellVlt    = CellVoltageRange.Max;
            measurement.BkLoCellVlt    = CellVoltageRange.Min;
            measurement.BkHiCellVltLoc = CellVoltageLocationRange.Max;
            measurement.BkLoCellVltLoc = CellVoltageLocationRange.Min;
            measurement.SOC            = Soc;
            measurement.SOH            = Soh;
            measurement.DCCrt          = DcCurrent;
            measurement.DCVlt          = DcVoltage;
            measurement.VltOfCellRange = new FloatingRange()
            {
                Min = CellVoltageRange.Min, Max = CellVoltageRange.Max
            };
            measurement.MeasureTime = MeasureTime;

            sensor = new BSCSensorValue();
            sensor.TempOfCellRange = new FloatingRange()
            {
                Min = ModuleTempRange.Min, Max = ModuleTempRange.Max
            };

            status        = new StatusValue();
            status.Status = new EventValue[]
            {
                new EventValue()
                {
                    Name = "status", Value = Status
                },

                new EventValue()
                {
                    Name = "Fault1", Value = Faults[0]
                },
                new EventValue()
                {
                    Name = "Fault2", Value = Faults[1]
                },
                new EventValue()
                {
                    Name = "Fault3", Value = Faults[2]
                },
                new EventValue()
                {
                    Name = "Fault4", Value = Faults[3]
                },

                new EventValue()
                {
                    Name = "Warn1", Value = Faults[0]
                },
                new EventValue()
                {
                    Name = "Warn2", Value = Faults[1]
                },
                new EventValue()
                {
                    Name = "Warn3", Value = Faults[2]
                },
                new EventValue()
                {
                    Name = "Warn4", Value = Faults[3]
                },

                //new EventValue(){Name = "OtherError", Value = OtherError },
            };
        }