Пример #1
0
        public static BHE.Profile FromTAS(this TBD.profile tbdProfile)
        {
            BHE.Profile profile = new BHE.Profile();

            profile.Name = tbdProfile.name;

            switch (tbdProfile.type)
            {
            case TBD.ProfileTypes.ticValueProfile:
                profile.HourlyValues.Add(tbdProfile.value);
                break;

            case TBD.ProfileTypes.ticHourlyProfile:
                for (int i = 1; i < 25; i++)
                {
                    profile.HourlyValues.Add(tbdProfile.hourlyValues[i]);
                }
                break;

            case TBD.ProfileTypes.ticYearlyProfile:
                profile.HourlyValues = ToDoubleList(tbdProfile.GetYearlyValues());
                break;
            }

            TASDescription tasData = new TASDescription();

            tasData.Description = tbdProfile.description.RemoveBrackets();
            profile.Fragments.Add(tasData);

            return(profile);
        }
Пример #2
0
        public static TBD.profile ToTAS(this BHE.Profile profile, TBD.profile tbdProfile)
        {
            if (profile == null)
            {
                return(tbdProfile);
            }

            tbdProfile.name = profile.Name;

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

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

            return(tbdProfile);
        }
Пример #3
0
        public static List <BHE.IGain> FromTAS(this TBD.InternalGain tbdInternalGain)
        {
            if (tbdInternalGain == null)
            {
                return(null);
            }

            List <BHE.IGain> gains = new List <BHE.IGain>();

            TASInternalGainData tasData = new TASInternalGainData();

            tasData.ActivityID        = System.Convert.ToInt32(tbdInternalGain.activityID);
            tasData.DomesticHotWater  = System.Convert.ToDouble(tbdInternalGain.domesticHotWater);
            tasData.TargetIlluminance = System.Convert.ToDouble(tbdInternalGain.targetIlluminance);

            TASDescription tASDescription = new TASDescription();

            tASDescription.Description = tbdInternalGain.description.RemoveBrackets();

            //Lighting
            BHE.Lighting lightGain = new BHE.Lighting();
            lightGain.Name            = "L " + tbdInternalGain.name;
            lightGain.RadiantFraction = tbdInternalGain.lightingRadProp;

            TBD.profile tbdProfile = tbdInternalGain.GetProfile((int)TBD.Profiles.ticLG);
            BHE.Profile aProfile   = tbdProfile.FromTAS();
            lightGain.Profile = aProfile;
            lightGain.Fragments.Add(tasData);
            lightGain.Fragments.Add(tASDescription);
            gains.Add(lightGain);

            //Occupancy
            BHE.People occupantGain = new BHE.People();
            occupantGain.Name = "O " + tbdInternalGain.name;
            tbdProfile        = tbdInternalGain.GetProfile((int)TBD.Profiles.ticOSG);
            //curent limitation it works if we use hourly or yearl profile apprach with 0-1 values and factor as max
            occupantGain.Sensible = tbdProfile.factor;                                                         //Unit W/m2 sensible gain
            TBD.profile tbdProfileLat = tbdInternalGain.GetProfile((int)TBD.Profiles.ticOLG);
            occupantGain.Latent = tbdProfileLat.factor;                                                        //Unit W/m2 latent gain
            double aPeopleDesity = (occupantGain.Sensible + occupantGain.Latent) / tbdInternalGain.personGain; //Unit people/m2

            aProfile = tbdProfile.FromTAS();

            for (int i = 0; i < aProfile.HourlyValues.Count; i++)
            {
                aProfile.HourlyValues[i] = aProfile.HourlyValues[i] * aPeopleDesity;
            }

            occupantGain.RadiantFraction = tbdInternalGain.occupantRadProp;

            occupantGain.Profile = aProfile;
            occupantGain.Fragments.Add(tasData);
            occupantGain.Fragments.Add(tASDescription);
            gains.Add(occupantGain);

            //Equipment
            BHE.Equipment equipGain = new BHE.Equipment();
            equipGain.Name            = "Equipment " + tbdInternalGain.name;
            equipGain.RadiantFraction = tbdInternalGain.equipmentRadProp;

            tbdProfile        = tbdInternalGain.GetProfile((int)TBD.Profiles.ticESG);
            aProfile          = tbdProfile.FromTAS();
            equipGain.Profile = aProfile;

            equipGain.Fragments.Add(tasData);
            equipGain.Fragments.Add(tASDescription);
            gains.Add(equipGain);


            //Pollutant
            BHE.Pollutant pollGain = new BHE.Pollutant();
            pollGain.Name = "P " + tbdInternalGain.name;

            tbdProfile       = tbdInternalGain.GetProfile((int)TBD.Profiles.ticCOG);
            aProfile         = tbdProfile.FromTAS();
            pollGain.Profile = aProfile;

            pollGain.Fragments.Add(tasData);
            pollGain.Fragments.Add(tASDescription);
            gains.Add(pollGain);

            //Infiltration
            BHE.Infiltration infGain = new BHE.Infiltration();
            infGain.Name = "I " + tbdInternalGain.name;

            tbdProfile      = tbdInternalGain.GetProfile((int)TBD.Profiles.ticI);
            aProfile        = tbdProfile.FromTAS();
            infGain.Profile = aProfile;

            infGain.Fragments.Add(tasData);
            infGain.Fragments.Add(tASDescription);
            gains.Add(infGain);


            //tbdInternalGain.freshAirRate; //ToDo: Figure this one out later...

            return(gains);
        }