Esempio n. 1
0
        public static TBD.Thermostat ToTAS(this BHE.Thermostat thermostat, TBD.Thermostat tbdThermostat)
        {
            if (thermostat == null)
            {
                return(tbdThermostat);
            }

            tbdThermostat.name                = thermostat.Name;
            tbdThermostat.controlRange        = (float)thermostat.ControlRange;
            tbdThermostat.proportionalControl = (thermostat.ProportionalControl ? 1 : 0);

            TASDescription tasFragment = thermostat.FindFragment <TASDescription>(typeof(TASDescription));

            if (tasFragment != null)
            {
                tbdThermostat.description = tasFragment.Description;
            }

            TASThermostatData thermostatData = thermostat.FindFragment <TASThermostatData>(typeof(TASThermostatData));

            if (thermostatData != null)
            {
                tbdThermostat.radiantProportion = (float)thermostatData.RadiantProportion;
            }

            return(tbdThermostat);
        }
Esempio n. 2
0
        public static BHE.Thermostat FromTAS(this TBD.Thermostat tbdThermostat)
        {
            if (tbdThermostat == null)
            {
                return(null);
            }

            BHE.Thermostat thermostat = new BHE.Thermostat();
            thermostat.Name                = tbdThermostat.name;
            thermostat.ControlRange        = tbdThermostat.controlRange;
            thermostat.ProportionalControl = tbdThermostat.proportionalControl != 0;

            TASThermostatData tasData        = new TASThermostatData();
            TASDescription    tasDescription = new TASDescription();

            tasData.RadiantProportion  = tbdThermostat.radiantProportion;
            tasDescription.Description = tbdThermostat.description;
            thermostat.Fragments.Add(tasData);
            thermostat.Fragments.Add(tasDescription);

            thermostat.Profiles = tbdThermostat.Profiles();
            return(thermostat);
        }