public void Calculate_DisplacementVector_SmallNumberOfDegreesOfFreedom_Success()
        {
            Mock <IStiffnessMatrix> stiffnessMatrix = new Mock <IStiffnessMatrix>();

            stiffnessMatrix.Setup(sm => sm.Size).Returns(6);
            Mock <ISpan> span = new Mock <ISpan>();

            SetUpSpan(span);

            VectorAdapter deflectionVector = SetUpDeflectionVector();

            var spanCalculationEngine = new SpanCalculationEngine(span.Object, stiffnessMatrix.Object);

            spanCalculationEngine.CalculateDisplacement(deflectionVector, numberOfDegreesOfFreedom: 0);

            Assert.That(spanCalculationEngine.Displacements[0], Is.EqualTo(0));
            Assert.That(spanCalculationEngine.Displacements[1], Is.EqualTo(0));
            Assert.That(spanCalculationEngine.Displacements[2], Is.EqualTo(0));
            Assert.That(spanCalculationEngine.Displacements[3], Is.EqualTo(0));
            Assert.That(spanCalculationEngine.Displacements[4], Is.EqualTo(0));
            Assert.That(spanCalculationEngine.Displacements[5], Is.EqualTo(0));

            Assert.That(span.Object.LeftNode.HorizontalDeflection.Value, Is.EqualTo(0));
            Assert.That(span.Object.LeftNode.VerticalDeflection.Value, Is.EqualTo(0));
            Assert.That(span.Object.LeftNode.RightRotation.Value, Is.EqualTo(0));
            Assert.That(span.Object.RightNode.HorizontalDeflection.Value, Is.EqualTo(0));
            Assert.That(span.Object.RightNode.VerticalDeflection.Value, Is.EqualTo(0));
            Assert.That(span.Object.RightNode.LeftRotation.Value, Is.EqualTo(0));

            Assert.That(span.Object.LeftNode.LeftRotation, Is.Null);
            Assert.That(span.Object.RightNode.RightRotation, Is.Null);
        }
Exemplo n.º 2
0
        public void CalculateSpanLoadVector()
        {
            if (_span.IncludeSelfWeight)
            {
                AddSelfWeightLoad();
            }

            LoadVector = VectorAdapter.Create(StiffnessMatrix.Size);

            LoadVector[0] = SetNormalForceLoadVector(isLeftNode: true);
            LoadVector[1] = SetShearForceLoadVector(isLeftNode: true);
            LoadVector[2] = SetBendingMomentForceLoadVector(isLeftNode: true);

            LoadVector[3] = SetNormalForceLoadVector(isLeftNode: false);
            LoadVector[4] = SetShearForceLoadVector(isLeftNode: false);
            LoadVector[5] = SetBendingMomentForceLoadVector(isLeftNode: false);

            if (_span.LeftNode.Angle != 0)
            {
                SetLoadVectorsWithAngle(isLeftNode: true);
            }
            if (_span.RightNode.Angle != 0)
            {
                SetLoadVectorsWithAngle(isLeftNode: false);
            }
        }
Exemplo n.º 3
0
        private void CalculateDisplacementVector(VectorAdapter deflectionVector, int numberOfDegreesOfFreedom)
        {
            Displacements = VectorAdapter.Create(StiffnessMatrix.Size);

            if (_span.LeftNode.HorizontalMovementNumber < numberOfDegreesOfFreedom)
            {
                Displacements[0] = deflectionVector[_span.LeftNode.HorizontalMovementNumber];
            }
            if (_span.LeftNode.VerticalMovementNumber < numberOfDegreesOfFreedom)
            {
                Displacements[1] = deflectionVector[_span.LeftNode.VerticalMovementNumber];
            }
            if (_span.LeftNode.RightRotationNumber < numberOfDegreesOfFreedom)
            {
                Displacements[2] = deflectionVector[_span.LeftNode.RightRotationNumber];
            }
            if (_span.RightNode.HorizontalMovementNumber < numberOfDegreesOfFreedom)
            {
                Displacements[3] = deflectionVector[_span.RightNode.HorizontalMovementNumber];
            }
            if (_span.RightNode.VerticalMovementNumber < numberOfDegreesOfFreedom)
            {
                Displacements[4] = deflectionVector[_span.RightNode.VerticalMovementNumber];
            }
            if (_span.RightNode.LeftRotationNumber < numberOfDegreesOfFreedom)
            {
                Displacements[5] = deflectionVector[_span.RightNode.LeftRotationNumber];
            }
        }
        private static VectorAdapter SetUpDeflectionVector()
        {
            var deflectionVector = VectorAdapter.Create(8);

            deflectionVector[0] = 1;
            deflectionVector[1] = 2;
            deflectionVector[2] = 3;
            deflectionVector[3] = 4;
            deflectionVector[4] = 5;
            deflectionVector[5] = 6;
            deflectionVector[6] = 7;
            deflectionVector[7] = 8;
            return(deflectionVector);
        }
        public void SpanCalculate_Force_Success()
        {
            Mock <IStiffnessMatrix> stiffnessMatrix = new Mock <IStiffnessMatrix>();

            stiffnessMatrix.Setup(sm => sm.Matrix)
            .Returns(MatrixAdapter.Create(rows: 2, columns: 2, values: new double[4] {
                1, 2, 3, 4
            }));

            Mock <ISpan> span = new Mock <ISpan>();

            var spanCalculationEngine = new SpanCalculationEngine(span.Object, stiffnessMatrix.Object);
            var loadVector            = VectorAdapter.Create(values: new double[2] {
                2, 1
            });
            var displacements = VectorAdapter.Create(values: new double[2] {
                1, 3
            });

            spanCalculationEngine.CalculateForce(loadVector, displacements);

            Assert.That(spanCalculationEngine.Forces[0], Is.EqualTo(12));
            Assert.That(spanCalculationEngine.Forces[1], Is.EqualTo(15));
        }
Exemplo n.º 6
0
 public void CalculateForce(VectorAdapter loadVector, VectorAdapter displacements)
 {
     Forces = StiffnessMatrix.Matrix.Multiply(displacements).Add(loadVector);
 }
Exemplo n.º 7
0
 public void CalculateDisplacement(VectorAdapter deflectionVector, int numberOfDegreesOfFreedom)
 {
     CalculateDisplacementVector(deflectionVector, numberOfDegreesOfFreedom);
     SetDisplacement();
 }