plcsharp/Tests/PLCSharp.Tests/MatrixMotionTests.cs

31 lines
1.2 KiB
C#

using PLCSharp.VVMs.MotionController;
namespace PLCSharp.Tests;
public class MatrixMotionTests
{
[Fact]
public void GeneratedPointUsesStartingClearanceAndSpeedForJump()
{
var origin = new AxisPoint
{
Name = "origin", AxisX = new Axis(), AxisY = new Axis(),
AxisZ = new Axis { ORGCreated = true }, AxisU = new Axis(),
ZSafe = -17.5, Rate = 50, XRate = 20, YRate = 40, ZRate = 60, URate = 80
};
var end = new AxisPoint { Name = "end", X = 8, Y = 10, Z = 2 };
var matrix = new Matrix { StartName = "origin", XEndName = "end", YEndName = "end", XCount = 2, YCount = 2 };
Assert.True(ControllersModel.TryCreateMatrix(matrix, [origin, end]));
var point = matrix.GetPoint(1, 1);
Assert.True(point.Jump());
point.Run();
Assert.Equal(-17.5, origin.AxisZ.Params.TargetPos);
Assert.Equal(11, origin.AxisZ.MotionFlow.Step);
Assert.Equal(0, origin.AxisX.MotionFlow.Step);
Assert.Equal(10, origin.AxisX.Params.Rate);
Assert.Equal(20, origin.AxisY.Params.Rate);
Assert.Equal(30, origin.AxisZ.Params.Rate);
Assert.Equal(40, origin.AxisU.Params.Rate);
}
}