操控平台后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
4.9 KiB

4 months ago
using Bodk.Device.Storage.EventArgs;
namespace Bodk.Device.Storage.Modules;
4 months ago
/// <summary>
/// 龙门Y
/// </summary>
/// <param name="alarmEventHandler"></param>
/// <param name="motionTimeoutAlarmEventHandler"></param>
/// <param name="writeCoilRegisterFunc"></param>
/// <param name="readCoilRegisterFunc"></param>
/// <param name="readHoldingRegistersFunc"></param>
/// <param name="writeHoldingRegistersFunc"></param>
4 months ago
public class GantryY(
Action<object?, AlarmChangedEventArg> alarmEventHandler,
Action<object?, MotionTimeoutAlarmChangedEventArg> motionTimeoutAlarmEventHandler,
Func<ushort, bool[], Task> writeCoilRegisterFunc,
Func<ushort, ushort, Task<bool[]>> readCoilRegisterFunc,
Func<ushort, ushort, Task<ushort[]>> readHoldingRegistersFunc,
Func<ushort, ushort[], Task> writeHoldingRegistersFunc)
: ModuleBase(alarmEventHandler, motionTimeoutAlarmEventHandler, writeCoilRegisterFunc, readCoilRegisterFunc,
readHoldingRegistersFunc, writeHoldingRegistersFunc)
{
public override string Name => "GantryY";
public override string Descirption => "龙门Y轴";
public override int Id => 4;
internal override ushort? EnableAddress => 103;
internal override ushort? ResetAddress => 123;
internal override ushort? CleanAddress => 143;
internal override ushort? GotoOriginAddress => 163;
internal override ushort? ForwardAddress => 183;
internal override ushort? BackwardAddress => 203;
internal override ushort? RelativeMoveAddress => 223;
internal override ushort? AbsoluteMoveAddress => 243;
internal override ushort? MotionTimeoutAlarmAddress => 283;
internal override ushort? AlarmAddress => 303;
internal override ushort? IsEnabledAddress => 333;
internal override ushort? OriginFlagAddress => 353;
internal override ushort? MoveDistanceAddress => 106;
internal override ushort? CurrentPositionAddress => 130;
internal override ushort? ManualSpeedAddress => 1006;
internal override ushort? AutoSpeedAddress => 1046;
internal override ushort? AccDecAddress => 1086;
internal override ushort? GotoOriginHighSpeedAddress => 1126;
internal override ushort? GotoOriginLowSpeedAddress => 1150;
internal ushort StandbyAddress => 1378;
internal ushort GraspFoamLidAddress => 1380;
internal ushort PlaceFoamLidAddress => 1382;
internal ushort BipolarModuleAAddress => 1384;
internal ushort BipolarModuleBAddress => 1386;
internal ushort BipolarModuleCAddress => 1388;
internal ushort UnipolarModuleAAddress => 1390;
internal ushort UnipolarModuleBAddress => 1392;
internal ushort UnipolarModuleCAddress => 1394;
/// <summary>
/// 移动到待机位
/// </summary>
public async Task MoveToStandbyPositionAsync()
{
await AbsoluteMoveAsync(await ReadFloat(StandbyAddress));
}
/// <summary>
/// 移动到抓取泡沫盖位
/// </summary>
public async Task MoveToGraspFoamLidPositionAsync()
{
await AbsoluteMoveAsync(await ReadFloat(GraspFoamLidAddress));
}
/// <summary>
/// 移动到放泡沫盖位
/// </summary>
public async Task MoveToPlaceFoamLidPositionAsync()
{
await AbsoluteMoveAsync(await ReadFloat(PlaceFoamLidAddress));
}
/// <summary>
4 months ago
/// 移动到双极模组A位
/// </summary>
public async Task MoveToBipolarModuleAPositionAsync()
{
await AbsoluteMoveAsync(await ReadFloat(BipolarModuleAAddress));
}
/// <summary>
/// 移动到双极模组B位
/// </summary>
public async Task MoveToBipolarModuleBPositionAsync()
{
await AbsoluteMoveAsync(await ReadFloat(BipolarModuleBAddress));
}
/// <summary>
/// 移动到双极模组C位
/// </summary>
public async Task MoveToBipolarModuleCPositionAsync()
{
await AbsoluteMoveAsync(await ReadFloat(BipolarModuleCAddress));
}
/// <summary>
/// 移动到单极模组A位
/// </summary>
public async Task MoveToUnipolarModuleAPositionAsync()
{
await AbsoluteMoveAsync(await ReadFloat(UnipolarModuleAAddress));
}
/// <summary>
/// 移动到单极模组B位
/// </summary>
public async Task MoveToUnipolarModuleBPositionAsync()
{
await AbsoluteMoveAsync(await ReadFloat(UnipolarModuleBAddress));
}
/// <summary>
/// 移动到单极模组C位
/// </summary>
public async Task MoveToUnipolarModuleCPositionAsync()
{
await AbsoluteMoveAsync(await ReadFloat(UnipolarModuleCAddress));
}
/// <summary>
/// 待机位
/// </summary>
public float StandbyPosition
{
get
{
_standbyPosition ??= ReadFloat(StandbyAddress).Result;
return _standbyPosition.Value;
}
set
{
_standbyPosition = value;
WriteFloat(StandbyAddress, value);
}
}
private float? _standbyPosition;
}