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.
120 lines
3.3 KiB
120 lines
3.3 KiB
using Bodk.Device.Storage.Attributes;
|
|
using Bodk.Device.Storage.EventArgs;
|
|
|
|
namespace Bodk.Device.Storage.Modules;
|
|
|
|
public class CryogenicRackGripper2(
|
|
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 => "CryogenicRackGripper2";
|
|
public override string Descirption => "冻存架夹爪2";
|
|
public override int Id => 3;
|
|
|
|
internal override ushort? EnableAddress => 102;
|
|
|
|
internal override ushort? ResetAddress => 122;
|
|
|
|
internal override ushort? CleanAddress => 142;
|
|
|
|
internal override ushort? GotoOriginAddress => 162;
|
|
|
|
internal override ushort? ForwardAddress => 182;
|
|
|
|
internal override ushort? BackwardAddress => 202;
|
|
|
|
internal override ushort? RelativeMoveAddress => 222;
|
|
|
|
internal override ushort? AbsoluteMoveAddress => 242;
|
|
|
|
internal override ushort? MotionTimeoutAlarmAddress => 282;
|
|
|
|
internal override ushort? AlarmAddress => 302;
|
|
|
|
internal override ushort? IsEnabledAddress => 332;
|
|
|
|
internal override ushort? OriginFlagAddress => 352;
|
|
|
|
internal override ushort? MoveDistanceAddress => 104;
|
|
|
|
internal override ushort? CurrentPositionAddress => 128;
|
|
|
|
internal override ushort? ManualSpeedAddress => 1004;
|
|
|
|
internal override ushort? AutoSpeedAddress => 1044;
|
|
|
|
internal override ushort? AccDecAddress => 1084;
|
|
|
|
internal override ushort? GotoOriginHighSpeedAddress => 1124;
|
|
|
|
internal override ushort? GotoOriginLowSpeedAddress => 1148;
|
|
|
|
internal ushort ReleasePositionAddress => 1374;
|
|
|
|
internal ushort HoldingPositionAddress => 1376;
|
|
|
|
|
|
/// <summary>
|
|
/// 是否需要加紧
|
|
/// </summary>
|
|
/// <param name="holding"></param>
|
|
[Switch]
|
|
public async Task Holding(bool holding)
|
|
{
|
|
if (holding)
|
|
{
|
|
var des = await ReadFloat(HoldingPositionAddress);
|
|
await AbsoluteMoveAsync(des);
|
|
}
|
|
else
|
|
{
|
|
var des = await ReadFloat(ReleasePositionAddress);
|
|
await AbsoluteMoveAsync(des);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 松开位
|
|
/// </summary>
|
|
public float ReleasePosition
|
|
{
|
|
get
|
|
{
|
|
_releasePosition ??= ReadFloat(ReleasePositionAddress).Result;
|
|
return _releasePosition.Value;
|
|
}
|
|
set
|
|
{
|
|
_releasePosition = value;
|
|
WriteFloat(ReleasePositionAddress, value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 夹紧位
|
|
/// </summary>
|
|
public float HoldingPosition
|
|
{
|
|
get
|
|
{
|
|
_holdingPosition ??= ReadFloat(HoldingPositionAddress).Result;
|
|
return _holdingPosition.Value;
|
|
}
|
|
set
|
|
{
|
|
_holdingPosition = value;
|
|
WriteFloat(HoldingPositionAddress, value);
|
|
}
|
|
}
|
|
|
|
private float? _releasePosition;
|
|
|
|
private float? _holdingPosition;
|
|
}
|