示例#1
0
        public override void Refresh()
        {
            int    integer  = random.Next(-100, 100);
            double fraction = (double)integer / (double)100;

            PriorState   = CurrentState;
            CurrentState = new ThermocoupleState {
                Temperature = PriorState.Temperature + fraction
            };

            _publishThermocoupleStateChange(this.CreateComponentStateChange());
        }
示例#2
0
        public override void Refresh()
        {
            var newTemp = CurrentState.Temperature + TemperatureChange;

            if (newTemp < Temperature.RoomTemp)
            {
                newTemp = Temperature.RoomTemp;
            }
            if (newTemp > Temperature.BoilingTemp)
            {
                newTemp = Temperature.BoilingTemp;
            }

            // Only update if there is a temp change
            if (newTemp != CurrentState.Temperature)
            {
                PriorState   = CurrentState;
                CurrentState = new ThermocoupleState {
                    Temperature = newTemp
                };
                //_logger.LogInformation($"Thermo: {Location} {CurrentState}");
                _publishThermocoupleStateChange(this.CreateComponentStateChange());
            }
        }
示例#3
0
 public SimulationThermocouple(ILogger <Thermocouple> logger) : base(logger)
 {
     CurrentState = new ThermocoupleState {
         Temperature = Temperature.RoomTemp
     };
 }
        private (Mock <IHub> MockHub, IHub Hub, SimulationThermocouple Thermocouple) CreateUtils(Location location, ThermocoupleState state)
        {
            var logger  = new Mock <ILogger <Thermocouple> >();
            var mockHub = new Mock <IHub>();
            var hub     = mockHub.Object;

            var thermo = new SimulationThermocouple(logger.Object);

            thermo.CurrentState = state;
            thermo.Location     = location;
            return(mockHub, hub, thermo);
        }
示例#5
0
 public RandomFakedThermocouple(ILogger <Thermocouple> logger) : base(logger)
 {
     CurrentState = new ThermocoupleState {
         Temperature = 70
     };
 }