Browse Source

添加

master
肖正 5 months ago
parent
commit
42e538a233
  1. BIN
      Admin.NET.Web.Entry/Admin.NET.db
  2. 4
      Bodk.Device.Storage/M9Storage.cs
  3. 174
      Bodk.Device.Storage/Modules/GantryX.cs
  4. 10
      Bodk.Device.Storage/Modules/GantryY.cs

BIN
Admin.NET.Web.Entry/Admin.NET.db

Binary file not shown.

4
Bodk.Device.Storage/M9Storage.cs

@ -35,6 +35,10 @@ public class M9Storage : IStorage
_modbusWrapper.WriteCoilsAsync,
_modbusWrapper.ReadCoilsAsync, _modbusWrapper.ReadHoldingRegistersAsync,
_modbusWrapper.WriteHoldingRegistersAsync));
_modules.Add(new GantryY(alarmEventHandler, motionTimeoutAlarmEventHandler,
_modbusWrapper.WriteCoilsAsync,
_modbusWrapper.ReadCoilsAsync, _modbusWrapper.ReadHoldingRegistersAsync,
_modbusWrapper.WriteHoldingRegistersAsync));
}
public async Task Start()

174
Bodk.Device.Storage/Modules/GantryX.cs

@ -0,0 +1,174 @@
using Bodk.Device.Storage.EventArgs;
namespace Bodk.Device.Storage.Modules;
/// <summary>
/// 龙门X
/// </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>
public class GantryX(
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 => "GantryX";
public override string Descirption => "龙门X轴";
public override int Id => 5;
internal override ushort? EnableAddress => 104;
internal override ushort? ResetAddress => 124;
internal override ushort? CleanAddress => 144;
internal override ushort? GotoOriginAddress => 164;
internal override ushort? ForwardAddress => 184;
internal override ushort? BackwardAddress => 204;
internal override ushort? RelativeMoveAddress => 224;
internal override ushort? AbsoluteMoveAddress => 244;
internal override ushort? MotionTimeoutAlarmAddress => 284;
internal override ushort? AlarmAddress => 304;
internal override ushort? IsEnabledAddress => 334;
internal override ushort? OriginFlagAddress => 354;
internal override ushort? MoveDistanceAddress => 108;
internal override ushort? CurrentPositionAddress => 132;
internal override ushort? ManualSpeedAddress => 1008;
internal override ushort? AutoSpeedAddress => 1048;
internal override ushort? AccDecAddress => 1088;
internal override ushort? GotoOriginHighSpeedAddress => 1128;
internal override ushort? GotoOriginLowSpeedAddress => 1152;
internal ushort StandbyAddress => 1420;
internal ushort GraspFoamLidAddress => 1422;
internal ushort PlaceFoamLidAddress => 1424;
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>
/// 移动到双极模组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;
}

10
Bodk.Device.Storage/Modules/GantryY.cs

@ -1,7 +1,15 @@
using Bodk.Device.Storage.EventArgs;
namespace Bodk.Device.Storage.Modules;
/// <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>
public class GantryY(
Action<object?, AlarmChangedEventArg> alarmEventHandler,
Action<object?, MotionTimeoutAlarmChangedEventArg> motionTimeoutAlarmEventHandler,

Loading…
Cancel
Save