using NUnit.Framework;
[TestFixture]
[Category("Software")]
class GearingCamming : SampleAppTestBase
{
[Test, Timeout(Constants.MAX_TEST_TIME)]
public void Camming()
{
Axis moving_axis = controller.AxisGet(Constants.MAIN_AXIS_NUMBER);
Axis follower_axis = controller.AxisGet(Constants.DRIVEN_AXIS_NUMBER);
const double MAIN_VELOCITY = 50;
const double MAIN_ACCELERATION = 20;
double[] movingAxisDistances = { 5, 10, 8 };
double[] followerAxisPositions = { 10, 20, 10 };
follower_axis.MoveCamLinear(moving_axis.NumberGet(),
movingAxisDistances,
followerAxisPositions,
movingAxisDistances.Length);
moving_axis.MoveVelocity(MAIN_VELOCITY, MAIN_ACCELERATION);
follower_axis.MotionDoneWait();
moving_axis.Stop();
Assert.AreEqual(followerAxisPositions[followerAxisPositions.Length - 1], follower_axis.CommandPositionGet());
}
[Test, Timeout(Constants.MAX_TEST_TIME)]
public void Gearing()
{
Axis moving_axis = controller.AxisGet(Constants.MAIN_AXIS_NUMBER);
Axis follower_axis = controller.AxisGet(Constants.DRIVEN_AXIS_NUMBER);
int numerator = 2;
int denominator = 1;
follower_axis.GearingEnable(moving_axis,
numerator,
denominator);
moving_axis.MoveSCurve(Constants.POSITION,
Constants.VELOCITY,
Constants.ACCELERATION,
Constants.DECELERATION,
Constants.JERK_PERCENT);
moving_axis.MotionDoneWait();
Assert.That(moving_axis.CommandPositionGet(), Is.EqualTo(Constants.POSITION), "The command position should be equal to POSITION");
Assert.That(follower_axis.CommandPositionGet(), Is.EqualTo(Constants.POSITION * (numerator / denominator)), "The command position should be equal to twice POSITION");
}
}