Example #1
0
        /// <summary>
        /// 单元下多个汇流箱日总电流对比
        /// </summary>
        /// <param name="uId"></param>
        /// <param name="startYYYYMMDDHH"></param>
        /// <param name="endYYYYMMDDHH"></param>
        /// <param name="chartType"></param>
        /// <param name="intervalMins"></param>
        /// <returns></returns>
        public ActionResult CompareDayCurrentChartByUnit(int uId, string startYYYYMMDDHH, string endYYYYMMDDHH, string chartType, int intervalMins)
        {
            string         reportCode = string.Empty;
            PlantUnit      unit       = PlantUnitService.GetInstance().GetPlantUnitById(uId);
            IList <Device> deviceList = unit.typeDevices(DeviceData.HUILIUXIANG_CODE, false);
            MonitorType    mt         = MonitorType.getMonitorTypeByCode(MonitorType.MIC_BUSBAR_TOTALCURRENT);

            if (deviceList != null && deviceList.Count > 0)
            {
                IList <DeviceStuct> devices = new List <DeviceStuct>();
                foreach (Device device in deviceList)
                {
                    float rate = 1.0F;
                    devices.Add(new DeviceStuct()
                    {
                        deviceId = device.id.ToString(), rate = rate, name = device.fullName, unit = mt.unit, chartType = chartType, monitorType = mt, cVal = ComputeType.Avg, deviceType = ChartDeviceType.DEVICE, intervalMins = intervalMins
                    });
                }

                string chartName = LanguageUtil.getDesc("DEVICE_DAY_TOTALCURRENT_COMPARE");
                //取得用户年度发电量图表数据
                ChartData chartData = CompareChartService.GetInstance().compareDayHHMultiDeviceMultiMonitor(chartName, devices, startYYYYMMDDHH, endYYYYMMDDHH, intervalMins, ComputeType.Avg);
                reportCode = JsonUtil.convertToJson(chartData, typeof(ChartData));
            }
            else
            {
                reportCode = "error:" + Resources.SunResource.NODATA;
            }
            return(Content(reportCode));
        }
Example #2
0
 public void RunWhenBoolChange(BoolMonitor monitor, bool condition, Operation operation)
 {
     _monitorType = MonitorType.Bool;
     _boolMonitor = monitor;
     _oper        = operation;
     _condition   = condition;
 }
Example #3
0
        /// <summary>
        /// 电站的月天数据
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="startYYYYMMDD"></param>
        /// <param name="endYYYYMMDD"></param>
        /// <param name="chartType"></param>
        /// <returns></returns>
        public ActionResult PlantMonthDayChart(int pid, string startYYYYMMDD, string endYYYYMMDD, string chartType, string lan)
        {
            setlan(lan);

            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            Plant  plant      = PlantService.GetInstance().GetPlantInfoById(pid);
            string reportData = string.Empty;

            if (plant != null)
            {
                MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE);
                string      unit     = energyMt.unit;
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = PlantChartService.GetInstance().MMDDChartBypList(new List <Plant> {
                    plant
                }, startYYYYMMDD, endYYYYMMDD, chartType, unit);
                reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            else
            {
                AppError appError = new AppError(AppError.plantnoexist, Resources.SunResource.CHART_PLANT_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(AppError));
            }
            return(Content(reportData));
        }
Example #4
0
        /// <summary>
        /// 用户所有电站的年度发电量图表数据
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="chartType"></param>
        /// <returns></returns>
        public ActionResult AllPlantYearChart(int userId, string chartType, string lan)
        {
            setlan(lan);

            string reportData = string.Empty;

            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            User user = UserService.GetInstance().Get(userId);

            if (user != null && user.plants != null)
            {
                MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE);
                string      unit     = energyMt.unit;
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = PlantChartService.GetInstance().YearChartBypList(user.plants, chartType, unit);
                reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            else
            {
                AppError appError = new AppError(AppError.useridnoexist, Resources.SunResource.CHART_USER_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(AppError));
            }
            return(Content(reportData));
        }
Example #5
0
        /// <summary>
        /// 取得某个设备跨小时的某测点图表
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="startYYYYMMDD"></param>
        /// <param name="endYYYYMMDD"></param>
        /// <returns></returns>
        public ActionResult MonitorDayChart(int dId, string startYYYYMMDDHH, string endYYYYMMDDHH, string chartType, int monitorCode, string lan)
        {
            setlan(lan);

            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            Device device = DeviceService.GetInstance().get(dId);
            //获得报表js代码
            MonitorType energyMt   = MonitorType.getMonitorTypeByCode(monitorCode);
            string      unit       = energyMt.unit;
            string      chartName  = device.fullName + " " + LanguageUtil.getDesc("CHART_DAY_CHART");
            string      reportData = string.Empty;

            if (device != null)
            {
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = DeviceChartService.GetInstance().DayChart(device, chartName, startYYYYMMDDHH, endYYYYMMDDHH, chartType, unit, monitorCode, intervalTime);
                reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            else
            {
                AppError appError = new AppError(AppError.devicenoexist, Resources.SunResource.CHART_DEVICE_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(AppError));
            }
            return(Content(reportData));
        }
Example #6
0
        /// <summary>
        /// 逆变器设备的月天数据
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="startYYYYMMDD"></param>
        /// <param name="endYYYYMMDD"></param>
        /// <param name="chartType"></param>
        /// <returns></returns>
        public ActionResult DeviceMonthDayChart(int dId, string startYYYYMMDD, string endYYYYMMDD, string chartType, string lan)
        {
            setlan(lan);

            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            Device device     = DeviceService.GetInstance().get(dId);
            string reportData = string.Empty;

            if (device != null)
            {
                MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.MIC_INVERTER_TODAYENERGY);
                string      unit     = energyMt.unit;
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = DeviceChartService.GetInstance().MonthDDChartByDevice(device, 1.0F, string.Format(LanguageUtil.getDesc("DEVICEMONTHCHART_NAME"), device.fullName), startYYYYMMDD, endYYYYMMDD, chartType, unit);
                reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            else
            {
                AppError appError = new AppError(AppError.devicenoexist, Resources.SunResource.CHART_DEVICE_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(AppError));
            }
            return(Content(reportData));
        }
Example #7
0
        /// <summary>
        /// 取得用户所有电站跨小时的功率图表
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="startYYYYMMDDHH"></param>
        /// <param name="endYYYYMMDDHH"></param>
        /// <param name="chartType"></param>
        /// <returns></returns>
        public ActionResult AllPlantDayChart(int userId, string startYYYYMMDDHH, string endYYYYMMDDHH, string chartType, string lan)
        {
            setlan(lan);

            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            User user = UserService.GetInstance().Get(userId);

            //获得报表业务逻辑类
            PlantChartService reportService = PlantChartService.GetInstance();
            //获得报表js代码
            int         monitorCode = MonitorType.PLANT_MONITORITEM_POWER_CODE;//发电量测点
            MonitorType Mt          = MonitorType.getMonitorTypeByCode(monitorCode);
            string      unit        = Mt.unit;
            string      chartName   = LanguageUtil.getDesc("CHART_DAY_POWER_CHART");
            string      reportData  = string.Empty;

            if (user != null && user.plants != null)
            {
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = reportService.PlantDayChart(user.plants, chartName, startYYYYMMDDHH, endYYYYMMDDHH, chartType, unit, monitorCode, intervalTime);
                reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            else
            {
                AppError appError = new AppError(AppError.useridnoexist, Resources.SunResource.CHART_USER_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(AppError));
            }
            return(Content(reportData));
        }
Example #8
0
        /// <summary>
        /// 设备的月天统计图表
        /// </summary>
        /// <param name="device"></param>
        /// <param name="rate"></param>
        /// <param name="chartname"></param>
        /// <param name="startYearMMDD"></param>
        /// <param name="endYearMMDD"></param>
        /// <param name="chartType"></param>
        /// <param name="unit"></param>
        /// <returns></returns>
        public ChartData MonthDDChartByDevice(Device device, float rate, string chartname, string startYearMMDD, string endYearMMDD, string chartType, string unit)
        {
            if (device == null)
            {
                return(new ChartData());
            }
            string name = LanguageUtil.getDesc("CHART_TITLE_MONTH_ENERGY");

            string    startYearMM   = startYearMMDD.Substring(0, 6);
            string    endYearMM     = endYearMMDD.Substring(0, 6);
            Hashtable monthDDEnergy = DeviceMonthDayDataService.GetInstance().DeviceYearMMDDList(device, startYearMM, endYearMM);

            string[] ic = base.getXseriesFromYYYYMMDD(startYearMMDD, endYearMMDD).ToArray();

            string[] xAxis = formatXaxis(ic, ChartTimeType.MonthDay);
            string   xname = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE).name;

            KeyValuePair <string, float?[]> data = new KeyValuePair <string, float?[]>();

            if (monthDDEnergy.Count > 0)
            {
                data = GenerateChartData(xname, ic, monthDDEnergy, rate);
            }
            return(ReportBuilder.createJsonChartXY(name, xAxis, data, "", unit, chartType, fromApp));
        }
Example #9
0
            public void FilfterByType_OnProper_Calculated()
            {
                MonitorType type = MonitorType.LED;

                List <ComputerMonitor> data = new List <ComputerMonitor>
                {
                    new ComputerMonitor {
                        Name = "A1", Screen = Screen.CurvedScreen, Type = MonitorType.LCD
                    },
                    new ComputerMonitor {
                        Name = "A2", Screen = Screen.CurvedScreen, Type = MonitorType.LED
                    },
                    new ComputerMonitor {
                        Name = "A3", Screen = Screen.CurvedScreen, Type = MonitorType.OLED
                    },
                    new ComputerMonitor {
                        Name = "B1", Screen = Screen.WideScreen, Type = MonitorType.LCD
                    },
                    new ComputerMonitor {
                        Name = "B2", Screen = Screen.WideScreen, Type = MonitorType.LED
                    },
                    new ComputerMonitor {
                        Name = "B3", Screen = Screen.WideScreen, Type = MonitorType.OLED
                    }
                };

                MonitorFilter filter = new MonitorFilter();

                List <ComputerMonitor> actual = filter.FilfterByType(data, type);

                Predicate <ComputerMonitor> filterByType = (x) => x.Type == type;

                Assert.Contains <ComputerMonitor>(actual, filterByType);
            }
Example #10
0
        /// <summary>
        /// 取得汇流箱传感器路数
        /// </summary>
        /// <param name="rundatas"></param>
        /// <returns></returns>
        public int getHlxroute(string[] rundatas)
        {
            string[] datas           = null;
            int      displayHxlroute = 0;

            foreach (string data in rundatas)
            {
                datas = data.Split(':');
                int         monitorCode = int.Parse(datas[0]);
                MonitorType mt          = MonitorType.getMonitorTypeByCode(monitorCode);
                if (mt == null)
                {
                    continue;
                }
                //判断是否接入路数测点
                if (monitorCode == MonitorType.MIC_BUSBAR_MAXLINE)
                {
                    try
                    {
                        int value = int.Parse(datas[1]);
                        if (value == 0)
                        {
                            value = 16;
                        }
                        displayHxlroute = DeviceData.HUILIUXIANG_CODE * 100 + value;
                    }
                    catch (Exception e)
                    {
                        break;
                    }
                    break;
                }
            }
            return(displayHxlroute);
        }
Example #11
0
        /// <summary>
        /// 作者:鄢睿
        /// 功能:通过电站列表获得跨月度图表数据
        /// 创建时间:2011年02月25日
        /// 修改:胡圣忠
        /// </summary>
        /// <param name="plantList">电站列表</param>
        /// <param name="rate">数据换算系数</param>
        /// <returns></returns>
        public ChartData YearMMChartBypList(IList <Plant> plantList, float rate, string chartname, string newserieKey, string startYearMM, string endYearMM, string chartType, string unit)
        {
            if (plantList == null)
            {
                return(new ChartData());
            }
            ///所有子站累加
            IList <PlantUnit> units = this.getUnitsByPlantList(plantList);

            int startYear = int.Parse(startYearMM.Substring(0, 4));
            int endYear   = int.Parse(endYearMM.Substring(0, 4));

            Hashtable yearMonthEnergy = CollectorYearMonthDataService.GetInstance().GetUnitBetweenYearData(units, startYear, endYear);

            string[] ic = base.getXseriesFromYYYYMM(startYearMM, endYearMM).ToArray();

            string[]    xAxis = formatXaxis(ic, ChartTimeType.YearMonth);
            MonitorType mt    = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE);
            KeyValuePair <string, float?[]> data = new KeyValuePair <string, float?[]>();

            if (yearMonthEnergy.Count > 0)
            {
                if (newserieKey == null)
                {
                    data = GenerateChartData(mt.name, ic, yearMonthEnergy, rate);
                }
                else
                {
                    data = GenerateChartData(newserieKey, ic, yearMonthEnergy, rate);
                }
            }
            string comobj = "";//plantList.Count > 1 ? "" : plantList[0].name;

            return(ReportBuilder.createJsonChartXY(chartname, xAxis, data, "", unit, chartType, comobj, fromApp));
        }
Example #12
0
        /// <summary>
        /// 单个设备的年月发电量图表数据
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <param name="startYM">开始年月</param>
        /// <param name="endYM">截止年月</param>
        /// <param name="chartType">图表类型</param>
        /// <returns></returns>
        public ActionResult DeviceYearMMChart(int dId, string startYM, string endYM, string chartType, string lan)
        {
            setlan(lan);

            string reportData = string.Empty;

            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            Device device = DeviceService.GetInstance().get(dId);

            if (device != null)
            {
                MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE);
                string      unit     = energyMt.unit;
                //取得用户年度发电量图表数据
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = DeviceChartService.GetInstance().YearMMChartByDevice(device, 1.0F, string.Format(LanguageUtil.getDesc("DEVICEYEAR_CHART_NAME"), device.fullName), startYM, endYM, chartType, unit);
                reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            else
            {
                AppError appError = new AppError(AppError.devicenoexist, Resources.SunResource.CHART_DEVICE_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(AppError));
            }
            return(Content(reportData));
        }
Example #13
0
        public ActionResult PlantData(int plantId)
        {
            Plant plant = PlantService.GetInstance().GetPlantInfoById(plantId);

            Cn.Loosoft.Zhisou.SunPower.Common.vo.PlantVO plantVO = new Cn.Loosoft.Zhisou.SunPower.Common.vo.PlantVO();

            User user = UserService.GetInstance().Get((int)plant.userID);

            plantVO.plantName          = plant.name;
            plantVO.CQ2reduce          = plant.Reductiong.ToString();
            plantVO.CQ2reduceUnit      = plant.ReductiongUnit;
            plantVO.curPower           = plant.DisplayTodayTotalPower;
            plantVO.curPowerUnit       = plant.TodayTotalPowerUnit;
            plantVO.dayEnergy          = plant.DisplayTotalDayEnergy;
            plantVO.dayEnergyUnit      = plant.TotalDayEnergyUnit;
            plantVO.solarIntensity     = plant.Sunstrength == null ? "" : plant.Sunstrength.ToString();
            plantVO.solarIntensityUnit = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_LINGT_CODE).unit;
            //add by qhb in 20120106 for 增加逆变器数量
            IList <Device> inverterDevices = plant.typeDevices(DeviceData.INVERTER_CODE);

            plantVO.inverterCount   = inverterDevices.Count.ToString();
            plantVO.inverterTypeStr = getMainType(inverterDevices, 3);
            plantVO.installDate     = plant.installdate.ToString("yyyy-MM-dd");
            plantVO.DesignPower     = plant.design_power + " kWp";
            plantVO.Country         = plant.country;
            plantVO.City            = plant.city;
            plantVO.organize        = user.organize;
            plantVO.totalEnergy     = plant.DisplayTotalEnergy;
            plantVO.totalEnergyUnit = plant.TotalEnergyUnit;
            plantVO.imageArray      = "http://" + Request.Url.Authority + (string.IsNullOrEmpty(plant.onePic) ? "/bigscreen/images/plant_img.jpg":"/ufile/" + plant.onePic);
            plantVO.temprature      = getPlantTemp(plant).ToString();
            plantVO.tempratureUnit  = user.TemperatureType.ToUpper();
            return(Json(plantVO, JsonRequestBehavior.AllowGet));
        }
Example #14
0
        /// <summary>
        /// 比较一个设备的多个测点的日数据
        /// </summary>
        /// <param name="dId"></param>
        /// <param name="startYYYYMMDDHH"></param>
        /// <param name="endYYYYMMDDHH"></param>
        /// <param name="chartType"></param>
        /// <param name="monitorCodes">多个测点之间用逗号分隔</param>
        /// <returns></returns>
        public ActionResult CompareDayByMonitor(int dId, string startYYYYMMDDHH, string endYYYYMMDDHH, string chartType, string monitorCodes, int intervalMins)
        {
            string reportCode = string.Empty;
            Device device     = DeviceService.GetInstance().get(dId);

            IList <MonitorType> monitorTypes = new List <MonitorType>();

            string[]            monitorArr = monitorCodes.Split(',');
            IList <DeviceStuct> devices    = new List <DeviceStuct>();

            string[] chartTypes = chartType.Split(',');
            string   chartName  = string.Empty;

            for (int i = 0; i < monitorArr.Length; i++)
            {
                MonitorType monitorType = MonitorType.getMonitorTypeByCode(int.Parse(monitorArr[i]));
                devices.Add(new DeviceStuct()
                {
                    deviceId = dId.ToString(), rate = 1.0F, comareObj = device.fullName, chartType = chartTypes[i], monitorType = monitorType, cVal = ComputeType.Avg, deviceType = ChartDeviceType.DEVICE, intervalMins = intervalMins
                });
                chartName += monitorType.name + "&";
            }
            chartName = chartName.Length > 1 ? chartName.Substring(0, chartName.Length - 1) : chartName;

            if (device != null)
            {
                // string chartName = LanguageUtil.getDesc("CHART_DAY_CHART");
                ChartData chartData = CompareChartService.GetInstance().compareDayHHMultiDeviceMultiMonitor(chartName, devices, startYYYYMMDDHH, endYYYYMMDDHH, intervalMins);
                reportCode = JsonUtil.convertToJson(chartData, typeof(ChartData));
            }
            return(Content(reportCode));
        }
Example #15
0
 public void RunWhenFloatLarger(FloatMonitor monitor, float floatThreshold, Operation operation)
 {
     _monitorType    = MonitorType.FloatLarge;
     _floatMonitor   = monitor;
     _oper           = operation;
     _floatThreshold = floatThreshold;
 }
Example #16
0
        /// <summary>
        /// 获取日志监控信息
        /// </summary>
        /// <param name="mType"></param>
        /// <returns></returns>
        public string GetLogInfo(MonitorType mType = MonitorType.Action)
        {
            string actionView = "Action执行时间监控";
            string name       = "Action";

            if (mType == MonitorType.View)
            {
                actionView = "View视图生成时间监控";
                name       = "View";
            }

            string msg = @"
            {0}
            ControllerName:{1}Controller,
            {8}Name:{2}
            开始时间:{3}
            结束时间:{4}
            总 耗 时:{5}秒
            Form表单:{6}
            URL参数:{7}
                        ";

            return(string.Format(msg,
                                 actionView,
                                 ControllerName,
                                 ActionName,
                                 ExecuteStartTime,
                                 ExecuteEndTime,
                                 (ExecuteEndTime - ExecuteStartTime).TotalSeconds,
                                 GetCollections(FormCollections),
                                 GetCollections(QueryCollections),
                                 name));
        }
Example #17
0
        private async Task <float[]> SendState(WebSocket webSocket, MonitorType monitorType, float[] oldValue, float[] newValue)
        {
            if (oldValue.Sum() == newValue.Sum())
            {
                return(oldValue);
            }

            MonitorState state = null;

            switch (monitorType)
            {
            case MonitorType.CPU:
                state = new MonitorStateCPU(newValue);
                break;

            case MonitorType.RAM:
                state = new MonitorStateRAM(newValue);
                break;

            case MonitorType.HDD:
                state = new MonitorStateHDD(newValue);
                break;

            case MonitorType.NET:
                state = new MonitorStateNET(newValue);
                break;
            }

            var buffer = Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(state));

            await webSocket.SendAsync(new ReadOnlyMemory <byte>(buffer, 0, buffer.Length), WebSocketMessageType.Text, true, CancellationToken.None);

            return(newValue);
        }
        /// <summary>
        /// 获取日志监控指标项
        /// </summary>
        /// <param name="mtype"></param>
        /// <returns></returns>
        public string GetLoginfo(MonitorType mtype = MonitorType.Action)
        {
            string ActionView = "Action执行时间监控:";
            string Name       = "Action";

            if (mtype == MonitorType.View)
            {
                ActionView = "View视图生成时间监控:";
                Name       = "View";
            }
            string Msg = @"
            {0}
            ControllerName:{1}Controller
            {8}Name:{2}
            开始时间:{3}
            结束时间:{4}
            总 时 间:{5}秒
            Form表单数据:{6}
            URL参数:{7}
                    ";

            return(string.Format(Msg,
                                 ActionView,
                                 ControllerName,
                                 ActionName,
                                 ExecuteStartTime,
                                 ExecuteEndTime,
                                 (ExecuteEndTime - ExecuteStartTime).TotalSeconds,
                                 GetCollections(FormCollections),
                                 GetCollections(QueryCollections),
                                 Name));
        }
Example #19
0
   /// <summary>
   /// 获取监控指标日志
   /// </summary>
   /// <param name="mtype"></param>
   /// <returns></returns>
   public string GetLoginfo(MonitorType mtype = MonitorType.Action)
   {
       string ActionView = "Action执行时间监控:";
       string Name = "Action";
       if (mtype == MonitorType.View)
       {
           ActionView = "View视图生成时间监控:";
           Name = "View";
       }
       string Msg = @"
 {0}
 ControllerName:{1}Controller
 {8}Name:{2}
 开始时间:{3}
 结束时间:{4}
 总 时 间:{5}秒
 Form表单数据:{6}
 URL参数:{7}
 访问来自:{9}
     ";
       return string.Format(Msg,
         ActionView,
         ControllerName,
         ActionName,
         ExecuteStartTime,
         ExecuteEndTime,
         (ExecuteEndTime - ExecuteStartTime).TotalSeconds,
         GetCollections(FormCollections),
         GetCollections(QueryCollections),
         Name, GetIP());
   }
Example #20
0
        /// <summary>
        /// 设备的年月统计图表
        /// </summary>
        /// <param name="device"></param>
        /// <param name="rate"></param>
        /// <param name="chartname"></param>
        /// <param name="startYearMM"></param>
        /// <param name="endYearMM"></param>
        /// <param name="chartType"></param>
        /// <param name="unit"></param>
        /// <returns></returns>
        public ChartData YearMMChartByDevice(Device device, float rate, string chartname, string startYearMM, string endYearMM, string chartType, string unit)
        {
            if (device == null)
            {
                return(new ChartData());
            }
            string name = LanguageUtil.getDesc("CHART_TITLE_YEAR_ENERGY");

            int       startYear       = int.Parse(startYearMM.Substring(0, 4));
            int       endYear         = int.Parse(endYearMM.Substring(0, 4));
            Hashtable yearMonthEnergy = DeviceYearMonthDataService.GetInstance().GetDeviceBetweenYearData(device, startYear, endYear);

            string[] ic = base.getXseriesFromYYYYMM(startYearMM, endYearMM).ToArray();

            string[] xAxis = formatXaxis(ic, ChartTimeType.YearMonth);

            string yname = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE).name;

            KeyValuePair <string, float?[]> data = new KeyValuePair <string, float?[]>();

            if (yearMonthEnergy.Count > 0)
            {
                data = GenerateChartData(yname, ic, yearMonthEnergy, rate);
            }
            return(ReportBuilder.createJsonChartXY(name, xAxis, data, "", unit, chartType, fromApp));
        }
Example #21
0
        /// <summary>
        /// 获取监控指标日志
        /// </summary>
        /// <param name="mtype"></param>
        /// <returns></returns>
        public string GetLoginfo(MonitorType mtype = MonitorType.Action)
        {
            string ActionView = "Action执行时间监控:";
            string Name       = "Action";

            if (mtype == MonitorType.View)
            {
                ActionView = "View视图生成时间监控:";
                Name       = "View";
            }
            string Msg = @"
			{0}
			ControllerName:{1}Controller
			{6}Name:{2}
			开始时间:{3}
			Form表单数据:{4}
			URL参数:{5}
					"                    ;

            return(string.Format(Msg,
                                 ActionView,
                                 ControllerName,
                                 ActionName,
                                 ExecuteStartTime,
                                 BodyCollections,
                                 QueryCollections.ToString(),
                                 Name));
        }
Example #22
0
        /// <summary>
        /// 作者:鄢睿
        /// 功能:通过电站列表获得电站总量图表数据
        /// 创建时间:2011年02月25日
        /// 修改:胡圣忠
        /// </summary>
        /// <param name="plantList">电站列表</param>
        /// <param name="rate">数据换算系数</param>
        /// <returns></returns>
        public ChartData YearChartBypList(IList <Plant> plantList, float rate, string chartname, string newserieKey, string chartType, string unit)
        {
            if (plantList == null)
            {
                return(new ChartData());
            }

            //所有子站累加
            Hashtable yearEnergy = CollectorYearDataService.GetInstance().GetYearDatasByUnits(this.getUnitsByPlantList(plantList));

            string[] ic    = sortCollection(yearEnergy.Keys);
            string[] newic = null;
            int      len   = 5;
            int      skip  = len - ic.Length;
            int      left  = (int)skip / 2;
            int      right = 5 - ic.Length - left;

            if (ic.Length < len)
            {
                newic = new string[len];
                len   = 0;
                int startYear = ic.Length == 0 ? DateTime.Now.Year : int.Parse(ic[0]);
                int endYear   = ic.Length == 0 ? DateTime.Now.Year : int.Parse(ic[ic.Length - 1]);
                while (left > 0)
                {
                    newic[len++] = (startYear - (left--)).ToString();
                }
                foreach (string s in ic)
                {
                    newic[len++] = s;
                }
                for (int i = 1; i <= right; i++)
                {
                    newic[len++] = (endYear + (i)).ToString();
                }
            }
            else
            {
                newic = ic;
            }
            string[]    xAxis = formatXaxis(newic, ChartTimeType.Year);
            MonitorType mt    = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE);
            KeyValuePair <string, float?[]> data = new KeyValuePair <string, float?[]>();

            if (yearEnergy.Count > 0)
            {
                if (newserieKey == null)
                {
                    data = GenerateChartData(mt.name, newic, yearEnergy, rate);
                }
                else
                {
                    data = GenerateChartData(newserieKey, newic, yearEnergy, rate);
                }
            }

            string comobj = "";//plantList.Count > 1 ? "" : plantList[0].name;

            return(ReportBuilder.createJsonChartXY(chartname, xAxis, data, "", unit, chartType, comobj, fromApp));
        }
Example #23
0
        /// <summary>
        /// 取得电站详细信息
        /// </summary>
        /// <param name="pid"></param>
        /// <returns></returns>
        public ActionResult Plantinfo(int pid, string lan)
        {
            setlan(lan);

            string data;
            Plant  plant = PlantService.GetInstance().GetPlantInfoById(pid);

            if (plant == null)
            {
                AppError appError = new AppError(AppError.plantnoexist, Resources.SunResource.CHART_PLANT_DONT_EXISTED);
                data = JsonUtil.convertToJson(appError, typeof(AppError));
            }
            else
            {
                User        user     = UserService.GetInstance().Get((int)plant.userID);
                MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE);
                MonitorType powerMt  = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_POWER_CODE);
                PlantInfoVO plantvo  = new PlantInfoVO();

                plantvo.totalEnergy      = plant.upTotalEnergy;
                plantvo.todayEnergy      = plant.upTotalDayEnergy;
                plantvo.pId              = plant.id;
                plantvo.name             = plant.name;
                plantvo.co2Reduction     = plant.Reductiong;
                plantvo.revenue          = user.revenue * plantvo.totalEnergy;
                plantvo.designPower      = Math.Round(plant.design_power, 2);
                plantvo.powerUnit        = "KWp";
                plantvo.revenueUnit      = plant.currencies;
                plantvo.totalEnergyUnit  = plant.TotalEnergyUnit;
                plantvo.todayEnergyUnit  = plant.TotalDayEnergyUnit;
                plantvo.co2ReductionUnit = plant.ReductiongUnit;
                plantvo.pic              = base.getCurWebContext() + "/ufile/small/" + plant.onePic;
                plantvo.country          = plant.country;
                plantvo.city             = plant.city;
                plantvo.direction        = plant.direction;
                plantvo.installdate      = plant.installdate.ToString("yyyy-MM-dd");
                plantvo.angle            = plant.angle;
                plantvo.latitude         = plant.latitudeString;
                plantvo.location         = plant.location;
                plantvo.longitude        = plant.longitudeString;
                plantvo.street           = plant.street;
                plantvo.sunlight         = plant.Sunstrength.ToString();
                plantvo.temperature      = plant.Temperature.ToString();
                plantvo.weather          = "Sundy";
                plantvo.moduleType       = plant.module_type;
                plantvo.email            = plant.email;

                plantvo.manufacturer   = plant.manufacturer;
                plantvo.operatorPerson = plant.operater;
                plantvo.phone          = plant.phone;
                plantvo.revenueRate    = Math.Round(plant.revenueRate, 2).ToString();

                plantvo.timeZone = Cn.Loosoft.Zhisou.SunPower.Common.TimeZone.GetText(plant.timezone);
                plantvo.zipCode  = plant.postcode;

                data = JsonUtil.convertToJson(plantvo, typeof(PlantInfoVO));
            }
            return(Content(data));
        }
Example #24
0
		public Result Add (string uri, MonitorType type)
		{
			handle = IntPtr.Zero;
			if (wrapper == null)
				wrapper = new MonitorCallbackWrapper (new MonitorCallback (OnMonitorEvent), null);
			Result result = gnome_vfs_monitor_add (out handle, uri, type, wrapper.NativeDelegate, IntPtr.Zero);
			return result;
		}
Example #25
0
 /// <summary>
 /// Define the type of monitor used to take latency measurements.
 /// </summary>
 /// <param name="type">The used display technology</param>
 public void SetMonitorType(MonitorType type)
 {
     _displayGreenOnly = (type == MonitorType.DLP);
     if (type == MonitorType.OLED_HMD)
     {
         gameObject.transform.Rotate(new Vector3(180f, 180f, 0));
     }
 }
Example #26
0
        /// <summary>
        /// 取得多个电站的pr性能图表数据
        /// </summary>
        /// <param name="plantList"></param>
        /// <param name="chartname"></param>
        /// <param name="newseriekey"></param>
        /// <param name="startYearMMDD"></param>
        /// <param name="endYearMMDD"></param>
        /// <param name="chartType"></param>
        /// <param name="unit"></param>
        /// <returns></returns>
        public ChartData MonthDDRPChartBypList(Device invertDevice, Device detectorDevice, string chartName, string startYearMMDD, string endYearMMDD, string chartType)
        {
            if (invertDevice == null)
            {
                return(new ChartData());
            }

            MonitorType    mt         = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE);
            IList <string> chartTypes = new List <string>(); //图表类型
            IList <string> units      = new List <string>(); //单位
            IList <string> ynames     = new List <string>(); //y轴名称

            //IList<string> compareObjs = null;            //图例比较对象,因为是同一个电站,不追加
            chartTypes.Add(chartType);
            chartTypes.Add(chartType);
            ynames.Add(mt.name);
            ynames.Add(mt.name);

            //产生坐标
            string[] ic = base.getXseriesFromYYYYMMDD(startYearMMDD, endYearMMDD).ToArray();

            string[] xAxis = formatXaxis(ic, ChartTimeType.MonthDay);
            float    rate  = 1.0F;
            string   newseriekey;
            //取得多个采集器的实际发电量
            Hashtable monthDDEnergy = DeviceMonthDayDataService.GetInstance().DeviceYearMMDDList(invertDevice, startYearMMDD, endYearMMDD);

            units.Add(mt.unit);
            units.Add(mt.unit);

            IList <KeyValuePair <string, float?[]> > datas = new List <KeyValuePair <string, float?[]> >();
            KeyValuePair <string, float?[]>          data  = new KeyValuePair <string, float?[]>();

            if (monthDDEnergy.Count > 0)
            {
                newseriekey = LanguageUtil.getDesc("ACTUALENERGY");
                data        = GenerateChartData(newseriekey, ic, monthDDEnergy, rate);
            }
            //string comobj = "";//plantList.Count > 1 ? "" : plantList[0].name;
            datas.Add(data);
            //取得日照增量强度,并依次计算理论发电量
            rate = this.getEnergyRate(invertDevice.designPower);

            monthDDEnergy = DeviceMonthDayDataService.GetInstance().DeviceYearMMDDList(detectorDevice, startYearMMDD, endYearMMDD);
            newseriekey   = LanguageUtil.getDesc("THEORYENERGY");
            data          = GenerateChartData(newseriekey, ic, monthDDEnergy, rate);
            datas.Add(data);

            float?[] newDataArr = computeByType(xAxis.ToArray(), datas, ComputeType.Ratio);
            KeyValuePair <string, float?[]> newdata = new KeyValuePair <string, float?[]>("PR", newDataArr);

            datas.Add(newdata);
            chartTypes.Add(ChartType.line);
            units.Add("%");
            ynames.Add("PR");

            return(ReportBuilder.createMultiJsonChartXY(chartName, xAxis, datas, ynames.ToArray(), chartTypes.ToArray(), units.ToArray(), fromApp));
        }
        public string GetTargetName(MonitorType monitorType, int id)
        {
            switch (monitorType)
            {
            case MonitorType.Process:
                Process process;
                if (processInfo.ContainsKey(id))
                {
                    process = processInfo [id];
                }
                else
                {
                    process = this.GetProcessItem(id);
                }
                if (process != null)
                {
                    processInfo [id] = process;
                    return(process.ProcessName);
                }
                break;

            case MonitorType.MySql:
                MySql mysql;
                if (mysqlInfo.ContainsKey(id))
                {
                    mysql = mysqlInfo [id];
                }
                else
                {
                    mysql = this.GetMySqlItem(id);
                }
                if (mysql != null)
                {
                    mysqlInfo [id] = mysql;
                    return(mysql.Description);
                }
                break;

            case MonitorType.HttpUrl:
                HttpUrl httpUrl;
                if (httpUrlInfo.ContainsKey(id))
                {
                    httpUrl = httpUrlInfo [id];
                }
                else
                {
                    httpUrl = this.GetUrlItem(id);
                }
                if (httpUrl != null)
                {
                    httpUrlInfo [id] = httpUrl;
                    return(httpUrl.Description);
                }
                break;
            }
            return("未知监控");
        }
Example #28
0
        /// <summary>
        /// 作者:鄢睿
        /// 功能:取得设备多个年度的年月比较数据
        /// 创建时间:2011年02月25日
        /// </summary>
        /// <param name="device"></param>
        /// <param name="years"></param>
        /// <param name="monitorCode"></param>
        /// <param name="unit"></param>
        /// <param name="chartType"></param>
        /// <returns></returns>
        public ChartData DeviceMMCompare(Device device, IList <string> yearmms, MonitorType mt, string unit, string chartType, float rate)
        {
            ICollection <ICollection> keys = new List <ICollection>();
            StringBuilder             sb   = new StringBuilder();
            // foreach (string year in yearmms)
            //{
            // sb.Append("," + year);
            //}
            string chartName = mt.name + " " + LanguageUtil.getDesc("CHART_TITLE_COMPARE");
            IList <KeyValuePair <string, float?[]> > datas = new List <KeyValuePair <string, float?[]> >();

            string[] chartTypes = new string[1] {
                chartType
            };
            string[] units = new string[1] {
                unit
            };
            string[] ynames = new string[1] {
                ""
            };
            string[] ic = null;

            bool hasData = false;
            //取得多个年度的发电月数据
            int i = 0;

            foreach (string yearMM in yearmms)
            {
                Hashtable dataHash = null;
                string    curName  = yearMM;
                dataHash = DeviceMonthDayDataService.GetInstance().DeviceYearMMDDList(device, yearMM, yearMM);
                string[] tmpic = base.getXseriesFromYYYYMMDD(yearMM + "01", yearMM + CalenderUtil.getMonthDays(yearMM).ToString("00")).ToArray();
                if (ic == null || tmpic.Length > ic.Length)
                {
                    ic = tmpic;
                }
                //如果有多个设备进行编辑,没有数据的时候也显示
                //if (dataHash.Count > 0)
                //{
                KeyValuePair <string, float?[]> data = GenerateChartData(curName, ic, dataHash, rate);
                datas.Add(data);
                //}
                //如果有数据则将有数据标识为true
                if (dataHash.Count > 0)
                {
                    hasData = true;
                }
                i++;
            }
            if (!hasData)
            {
                //如果所有设备都没数据才清空数据,即图表中显示无数据提示
                datas.Clear();
            }
            string[] xAxis = formatXaxis(ic, ChartTimeType.MonthDay);
            return(ReportBuilder.createMultiJsonChartXY(chartName, xAxis, datas, ynames, chartTypes, units, fromApp));
        }
Example #29
0
        public Target(MySqlDataReader reader, bool bCloseReader)  // Create the Target object from a row of data.
            : base(reader, 0, 3)
        {
            m_unAccountID       = reader.GetUInt32(1);
            m_bEnabled          = StringUtils.DatabaseStringToBoolean(reader, 2);
            m_strURL            = reader.GetString(4);
            m_nMonitorInterval  = reader.GetInt32(5);
            m_tsMonitorInterval = new TimeSpan(0, 0, m_nMonitorInterval);
            //m_bLastMonitoredAtIsNull = reader.IsDBNull(6);

            if (!reader.IsDBNull(6))
            {
                m_ndtLastMonitoredAt = reader.GetDateTime(6);
            }

            if (!m_ndtLastMonitoredAt.HasValue)
            {
                m_dtNextMonitor = DateTime.UtcNow;
            }
            else
            {
                m_dtNextMonitor = m_ndtLastMonitoredAt.Value + m_tsMonitorInterval;
            }

            uint unMonitorTypeAsUInt         = reader.GetUInt32(7);
            MonitorTypeCollectionMember mtcm = MonitorTypeCollection.FindUsingEquivalentUInt(unMonitorTypeAsUInt);

            if (mtcm != null)
            {
                m_eMonitorType = mtcm.MonitorType;
            }

            m_unLastTargetLogID = reader.GetUInt32(8);

            try
            {
                if (!reader.IsDBNull(9))
                {
                    m_dtTargetAddedAt = reader.GetDateTime(9);
                }
            }
            catch (MySqlConversionException)
            {
                m_dtTargetAddedAt = DateTime.UtcNow;
            }

            if (!reader.IsDBNull(10))
            {
                m_ndtLastFailedAt = reader.GetDateTime(10);
            }

            if (bCloseReader)
            {
                reader.Close(); // We are only permitted one open data reader per connection at a time.
            }
        }
Example #30
0
 public void RunDelay(float delayTime, Operation operation)
 {
     _monitorType  = MonitorType.FloatLarge;
     _floatMonitor = delegate {
         _timer += Time.deltaTime;
         return(_timer);
     };
     _oper           = operation;
     _floatThreshold = delayTime;
 }
Example #31
0
        public static void RestartEvent(MonitorType monitorType)
        {
            if (!IsRunning)
            {
                return;
            }

            monitors24h[(int)monitorType].Restart();
            monitors1h[(int)monitorType].Restart();
            monitors5m[(int)monitorType].Restart();
        }
Example #32
0
        public static void RegisterEventEnd(MonitorType monitorType)
        {
            if (!IsRunning)
            {
                return;
            }

            monitors5m[(int)monitorType].RegisterEventEnd();
            monitors1h[(int)monitorType].RegisterEventEnd();
            monitors24h[(int)monitorType].RegisterEventEnd();
        }
Example #33
0
 /// <summary>
 /// Creates a new instance of a monitor class
 /// </summary>
 /// <param name="target">
 /// <see cref="Control"/> to monitor (may be null if not needed and
 /// is not checked by <see cref="CreateInstance"/> before calling the constructor)
 /// </param>
 /// <param name="type">
 /// Type of the monitor to create
 /// </param>
 /// <returns>Reference to the new  <see cref="IInactivityMonitor"/> object</returns>
 public static IInactivityMonitor CreateInstance(Control target, MonitorType type)
 {
     switch (type)
     {
         case MonitorType.ApplicationMonitor:
             return new ApplicationMonitor();
         case MonitorType.ControlMonitor:
             return new ControlMonitor(target);
         case MonitorType.LastInputMonitor:
             return new LastInputMonitor();
         case MonitorType.ThreadHookMonitor:
             return new HookMonitor(false);
         case MonitorType.GlobalHookMonitor:
         default:
             return new HookMonitor(true);
     }
 }
Example #34
0
 public ContextTimeoutManager(MonitorType pMonitorType)
 {
     _contexts = new LocklessQueue<HttpClientContext>();
     _monitoringType = pMonitorType;
     switch (pMonitorType)
     {
         case MonitorType.Thread:
             _internalThread = new Thread(ThreadRunProcess);
             _internalThread.Priority = ThreadPriority.Lowest;
             _internalThread.IsBackground = true;
             _internalThread.CurrentCulture = new CultureInfo("en-US", false);
             _internalThread.Name = "HttpServer Internal Zombie Timeout Checker";
             _internalThread.Start();
             break;
         case MonitorType.Timer:
             _internalTimer = new Timer(TimerCallbackCheck, null, _monitorMS, _monitorMS);
             
             break;
     }
 }
Example #35
0
        private void FillRealtimeTable(MonitorType type)
        {
            if (gridRealtime.DataSource == null)
            {
                System.Data.DataTable dt = new System.Data.DataTable();
                dt.TableName = "RTSymbols";
                dt.Columns.Add("SymbolName");
                dt.Columns.Add("Description");
                dt.Columns.Add("Symbolnumber", Type.GetType("System.Int32"));
                dt.Columns.Add("Value", Type.GetType("System.Double"));
                dt.Columns.Add("Offset", Type.GetType("System.Double"));
                dt.Columns.Add("Correction", Type.GetType("System.Double"));
                dt.Columns.Add("Peak", Type.GetType("System.Double"));
                dt.Columns.Add("Minimum", Type.GetType("System.Double"));
                dt.Columns.Add("Maximum", Type.GetType("System.Double"));
                dt.Columns.Add("ConvertedSymbolnumber", Type.GetType("System.Int32"));
                dt.Columns.Add("SRAMAddress", Type.GetType("System.Int32"));
                dt.Columns.Add("Length", Type.GetType("System.Int32"));
                dt.Columns.Add("UserDefined", Type.GetType("System.Int32"));
                dt.Columns.Add("Delay", Type.GetType("System.Int32"));
                dt.Columns.Add("Reload", Type.GetType("System.Int32"));
                gridRealtime.DataSource = dt;
            }
            // fill values
            try
            {
                System.Data.DataTable dt = (System.Data.DataTable)gridRealtime.DataSource;
                // rpm should always be present
                if (!m_appSettings.UseAdditionalCanbusFrames) // <GS-05042011> otherwise, get it from the data that is already on the bus
                {
                    if (SymbolExists("ActualIn.n_Engine")) AddToRealtimeTable(dt, "ActualIn.n_Engine", "Engine speed", GetSymbolNumber(m_symbols, "ActualIn.n_Engine"), 0, 0, 1, 0, 0, 8000, GetSymbolNumber(m_symbols, "ActualIn.n_Engine"), (uint)GetSymbolAddressSRAM(m_symbols, "ActualIn.n_Engine"), GetSymbolLength(m_symbols, "ActualIn.n_Engine"), 1);
                    if (SymbolExists("In.v_Vehicle")) AddToRealtimeTable(dt, "In.v_Vehicle", "Vehicle speed", GetSymbolNumber(m_symbols, "In.v_Vehicle"), 0, 0, 0.1, 0, 0, 300, GetSymbolNumber(m_symbols, "In.v_Vehicle"), (uint)GetSymbolAddressSRAM(m_symbols, "In.v_Vehicle"), GetSymbolLength(m_symbols, "In.v_Vehicle"), 3);
                    if (SymbolExists("Out.X_AccPedal")) AddToRealtimeTable(dt, "Out.X_AccPedal", "TPS %", GetSymbolNumber(m_symbols, "Out.X_AccPedal"), 0, 0, 0.1, 0, 0, 100, GetSymbolNumber(m_symbols, "Out.X_AccPedal"), (uint)GetSymbolAddressSRAM(m_symbols, "Out.X_AccPedal"), GetSymbolLength(m_symbols, "Out.X_AccPedal"), 1);
                }
                if (SymbolExists("ActualIn.T_Engine")) AddToRealtimeTable(dt, "ActualIn.T_Engine", "Engine temperature", GetSymbolNumber(m_symbols, "ActualIn.T_Engine"), 0, 0, 1, 0, -20, 120, GetSymbolNumber(m_symbols, "ActualIn.T_Engine"), (uint)GetSymbolAddressSRAM(m_symbols, "ActualIn.T_Engine"), GetSymbolLength(m_symbols, "ActualIn.T_Engine"), 5);
                if (SymbolExists("ActualIn.T_AirInlet")) AddToRealtimeTable(dt, "ActualIn.T_AirInlet", "Intake air temperature", GetSymbolNumber(m_symbols, "ActualIn.T_AirInlet"), 0, 0, 1, 0, -20, 120, GetSymbolNumber(m_symbols, "ActualIn.T_AirInlet"), (uint)GetSymbolAddressSRAM(m_symbols, "ActualIn.T_AirInlet"), GetSymbolLength(m_symbols, "ActualIn.T_AirInlet"), 3);
                if (SymbolExists("ECMStat.ST_ActiveAirDem")) AddToRealtimeTable(dt, "ECMStat.ST_ActiveAirDem", "Active air demand map", GetSymbolNumber(m_symbols, "ECMStat.ST_ActiveAirDem"), 0, 0, 1, 0, 0, 255, GetSymbolNumber(m_symbols, "ECMStat.ST_ActiveAirDem"), (uint)GetSymbolAddressSRAM(m_symbols, "ECMStat.ST_ActiveAirDem"), GetSymbolLength(m_symbols, "ECMStat.ST_ActiveAirDem"), 1);
                if (SymbolExists("Lambda.Status")) AddToRealtimeTable(dt, "Lambda.Status", "Lambda status", GetSymbolNumber(m_symbols, "Lambda.Status"), 0, 0, 1, 0, 0, 255, GetSymbolNumber(m_symbols, "Lambda.Status"), (uint)GetSymbolAddressSRAM(m_symbols, "Lambda.Status"), GetSymbolLength(m_symbols, "Lambda.Status"), 1);
                if (SymbolExists("FCut.CutStatus")) AddToRealtimeTable(dt, "FCut.CutStatus", "Fuelcut status", GetSymbolNumber(m_symbols, "FCut.CutStatus"), 0, 0, 1, 0, 0, 255, GetSymbolNumber(m_symbols, "FCut.CutStatus"), (uint)GetSymbolAddressSRAM(m_symbols, "FCut.CutStatus"), GetSymbolLength(m_symbols, "FCut.CutStatus"), 1);
                if (SymbolExists("IgnProt.fi_Offset")) AddToRealtimeTable(dt, "IgnProt.fi_Offset", "Ignition offset", GetSymbolNumber(m_symbols, "IgnProt.fi_Offset"), 0, 0, 0.1, 0, -20, 20, GetSymbolNumber(m_symbols, "IgnProt.fi_Offset"), (uint)GetSymbolAddressSRAM(m_symbols, "IgnProt.fi_Offset"), GetSymbolLength(m_symbols, "IgnProt.fi_Offset"), 1);
                if (SymbolExists("m_Request")) AddToRealtimeTable(dt, "m_Request", "Requested airmass", GetSymbolNumber(m_symbols, "m_Request"), 0, 0, 1, 0, 0, 600, GetSymbolNumber(m_symbols, "m_Request"), (uint)GetSymbolAddressSRAM(m_symbols, "m_Request"), GetSymbolLength(m_symbols, "m_Request"), 1);
                if (SymbolExists("Out.M_Engine")) AddToRealtimeTable(dt, "Out.M_Engine", "Calculated torque", GetSymbolNumber(m_symbols, "Out.M_Engine"), 0, 0, 1, 0, 0, 600, GetSymbolNumber(m_symbols, "Out.M_Engine"), (uint)GetSymbolAddressSRAM(m_symbols, "Out.M_Engine"), GetSymbolLength(m_symbols, "Out.M_Engine"), 1);

                //<GS-05042011> P_Engine is not needed, we can calculate that from torque and RPM
                //if (SymbolExists("ECMStat.P_Engine")) AddToRealtimeTable(dt, "ECMStat.P_Engine", "Calculated power", GetSymbolNumber(m_symbols, "ECMStat.P_Engine"), 0, 0, 1, 0, 0, 600, GetSymbolNumber(m_symbols, "ECMStat.P_Engine"), (uint)GetSymbolAddressSRAM(m_symbols, "ECMStat.P_Engine"), GetSymbolLength(m_symbols, "ECMStat.P_Engine"), 1);

                //if (SymbolExists("ECMStat.p_Diff")) AddToRealtimeTable(dt, "ECMStat.p_Diff", "Boost", GetSymbolNumber(m_symbols, "ECMStat.p_Diff"), 0, 0, 0.01, 0, -1, 3, GetSymbolNumber(m_symbols, "ECMStat.p_Diff"), (uint)GetSymbolAddressSRAM(m_symbols, "ECMStat.p_Diff"), GetSymbolLength(m_symbols, "ECMStat.p_Diff"));
                if (SymbolExists("In.p_AirInlet")) AddToRealtimeTable(dt, "In.p_AirInlet", "Boost", GetSymbolNumber(m_symbols, "In.p_AirInlet"), 0, -1, 0.001, 0, -1, 3, GetSymbolNumber(m_symbols, "In.p_AirInlet"), (uint)GetSymbolAddressSRAM(m_symbols, "In.p_AirInlet"), GetSymbolLength(m_symbols, "In.p_AirInlet"), 1);
                if (SymbolExists("Out.PWM_BoostCntrl")) AddToRealtimeTable(dt, "Out.PWM_BoostCntrl", "Duty cycle BCV", GetSymbolNumber(m_symbols, "Out.PWM_BoostCntrl"), 0, 0, 0.1, 0, 0, 100, GetSymbolNumber(m_symbols, "Out.PWM_BoostCntrl"), (uint)GetSymbolAddressSRAM(m_symbols, "Out.PWM_BoostCntrl"), GetSymbolLength(m_symbols, "Out.PWM_BoostCntrl"), 1);
                if (SymbolExists("Out.fi_Ignition")) AddToRealtimeTable(dt, "Out.fi_Ignition", "Ignition advance", GetSymbolNumber(m_symbols, "Out.fi_Ignition"), 0, 0, 0.1, 0, -10, 50, GetSymbolNumber(m_symbols, "Out.fi_Ignition"), (uint)GetSymbolAddressSRAM(m_symbols, "Out.fi_Ignition"), GetSymbolLength(m_symbols, "Out.fi_Ignition"), 1);
                if (SymbolExists("MAF.m_AirInlet")) AddToRealtimeTable(dt, "MAF.m_AirInlet", "Actual airmass", GetSymbolNumber(m_symbols, "MAF.m_AirInlet"), 0, 0, 1, 0, 0, 1600, GetSymbolNumber(m_symbols, "MAF.m_AirInlet"), (uint)GetSymbolAddressSRAM(m_symbols, "MAF.m_AirInlet"), GetSymbolLength(m_symbols, "MAF.m_AirInlet"), 1);

                //<GS-05042011> Only add Exhaust.T_Calc when this function is active in the opened binary file
                if (HasExhaustGasTemperatureCalculation())
                {
                    if (SymbolExists("Exhaust.T_Calc")) AddToRealtimeTable(dt, "Exhaust.T_Calc", "Calculated EGT temperature", GetSymbolNumber(m_symbols, "Exhaust.T_Calc"), 0, 0, 1, 0, 0, 1200, GetSymbolNumber(m_symbols, "Exhaust.T_Calc"), (uint)GetSymbolAddressSRAM(m_symbols, "Exhaust.T_Calc"), GetSymbolLength(m_symbols, "Exhaust.T_Calc"), 2);
                    // enable the realtime symbol for exhaust gas temperature
                    measurementEGT.Enabled = true;
                    labelControl4.Enabled = true;
                }
                else
                {
                    // disable the realtime symbol for exhaust gas temperature
                    measurementEGT.Enabled = false;
                    labelControl4.Enabled = false;
                }
                if (SymbolExists("BFuelProt.CurrentFuelCon")) AddToRealtimeTable(dt, "BFuelProt.CurrentFuelCon", "Fuel consumption", GetSymbolNumber(m_symbols, "BFuelProt.CurrentFuelCon"), 0, 0, 0.1, 0, 0, 50, GetSymbolNumber(m_symbols, "BFuelProt.CurrentFuelCon"), (uint)GetSymbolAddressSRAM(m_symbols, "BFuelProt.CurrentFuelCon"), GetSymbolLength(m_symbols, "BFuelProt.CurrentFuelCon"), 2);

                // only if use wideband selected
                if (m_appSettings.UseWidebandLambda)
                {
                    if (SymbolExists(m_appSettings.WideBandSymbol))
                    {
                        double corr = 0.1;
                        if (m_appSettings.WideBandSymbol == "DisplProt.AD_Scanner") corr = 1;
                        AddToRealtimeTable(dt, m_appSettings.WideBandSymbol, "Lambda value (wbO2)", GetSymbolNumber(m_symbols, m_appSettings.WideBandSymbol), 0, 0, corr, 0, 10, 20, GetSymbolNumber(m_symbols, m_appSettings.WideBandSymbol), (uint)GetSymbolAddressSRAM(m_symbols, m_appSettings.WideBandSymbol), GetSymbolLength(m_symbols, m_appSettings.WideBandSymbol), 1);
                        // AFR feedback map initialiseren // <GS-19042010>
                        int _width = 18;
                        int _height = 16;
                        if (m_appSettings.AutoCreateAFRMaps)
                        {
                            GetTableMatrixWitdhByName(m_currentfile, m_symbols, "BFuelCal.Map", out _width, out _height);
                            m_AFRMap.RpmYSP = GetSymbolAsIntArray("BFuelCal.RpmYSP");
                            m_AFRMap.AirXSP = GetSymbolAsIntArray("BFuelCal.AirXSP");
                            m_AFRMap.InitializeMaps(_width * _height, m_currentfile);
                        }
                    }
                }
                else
                {
                    if (SymbolExists("Lambda.LambdaInt")) AddToRealtimeTable(dt, "Lambda.LambdaInt", "Lambda value (nbO2)", GetSymbolNumber(m_symbols, "Lambda.LambdaInt"), 0, 1, 0.0001, 0, 0, 2, GetSymbolNumber(m_symbols, "Lambda.LambdaInt"), (uint)GetSymbolAddressSRAM(m_symbols, "Lambda.LambdaInt"), GetSymbolLength(m_symbols, "Lambda.LambdaInt"), 1);
                }
            }
            catch (Exception E)
            {
                logger.Debug(E.Message);
            }
        }
Example #36
0
		private static extern Result gnome_vfs_monitor_add (out IntPtr handle, string uri, MonitorType type, MonitorCallbackNative callback, IntPtr user_data);
Example #37
0
 public ContextTimeoutManager(MonitorType pMonitorType, int pMonitorMs) : this(pMonitorType)
 {
     _monitorMS = pMonitorMs;
 }
Example #38
0
 /// <summary>
 /// Creates a new instance of a monitor class
 /// </summary>
 /// <param name="type">
 /// Type of the monitor to create
 /// </param>
 /// <returns>Reference to the new  <see cref="IInactivityMonitor"/> object</returns>
 public static IInactivityMonitor CreateInstance(MonitorType type)
 {
     return CreateInstance(null, type);
 }