Example #1
0
        public string getTotalPressureLossByType(MEPSection section, SectionMemberType eType)
        {
            string strVal = "";

            if (section != null)
            {
                double dVal = 0.0;
                if (eType == SectionMemberType.Segment)
                {
                    List <MEPCurve> curves = new List <MEPCurve>();
                    SectionsInfo.getSectionElements(section, curves, null, null, null);
                    foreach (MEPCurve crv in curves)
                    {
                        dVal += section.GetPressureDrop(crv.Id);
                    }
                }
                else if (eType == SectionMemberType.Fitting)
                {
                    List <FamilyInstance> fittings = new List <FamilyInstance>();
                    SectionsInfo.getSectionElements(section, null, fittings, null, null);
                    foreach (FamilyInstance famInst in fittings)
                    {
                        dVal += section.GetPressureDrop(famInst.Id);
                    }
                }
                else if (eType == SectionMemberType.AirTerminal)
                {
                    List <FamilyInstance> airTerminals = new List <FamilyInstance>();
                    SectionsInfo.getSectionElements(section, null, null, airTerminals, null);
                    foreach (FamilyInstance famInst in airTerminals)
                    {
                        dVal += section.GetPressureDrop(famInst.Id);
                    }
                }
                else if (eType == SectionMemberType.Equipment)
                {
                    List <FamilyInstance> equipments = new List <FamilyInstance>();
                    SectionsInfo.getSectionElements(section, null, null, null, equipments);
                    foreach (FamilyInstance famInst in equipments)
                    {
                        dVal += section.GetPressureDrop(famInst.Id);
                    }
                }

                if (eType == SectionMemberType.Section)
                {
                    dVal = section.TotalPressureLoss;
                }

                if (domain == ReportResource.pipeDomain)
                {
                    strVal = FormatUtils.Format(doc, UnitType.UT_Piping_Pressure, dVal);
                }
                else
                {
                    strVal = FormatUtils.Format(doc, UnitType.UT_HVAC_Pressure, dVal);
                }
            }
            return(strVal);
        }
        static public void getSectionCommonInfo(MEPSection section, Dictionary <string, string> fieldAndValue)
        {
            if (fieldAndValue == null)
            {
                return;
            }

            PressureLossReportHelper helper = PressureLossReportHelper.instance;

            if (helper == null)
            {
                return;
            }

            Document doc = helper.Doc;

            if (doc == null)
            {
                return;
            }

            if (helper.Domain == ReportResource.ductDomain)
            {
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_DUCT_FLOW_PARAM), FormatUtils.Format(doc, UnitType.UT_HVAC_Airflow, section.Flow));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_FRICTION), FormatUtils.Format(doc, UnitType.UT_HVAC_Friction, section.Friction));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY), FormatUtils.Format(doc, UnitType.UT_HVAC_Velocity, section.Velocity));
                fieldAndValue.Add(ReportResource.sectionPressureLoss, FormatUtils.Format(doc, UnitType.UT_HVAC_Pressure, section.TotalPressureLoss));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY_PRESSURE), FormatUtils.Format(doc, UnitType.UT_HVAC_Pressure, section.VelocityPressure));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_REYNOLDSNUMBER_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.ReynoldsNumber));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_LOSS_COEFFICIENT), FormatUtils.Format(doc, UnitType.UT_Number, getFittingsLossCoefficient(section)));
            }
            else
            {
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FLOW_PARAM), FormatUtils.Format(doc, UnitType.UT_Piping_Flow, section.Flow));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_FRICTION), FormatUtils.Format(doc, UnitType.UT_Piping_Friction, section.Friction));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY), FormatUtils.Format(doc, UnitType.UT_Piping_Velocity, section.Velocity));
                fieldAndValue.Add(ReportResource.sectionPressureLoss, FormatUtils.Format(doc, UnitType.UT_Piping_Pressure, section.TotalPressureLoss));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY_PRESSURE), FormatUtils.Format(doc, UnitType.UT_Piping_Pressure, section.VelocityPressure));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_REYNOLDS_NUMBER_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.ReynoldsNumber));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FRICTION_FACTOR_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.FrictionFactor));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_KFACTOR_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, getFittingsLossCoefficient(section)));

                //need to check system type
                if (helper.SystemClassification == MEPSystemClassification.DomesticColdWater ||
                    helper.SystemClassification == MEPSystemClassification.DomesticHotWater ||
                    helper.SystemClassification == MEPSystemClassification.Sanitary)
                {
                    fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FIXTURE_UNITS_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.FixtureUnit));
                }
                else
                {
                    fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FIXTURE_UNITS_PARAM), ReportConstants.emptyValue);
                }
            }

            fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_ROUGHNESS_PARAM), FormatUtils.Format(doc, UnitType.UT_Piping_Roughness, section.Roughness));
            fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.CURVE_ELEM_LENGTH), FormatUtils.Format(doc, UnitType.UT_Length, section.TotalCurveLength));
            fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_SECTION), section.Number.ToString());
        }
        static public string getSectionInfoByParamName(MEPSection section, string paramName, int nGetFrom, ElementId id)
        {
            string paramVal = "";

            if (section == null || paramName == null || (nGetFrom & (int)SectionMemberType.Section) == 0)
            {
                return(paramVal);
            }

            PressureLossReportHelper helper = PressureLossReportHelper.instance;

            if (helper == null)
            {
                return(paramVal);
            }

            if (paramName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PRESSURE_DROP) ||
                paramName == ReportResource.pressureLoss)
            {
                double dVal = section.GetPressureDrop(id);

                if (helper.Domain == ReportResource.pipeDomain)
                {
                    paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_Piping_Pressure, dVal);
                }
                else
                {
                    paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_HVAC_Pressure, dVal);
                }
                return(paramVal);
            }
            else if (paramName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_LOSS_COEFFICIENT) ||
                     paramName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_KFACTOR_PARAM))
            {
                double dVal = section.GetCoefficient(id);
                paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_Number, dVal);
                return(paramVal);
            }

            else if (paramName == LabelUtils.GetLabelFor(BuiltInParameter.CURVE_ELEM_LENGTH))
            {
                double dVal = section.GetSegmentLength(id);
                paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_Length, dVal);
                return(paramVal);
            }

            Dictionary <string, string> fieldAndValue = new Dictionary <string, string>();

            SectionsInfo.getSectionCommonInfo(section, fieldAndValue);

            if (fieldAndValue.ContainsKey(paramName))
            {
                return(fieldAndValue[paramName]);
            }

            return(paramVal);
        }
Example #4
0
        //private static string GetParamaterUnit(DisplayUnitType uniType)
        //{
        //    switch (uniType)
        //    {
        //        case DisplayUnitType.DUT_MILLIMETERS:
        //            return "mm";
        //        case DisplayUnitType.DUT_METERS:
        //            return "m";
        //        case DisplayUnitType.DUT_CENTIMETERS:
        //            return "cm";
        //        default:
        //            return string.Empty;
        //    }
        //}

        private static string FormatNumber(Document doc, UnitType unitType, double value)
        {
#if R2014
            var uStr = FormatUtils.Format(doc, unitType, value);
#else
            var uStr = UnitFormatUtils.Format(doc.GetUnits(), unitType, value, false, false);
#endif
            return(uStr);
        }
Example #5
0
        public static string ParameterToString(Document doc, FamilyParameter param, FamilyType type)
        {
            if (!type.HasValue(param))
            {
                return("无");
            }
            if (param.Definition.ParameterType == ParameterType.Invalid)
            {
                return("不可用");
            }
            switch (param.StorageType)
            {
            case StorageType.Double:
#if R2014
                var uStr = FormatUtils.Format(doc, param.Definition.UnitType, type.AsDouble(param).Value);
#else
                var uStr = UnitFormatUtils.Format(doc.GetUnits(), param.Definition.UnitType, type.AsDouble(param).Value, false, false);
#endif
                return(uStr);

            //var uStr = string.Empty;
            //if (param.Definition.ParameterType == ParameterType.Length)
            //{
            //    uStr = GetParamaterUnit(param.DisplayUnitType);
            //}
            //var dStr = param.AsValueString();
            //if (!String.IsNullOrEmpty(uStr) && !dStr.EndsWith(uStr)) dStr += uStr;
            //return dStr;
            case StorageType.Integer:
                var v = type.AsInteger(param).Value;
                if (param.Definition.ParameterType == ParameterType.YesNo)
                {
                    if (v == 0)
                    {
                        return("否");
                    }
                    return("是");
                }
#if R2014
                return(FormatUtils.Format(doc, param.Definition.UnitType, v));
#else
                return(UnitFormatUtils.Format(doc.GetUnits(), param.Definition.UnitType, v, false, false));
#endif
            case StorageType.String:
                return(type.AsString(param));

            case StorageType.ElementId:
                ElementId idVal = type.AsElementId(param);
                return(AsElementName(doc, idVal));

            case StorageType.None:
            default:
                return("无");
            }
        }
        static public string getCriticalPathPressureLoss(MEPSystem elemSystem)
        {
            string strVal = "";

            if (elemSystem != null)
            {
                if (PressureLossReportHelper.instance.Domain == ReportResource.pipeDomain)
                {
                    strVal = FormatUtils.Format(PressureLossReportHelper.instance.Doc, UnitType.UT_Piping_Pressure, elemSystem.PressureLossOfCriticalPath);
                }
                else
                {
                    strVal = FormatUtils.Format(PressureLossReportHelper.instance.Doc, UnitType.UT_HVAC_Pressure, elemSystem.PressureLossOfCriticalPath);
                }
            }
            return(strVal);
        }
Example #7
0
        public string getParamValue(Parameter param, bool bUseEmptySymbol = true)
        {
            string strVal = ReportConstants.emptyValue;

            if (!bUseEmptySymbol)
            {
                strVal = "";
            }

            if (param == null)
            {
                return(strVal);
            }

            if (param.HasValue)
            {
                if (param.StorageType == StorageType.String)
                {
                    strVal = param.AsString();
                }
                else if (param.StorageType == StorageType.Integer)
                {
                    if (param.Definition.ParameterType == ParameterType.YesNo)
                    {
                        strVal = ReportResource.no;
                        if (param.AsInteger() == 1)
                        {
                            strVal = ReportResource.yes;
                        }
                    }
                    else
                    {
                        strVal = param.AsInteger().ToString();
                    }
                }
                else if (param.StorageType == StorageType.Double)
                {
                    strVal = param.AsValueString();
                    if (strVal == null || strVal.Length < 1)
                    {
                        strVal = FormatUtils.Format(doc, UnitType.UT_Number, param.AsDouble());
                    }
                }
                else if (param.StorageType == StorageType.ElementId)
                {
                    //get the element name
                    ElementId id = param.AsElementId();
                    strVal = ReportResource.none;
                    if (id.IntegerValue != -1)
                    {
                        Element elem = doc.GetElement(id);
                        if (elem != null)
                        {
                            strVal = elem.Name;
                        }
                    }
                }
            }

            return(strVal);
        }