예제 #1
0
        protected override void CommandExecutor_UpdatePointEvent(Common.PointType type, ushort pointAddres, ushort newValue)
        {
            Thread.Sleep(100);

            if (this.type == type && this.address == pointAddres && newValue != RawValue)
            {
                //OVDE UPISATI U BAZU - POPUNJAVAA SE DATA POINT SA PODACIMA

                RawValue = newValue;
                ProcessRawValue(newValue);
                Timestamp = DateTime.Now;
                DERMSCommon.SCADACommon.PointType dad = (DERMSCommon.SCADACommon.PointType)configItem.RegistryType;
                NetTcpBinding binding = new NetTcpBinding();
                binding.Security = new NetTcpSecurity()
                {
                    Mode = SecurityMode.None
                };
                factoryUI = new ChannelFactory <ISendDataToCEThroughScada>(binding, new EndpointAddress("net.tcp://localhost:19999/ISendDataToCEThroughScada"));
                ProxyUI   = factoryUI.CreateChannel();
                Console.WriteLine("Connected: net.tcp://localhost:19999/ISendDataToCEThroughScada");
                DataPoint        dataPoint  = new DataPoint((long)configItem.Gid, (DERMSCommon.SCADACommon.PointType)configItem.RegistryType, pointAddres, Timestamp, configItem.Description, DisplayValue, RawValue, (DERMSCommon.SCADACommon.AlarmType)alarm, configItem.GidGeneratora);
                List <DataPoint> datapoints = new List <DataPoint>();
                datapoints.Add(dataPoint);
                ProxyUI.ReceiveFromScada(datapoints);
            }
        }
예제 #2
0
        protected override void CommandExecutor_UpdatePointEvent(Common.PointType type, ushort pointAddres, ushort newValue)
        {
            Thread.Sleep(100);

            if (this.type == type && this.address == pointAddres)
            {
                //OVDE UPISATI U BAZU - POPUNJAVAA SE DATA POINT SA PODACIMA

                RawValue = newValue;
                ProcessRawValue(newValue);
                Timestamp = DateTime.Now;
                DERMSCommon.SCADACommon.PointType dad = (DERMSCommon.SCADACommon.PointType)configItem.RegistryType;
                NetTcpBinding binding = new NetTcpBinding();
                binding.Security = new NetTcpSecurity()
                {
                    Mode = SecurityMode.None
                };
                factoryUI = new ChannelFactory <ISendDataToCEThroughScada>(binding, new EndpointAddress("net.tcp://*****:*****@Timestamp, @Gid, @Production)";
                //scadaDB.InsertInCollectTable(collectItems, queryStmt1, connectionString);

                //dayItems = scadaDB.ReadFromCollectTable(connectionString);
                //string queryStmt2 = "INSERT INTO dbo.Day(Gid, Pmin, Pmax, Pavg, E, Timestamp) VALUES(@Gid, @Pmin, @Pmax, @Pavg, @E, @Timestamp)";
                //scadaDB.InsertInDayTable(dayItems, queryStmt2, connectionString);

                //string queryStmt3 = "INSERT INTO dbo.Month(Gid, Pmin, Pmax, Pavg, E, Timestamp) VALUES(@Gid, @Pmin, @Pmax, @Pavg, @E, @Timestamp)";
                //monthItems = scadaDB.ReadFromDayTable(connectionString);
                //scadaDB.InsertInMonthTable(monthItems, queryStmt3, connectionString);

                //string queryStmt4 = "INSERT INTO dbo.Year(Gid, Pmin, Pmax, Pavg, E, Timestamp) VALUES(@Gid, @Pmin, @Pmax, @Pavg, @E, @Timestamp)";
                //yearItems = scadaDB.ReadFromMonthTable(connectionString);
                //scadaDB.InsertInYearTable(yearItems, queryStmt4, connectionString);
            }
        }