コード例 #1
0
        /// <summary>
        /// Configure the alarm with the default alarm messages and only one low and high threshold
        /// </summary>
        /// <param name="lowAlerts">set the low thresholds and their messages</param>
        /// <param name="highAlerts">set the high thresholds and their messages</param>
        /// <param name="alarmType">set which sensor to use, light(average of both), lightRight, lightLeft, temperature(default)</param>
        static public void ConfigureAlarm(Alert[] lowAlerts, Alert[] highAlerts, Sensor alarmType = Sensor.temperatureF,
                                          int monitoringTime = 5, timeUnits unit = timeUnits.minutes)
        {
            //set data sensor
            dataSensor    = alarmType;
            unitOfTime    = unit;
            timeToMonitor = monitoringTime;

            //set high thresholds
            for (int index = 0; index < highAlerts.Length; ++index)
            {
                lowAlarm.Add(highAlerts[index]);
            }

            //set low thresholds
            for (int index = 0; index < lowAlerts.Length; ++index)
            {
                highAlarm.Add(lowAlerts[index]);
            }

            //verify correct thresholds
            if (!VerifyAlertValidity())
            {
                throw new ArgumentOutOfRangeException("No condition exists to stop alarm! All low alerts must be less than all high alerts.");
            }

            //set the info strings
            SetInfoStrings();

            //set the final alarm cycle
            finalAlarmCycle = (ulong)(timeToMonitor * (int)unitOfTime);
        }
コード例 #2
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="numberOfRecords">How many times the finch will take data. Default is 8</param>
        /// <param name="timeBetweenRecords">How much time will pass between data points. Default is 10</param>
        /// <param name="timeUnit">The unit of time used in the delay. This can be set to one of 3 options with timeUnits.seconds being the
        /// default. The other options available are timeUnits.milliseconds and timeUnits.minutes</param>
        public DataRecorder(int numberOfRecords = 8, int timeBetweenRecords = 10, timeUnits timeUnit = timeUnits.seconds)
        {
            NUMBER_OF_RECORDS    = numberOfRecords;
            TIME_BETWEEN_RECORDS = timeBetweenRecords;
            TIME_SCALE           = (int)timeUnit;
            TIME_UNIT            = timeUnit;

            temperatures = new int[NUMBER_OF_RECORDS];
            dataAccuired = false;
        }
コード例 #3
0
        /// <summary>
        /// Configure the alarm with the default alarm messages and only one low and high threshold
        /// </summary>
        /// <param name="lowThreshold">set the low threshold</param>
        /// <param name="highThreshold">set the high threshold</param>
        /// <param name="alarmType">set which sensor to use, light(average of both), lightRight, lightLeft, temperature(default)</param>
        static public void ConfigureAlarm(int lowThreshold, int highThreshold, Sensor alarmType = Sensor.temperatureF,
                                          int monitoringTime = 5, timeUnits unit = timeUnits.minutes)
        {
            //set basic parameters
            dataSensor    = alarmType;
            unitOfTime    = unit;
            timeToMonitor = monitoringTime;

            //verify correct thresholds
            if (!VerifyAlertValidity())
            {
                throw new ArgumentOutOfRangeException("No condition exists to stop alarm! All low alerts must be less than all high alerts.");
            }

            //set the info strings
            SetInfoStrings();

            //set the final alarm cycle
            finalAlarmCycle = (ulong)(timeToMonitor * (int)unitOfTime);
        }