Esempio n. 1
0
        public void SyncWith(TCDSimulator simulator)
        {
            // Update ConnectedLoad.
            double connectedLoad = simulator.GetConnectedLoad();

            if (!(m_connectedLoad.Value is double) || (double)m_connectedLoad.Value != connectedLoad)
            {
                m_connectedLoad.Value = connectedLoad;
                m_connectedLoad.UpdateChangeMasks(NodeStateChangeMasks.Value);
            }

            // Update CoolingCapacity.
            double coolingCapacity = simulator.GetCoolingCapacity_W() / 1000.0;

            if (!(m_coolingCapacity.Value is double) || (double)m_coolingCapacity.Value != connectedLoad)
            {
                m_coolingCapacity.Value                  = coolingCapacity;
                m_coolingCapacity.EngineeringUnits       = new PropertyState <EUInformation>(m_coolingCapacity);
                m_coolingCapacity.EngineeringUnits.Value = new EUInformation("W", "uri");
                m_coolingCapacity.UpdateChangeMasks(NodeStateChangeMasks.Value);
            }

            // Update MaxTemperature
            double maxTemperature = simulator.GetMaxTemperature_C();

            if (!(m_maxTemperature.Value is double) || (double)m_maxTemperature.Value != maxTemperature)
            {
                m_maxTemperature.Value = maxTemperature;
                m_maxTemperature.UpdateChangeMasks(NodeStateChangeMasks.Value);
            }

            // Update MinTemperature
            double minTemperature = simulator.GetMinTemperature_C();

            if (!(m_minTemperature.Value is double) || (double)m_minTemperature.Value != minTemperature)
            {
                m_minTemperature.Value = minTemperature;
                m_minTemperature.UpdateChangeMasks(NodeStateChangeMasks.Value);
            }

            // Update PowerValue
            double power = simulator.GetHeatingPower_W() / 1000.0;

            if (!(m_powerValue.Value is double) || (double)m_powerValue.Value != minTemperature)
            {
                m_powerValue.Value = power;
                m_powerValue.UpdateChangeMasks(NodeStateChangeMasks.Value);
            }
        }