Example #1
0
 public void SetWeather(WeatherSim.Weather w)
 {
     minTemp     = w.minTemp;
     maxTemp     = w.maxTemp;
     minTempTime = w.minTempTime;
     maxTempTime = w.maxTempTime;
     curTemp     = w.curTemp;
 }
Example #2
0
        public State Simulate(float deltaT)
        {
            WeatherSim.Weather weather = weatherSim_.Simulate(dayInYear_, timeOfDay_);
            State result = new State(state_);

            result.SetWeather(weather);
            // simulate how the room responds
            float houseTemperature = 20;
            float houseWeight      = 0.9f;

            fan_.Simulate(deltaT, this);
            float ambientTemperature = (weather.curTemp * (1 - houseWeight) + houseTemperature * houseWeight);

            result.roomTemperature_ += (ambientTemperature - result.roomTemperature_) * 0.007f * deltaT;
            if (fan_.FanStatus())
            {
                result.roomTemperature_ += (weather.curTemp - result.roomTemperature_) * 0.02f * deltaT;
            }
            state_ = result;
            return(result);
        }