Beispiel #1
0
        /*
         * public List<CAD.MetricType> MetricsToCADXMLOutput(string componentID)
         * {
         *  List<CAD.MetricType> metriclist = new List<CAD.MetricType>();
         *  foreach (var item in Computations)
         *  {
         *      CAD.MetricType metric = new CAD.MetricType();
         *      metric._id = UtilityHelpers.MakeUdmID();
         *      metric.ComponentID = componentID;
         *      metric.MetricID = item.MetricID;
         *      metric.RequestedValueType = "Scalar";
         *      metric.MetricType1 = item.ComputationType.ToString();
         *      metric.Details = "";
         *      metric.MetricName = item.MetricName ?? "";
         *      metriclist.Add(metric);
         *  }
         *
         *  return metriclist;
         * }
         */

        public List <CAD.MetricType> MetricsToCADXMLOutput(List <TBComputation> dataSet, string componentID = "")
        {
            List <CAD.MetricType> metriclist = new List <CAD.MetricType>();

            foreach (var item in dataSet)
            {
                CAD.MetricType ptout = new CAD.MetricType();
                ptout._id                = UtilityHelpers.MakeUdmID();
                ptout.ComponentID        = item.ComponentID;
                ptout.MetricID           = item.MetricID;
                ptout.MetricType1        = item.ComputationType.ToString();
                ptout.RequestedValueType = item.RequestedValueType;
                ptout.ComponentID        = String.IsNullOrEmpty(componentID) ? item.ComponentID : componentID; // PointCoordinate metric is tied to a specific Component
                ptout.Details            = item.Details ?? "";
                ptout.MetricName         = item.MetricName ?? "";
                metriclist.Add(ptout);
            }

            return(metriclist);
        }
        // This code is copy/pasted from TestBench. Since this class is not a subclass of TestBench,
        // it can't be re-used. Can this code be re-used from there by moving it to TestBenchBase?
        private void AddComputations(CAD.AssemblyType assemblyRoot)
        {
            if (Computations.Any())
            {
                CAD.AnalysesType cadanalysis = GetCADAnalysis(assemblyRoot);

                CAD.StaticType staticanalysis = new CAD.StaticType();
                staticanalysis._id = UtilityHelpers.MakeUdmID();
                staticanalysis.AnalysisID = AnalysisID;

                List<CAD.MetricType> metriclist = new List<CAD.MetricType>();
                foreach (var item in Computations)
                {
                    if (item.ComputationType == "PointCoordinates")
                    {
                        CAD.MetricType ptout = new CAD.MetricType();
                        ptout._id = UtilityHelpers.MakeUdmID();
                        ptout.ComponentID = item.ComponentID;
                        ptout.MetricID = item.MetricID;
                        ptout.MetricType1 = item.ComputationType;
                        ptout.RequestedValueType = item.RequestedValueType;
                        ptout.Details = item.FeatureDatumName;
                        ptout.ComponentID = String.IsNullOrEmpty(item.ComponentID) ? "" : item.ComponentID;     // PointCoordinate metric is tied to a specific Component  
                        metriclist.Add(ptout);
                    }
                    else
                    {
                        CAD.MetricType metric = new CAD.MetricType();
                        metric._id = UtilityHelpers.MakeUdmID();
                        metric.MetricID = item.MetricID;
                        metric.MetricType1 = item.ComputationType;
                        metric.RequestedValueType = item.RequestedValueType;
                        metric.ComponentID = assemblyRoot.ConfigurationID;
                        metric.Details = "";
                        metriclist.Add(metric);
                    }
                }

                staticanalysis.Metrics = new CAD.MetricsType();
                staticanalysis.Metrics._id = UtilityHelpers.MakeUdmID();
                staticanalysis.Metrics.Metric = metriclist.ToArray();

                cadanalysis.Static = new CAD.StaticType[] { staticanalysis };
            }
        }
Beispiel #3
0
        protected override void AddAnalysisToXMLOutput(CAD.AssemblyType assembly)
        {
            base.AddAnalysisToXMLOutput(assembly);
            CAD.AnalysesType cadanalysis = GetCADAnalysis(assembly);

            CAD.FEAType feaanalysis = new CAD.FEAType();
            feaanalysis._id = UtilityHelpers.MakeUdmID();
            feaanalysis.AnalysisID = AnalysisID;
            feaanalysis.Type = FEAAnalysisType;
            feaanalysis.MaxAdaptiveIterations = MaxAdaptiveIterations;
            feaanalysis.MaxElementSize = this.CyphyTestBenchRef.Attributes.MaximumElementSize;
            // solvers
            CAD.SolversType solversType = new CAD.SolversType();
            solversType._id = UtilityHelpers.MakeUdmID();
            CAD.SolverType solver = new CAD.SolverType();
            solver._id = UtilityHelpers.MakeUdmID();
            solver.ElementShapeType = ElementType;
            solver.MeshType = MeshType;
            solver.ShellElementType = ShellType;
            if (SolverType == "CALCULIX")
            {
                solver.Type = "NASTRAN";
            }
            else
            {
                solver.Type = SolverType;
            }
            
            solversType.Solver = new CAD.SolverType[1];
            solversType.Solver[0] = solver;
            feaanalysis.Solvers = solversType;

            // loads
            if (Loads.Count > 0)
            {
                List<CAD.LoadType> loadList = new List<CAD.LoadType>();
                foreach (var item in Loads)
                {
                    loadList.Add(item.ToCADXMLOutput());
                }

                feaanalysis.Loads = new CAD.LoadsType();
                feaanalysis.Loads._id = UtilityHelpers.MakeUdmID();
                feaanalysis.Loads.Load = loadList.ToArray();
            }

            // constraints
            if (Constraints.Count > 0)
            {
                List<CAD.AnalysisConstraintType> constraintList = new List<CAD.AnalysisConstraintType>();
                foreach (var item in Constraints)
                {
                    constraintList.Add(item.ToCADXMLOutput());
                }
                feaanalysis.AnalysisConstraints = new CAD.AnalysisConstraintsType();
                feaanalysis.AnalysisConstraints._id = UtilityHelpers.MakeUdmID();
                feaanalysis.AnalysisConstraints.AnalysisConstraint = constraintList.ToArray();
            }
            
            // thermal
            List<CAD.ThermalElementType> thermalOutList = new List<CAD.ThermalElementType>();
            if (ThermalElements.Count > 0)
            {
                foreach (var thermalLoad in ThermalElements)
                {
                    CAD.ThermalElementType thermalOut = new CAD.ThermalElementType();
                    thermalOut._id = UtilityHelpers.MakeUdmID();
                    thermalOut.LoadType = thermalLoad.Type;
                    thermalOut.Unit = thermalLoad.Unit;
                    thermalOut.Value = thermalLoad.LoadValue;

                    if (thermalLoad.Geometry == null)
                    {
                        CAD.ComponentType component = new CAD.ComponentType();
                        component._id = UtilityHelpers.MakeUdmID();
                        component.ComponentID = thermalLoad.ComponentID;
                        component.InfiniteCycle = false;
                        thermalOut.Component = new CAD.ComponentType[] { component };
                    }
                    else
                    {
                        thermalOut.Geometry = new CAD.GeometryType[] { thermalLoad.Geometry.ToCADXMLOutput() };
                    }

                    thermalOutList.Add(thermalOut);
                }
                feaanalysis.ThermalElements = new CAD.ThermalElementsType();
                feaanalysis.ThermalElements._id = UtilityHelpers.MakeUdmID();
                feaanalysis.ThermalElements.ThermalElement = thermalOutList.ToArray();
                
            }
             
            // metrics
            List<CAD.MetricType> metriclist = new List<CAD.MetricType>();
            foreach (var item in Computations)
            {
                CAD.MetricType metric = new CAD.MetricType();
                metric._id = UtilityHelpers.MakeUdmID();
                metric.ComponentID = item.ComponentID;
                metric.MetricID = item.MetricID;
                metric.RequestedValueType = item.RequestedValueType;
                metric.MetricType1 = item.ComputationType.ToString();
                metric.Details = "";
                metric.MetricName = item.MetricName;
                metriclist.Add(metric);
            }
            if (metriclist.Any())
            {
                feaanalysis.Metrics = new CAD.MetricsType();
                feaanalysis.Metrics._id = UtilityHelpers.MakeUdmID();
                feaanalysis.Metrics.Metric = metriclist.ToArray();
            }

            cadanalysis.FEA = new CAD.FEAType[] { feaanalysis };

            AddStaticAnalysis(assembly, StaticComputations);

        }
        /*
        public List<CAD.MetricType> MetricsToCADXMLOutput(string componentID)
        {
            List<CAD.MetricType> metriclist = new List<CAD.MetricType>();
            foreach (var item in Computations)
            {
                CAD.MetricType metric = new CAD.MetricType();
                metric._id = UtilityHelpers.MakeUdmID();
                metric.ComponentID = componentID;
                metric.MetricID = item.MetricID;
                metric.RequestedValueType = "Scalar";
                metric.MetricType1 = item.ComputationType.ToString();
                metric.Details = "";
                metric.MetricName = item.MetricName ?? "";
                metriclist.Add(metric);
            }

            return metriclist;
        }
        */

        public List<CAD.MetricType> MetricsToCADXMLOutput(List<TBComputation> dataSet, string componentID = "")
        {
            List<CAD.MetricType> metriclist = new List<CAD.MetricType>();
            foreach (var item in dataSet)
            {          
                CAD.MetricType ptout = new CAD.MetricType();
                ptout._id = UtilityHelpers.MakeUdmID();
                ptout.ComponentID = item.ComponentID;
                ptout.MetricID = item.MetricID;
                ptout.MetricType1 = item.ComputationType.ToString();
                ptout.RequestedValueType = item.RequestedValueType;
                ptout.ComponentID = String.IsNullOrEmpty(componentID) ? item.ComponentID : componentID;     // PointCoordinate metric is tied to a specific Component  
                ptout.Details = item.Details ?? "";
                ptout.MetricName = item.MetricName ?? "";
                metriclist.Add(ptout);
            }
            
            return metriclist;
        }
        public List<CAD.MetricType> MetricsToCADXMLOutput(string componentID)
        {
            List<CAD.MetricType> metriclist = new List<CAD.MetricType>();
            foreach (var item in Computations)
            {
                CAD.MetricType metric = new CAD.MetricType();
                metric._id = UtilityHelpers.MakeUdmID();
                metric.ComponentID = componentID;
                metric.MetricID = item.MetricID;
                metric.RequestedValueType = "Scalar";
                metric.MetricType1 = item.ComputationType;
                metric.Details = "";
                metriclist.Add(metric);
            }

            return metriclist;
        }