Beispiel #1
0
        public List <Point> ConvertToPoints(List <dnp3_protocol.dnp3types.sServerDatabasePoint> mangagedArray)
        {
            var list = new List <Point>();

            foreach (var item in mangagedArray)
            {
                if (item.eGroupID == dnp3_protocol.dnp3types.eDNP3GroupID.ANALOG_INPUT || item.eGroupID == dnp3_protocol.dnp3types.eDNP3GroupID.ANALOG_OUTPUTS)
                {
                    var point = new AnalogPoint()
                    {
                        GroupId   = item.eGroupID,
                        Index     = item.u16IndexNumber,
                        TimeStamp = new DateTime(item.sTimeStamp.u16Year, item.sTimeStamp.u8Month, item.sTimeStamp.u8Day, item.sTimeStamp.u8Hour, item.sTimeStamp.u8Minute, item.sTimeStamp.u8Seconds).ToString()
                    };
                    SingleInt32Union value = new SingleInt32Union(Marshal.ReadInt32(item.pvData, 0));
                    point.Value = CheckAnalogValueExp(value.f, point.GroupId, point.Index);
                    list.Add(point);
                }
                else
                {
                    var point = new BinaryPoint()
                    {
                        GroupId   = item.eGroupID,
                        Index     = item.u16IndexNumber,
                        TimeStamp = new DateTime(item.sTimeStamp.u16Year, item.sTimeStamp.u8Month, item.sTimeStamp.u8Day, item.sTimeStamp.u8Hour, item.sTimeStamp.u8Minute, item.sTimeStamp.u8Seconds).ToString()
                    };
                    SingleInt32Union value = new SingleInt32Union(Marshal.ReadInt32(item.pvData, 0));
                    point.Value = CheckBinaryValueExp(value.i, point.GroupId, point.Index);;
                    list.Add(point);
                }
            }
            return(list);
        }
Beispiel #2
0
        private void GetPointsRightBranch()
        {
            simulator.MarshalUnmananagedArray2Struct(db.psServerDatabasePoint, (int)db.u32TotalPoints, out List <dnp3_protocol.dnp3types.sServerDatabasePoint> points);

            var result = simulator.ConvertToPoints(points);

            foreach (var item in result)
            {
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.BINARY_OUTPUT && item.Index == pairs["Breaker_13Status"])
                {
                    breaker13 = item as BinaryPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.BINARY_OUTPUT && item.Index == pairs["Breaker_23Status"])
                {
                    breaker23 = item as BinaryPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.BINARY_OUTPUT && item.Index == pairs["Discrete_Disc13"])
                {
                    dis13 = item as BinaryPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.BINARY_OUTPUT && item.Index == pairs["Discrete_Disc23"])
                {
                    dis23 = item as BinaryPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.ANALOG_INPUT && item.Index == pairs["Flow_AM3"])
                {
                    pump3flow = item as AnalogPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.ANALOG_INPUT && item.Index == pairs["Temp_AM3"])
                {
                    pump3temp = item as AnalogPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.ANALOG_OUTPUTS && item.Index == pairs["Discrete_Tap3"])
                {
                    tapChanger3 = item as AnalogPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.ANALOG_INPUT && item.Index == pairs["Current_Tap3"])
                {
                    TRCurrent3 = item as AnalogPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.ANALOG_INPUT && item.Index == pairs["Voltage_Tap3"])
                {
                    TRVoltage3 = item as AnalogPoint;
                }
            }
        }
Beispiel #3
0
        private void GetPoints()
        {
            simulator.MarshalUnmananagedArray2Struct(db.psServerDatabasePoint, (int)db.u32TotalPoints, out List <dnp3_protocol.dnp3types.sServerDatabasePoint> points);

            var result = simulator.ConvertToPoints(points);

            foreach (var item in result)
            {
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.BINARY_OUTPUT && item.Index == pairs["Breaker_01Status"])
                {
                    breaker01 = item as BinaryPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.BINARY_OUTPUT && item.Index == pairs["Breaker_12Status"])
                {
                    breaker12 = item as BinaryPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.BINARY_OUTPUT && item.Index == pairs["Breaker_22Status"])
                {
                    breaker22 = item as BinaryPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.BINARY_OUTPUT && item.Index == pairs["Discrete_Disc01"])
                {
                    dis01 = item as BinaryPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.BINARY_OUTPUT && item.Index == pairs["Discrete_Disc02"])
                {
                    dis02 = item as BinaryPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.BINARY_OUTPUT && item.Index == pairs["Discrete_Disc12"])
                {
                    dis12 = item as BinaryPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.BINARY_OUTPUT && item.Index == pairs["Discrete_Disc22"])
                {
                    dis22 = item as BinaryPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.ANALOG_INPUT && item.Index == pairs["Flow_AM2"])
                {
                    pump2flow = item as AnalogPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.ANALOG_INPUT && item.Index == pairs["Temp_AM2"])
                {
                    pump2temp = item as AnalogPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.ANALOG_OUTPUTS && item.Index == pairs["Discrete_Tap2"])
                {
                    tapChanger2 = item as AnalogPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.ANALOG_INPUT && item.Index == pairs["Current_Tap2"])
                {
                    TRCurrent2 = item as AnalogPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.ANALOG_INPUT && item.Index == pairs["FluidLevel_Tank"])
                {
                    fluidLever = item as AnalogPoint;
                }
                if (item.GroupId == dnp3_protocol.dnp3types.eDNP3GroupID.ANALOG_INPUT && item.Index == pairs["Voltage_Tap2"])
                {
                    TRVoltage2 = item as AnalogPoint;
                }
            }
        }