コード例 #1
0
        private FluxRunModel InitFluxRunModel(DateTime now)
        {
            var model = new FluxRunModel();

            model.UpdateTime           = now;
            model.FluxID               = FluxID;
            model.SubStationID         = SubStationID;
            model.Location             = Location;
            model.FluxName             = FluxName;
            model.ConcentrationPort    = (byte)ConcentrationPort;
            model.FluxPort             = (byte)FluxPort;
            model.PressurePort         = (byte)PressurePort;
            model.TemperaturePort      = (byte)TemperaturePort;
            model.PressureFlag         = PressureFlag % 2 == 1;
            model.StandardatMosphere   = StandardatMosphere;
            model.MethaneChromaMaxTime = now;
            model.MethaneChromaMinTime = now;
            model.FluxMaxTime          = now;
            model.FluxMinTime          = now;
            model.TemperatureMaxTime   = now;
            model.TemperatureMinTime   = now;
            model.PressureMaxTime      = now;
            model.PressureMinTime      = now;
            model.UpdateTime           = now;
            model.Year  = now.Year;
            model.Month = now.Month;
            model.Day   = now.Day;
            model.Hour  = now.Hour;
            model.Flag  = 1;
            return(model);
        }
コード例 #2
0
        internal void InitPointModel(FluxRunModel initModel)
        {
            var fluxCode    = $"{SubStationID:D3}A{FluxPort:D2}";
            var concentCode = $"{SubStationID:D3}A{ConcentrationPort:D2}";
            var temptCode   = $"{SubStationID:D3}A{TemperaturePort:D2}";
            var pressCode   = $"{SubStationID:D3}A{PressurePort:D2}";
            var coCode      = $"{SubStationID:D3}A{COPort:D2}";

            InitRealData(fluxCode, ref _fluxReal);
            InitRealData(temptCode, ref _temperatureReal);
            InitRealData(concentCode, ref _concentrationReal);
            InitRealData(pressCode, ref _pressureReal);
            InitRealData(coCode, ref _coReal);

            FluxRealDataModel.FluxID   = FluxID;
            FluxRealDataModel.RealDate = DateTime.Now;
            FluxRunModel = InitFluxRunModel(DateTime.Now);
            if (initModel == null)
            {
                return;
            }
            // 防止重新计算.
            _realTime = DateTime.Now;
            _preTime  = DateTime.Now;

            FluxRunModel.SpanTime                = initModel.SpanTime;
            FluxRunModel.CountSum                = initModel.CountSum;
            FluxRunModel.FluxSum                 = initModel.FluxSum;
            FluxRunModel.PressureSum             = initModel.PressureSum;
            FluxRunModel.TemperatureSum          = initModel.TemperatureSum;
            FluxRunModel.MethaneChromaSum        = initModel.MethaneChromaSum;
            FluxRunModel.IndustrialPureFluxTotal = initModel.IndustrialPureFluxTotal;
            FluxRunModel.IndustrialFluxTotal     = initModel.IndustrialFluxTotal;
            FluxRunModel.PureFluxTotal           = initModel.PureFluxTotal;
            FluxRunModel.FluxTotal               = initModel.FluxTotal;

            FluxRunModel.MethaneChromaMax     = initModel.MethaneChromaMax;
            FluxRunModel.MethaneChromaMaxTime = initModel.MethaneChromaMaxTime;
            FluxRunModel.MethaneChromaMin     = initModel.MethaneChromaMin;
            FluxRunModel.MethaneChromaMinTime = initModel.MethaneChromaMinTime;
            FluxRunModel.FluxMax            = initModel.FluxMax;
            FluxRunModel.FluxMaxTime        = initModel.FluxMaxTime;
            FluxRunModel.FluxMin            = initModel.FluxMin;
            FluxRunModel.FluxMinTime        = initModel.FluxMinTime;
            FluxRunModel.TemperatureMax     = initModel.TemperatureMax;
            FluxRunModel.TemperatureMaxTime = initModel.TemperatureMaxTime;
            FluxRunModel.TemperatureMin     = initModel.TemperatureMin;
            FluxRunModel.TemperatureMinTime = initModel.TemperatureMinTime;
            FluxRunModel.PressureMax        = initModel.PressureMax;
            FluxRunModel.PressureMaxTime    = initModel.PressureMaxTime;
            FluxRunModel.PressureMin        = initModel.PressureMin;
            FluxRunModel.PressureMinTime    = initModel.PressureMinTime;
        }
コード例 #3
0
        internal void Update(DateTime now, List <RealDataModel> realDataModels)
        {
            //Console.WriteLine($"{"=".Repeat(20)}开始计算抽采测点{FluxID} {Location}{"=".Repeat(20)}");
            _preTime  = _realTime;
            _realTime = now;
            float  tmpConcertReal, tmpTemptReal, tmpFluxReal, tmpPressure, tmpNegativePress, tmpAbsolutePress;
            double flux, pureFlux, industFlux, industPureFlux;
            var    spanTime = CalcSpanTime();
            int    count    = 1;

            FillRealData(realDataModels);

            CalcFluxRun(spanTime, out tmpConcertReal,
                        out tmpTemptReal, out tmpFluxReal, out tmpPressure,
                        out tmpNegativePress, out tmpAbsolutePress,
                        out flux, out pureFlux,
                        out industFlux, out industPureFlux);

            if (_preTime.Hour != _realTime.Hour)
            {
                FluxRunModel                  = InitFluxRunModel(_realTime);
                FluxRunModel.FluxMax          = tmpFluxReal;
                FluxRunModel.FluxMin          = tmpFluxReal;
                FluxRunModel.MethaneChromaMax = tmpConcertReal;
                FluxRunModel.MethaneChromaMin = tmpConcertReal;
                FluxRunModel.TemperatureMax   = tmpTemptReal;
                FluxRunModel.TemperatureMin   = tmpTemptReal;
                FluxRunModel.PressureMax      = tmpPressure;
                FluxRunModel.PressureMin      = tmpPressure;
                Console.WriteLine("跨小时, 重新累计.");
            }

            FluxRunModel.UpdateTime               = _realTime;
            FluxRunModel.FluxTotal               += (float)flux;
            FluxRunModel.PureFluxTotal           += (float)pureFlux;
            FluxRunModel.IndustrialFluxTotal     += (float)industFlux;
            FluxRunModel.IndustrialPureFluxTotal += (float)industPureFlux;
            FluxRunModel.MethaneChromaSum        += tmpConcertReal;
            FluxRunModel.TemperatureSum          += tmpTemptReal;
            FluxRunModel.FluxSum  += tmpFluxReal;
            FluxRunModel.CountSum += count;
            FluxRunModel.SpanTime += spanTime.TotalSeconds;
            Console.WriteLine($"累计时间:{spanTime.TotalSeconds}\t累次次数{FluxRunModel.CountSum}");
            FillFluxRunMinMax(tmpConcertReal, tmpTemptReal, tmpFluxReal, tmpPressure);
            FillFluxRealData();
        }