public static void AddRandomiseLoading(Model mdl, bool addNodalLoads, bool addElementLoads,
                                               params LoadCase[] cases)
        {
            if (addNodalLoads)
            {
                foreach (var nde in mdl.Nodes)
                {
                    foreach (var cse in cases)
                    {
                        nde.Loads.Add(new NodalLoad(RandomHelper.GetRandomForce(-1000, 1000), cse));
                    }
                }
            }

            if (addElementLoads)
            {
                foreach (var elm in mdl.Elements)
                {
                    foreach (var cse in cases)
                    {
                        var dir1 = rnd.GetRandomVector(-1, 1).GetUnit();

                        var uniformLoad = new UniformLoad(cse, dir1, rnd.GetRandomNumber(-1000, 1000), CoordinationSystem.Global);

                        elm.Loads.Add(uniformLoad);
                    }
                }
            }
        }
Пример #2
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 static void Run1()
        {
            var l     = 10;
            var model = new Model();

            model.Nodes.Add(new Node(0, 0, 0)
            {
                Label = "n0"
            });
            model.Nodes.Add(new Node(l, 0, 0)
            {
                Label = "n1"
            });
            //Fixed nodes
            model.Nodes["n0"].Constraints = Constraints.Fixed;
            model.Nodes["n1"].Constraints = Constraints.Fixed;

            var bar = new BarElement(model.Nodes["n0"], model.Nodes["n1"])
            {
                Label = "e0"
            };

            //Pinned bar releases

            bar.StartReleaseCondition = Constraints.MovementFixed;

            bar.EndReleaseCondition = Constraints.MovementFixed & Constraints.FixedRX;

            model.Elements.Add(bar);

            var sec = new UniformGeometric1DSection(SectionGenerator.GetISetion(0.24, 0.67, 0.01, 0.006));
            var mat = UniformIsotropicMaterial.CreateFromYoungPoisson(210e9, 0.3);

            (model.Elements["e0"] as BarElement).Material = mat;
            (model.Elements["e0"] as BarElement).Section  = sec;

            var u1 = new UniformLoad(LoadCase.DefaultLoadCase, -Vector.K, 1, CoordinationSystem.Global);

            model.Elements["e0"].Loads.Add(u1);

            model.Solve_MPC();

            var n0Force = model.Nodes["n0"].GetSupportReaction();
            var n1Force = model.Nodes["n1"].GetSupportReaction();

            Console.WriteLine("support reaction of n0: {0}, n1: {1}", n0Force, n1Force);

            var elm = model.Elements[0] as BarElement;

            BarInternalForceVisualizer.VisualizeInNewWindow(elm);
        }
Пример #4
0
        public AssignedAreaLoads(Item item)
            : base(item)
        {
            if (!(item is AreaElement))
                throw new InvalidItemException();
            weight = new UniformLoad();

            // TODO: Add specific variables for this uniform load to represent self weight
            //weight.Da = 0;
            //weight.Db = 1;
            //weight.Direction = LineLoad.LoadDirection.Gravity;
            //weight.La = 1;
            //weight.Lb = 1;
        }
Пример #5
0
        public AssignedAreaLoads(Item item)
            : base(item)
        {
            if (!(item is AreaElement))
            {
                throw new InvalidItemException();
            }
            weight = new UniformLoad();

            // TODO: Add specific variables for this uniform load to represent self weight
            //weight.Da = 0;
            //weight.Db = 1;
            //weight.Direction = LineLoad.LoadDirection.Gravity;
            //weight.La = 1;
            //weight.Lb = 1;
        }