Ejemplo n.º 1
0
        private void CalculateReactions()
        {
            int numberOfReactions = Spans.Count * 3 + 3 - NumberOfDegreesOfFreedom;

            numberOfReactions += Nodes.Count(n => n is Hinge); // HACK: Check if needed

            for (int i = NumberOfDegreesOfFreedom; i < numberOfReactions + NumberOfDegreesOfFreedom; i++)
            {
                if (Spans.SingleOrDefault(s => s.LeftNode.HorizontalMovementNumber == i)?.LeftNode.NormalForce != null)
                {
                    Spans.SingleOrDefault(s => s.LeftNode.HorizontalMovementNumber == i).LeftNode.NormalForce.Value
                        += Spans.Where(s => s.LeftNode.HorizontalMovementNumber == i).Sum(s => s.Forces[0]);
                }

                if (Spans.SingleOrDefault(s => s.LeftNode.VerticalMovementNumber == i)?.LeftNode.ShearForce != null)
                {
                    Spans.SingleOrDefault(s => s.LeftNode.VerticalMovementNumber == i).LeftNode.ShearForce.Value
                        += Spans.Where(s => s.LeftNode.VerticalMovementNumber == i).Sum(s => s.Forces[1]);
                }

                if (Spans.SingleOrDefault(s => s.LeftNode.RightRotationNumber == i)?.LeftNode.BendingMoment != null)
                {
                    Spans.SingleOrDefault(s => s.LeftNode.RightRotationNumber == i).LeftNode.BendingMoment.Value
                        -= Spans.Where(s => s.LeftNode.RightRotationNumber == i).Sum(s => s.Forces[2]);
                }

                if (Spans.SingleOrDefault(s => s.RightNode.HorizontalMovementNumber == i)?.RightNode.NormalForce != null)
                {
                    Spans.SingleOrDefault(s => s.RightNode.HorizontalMovementNumber == i).RightNode.NormalForce.Value
                        += Spans.Where(s => s.RightNode.HorizontalMovementNumber == i).Sum(s => s.Forces[3]);
                }

                if (Spans.SingleOrDefault(s => s.RightNode.VerticalMovementNumber == i)?.RightNode.ShearForce != null)
                {
                    Spans.SingleOrDefault(s => s.RightNode.VerticalMovementNumber == i).RightNode.ShearForce.Value
                        += Spans.Where(s => s.RightNode.VerticalMovementNumber == i).Sum(s => s.Forces[4]);
                }

                if (Spans.SingleOrDefault(s => s.RightNode.LeftRotationNumber == i)?.RightNode.BendingMoment != null)
                {
                    Spans.SingleOrDefault(s => s.RightNode.LeftRotationNumber == i).RightNode.BendingMoment.Value
                        -= Spans.Where(s => s.RightNode.LeftRotationNumber == i).Sum(s => s.Forces[5]);
                }
            }
        }