Ejemplo n.º 1
0
        /// <summary>
        /// Gets the internal force at <see cref="xi" /> position.
        /// </summary>
        /// <param name="xi">The iso coordinate of desired point (start = -1, mid = 0, end = 1).</param>
        /// <param name="loadCase">The Load case.</param>
        /// <returns></returns>
        /// <remarks>
        /// Will calculate the internal forces of member regarding the <see cref="loadCase" />
        /// </remarks>
        public virtual Force GetInternalForceAt(double xi, LoadCase loadCase)
        {
            var helpers = GetHelpers();

            var lds = new Displacement[this.Nodes.Length];
            var tr  = this.GetTransformationManager();

            for (var i = 0; i < Nodes.Length; i++)
            {
                var globalD = Nodes[i].GetNodalDisplacement(loadCase);
                var local   = tr.TransformGlobalToLocal(globalD);
                lds[i] = local;
            }

            //var buff = new Force();

            var frc = new Vector(); //forcec
            var mnt = new Vector(); //moment


            foreach (var helper in helpers)
            {
                var tns = helper.GetLocalInternalForceAt(this, lds, new[] { xi });

                foreach (var tuple in tns)
                {
                    switch (tuple.Item1)
                    {
                    case DoF.Dx:
                        frc.X += tuple.Item2;
                        break;

                    case DoF.Dy:
                        frc.Y += tuple.Item2;
                        break;

                    case DoF.Dz:
                        frc.Z += tuple.Item2;
                        break;

                    case DoF.Rx:
                        mnt.X += tuple.Item2;
                        break;

                    case DoF.Ry:
                        mnt.Y += tuple.Item2;
                        break;

                    case DoF.Rz:
                        mnt.Z += tuple.Item2;
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }
            }

            return(new Force(frc, mnt));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the internal force at <see cref="xi" /> position.
        /// </summary>
        /// <param name="xi">The iso coordinate of desired point (start = -1, mid = 0, end = 1).</param>
        /// <param name="loadCase">The Load case.</param>
        /// <returns></returns>
        /// <remarks>
        /// Will calculate the internal forces of member regarding the <see cref="loadCase" />
        /// </remarks>
        public Force GetExactInternalForceAt(double xi, LoadCase loadCase)
        {
            var approx = GetInternalForceAt(xi, loadCase);

            var buf = new FlatShellStressTensor();

            var helpers = GetHelpers();

            foreach (var load in this.Loads)
            {
                foreach (var helper in helpers)
                {
                    var tns = helper.GetLoadInternalForceAt(this, load, new[] { xi });
                    //buf = buf + tns;
                }
            }

            var buff = new Force();

            var forces = new Vector(buf.MembraneTensor.S11, buf.MembraneTensor.S12, buf.MembraneTensor.S13);
            //Fx, Vy, Vz
            var moments = new Vector(buf.BendingTensor.M11, buf.BendingTensor.M12, buf.BendingTensor.M13);

            //Mx, My, Mz

            return(new Force(forces, moments) + approx);
        }
Ejemplo n.º 3
0
        private void AddLoadCasesToOpenModel()
        {
            LoadCase loadCase = new LoadCase();

            loadCase.Name = "LC1";
            loadCase.Id   = 1;
            loadCase.Type = LoadCaseSubType.PermanentStandard;

            LoadGroupEC loadGroup = null;

            loadGroup           = new LoadGroupEC();
            loadGroup.Id        = 1;
            loadGroup.Name      = "LG1";
            loadGroup.GammaQ    = 1.5;
            loadGroup.Psi0      = 0.7;
            loadGroup.Psi1      = 0.5;
            loadGroup.Psi2      = 0.3;
            loadGroup.GammaGInf = 1.0;
            loadGroup.GammaGSup = 1.35;
            loadGroup.Dzeta     = 0.85;
            openStructModel.AddObject(loadGroup);

            loadCase.LoadGroup = new ReferenceElement(loadGroup);

            openStructModel.AddObject(loadCase);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Duplicate a new load case
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public bool DuplicateLoadCase(int index)
        {
            LoadCasesMap myLoadCase = null;
            bool         isUnique   = false;
            string       caseName   = null;

            //try to get the load case from the map
            try
            {
                myLoadCase = m_dataBuffer.LoadCasesMap[index];
            }
            catch (Exception e)
            {
                m_dataBuffer.ErrorInformation += e.ToString();
                return(false);
            }

            //get nothing
            if (null == myLoadCase)
            {
                m_dataBuffer.ErrorInformation += "Can not find the load case";
                return(false);
            }

            //check the name
            caseName = myLoadCase.LoadCasesName;
            while (!isUnique)
            {
                caseName += "(1)";
                isUnique  = IsCaseNameUnique(caseName);
            }

            //get the selected case's nature
            Autodesk.Revit.DB.Structure.LoadNatureCategory natureCategory = myLoadCase.LoadNatureCategory;
            Autodesk.Revit.DB.ElementId natureId = myLoadCase.LoadCasesNatureId;

            UIApplication uiapplication = new UIApplication(m_revit);

            //try to create a load case
            try
            {
                LoadCase newLoadCase = LoadCase.Create(uiapplication.ActiveUIDocument.Document, caseName, natureId, natureCategory);
                if (null == newLoadCase)
                {
                    m_dataBuffer.ErrorInformation += "Create Load Case Failed";
                    return(false);
                }
                //add the new case into list and map
                m_dataBuffer.LoadCases.Add(newLoadCase);
                LoadCasesMap newLoadCaseMap = new LoadCasesMap(newLoadCase);
                m_dataBuffer.LoadCasesMap.Add(newLoadCaseMap);
            }
            catch (Exception e)
            {
                m_dataBuffer.ErrorInformation += e.ToString();
                return(false);
            }
            return(true);
        }
Ejemplo n.º 5
0
        public override NodalResponse SuperimposeResponsesAtLoadCase(LoadCase loadCase)
        {
            NodalResponse response = base.SuperimposeResponsesAtLoadCase(loadCase);

            response.Coordinate = Coordinate;

            return(response);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Overload the constructor
 /// </summary>
 /// <param name="loadCase">Load Case</param>
 public LoadCasesMap(LoadCase loadCase)
 {
     m_loadCase               = loadCase;
     m_loadCasesName          = m_loadCase.Name;
     m_loadCasesNumber        = m_loadCase.Number.ToString();
     m_loadCasesNatureId      = m_loadCase.NatureId;
     m_loadCasesSubcategoryId = m_loadCase.SubcategoryId;
 }
        public override ShearWallPanelResponse SuperimposeResponsesAtLoadCase(LoadCase loadCase)
        {
            ShearWallPanelResponse response = base.SuperimposeResponsesAtLoadCase(loadCase);

            response.WallLocation = WallLocation;

            return(response);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Retrieves the modal case assigned to the analysis case.
        /// </summary>
        /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
        public void FillModalCase()
        {
            LoadCase loadCase = _loadCases.FillItem(_appGet?.GetModalCase(CaseName));

            if (loadCase is ModalEigen modalEigen)
            {
                _modalCase = modalEigen;
            }
        }
Ejemplo n.º 9
0
        public static void Run1()
        {
            double h = 5;

            Node n1 = new Node(0, 0, 0);
            Node n2 = new Node(h, 0, 0);

            n1.Constraints = Constraints.Fixed;

            var section  = new UniformGeometric1DSection(SectionGenerator.GetRectangularSection(1, 0.5));
            var material = UniformIsotropicMaterial.CreateFromYoungShear(205e9, 81e9);

            BarElement e = new BarElement(n1, n2)
            {
                Section  = section,
                Material = material
            };

            e.Behavior = BarElementBehaviours.FullFrame;

            var lc1 = new LoadCase("C1", LoadType.Dead);
            var lc2 = new LoadCase("C2", LoadType.Live);
            var lc3 = new LoadCase("C3", LoadType.Live);

            var load = new UniformLoad()
            {
                Direction          = Vector.FromXYZ(0, 0, -1),
                CoordinationSystem = CoordinationSystem.Global,
                Magnitude          = 1,
                Case = lc1
            };
            var load2 = new UniformLoad()
            {
                Direction          = Vector.FromXYZ(1, 0, 0),
                CoordinationSystem = CoordinationSystem.Global,
                Magnitude          = 10,
                Case = lc2
            };

            var load3 = new ConcentratedLoad(new Force(0, 0, 0, 00, 10, 00), new IsoPoint(0.50), CoordinationSystem.Local);

            load3.Case = lc3;

            e.Loads.Add(load);
            e.Loads.Add(load2);
            e.Loads.Add(load3);

            Model model = new Model();

            model.Nodes.Add(n1);
            model.Nodes.Add(n2);
            model.Elements.Add(e);
            model.Solve_MPC();

            BarInternalForceVisualizer.VisualizeInNewWindow(e);
        }
        public void DoTheBenchmark()
        {
            var sw = Stopwatch.StartNew();

            var st = GetCaseModel();


            var case1 = new LoadCase("c1", LoadType.Other);
            var case2 = new LoadCase("c2", LoadType.Other);


            foreach (var nde in st.Nodes)
            {
                nde.Loads.Add(new NodalLoad(Util.GetRandomForce(), case1));
                nde.Loads.Add(new NodalLoad(Util.GetRandomForce(), case2));
            }

            var type = SolverType;

            var conf = new SolverConfiguration
            {
                //SolverGenerator = i => CalcUtil.CreateBuiltInSolver(type, i),
                SolverFactory = CalcUtil.CreateBuiltInSolverFactory(type)
            };

            GC.Collect();

            Logger.Log("");
            Logger.Log("\tSolver type: {0}", Util.GetEnumDescription(SolverType));


            try
            {
                st.Solve(conf);

                sw.Restart();
                st.LastResult.AddAnalysisResultIfNotExists(case1);
                sw.Stop();

                Logger.Log("\t\tgeneral solve time: {0}", sw.Elapsed);

                sw.Restart();
                st.LastResult.AddAnalysisResultIfNotExists(case2);
                sw.Stop();

                Logger.Log("\t\textra solve time per LoadCase: {0}", sw.Elapsed);
            }
            catch (Exception ex)
            {
                Logger.Log("\t\tFailed, err = {0}", ex.Message);
            }

            sw.Stop();

            GC.Collect();
        }
Ejemplo n.º 11
0
        private static string CreateLoadNode(LoadCase loadCase)
        {
            // units are Newtons [N] for loads and Newton Millimetres for moments [N.mm]
#if false
text file version below, we'll emit csv

nF                   # number of loaded nodes (global)
 .node  X-load   Y-load   Z-load   X-mom     Y-mom     Z-mom
  N        N        N        N.mm      N.mm      N.mm
  N[1]    Fx[1]    Fy[1]    Fz[1]    Mxx[1]    Myy[1]    Mzz[1]
Ejemplo n.º 12
0
        public static void CheckModel_mpc(Model model, LoadCase lc)
        {
            var n = model.Nodes.Count * 6;

            //model.ReIndexNodes();
            //LoadCase.DefaultLoadCase

            var perm = CalcUtil.GenerateP_Delta_Mpc(model, lc, new Mathh.GaussRrefFinder());

            var np = perm.Item1.ColumnCount;//master count

            var rd = perm.Item2;

            var pd = perm.Item1;

            var kt = MatrixAssemblerUtil.AssembleFullStiffnessMatrix(model);


            if (perm.Item1.RowCount > 0 && perm.Item1.RowCount > 0)
            {
                var pf = pd.Transpose();


                var kr = pf.Multiply(kt).Multiply(pd);

                var nr = kr.RowCount;

                for (int i = 0; i < nr; i++)
                {
                    //two conditions:
                    // 1 - DoF[i] in reduced structure is a member of bounded dof group with MPC equations
                    // 2 - DoF[i] in reduced structure is not in first condition, it is standalone and not related to any other DoF or Fixed Value

                    var t = kr.At(i, i);

                    if (t > 0)
                    {
                        continue;
                    }



                    var nodeNum = 6.0 / 6;

                    if (t == 0)
                    {
                        model.Trace.Write(Common.TraceLevel.Warning, "DoF {0} of Node {1} not properly constrained", 7 % 6, nodeNum);
                    }
                    else//t < 0
                    {
                        model.Trace.Write(Common.TraceLevel.Warning, "DoF {0} of Node {1} not member", 7 % 6, nodeNum);
                    }
                }
            }
        }
Ejemplo n.º 13
0
        public override bool Execute(ExecutionInfo exInfo = null)
        {
            LoadCase lCase = Model.LoadCases.FindByName(Name);

            if (lCase == null || lCase.IsDeleted)
            {
                lCase = Model.Create.LoadCase(Name, exInfo);
            }
            lCase.CaseType = Type;
            return(true);
        }
Ejemplo n.º 14
0
        //TODO Only a mockup implementation ready
        //This method creates a load case
        private static LoadCase[] LoadCases()
        {
            LoadCase lCase = new LoadCase();

            lCase.SelfWeight = false;
            lCase.Loading.No = 1;
            LoadCase[] lCaseArray = { lCase };


            return(lCaseArray);
        }
Ejemplo n.º 15
0
        static void Main()
        {
            // PRACTICAL EXAMPLE: SETTING UP LOAD GROUPS
            // This example shows the core steps of creating load groups for a model.

            // This example was last updated 2022-04-06, using the ver. 21.1.0 FEM-Design API.


            // CREATING LOAD CASES
            LoadCase deadLoad1 = new LoadCase("Deadload1", LoadCaseType.DeadLoad, LoadCaseDuration.Permanent);
            LoadCase deadLoad2 = new LoadCase("Deadload2", LoadCaseType.DeadLoad, LoadCaseDuration.Permanent);
            LoadCase liveLoad1 = new LoadCase("Liveload1", LoadCaseType.Static, LoadCaseDuration.Permanent);
            LoadCase liveLoad2 = new LoadCase("Liveload2", LoadCaseType.Static, LoadCaseDuration.Permanent);

            List <LoadCase> loadCasesDeadLoads = new List <LoadCase>()
            {
                deadLoad1, deadLoad2
            };
            List <LoadCase> loadCaseLiveLoads = new List <LoadCase>()
            {
                liveLoad1, liveLoad2
            };


            // FETCHING LOAD CATEGORY DATABASE
            var          loadCategoryDatabase = LoadCategoryDatabase.GetDefault();
            LoadCategory loadCategory         = loadCategoryDatabase.LoadCategoryByName("A");


            // CREATING LOAD GROUPS
            var LG1 = new ModelGeneralLoadGroup(new LoadGroupPermanent(1, 1.35, 1, 1, loadCasesDeadLoads, ELoadGroupRelationship.Simultaneous, 0.89, "LG1"));
            var LG2 = new ModelGeneralLoadGroup(new LoadGroupTemporary(1.5, loadCategory.Psi0, loadCategory.Psi1, loadCategory.Psi2, true, loadCaseLiveLoads, ELoadGroupRelationship.Alternative, "LG2"));

            var loadGroups = new List <ModelGeneralLoadGroup>()
            {
                LG1, LG2
            };


            // CREATING AND OPENING NEW MODEL
            var model2 = new Model(Country.S, null, null, loadCasesDeadLoads.Concat(loadCaseLiveLoads).ToList(), null, loadGroups);

            string path = Path.GetFullPath("output/LoadGroups.struxml");

            if (!Directory.Exists("output"))
            {
                Directory.CreateDirectory("output");
            }

            model2.SerializeModel(path);
            var app = new Calculate.Application();

            app.OpenStruxml(path, true);
        }
Ejemplo n.º 16
0
        public static void CheckModel(Model model, LoadCase lc)
        {
            model.ReIndexNodes();
            //LoadCase.DefaultLoadCase

            var fullst = MatrixAssemblerUtil.AssembleFullStiffnessMatrix(model);

            var mgr = DofMappingManager.Create(model, lc);

            var dvd = CalcUtil.GetReducedZoneDividedMatrix(fullst, mgr);

            var stiffness = dvd.ReleasedReleasedPart;


            var n = stiffness.ColumnCount;

            for (int i = 0; i < n; i++)
            {
                var t = stiffness.At(i, i);

                if (t > 0)
                {
                    continue;
                }

                var m1 = mgr.RMap2[i];
                var m2 = mgr.RMap1[m1];

                var nodeNum = m2 / 6;

                if (t == 0)
                {
                    model.Trace.Write(Common.TraceLevel.Warning, "DoF {0} of Node {1} not properly constrained", m2 % 6, nodeNum);
                }
                else//t < 0
                {
                    model.Trace.Write(Common.TraceLevel.Warning, "DoF {0} of Node {1} not member", m2 % 6, nodeNum);
                }
            }

            var k = MatrixAssemblerUtil.AssembleFullStiffnessMatrix(model);
            //CalcUtil.MakeMatrixSymetric(k);


            var kt = k.Transpose();

            Enumerable.Range(0, k.Values.Length).ToList().ForEach(i => kt.Values[i] = -kt.Values[i]);

            var sym = k.Add(kt);



            var max = sym.Values.Max(i => Math.Abs(i));
        }
Ejemplo n.º 17
0
        public GeneralStressTensor GetLocalInternalForce(Element targetElement, LoadCase loadCase, params double[] isoCoords)
        {
            //step 1 : get transformation matrix
            //step 2 : convert globals points to locals
            //step 3 : convert global displacements to locals
            //step 4 : calculate B matrix and D matrix
            //step 5 : M=D*B*U
            //Note : Steps changed...
            var lds = new Displacement[targetElement.Nodes.Length];
            var tr  = targetElement.GetTransformationManager();

            for (var i = 0; i < targetElement.Nodes.Length; i++)
            {
                var globalD = targetElement.Nodes[i].GetNodalDisplacement(loadCase);
                var local   = tr.TransformGlobalToLocal(globalD);
                lds[i] = local;
            }

            var b = GetBMatrixAt(targetElement, isoCoords);

            var d = GetDMatrixAt(targetElement, isoCoords);

            var u1l = lds[0];
            var u2l = lds[1];
            var u3l = lds[2];

            var uDkt =
                targetElement.MatrixPool.Allocate(new[]
                                                  { u1l.DZ, u1l.RX, u1l.RY, /**/ u2l.DZ, u2l.RX, u2l.RY, /**/ u3l.DZ, u3l.RX, u3l.RY });


            var mDkt = d * b * uDkt; //eq. 32, batoz article

            //var buf = new PlateBendingStressTensor();

            //buf.Mx = mDkt[0, 0];
            //buf.My = mDkt[1, 0];
            //buf.Mxy = mDkt[2, 0];

            //return buf;

            var bTensor = new BendingStressTensor();

            //var buf = new List<Tuple<DoF, double>>();

            bTensor.M11 = mDkt[0, 0];
            bTensor.M22 = mDkt[1, 0];
            bTensor.M21 = bTensor.M12 = mDkt[2, 0];

            var buf = new GeneralStressTensor(bTensor);

            return(buf);
        }
        /// <summary>
        /// Gets the internal stress at defined <see cref="isoLocation"/>.
        /// tensor is in local coordinate system.
        /// </summary>
        /// <param name="loadCase">the load case </param>
        /// <param name="isoLocation"></param>
        /// <returns>Stress tensor of flat shell, in local coordination system</returns>
        /// <remarks>
        /// for more info about local coordinate of flat shell see page [72 of 166] (page 81 of pdf) of "Development of Membrane, Plate and Flat Shell Elements in Java" thesis by Kaushalkumar Kansara freely available on the web
        /// </remarks>
        public CauchyStressTensor GetLocalInternalStress(LoadCase loadCase, double[] isoLocation)
        {
            var helpers = GetHelpers();

            var gst = new GeneralStressTensor();
            var tr  = this.GetTransformationManager();

            var ld = this.Nodes.Select(i => tr.TransformGlobalToLocal(i.GetNodalDisplacement(loadCase))).ToArray();

            for (var i = 0; i < helpers.Count(); i++)
            {
                var st = helpers[i].GetLocalInternalStressAt(this, ld, isoLocation);
                gst += st;
            }

            var buf = new CauchyStressTensor();

            buf += gst.MembraneTensor;

            {
                //step2: update Cauchy based on bending,
                //bending tensor also affects the Cauchy tensor regarding how much distance between desired location and center of plate.

                //old code: buf.UpdateTotalStress(_section.GetThicknessAt(new double[] { localX, localY }) * localZ, probeLocation);

                var lambda = 0.0;

                if (isoLocation.Length == 3)
                {
                    lambda = isoLocation[2];
                }
                if (lambda > 1.0 || lambda < -1.0)
                {
                    throw new Exception("lambda must be between -1 and +1")
                          {
                          };
                }
                var thickness = Section.GetThicknessAt(isoLocation);

                var z = thickness * lambda;//distance from plate center, measure in [m]
                if (lambda > 0)
                {
                    //top -> add bending stress
                    buf += gst.BendingTensor.ConvertBendingStressToCauchyTensor(z);
                }
                else
                {
                    //bottom -> subtract bending stress
                    buf -= gst.BendingTensor.ConvertBendingStressToCauchyTensor(z);
                }
            }
            return(buf);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// prepare data for the dialog
        /// </summary>
        public void PrepareData()
        {
            //Create seven Load Natures first
            if (!CreateLoadNatures())
            {
                return;
            }

            //get all the categories of load cases
            UIApplication   uiapplication   = new UIApplication(m_revit);
            Categories      categories      = uiapplication.ActiveUIDocument.Document.Settings.Categories;
            Category        category        = categories.get_Item(BuiltInCategory.OST_LoadCases);
            CategoryNameMap categoryNameMap = category.SubCategories;

            System.Collections.IEnumerator iter = categoryNameMap.GetEnumerator();
            iter.Reset();
            while (iter.MoveNext())
            {
                Category temp = iter.Current as Category;
                if (null == temp)
                {
                    continue;
                }
                m_dataBuffer.LoadCasesCategory.Add(temp);
            }

            //get all the loadnatures name
            IList <Element> elements = new FilteredElementCollector(uiapplication.ActiveUIDocument.Document).OfClass(typeof(LoadNature)).ToElements();

            foreach (Element e in elements)
            {
                LoadNature nature = e as LoadNature;
                if (null != nature)
                {
                    m_dataBuffer.LoadNatures.Add(nature);
                    LoadNaturesMap newLoadNaturesMap = new LoadNaturesMap(nature);
                    m_dataBuffer.LoadNaturesMap.Add(newLoadNaturesMap);
                }
            }
            elements = new FilteredElementCollector(uiapplication.ActiveUIDocument.Document).OfClass(typeof(LoadCase)).ToElements();
            foreach (Element e in elements)
            {
                //get all the loadcases
                LoadCase loadCase = e as LoadCase;
                if (null != loadCase)
                {
                    m_dataBuffer.LoadCases.Add(loadCase);
                    LoadCasesMap newLoadCaseMap = new LoadCasesMap(loadCase);
                    m_dataBuffer.LoadCasesMap.Add(newLoadCaseMap);
                }
            }
        }
Ejemplo n.º 20
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get data
            Brep     surface = null;
            Vector3d direction = Vector3d.Zero;
            LoadCase loadCase = null;
            double   z0 = 0, q0 = 0, qh = 0;
            string   comment = null;

            if (!DA.GetData(0, ref surface))
            {
                return;
            }
            if (!DA.GetData(1, ref direction))
            {
                return;
            }
            if (!DA.GetData(2, ref loadCase))
            {
                return;
            }
            if (!DA.GetData(3, ref z0))
            {
                return;
            }
            if (!DA.GetData(4, ref q0))
            {
                return;
            }
            if (!DA.GetData(5, ref qh))
            {
                return;
            }
            if (!DA.GetData(6, ref comment))
            {
                // pass
            }
            if (surface == null || loadCase == null)
            {
                return;
            }

            // transform geometry
            FemDesign.Geometry.Region     region        = surface.FromRhino();
            FemDesign.Geometry.FdVector3d loadDirection = direction.FromRhino().Normalize();

            PressureLoad obj = new PressureLoad(region, loadDirection, z0, q0, qh, loadCase, comment, false, ForceLoadType.Force);

            // return
            DA.SetData(0, obj);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Find a load case by the load case name
        /// </summary>
        /// <param name="name">The name of load case</param>
        /// <returns>The reference of the LoadCase</returns>
        private LoadCase FindLoadCaseByName(String name)
        {
            LoadCase loadCase = null;

            foreach (LoadCase l in m_dataBuffer.LoadCases)
            {
                if (name == l.Name)
                {
                    loadCase = l;
                    break;
                }
            }
            return(loadCase);
        }
Ejemplo n.º 22
0
        // TODO: For SAP2000
        ///// <summary>
        ///// The output option for power spectral density results.
        ///// SAP2000 only.
        ///// </summary>
        ///// <value>The output PSD option.</value>
        //eAnalysisPSDOptions OutputPSDOption { get; internal set; }

        ///// <summary>
        ///// The output option for steady state results.
        ///// SAP2000 only.
        ///// </summary>
        ///// <value>The output steady state option.</value>
        //eAnalysisSteadyStateOptions OutputSteadyStateOption { get; internal set; }

        ///// <summary>
        ///// The steady state option.
        ///// SAP2000 only.
        ///// </summary>
        ///// <value>The steady state option.</value>
        //eSteadyStateOptions SteadyStateOption { get; internal set; }
        #endregion

        #region Fill/Set
        /// <summary>
        /// Sets the case selected for output.
        /// </summary>
        /// <param name="loadCase">An existing load case.</param>
        public void SetCaseSelectedForOutput(LoadCase loadCase)
        {
            if (loadCase.IsSelectedForAnalysis)
            {
                if (!CasesSelectedForOutput.Contains(loadCase))
                {
                    CasesSelectedForOutput.Add(loadCase);
                }
            }
            else
            {
                CasesSelectedForOutput.Remove(loadCase);
            }
        }
Ejemplo n.º 23
0
        private void addLoadDeflection(AbstractCase ac, LineElement line, float lineLength, float[,] controlPoints, DeformationAxis component, float scale, float EI)
        {
            if (ac == null)
            {
                return;
            }

            if (ac is LoadCombination)
            {
                foreach (AbstractCaseFactor acf in ((LoadCombination)ac).Cases)
                {
                    addLoadDeflection(acf.Case, line, lineLength, controlPoints, component, acf.Factor, EI);
                }
            }
            else if (ac is AnalysisCase)
            {
                if (((AnalysisCase)ac).Properties is StaticCaseProps)
                {
                    foreach (StaticCaseFactor staticCase in ((StaticCaseProps)((AnalysisCase)ac).Properties).Loads)
                    {
                        if (staticCase.AppliedLoad is LoadCase)
                        {
                            LoadCase lc = staticCase.AppliedLoad as LoadCase;
                            if (line.Loads[lc] != null)
                            {
                                foreach (Load load in line.Loads[lc])
                                {
                                    //addUniformLoadDeflection(line, lineLength, load as LineLoad, controlPoints, component, scale, EI);
                                    //addTriangularLoadDeflection(line, lineLength, load as LineLoad, controlPoints, component, scale, EI);
                                    if (load is DirectionalLineLoad)
                                    {
                                        addLoadDeflection(line, lineLength, load as DirectionalLineLoad, controlPoints, component, scale, EI);
                                    }
                                }
                            }
                            if (lc.SelfWeight > 0f)
                            {
                                if (line.Properties is StraightFrameProps)
                                {
                                    StraightFrameProps frameProps = line.Properties as StraightFrameProps;
                                    selfWeight.La = selfWeight.Lb = frameProps.Section.Area * frameProps.Section.Material.UnitWeight;
                                    //addUniformLoadDeflection(line, lineLength, selfWeight, controlPoints, component, lc.SelfWeight * scale, EI);
                                    addLoadDeflection(line, lineLength, selfWeight, controlPoints, component, lc.SelfWeight * scale, EI);
                                }
                            }
                        }
                    }
                }
            }
        }
 public RFLoadCase(LoadCase load)
 {
     Comment          = load.Comment;
     ID               = load.ID;
     IsValid          = load.IsValid;
     No               = load.Loading.No;
     Tag              = load.Tag;
     ToSolve          = load.ToSolve;
     Description      = load.Description;
     ActionCategory   = load.ActionCategory;
     SelfWeightFactor = new Vector3d(load.SelfWeightFactor.ToPoint3d());
     ToModify         = false;
     ToDelete         = false;
 }
Ejemplo n.º 25
0
        public EditLoadCaseDialog(LoadCase loadCase)
        {
            load = loadCase;
            InitializeComponent();

            foreach (LoadCase.LoadCaseType type in Enum.GetValues(typeof(LoadCase.LoadCaseType)))
            {
                caseTypes.Add(Culture.Get(type.ToString()), type);
            }

            foreach (string type in caseTypes.Keys)
            {
                typeComboBox.Items.Add(type);
            }
        }
Ejemplo n.º 26
0
 /// <summary>
 /// Sets the case selected for output.
 /// </summary>
 /// <param name="loadCase">An existing load case.</param>
 /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
 /// <exception cref="MPT.CSI.API.Core.Support.CSiException"></exception>
 public void SetCaseSelectedForOutput(LoadCase loadCase)
 {
     _analysisResultsSetup.SetCaseSelectedForOutput(loadCase.Name, loadCase.IsSelectedForAnalysis);
     if (loadCase.IsSelectedForAnalysis)
     {
         if (!CasesSelectedForOutput.Contains(loadCase))
         {
             CasesSelectedForOutput.Add(loadCase);
         }
     }
     else
     {
         CasesSelectedForOutput.Remove(loadCase);
     }
 }
Ejemplo n.º 27
0
        private void addToShearMomentDiagram(AbstractCase ac, LineElement line, float[,] controlPoints, LineForceComponent component, float scale)
        {
            if (ac == null)
            {
                return;
            }

            if (ac is LoadCombination)
            {
                foreach (AbstractCaseFactor acf in ((LoadCombination)ac).Cases)
                {
                    addToShearMomentDiagram(acf.Case, line, controlPoints, component, acf.Factor);
                }
            }
            else if (ac is AnalysisCase)
            {
                if (((AnalysisCase)ac).Properties is StaticCaseProps)
                {
                    foreach (StaticCaseFactor staticCase in ((StaticCaseProps)((AnalysisCase)ac).Properties).Loads)
                    {
                        if (staticCase.AppliedLoad is LoadCase)
                        {
                            LoadCase lc = staticCase.AppliedLoad as LoadCase;
                            if (line.Loads[lc] != null)
                            {
                                foreach (Load load in line.Loads[lc])
                                {
                                    if (load is DirectionalLineLoad)
                                    {
                                        addToShearMomentDiagram(line, load as DirectionalLineLoad, controlPoints, component, scale);
                                    }
                                }
                            }

                            if (lc.SelfWeight > 0f)
                            {
                                if (line.Properties is StraightFrameProps)
                                {
                                    StraightFrameProps frameProps = line.Properties as StraightFrameProps;
                                    selfWeight.La = selfWeight.Lb = frameProps.Section.Area * frameProps.Section.Material.UnitWeight;
                                    addToShearMomentDiagram(line, selfWeight, controlPoints, component, lc.SelfWeight * scale);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 28
0
        public override bool Execute(ExecutionInfo exInfo = null)
        {
            LoadCase lCase = Model.LoadCases.FindByName(Case);

            if (lCase == null)
            {
                lCase = Model.Create.LoadCase(Case, exInfo);
            }
            NodeLoad nLoad = Model.Create.NodeLoad(lCase, exInfo);

            nLoad.Name = Name;
            nLoad.AppliedTo.Set(ApplyTo);
            nLoad.SetForce(Force);
            Load = nLoad;
            return(true);
        }
Ejemplo n.º 29
0
 /// <summary>
 /// Relocates a ConcentratedSpanLoad between the line element where it is and a new adjacent line element.
 /// </summary>
 /// <param name="newLineLoads">The AssignedLoads object of the new Line Element</param>
 /// <param name="lc">The Load Case to which the load belongs.</param>
 /// <param name="x">The dividing point of the two line elements [0, 1]</param>
 /// <param name="load">The Load to distribute in two elements</param>
 /// <returns>true if the load was moved to the new Line Element (so the caller removes it). false otherwise.</returns>
 private static bool RelocateConcentratedLoads(AssignedLoads newLineLoads, LoadCase lc, float x, ConcentratedSpanLoad load)
 {
     if (x > load.D)
     {
         load.D = load.D / x;
         return(false);
     }
     else
     {
         load    = (ConcentratedSpanLoad)load.Clone();
         load.Id = 0;
         load.D  = (load.D - x) / (1f - x);
         newLineLoads.Add(load, lc);
         return(true);
     }
 }
Ejemplo n.º 30
0
        public LoadCase LoadPatternCaseToSpeckle(string loadPatternName)
        {
            //Converts just the load case name
            var speckleLoadCase = new LoadCase();

            speckleLoadCase.loadType = GetAndConvertEtabsLoadType(loadPatternName);
            speckleLoadCase.name     = loadPatternName;
            if (!SpeckleModel.loads.Contains(speckleLoadCase))
            {
            }
            else
            {
                SpeckleModel.loads.Add(speckleLoadCase);
            }
            return(speckleLoadCase);
        }
Ejemplo n.º 31
0
        string m_loadCasesNumber; //Store the load cases number

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Overload the constructor
        /// </summary>
        /// <param name="loadCase">Load Case</param>
        public LoadCasesMap(LoadCase loadCase)
        {
            m_loadCase = loadCase;
            m_loadCasesName = m_loadCase.Name;
            FindProperty();
        }
Ejemplo n.º 32
0
        private void Stream( ArrayList data, LoadCase loadcase )
        {
            data.Add( new Snoop.Data.ClassSeparator( typeof( LoadCase ) ) );

              // Nothing at this level yet!
        }
Ejemplo n.º 33
0
        private void Stream( ArrayList data, LoadCase loadcase )
        {
            data.Add( new Snoop.Data.ClassSeparator( typeof( LoadCase ) ) );

              // Nothing at this level yet!
              data.Add( new Snoop.Data.ElementId( "NatureId", loadcase.NatureId, loadcase.Document ) );
              data.Add( new Snoop.Data.ElementId( "SubcategoryId", loadcase.SubcategoryId, loadcase.Document ) );
              data.Add( new Snoop.Data.Int( "Number", loadcase.Number ) );
        }