Esempio n. 1
0
        public Sensor(IEnvironment environment, ITimer timer)
        {
            _environment    = environment;
            _timer          = timer;
            _timer.Interval = 1000;
            _timer.Tick    += TimerTick;
            _timer.Start();

            SensorSchedule = new SensorSchedule();
        }
Esempio n. 2
0
        public SensorSchedule this[Area area]
        {
            get
            {
                var sensorSchedule = new SensorSchedule();
                switch (area)
                {
                case Area.AirTemperature:
                    sensorSchedule.MaxDeviation    = double.Parse(AirTempretureSensorMaxDeviation);
                    sensorSchedule.OptimalValue    = double.Parse(AirTempretureSensorOptimalValue);
                    sensorSchedule.SensorEndTime   = AirTempretureSensorEndTime;
                    sensorSchedule.SensorStartTime = AirTempretureSensorStartTime;
                    return(sensorSchedule);

                case Area.Acid:
                    sensorSchedule.MaxDeviation    = double.Parse(AcidSensorMaxDeviation);
                    sensorSchedule.OptimalValue    = double.Parse(AcidSensorOptimalValue);
                    sensorSchedule.SensorEndTime   = AcidSensorEndTime;
                    sensorSchedule.SensorStartTime = AcidSensorStartHour;
                    return(sensorSchedule);

                case Area.WaterTemperature:
                    sensorSchedule.MaxDeviation    = double.Parse(WaterTemperatureSensorMaxDeviation);
                    sensorSchedule.OptimalValue    = double.Parse(WaterTemperatureSensorOptimalValue);
                    sensorSchedule.SensorEndTime   = WaterTemperatureSensorEndTime;
                    sensorSchedule.SensorStartTime = WaterTemperatureSensorStartHour;
                    return(sensorSchedule);

                case Area.Nutrient:
                    sensorSchedule.MaxDeviation    = double.Parse(NutrientSensorMaxDeviation);
                    sensorSchedule.OptimalValue    = double.Parse(NutrientSensorOptimalValue);
                    sensorSchedule.SensorEndTime   = NutrientSensorEndTime;
                    sensorSchedule.SensorStartTime = NutrientSensorStartHour;
                    return(sensorSchedule);

                default:
                    throw new NotImplementedException();
                }
            }
            set { }
        }