Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO775-DUOStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 1c43d39d
由
刘韬
编写于
2020-11-18 16:03:56 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
导入汇川库
1 个父辈
73bbb05b
隐藏空白字符变更
内嵌
并排
正在显示
29 个修改的文件
包含
2221 行增加
和
438 行删除
RC1271-DUOStore.sln → SO755-DUOStore.sln
source/Common/Setting_Init.cs
source/DUOStore/DUOStore.csproj
source/DUOStore/FrmAxisDebug.cs
source/DUOStore/FrmAxisMove.cs
source/DUOStore/FrmBox.cs
source/DUOStore/FrmStore.cs
source/DUOStore/positionTool/FrmPositionTool.cs
source/DUOStore/useControl/AxisMoveControl.cs
source/DeviceLibrary/AXIS/AxisManager.cs
source/DeviceLibrary/AXIS/HC/HCAxisManager.cs
source/DeviceLibrary/AXIS/PanasonicServo/ACCMDManager.cs
source/DeviceLibrary/AXIS/PanasonicServo/ACServerManager.cs
source/DeviceLibrary/AXIS/PanasonicServo/ACServerManager_Partial.cs
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/StoreConfig/StoreConfig.csv
source/DeviceLibrary/device/IO/AIOBOX/AIOBOXManager.cs
source/DeviceLibrary/device/IO/HCIOManager.cs
source/DeviceLibrary/device/IO/IOManager.cs
source/DeviceLibrary/duoStore/AxisBean.cs
source/DeviceLibrary/duoStore/BoxBean.cs
source/DeviceLibrary/duoStore/BoxBean_Partial.cs
source/DeviceLibrary/duoStore/DUOStoreBean.cs
source/DeviceLibrary/duoStore/DUOStoreBean_Partial.cs
source/DeviceLibrary/duoStore/EquipBase.cs
source/DeviceLibrary/duoStore/StoreManager.cs
source/DeviceLibrary/store/KTK_Store.cs
source/LoadCVSLibrary/storeConfig/ConfigItemBase.cs
source/LoadCVSLibrary/storeConfig/config/IO_Type.cs
RC1271
-DUOStore.sln
→
SO755
-DUOStore.sln
查看文件 @
1c43d39
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio
15
# Visual Studio
Version 16
VisualStudioVersion = 1
5.0.27130.2024
VisualStudioVersion = 1
6.0.30621.155
MinimumVisualStudioVersion = 10.0.40219.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "source\Common\Common.csproj", "{43CDD09E-FCF3-4960-A01D-3BBFE9933122}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "source\Common\Common.csproj", "{43CDD09E-FCF3-4960-A01D-3BBFE9933122}"
EndProject
EndProject
...
...
source/Common/Setting_Init.cs
查看文件 @
1c43d39
...
@@ -73,7 +73,10 @@ namespace OnlineStore.Common
...
@@ -73,7 +73,10 @@ namespace OnlineStore.Common
/// 温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪
/// 温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪
/// </summary>
/// </summary>
public
static
string
HumitureControllerType
=
"HumitureControllerType"
;
public
static
string
HumitureControllerType
=
"HumitureControllerType"
;
public
static
string
UseHCBoard
=
"UseHCBoard"
;
public
static
string
UseAIOBOX
=
"UseAIOBOX"
;
public
static
string
LineServerIp
=
"LineServerIp"
;
public
static
string
LineServerIp
=
"LineServerIp"
;
public
static
string
LineServerPort
=
"LineServerPort"
;
public
static
string
LineServerPort
=
"LineServerPort"
;
...
...
source/DUOStore/DUOStore.csproj
查看文件 @
1c43d39
...
@@ -41,9 +41,6 @@
...
@@ -41,9 +41,6 @@
<Reference Include="CodeLibrary">
<Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
</Reference>
<Reference Include="DeviceLib">
<HintPath>..\..\dll\DeviceLib.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<Reference Include="halcondotnet">
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
</Reference>
</Reference>
...
...
source/DUOStore/FrmAxisDebug.cs
查看文件 @
1c43d39
using
DeviceLib
;
using
log4net
;
using
log4net
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.DeviceLibrary
;
using
OnlineStore.DeviceLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
...
@@ -40,7 +39,7 @@ namespace OnlineStore.DUOStore
...
@@ -40,7 +39,7 @@ namespace OnlineStore.DUOStore
private
void
AxisMove
(
ConfigMoveAxis
axis
,
int
speed
)
private
void
AxisMove
(
ConfigMoveAxis
axis
,
int
speed
)
{
{
LogUtil
.
debug
(
"点动:deviceName="
+
axis
.
DeviceName
+
",axis="
+
axis
.
GetAxisValue
()
+
",speed="
+
speed
);
LogUtil
.
debug
(
"点动:deviceName="
+
axis
.
DeviceName
+
",axis="
+
axis
.
GetAxisValue
()
+
",speed="
+
speed
);
A
CServerManager
.
SpeedMove
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
speed
);
A
xisManager
.
instance
.
SpeedMove
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
speed
);
}
}
private
void
FrmAxisDebug_Load
(
object
sender
,
EventArgs
e
)
private
void
FrmAxisDebug_Load
(
object
sender
,
EventArgs
e
)
...
@@ -55,7 +54,7 @@ namespace OnlineStore.DUOStore
...
@@ -55,7 +54,7 @@ namespace OnlineStore.DUOStore
{
{
int
InOutDefaultPosition
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
InOutDefaultPosition
);
int
InOutDefaultPosition
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
InOutDefaultPosition
);
int
currValue
=
A
CServerManager
.
GetActualtPosition
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
int
currValue
=
A
xisManager
.
instance
.
GetActualtPosition
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
if
(
currValue
<=
InOutDefaultPosition
)
if
(
currValue
<=
InOutDefaultPosition
)
{
{
return
true
;
return
true
;
...
@@ -88,7 +87,7 @@ namespace OnlineStore.DUOStore
...
@@ -88,7 +87,7 @@ namespace OnlineStore.DUOStore
if
(
btnMiddleMove
.
BackColor
==
Color
.
Green
)
if
(
btnMiddleMove
.
BackColor
==
Color
.
Green
)
{
{
btnMiddleMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
btnMiddleMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
middle
.
DeviceName
,
middle
.
GetAxisValue
());
A
xisManager
.
instance
.
SuddenStop
(
middle
.
DeviceName
,
middle
.
GetAxisValue
());
UpdateMiddlePosition
();
UpdateMiddlePosition
();
}
}
}
}
...
@@ -116,8 +115,8 @@ namespace OnlineStore.DUOStore
...
@@ -116,8 +115,8 @@ namespace OnlineStore.DUOStore
{
{
if
(
btnUpDownMove
.
BackColor
==
Color
.
Green
)
if
(
btnUpDownMove
.
BackColor
==
Color
.
Green
)
{
{
btnUpDownMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
btnUpDownMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
updown
.
DeviceName
,
updown
.
GetAxisValue
());
A
xisManager
.
instance
.
SuddenStop
(
updown
.
DeviceName
,
updown
.
GetAxisValue
());
UpdateUpdownPosition
();
UpdateUpdownPosition
();
}
}
}
}
...
@@ -142,7 +141,7 @@ namespace OnlineStore.DUOStore
...
@@ -142,7 +141,7 @@ namespace OnlineStore.DUOStore
if
(
this
.
btnInOutMove
.
BackColor
==
Color
.
Green
)
if
(
this
.
btnInOutMove
.
BackColor
==
Color
.
Green
)
{
{
btnInOutMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
btnInOutMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
A
xisManager
.
instance
.
SuddenStop
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
UpdateInOutPosition
();
UpdateInOutPosition
();
}
}
}
}
...
@@ -170,7 +169,7 @@ namespace OnlineStore.DUOStore
...
@@ -170,7 +169,7 @@ namespace OnlineStore.DUOStore
if
(
btnMiddleMovej
.
BackColor
==
Color
.
Green
)
if
(
btnMiddleMovej
.
BackColor
==
Color
.
Green
)
{
{
btnMiddleMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
btnMiddleMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
middle
.
DeviceName
,
middle
.
GetAxisValue
());
A
xisManager
.
instance
.
SuddenStop
(
middle
.
DeviceName
,
middle
.
GetAxisValue
());
UpdateMiddlePosition
();
UpdateMiddlePosition
();
}
}
}
}
...
@@ -199,7 +198,7 @@ namespace OnlineStore.DUOStore
...
@@ -199,7 +198,7 @@ namespace OnlineStore.DUOStore
if
(
btnUpDownMovej
.
BackColor
==
Color
.
Green
)
if
(
btnUpDownMovej
.
BackColor
==
Color
.
Green
)
{
{
btnUpDownMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
btnUpDownMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
updown
.
DeviceName
,
updown
.
GetAxisValue
());
A
xisManager
.
instance
.
SuddenStop
(
updown
.
DeviceName
,
updown
.
GetAxisValue
());
UpdateUpdownPosition
();
UpdateUpdownPosition
();
}
}
}
}
...
@@ -224,7 +223,7 @@ namespace OnlineStore.DUOStore
...
@@ -224,7 +223,7 @@ namespace OnlineStore.DUOStore
if
(
btnInOutMovej
.
BackColor
.
Equals
(
Color
.
Green
))
if
(
btnInOutMovej
.
BackColor
.
Equals
(
Color
.
Green
))
{
{
btnInOutMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
btnInOutMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
A
xisManager
.
instance
.
SuddenStop
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
UpdateInOutPosition
();
UpdateInOutPosition
();
}
}
}
}
...
@@ -247,8 +246,8 @@ namespace OnlineStore.DUOStore
...
@@ -247,8 +246,8 @@ namespace OnlineStore.DUOStore
{
{
if
(
this
.
btnComMove
.
BackColor
==
Color
.
Green
)
if
(
this
.
btnComMove
.
BackColor
==
Color
.
Green
)
{
{
btnComMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
btnComMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
comp
.
DeviceName
,
comp
.
GetAxisValue
());
A
xisManager
.
instance
.
SuddenStop
(
comp
.
DeviceName
,
comp
.
GetAxisValue
());
UpdateCompPosition
();
UpdateCompPosition
();
}
}
}
}
...
@@ -268,8 +267,8 @@ namespace OnlineStore.DUOStore
...
@@ -268,8 +267,8 @@ namespace OnlineStore.DUOStore
{
{
if
(
btnComMovej
.
BackColor
.
Equals
(
Color
.
Green
))
if
(
btnComMovej
.
BackColor
.
Equals
(
Color
.
Green
))
{
{
btnComMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
btnComMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
comp
.
DeviceName
,
comp
.
GetAxisValue
());
A
xisManager
.
instance
.
SuddenStop
(
comp
.
DeviceName
,
comp
.
GetAxisValue
());
UpdateCompPosition
();
UpdateCompPosition
();
}
}
}
}
...
@@ -297,7 +296,7 @@ namespace OnlineStore.DUOStore
...
@@ -297,7 +296,7 @@ namespace OnlineStore.DUOStore
}
}
private
void
UpdateCompPosition
()
private
void
UpdateCompPosition
()
{
{
int
compPosition
=
A
CServerManager
.
GetTargetPosition
(
comp
.
DeviceName
,
comp
.
GetAxisValue
());
int
compPosition
=
A
xisManager
.
instance
.
GetTargetPosition
(
comp
.
DeviceName
,
comp
.
GetAxisValue
());
if
(!
txtComPosition
.
Text
.
Equals
(
compPosition
.
ToString
()))
if
(!
txtComPosition
.
Text
.
Equals
(
compPosition
.
ToString
()))
{
{
txtComPosition
.
Text
=
compPosition
.
ToString
();
txtComPosition
.
Text
=
compPosition
.
ToString
();
...
@@ -305,7 +304,7 @@ namespace OnlineStore.DUOStore
...
@@ -305,7 +304,7 @@ namespace OnlineStore.DUOStore
}
}
private
void
UpdateUpdownPosition
()
private
void
UpdateUpdownPosition
()
{
{
int
updownPosition
=
A
CServerManager
.
GetTargetPosition
(
updown
.
DeviceName
,
updown
.
GetAxisValue
());
int
updownPosition
=
A
xisManager
.
instance
.
GetTargetPosition
(
updown
.
DeviceName
,
updown
.
GetAxisValue
());
if
(!
txtUpdownPosition
.
Text
.
Equals
(
updownPosition
.
ToString
()))
if
(!
txtUpdownPosition
.
Text
.
Equals
(
updownPosition
.
ToString
()))
{
{
txtUpdownPosition
.
Text
=
updownPosition
.
ToString
();
txtUpdownPosition
.
Text
=
updownPosition
.
ToString
();
...
@@ -314,7 +313,7 @@ namespace OnlineStore.DUOStore
...
@@ -314,7 +313,7 @@ namespace OnlineStore.DUOStore
private
void
UpdateMiddlePosition
()
private
void
UpdateMiddlePosition
()
{
{
int
middlePosition
=
A
CServerManager
.
GetTargetPosition
(
middle
.
DeviceName
,
middle
.
GetAxisValue
());
int
middlePosition
=
A
xisManager
.
instance
.
GetTargetPosition
(
middle
.
DeviceName
,
middle
.
GetAxisValue
());
if
(!
txtMiddlePosition
.
Text
.
Equals
(
middlePosition
.
ToString
()))
if
(!
txtMiddlePosition
.
Text
.
Equals
(
middlePosition
.
ToString
()))
{
{
txtMiddlePosition
.
Text
=
middlePosition
.
ToString
();
txtMiddlePosition
.
Text
=
middlePosition
.
ToString
();
...
@@ -323,7 +322,7 @@ namespace OnlineStore.DUOStore
...
@@ -323,7 +322,7 @@ namespace OnlineStore.DUOStore
private
void
UpdateInOutPosition
()
private
void
UpdateInOutPosition
()
{
{
int
inoutPosition
=
A
CServerManager
.
GetTargetPosition
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
int
inoutPosition
=
A
xisManager
.
instance
.
GetTargetPosition
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
if
(!
txtInOutPosition
.
Text
.
Equals
(
inoutPosition
.
ToString
()))
if
(!
txtInOutPosition
.
Text
.
Equals
(
inoutPosition
.
ToString
()))
{
{
txtInOutPosition
.
Text
=
inoutPosition
.
ToString
();
txtInOutPosition
.
Text
=
inoutPosition
.
ToString
();
...
...
source/DUOStore/FrmAxisMove.cs
查看文件 @
1c43d39
...
@@ -17,7 +17,6 @@ using OnlineStore.DeviceLibrary;
...
@@ -17,7 +17,6 @@ using OnlineStore.DeviceLibrary;
using
System.IO.Ports
;
using
System.IO.Ports
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
CodeLibrary
;
using
CodeLibrary
;
using
DeviceLib
;
using
UserFromControl
;
using
UserFromControl
;
namespace
OnlineStore.DUOStore
namespace
OnlineStore.DUOStore
...
...
source/DUOStore/FrmBox.cs
查看文件 @
1c43d39
...
@@ -17,7 +17,6 @@ using OnlineStore.DeviceLibrary;
...
@@ -17,7 +17,6 @@ using OnlineStore.DeviceLibrary;
using
System.IO.Ports
;
using
System.IO.Ports
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
CodeLibrary
;
using
CodeLibrary
;
using
DeviceLib
;
using
UserFromControl
;
using
UserFromControl
;
namespace
OnlineStore.DUOStore
namespace
OnlineStore.DUOStore
...
@@ -411,7 +410,7 @@ namespace OnlineStore.DUOStore
...
@@ -411,7 +410,7 @@ namespace OnlineStore.DUOStore
private
bool
InOutIsIsP1
()
private
bool
InOutIsIsP1
()
{
{
int
InOutDefaultPosition
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
InOutDefaultPosition
);
int
InOutDefaultPosition
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
InOutDefaultPosition
);
int
currValue
=
A
CServerManager
.
GetActualtPosition
(
BoxBean
.
Config
.
InOut_Axis
.
DeviceName
,
BoxBean
.
Config
.
InOut_Axis
.
GetAxisValue
());
int
currValue
=
A
xisManager
.
instance
.
GetActualtPosition
(
BoxBean
.
Config
.
InOut_Axis
.
DeviceName
,
BoxBean
.
Config
.
InOut_Axis
.
GetAxisValue
());
if
(
currValue
<=
InOutDefaultPosition
)
if
(
currValue
<=
InOutDefaultPosition
)
{
{
return
true
;
return
true
;
...
@@ -431,7 +430,7 @@ namespace OnlineStore.DUOStore
...
@@ -431,7 +430,7 @@ namespace OnlineStore.DUOStore
}
}
int
targetPosition
=
FormUtil
.
GetIntValue
(
txtValue
);
int
targetPosition
=
FormUtil
.
GetIntValue
(
txtValue
);
moveAxis
.
TargetPosition
=
targetPosition
;
moveAxis
.
TargetPosition
=
targetPosition
;
A
CServerManager
.
AbsMove
(
moveAxis
.
DeviceName
,
moveAxis
.
GetAxisValue
(),
targetPosition
,
target
Speed
);
A
xisManager
.
instance
.
AbsMove
(
moveAxis
.
DeviceName
,
moveAxis
.
GetAxisValue
(),
targetPosition
,
targetSpeed
,
moveAxis
.
AddSpeed
,
moveAxis
.
Del
Speed
);
}
}
private
void
btnUpDownP1_Click
(
object
sender
,
EventArgs
e
)
private
void
btnUpDownP1_Click
(
object
sender
,
EventArgs
e
)
{
{
...
@@ -711,7 +710,7 @@ namespace OnlineStore.DUOStore
...
@@ -711,7 +710,7 @@ namespace OnlineStore.DUOStore
private
void
btnUpdown_Click
(
object
sender
,
EventArgs
e
)
private
void
btnUpdown_Click
(
object
sender
,
EventArgs
e
)
{
{
string
PortName
=
BoxBean
.
Config
.
UpDown_Axis
.
DeviceName
;
string
PortName
=
BoxBean
.
Config
.
UpDown_Axis
.
DeviceName
;
in
t
slvAddr
=
BoxBean
.
Config
.
UpDown_Axis
.
GetAxisValue
();
shor
t
slvAddr
=
BoxBean
.
Config
.
UpDown_Axis
.
GetAxisValue
();
string
ioIP
=
"192.168.200.13"
;
string
ioIP
=
"192.168.200.13"
;
int
ioIndex
=
0
;
int
ioIndex
=
0
;
// if (store.Config.StoreDIList.ContainsKey(IO_Type.UpdownPositionSingal))
// if (store.Config.StoreDIList.ContainsKey(IO_Type.UpdownPositionSingal))
...
...
source/DUOStore/FrmStore.cs
查看文件 @
1c43d39
using
CodeLibrary
;
using
CodeLibrary
;
using
DeviceLib
;
using
log4net
;
using
log4net
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.DeviceLibrary
;
using
OnlineStore.DeviceLibrary
;
...
@@ -243,7 +242,7 @@ namespace OnlineStore.DUOStore
...
@@ -243,7 +242,7 @@ namespace OnlineStore.DUOStore
e
.
Cancel
=
true
;
e
.
Cancel
=
true
;
HideForm
();
HideForm
();
}
}
}
}
private
void
ExitApp
()
private
void
ExitApp
()
{
{
...
@@ -270,8 +269,8 @@ namespace OnlineStore.DUOStore
...
@@ -270,8 +269,8 @@ namespace OnlineStore.DUOStore
IOManager
.
instance
.
CloseAllDO
();
IOManager
.
instance
.
CloseAllDO
();
IOManager
.
instance
.
CloseAllConnection
();
IOManager
.
instance
.
CloseAllConnection
();
HumitureController
.
CloseAllPort
();
HumitureController
.
CloseAllPort
();
A
CServerManager
.
CloseAllPort
();
A
xisManager
.
instance
.
CloseAllPort
();
if
(
Camera
.
_cam
!=
null
)
if
(
Camera
.
_cam
!=
null
)
{
{
Camera
.
_cam
.
CloseAll
();
Camera
.
_cam
.
CloseAll
();
...
...
source/DUOStore/positionTool/FrmPositionTool.cs
查看文件 @
1c43d39
using
DeviceLib
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.DeviceLibrary
;
using
OnlineStore.DeviceLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
...
@@ -22,14 +21,16 @@ namespace OnlineStore.DUOStore
...
@@ -22,14 +21,16 @@ namespace OnlineStore.DUOStore
{
{
private
string
LogName
=
ResourceCulture
.
GetString
(
"升降轴位置调试:"
);
private
string
LogName
=
ResourceCulture
.
GetString
(
"升降轴位置调试:"
);
private
string
PortName
=
""
;
private
string
PortName
=
""
;
private
in
t
SlvAddr
=
0
;
private
shor
t
SlvAddr
=
0
;
private
string
IoIp
=
""
;
private
string
IoIp
=
""
;
private
int
IoIndex
=
0
;
private
int
IoIndex
=
0
;
public
string
Axis_Brake
=
IO_Type
.
UpdownAxis_Break
;
public
string
Axis_Brake
=
IO_Type
.
UpdownAxis_Break
;
private
int
subType
=
0
;
private
int
subType
=
0
;
private
System
.
Timers
.
Timer
toolTimer
=
new
System
.
Timers
.
Timer
();
private
System
.
Timers
.
Timer
toolTimer
=
new
System
.
Timers
.
Timer
();
public
int
ptpAcc
=
0
;
public
int
ptpDec
=
0
;
private
string
boxName
=
""
;
private
string
boxName
=
""
;
public
FrmPositionTool
(
string
protName
,
in
t
slvAddr
,
string
ioIp
,
int
ioIndex
,
string
text
,
int
ioSubType
)
public
FrmPositionTool
(
string
protName
,
shor
t
slvAddr
,
string
ioIp
,
int
ioIndex
,
string
text
,
int
ioSubType
)
{
{
InitializeComponent
();
InitializeComponent
();
this
.
PortName
=
protName
;
this
.
PortName
=
protName
;
...
@@ -49,11 +50,11 @@ namespace OnlineStore.DUOStore
...
@@ -49,11 +50,11 @@ namespace OnlineStore.DUOStore
private
void
Form1_Load
(
object
sender
,
EventArgs
e
)
private
void
Form1_Load
(
object
sender
,
EventArgs
e
)
{
{
A
CServerManager
.
IsShowMsg
=
false
;
A
xisManager
.
instance
.
IsShowMsg
=
false
;
LogUtil
.
logBox
=
this
.
richTextBox1
;
LogUtil
.
logBox
=
this
.
richTextBox1
;
//A
CServerManager
.richeBox = this.richTextBox1;
//A
xisManager.instance
.richeBox = this.richTextBox1;
CheckForIllegalCrossThreadCalls
=
false
;
CheckForIllegalCrossThreadCalls
=
false
;
txtPortName
.
Text
=
PortName
;
txtPortName
.
Text
=
PortName
;
...
@@ -91,7 +92,7 @@ namespace OnlineStore.DUOStore
...
@@ -91,7 +92,7 @@ namespace OnlineStore.DUOStore
SaveConfig
(
tSpeed
,
tPosition
);
SaveConfig
(
tSpeed
,
tPosition
);
//判断伺服是否已经打开
//判断伺服是否已经打开
bool
isOn
=
A
CServerManager
.
ServerOnStatus
(
PortName
,
SlvAddr
);
bool
isOn
=
A
xisManager
.
instance
.
IsServeoOn
(
PortName
,
SlvAddr
);
formStatus
(
isOn
);
formStatus
(
isOn
);
timer1
.
Start
();
timer1
.
Start
();
ioStatusControl1
.
IOName
=
ResourceCulture
.
GetString
(
"检测信号"
);
ioStatusControl1
.
IOName
=
ResourceCulture
.
GetString
(
"检测信号"
);
...
@@ -109,8 +110,8 @@ namespace OnlineStore.DUOStore
...
@@ -109,8 +110,8 @@ namespace OnlineStore.DUOStore
//P6Offset = FormUtil.GetIntValue(txtP6Offset);
//P6Offset = FormUtil.GetIntValue(txtP6Offset);
//StopTimer();
//StopTimer();
this
.
PortName
=
txtPortName
.
Text
;
this
.
PortName
=
txtPortName
.
Text
;
this
.
SlvAddr
=
FormUtil
.
Get
In
tValue
(
txtAddr
);
this
.
SlvAddr
=
FormUtil
.
Get
Shor
tValue
(
txtAddr
);
bool
result
=
A
CServerManager
.
OpenPort
(
PortName
,
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
ACBaudRate
)
);
bool
result
=
A
xisManager
.
instance
.
OpenPort
(
PortName
);
if
(!
result
)
if
(!
result
)
{
{
MessageBox
.
Show
(
ResourceCulture
.
GetString
(
"打开串口失败"
));
MessageBox
.
Show
(
ResourceCulture
.
GetString
(
"打开串口失败"
));
...
@@ -118,10 +119,10 @@ namespace OnlineStore.DUOStore
...
@@ -118,10 +119,10 @@ namespace OnlineStore.DUOStore
}
}
formStatus
(
true
);
formStatus
(
true
);
ACServerManager
.
InitSlvAddr
(
PortName
,
SlvAddr
);
//AxisManager.instance
.InitSlvAddr(PortName, SlvAddr);
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
100
);
A
CServerManager
.
AlarmClear
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
AlarmClear
(
PortName
,
SlvAddr
);
A
CServerManager
.
ServoOn
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
ServoOn
(
PortName
,
SlvAddr
);
try
try
{
{
...
@@ -137,7 +138,7 @@ namespace OnlineStore.DUOStore
...
@@ -137,7 +138,7 @@ namespace OnlineStore.DUOStore
{
{
StopTimer
();
StopTimer
();
// toolTimer.Stop();
// toolTimer.Stop();
A
CServerManager
.
SuddenStop
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
SuddenStop
(
PortName
,
SlvAddr
);
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
100
);
try
try
{
{
...
@@ -147,7 +148,7 @@ namespace OnlineStore.DUOStore
...
@@ -147,7 +148,7 @@ namespace OnlineStore.DUOStore
{
{
}
}
A
CServerManager
.
ServoOff
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
ServoOff
(
PortName
,
SlvAddr
);
formStatus
(
false
);
formStatus
(
false
);
}
}
...
@@ -174,25 +175,25 @@ namespace OnlineStore.DUOStore
...
@@ -174,25 +175,25 @@ namespace OnlineStore.DUOStore
private
void
btnRelMove_Click
(
object
sender
,
EventArgs
e
)
private
void
btnRelMove_Click
(
object
sender
,
EventArgs
e
)
{
{
int
speed
=
Convert
.
ToInt32
(
txtSpeed
.
Text
);
//
int speed = Convert.ToInt32(txtSpeed.Text);
int
position
=
Convert
.
ToInt32
(
txtPosition
.
Text
);
//
int position = Convert.ToInt32(txtPosition.Text);
ACServerManager
.
RelMove
(
PortName
,
SlvAddr
,
position
,
speed
);
//AxisManager.instance
.RelMove(PortName, SlvAddr, position,speed);
}
}
private
void
btnHomeMove_Click
(
object
sender
,
EventArgs
e
)
private
void
btnHomeMove_Click
(
object
sender
,
EventArgs
e
)
{
{
int
speed
=
Convert
.
ToInt32
(
txtSpeed
.
Text
);
int
speed
=
Convert
.
ToInt32
(
txtSpeed
.
Text
);
A
CServerManager
.
HomeMove
(
PortName
,
SlvAddr
,
speed
);
A
xisManager
.
instance
.
HomeMove
(
PortName
,
SlvAddr
,
50
,
1
,
speed
);
}
}
private
void
btnSpeedMove_Click
(
object
sender
,
EventArgs
e
)
private
void
btnSpeedMove_Click
(
object
sender
,
EventArgs
e
)
{
{
int
speed
=
Convert
.
ToInt32
(
txtSpeed
.
Text
);
int
speed
=
Convert
.
ToInt32
(
txtSpeed
.
Text
);
A
CServerManager
.
SpeedMove
(
PortName
,
SlvAddr
,
speed
);
A
xisManager
.
instance
.
SpeedMove
(
PortName
,
SlvAddr
,
speed
);
}
}
private
void
btnGetActualPosition_Click
(
object
sender
,
EventArgs
e
)
private
void
btnGetActualPosition_Click
(
object
sender
,
EventArgs
e
)
{
{
int
value
=
A
CServerManager
.
GetTargetPosition
(
PortName
,
SlvAddr
);
int
value
=
A
xisManager
.
instance
.
GetTargetPosition
(
PortName
,
SlvAddr
);
txtTargetPosition
.
Text
=
value
.
ToString
();
txtTargetPosition
.
Text
=
value
.
ToString
();
value
=
A
CServerManager
.
GetActualtPosition
(
PortName
,
SlvAddr
);
value
=
A
xisManager
.
instance
.
GetActualtPosition
(
PortName
,
SlvAddr
);
txtActualPosition
.
Text
=
value
.
ToString
();
txtActualPosition
.
Text
=
value
.
ToString
();
}
}
...
@@ -242,7 +243,7 @@ namespace OnlineStore.DUOStore
...
@@ -242,7 +243,7 @@ namespace OnlineStore.DUOStore
PositionList
=
new
List
<
int
>();
PositionList
=
new
List
<
int
>();
LogUtil
.
info
(
LogName
+
"伺服开始运动,速度【"
+
speed
+
"】位置【"
+
position
+
"】启动定时器 "
);
LogUtil
.
info
(
LogName
+
"伺服开始运动,速度【"
+
speed
+
"】位置【"
+
position
+
"】启动定时器 "
);
formMoveStatus
(
false
);
formMoveStatus
(
false
);
A
CServerManager
.
AbsMove
(
PortName
,
SlvAddr
,
position
,
speed
);
A
xisManager
.
instance
.
AbsMove
(
PortName
,
SlvAddr
,
position
,
speed
,
ptpAcc
,
ptpDec
);
toolTimer
.
Start
();
toolTimer
.
Start
();
}
}
private
int
P3Offset
=
0
;
private
int
P3Offset
=
0
;
...
@@ -263,7 +264,7 @@ namespace OnlineStore.DUOStore
...
@@ -263,7 +264,7 @@ namespace OnlineStore.DUOStore
private
void
btnSdStop_Click
(
object
sender
,
EventArgs
e
)
private
void
btnSdStop_Click
(
object
sender
,
EventArgs
e
)
{
{
toolTimer
.
Stop
();
toolTimer
.
Stop
();
A
CServerManager
.
SuddenStop
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
SuddenStop
(
PortName
,
SlvAddr
);
}
}
private
IO_VALUE
GetSingleValue
()
private
IO_VALUE
GetSingleValue
()
...
@@ -289,14 +290,14 @@ namespace OnlineStore.DUOStore
...
@@ -289,14 +290,14 @@ namespace OnlineStore.DUOStore
isInProcesss
=
true
;
isInProcesss
=
true
;
try
try
{
{
int
moveS
=
A
CServerManager
.
GetBusyStatus
(
PortName
,
SlvAddr
);
int
moveS
=
A
xisManager
.
instance
.
GetBusyStatus
(
PortName
,
SlvAddr
);
if
(
moveS
.
Equals
(
1
))
if
(
moveS
.
Equals
(
1
))
{
{
IO_VALUE
currValue
=
GetSingleValue
();
IO_VALUE
currValue
=
GetSingleValue
();
TimeSpan
checkSpan
=
DateTime
.
Now
-
LastGetPTime
;
TimeSpan
checkSpan
=
DateTime
.
Now
-
LastGetPTime
;
if
(
LastValue
.
Equals
(
IO_VALUE
.
LOW
)
&&
currValue
.
Equals
(
IO_VALUE
.
HIGH
)
&&
checkSpan
.
TotalSeconds
>
2
)
if
(
LastValue
.
Equals
(
IO_VALUE
.
LOW
)
&&
currValue
.
Equals
(
IO_VALUE
.
HIGH
)
&&
checkSpan
.
TotalSeconds
>
2
)
{
{
int
currPos
=
A
CServerManager
.
GetActualtPosition
(
PortName
,
SlvAddr
);
int
currPos
=
A
xisManager
.
instance
.
GetActualtPosition
(
PortName
,
SlvAddr
);
txtActualPosition
.
Text
=
currPos
.
ToString
();
txtActualPosition
.
Text
=
currPos
.
ToString
();
PositionList
.
Add
(
currPos
);
PositionList
.
Add
(
currPos
);
int
num
=
PositionList
.
Count
;
int
num
=
PositionList
.
Count
;
...
@@ -399,11 +400,11 @@ namespace OnlineStore.DUOStore
...
@@ -399,11 +400,11 @@ namespace OnlineStore.DUOStore
{
{
StopTimer
();
StopTimer
();
// toolTimer.Stop();
// toolTimer.Stop();
A
CServerManager
.
SuddenStop
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
SuddenStop
(
PortName
,
SlvAddr
);
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
100
);
}
}
LogUtil
.
logBox
=
null
;
LogUtil
.
logBox
=
null
;
//A
CServerManager
.CloseAllPort();
//A
xisManager.instance
.CloseAllPort();
//IOManager.instance.CloseAllConnection();
//IOManager.instance.CloseAllConnection();
}
}
...
...
source/DUOStore/useControl/AxisMoveControl.cs
查看文件 @
1c43d39
...
@@ -11,7 +11,6 @@ using OnlineStore.DeviceLibrary;
...
@@ -11,7 +11,6 @@ using OnlineStore.DeviceLibrary;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
System.Threading
;
using
System.Threading
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
DeviceLib
;
namespace
OnlineStore.DUOStore
namespace
OnlineStore.DUOStore
{
{
...
@@ -20,8 +19,9 @@ namespace OnlineStore.DUOStore
...
@@ -20,8 +19,9 @@ namespace OnlineStore.DUOStore
private
List
<
AxisBean
>
axisList
=
new
List
<
AxisBean
>();
private
List
<
AxisBean
>
axisList
=
new
List
<
AxisBean
>();
private
BoxBean
boxBean
=
null
;
private
BoxBean
boxBean
=
null
;
private
string
PortName
=
""
;
private
string
PortName
=
""
;
private
int
SlvAddr
=
0
;
private
short
SlvAddr
=
0
;
public
int
ptpAcc
=
0
;
public
int
ptpDec
=
0
;
public
AxisMoveControl
()
public
AxisMoveControl
()
{
{
InitializeComponent
();
InitializeComponent
();
...
@@ -85,7 +85,7 @@ namespace OnlineStore.DUOStore
...
@@ -85,7 +85,7 @@ namespace OnlineStore.DUOStore
private
void
btnCloseAxis_Click
(
object
sender
,
EventArgs
e
)
private
void
btnCloseAxis_Click
(
object
sender
,
EventArgs
e
)
{
{
LogUtil
.
info
(
"点击【关闭伺服】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 "
);
LogUtil
.
info
(
"点击【关闭伺服】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 "
);
// A
CServerManager
.ServoOff(PortName, SlvAddr);
// A
xisManager.instance
.ServoOff(PortName, SlvAddr);
axisList
[
comboBox1
.
SelectedIndex
].
ServoOff
();
axisList
[
comboBox1
.
SelectedIndex
].
ServoOff
();
}
}
...
@@ -98,7 +98,7 @@ namespace OnlineStore.DUOStore
...
@@ -98,7 +98,7 @@ namespace OnlineStore.DUOStore
int
position
=
FormUtil
.
GetIntValue
(
txtAPosition
);
int
position
=
FormUtil
.
GetIntValue
(
txtAPosition
);
int
speed
=
FormUtil
.
GetIntValue
(
txtASpeed
);
int
speed
=
FormUtil
.
GetIntValue
(
txtASpeed
);
LogUtil
.
info
(
"点击【绝对运动】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】位置【"
+
position
+
"】速度【"
+
speed
+
"】"
);
LogUtil
.
info
(
"点击【绝对运动】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】位置【"
+
position
+
"】速度【"
+
speed
+
"】"
);
A
CServerManager
.
AbsMove
(
PortName
,
SlvAddr
,
position
,
speed
);
A
xisManager
.
instance
.
AbsMove
(
PortName
,
SlvAddr
,
position
,
speed
,
ptpAcc
,
ptpDec
);
}
}
private
void
btnAxisRMove_Click
(
object
sender
,
EventArgs
e
)
private
void
btnAxisRMove_Click
(
object
sender
,
EventArgs
e
)
...
@@ -110,7 +110,7 @@ namespace OnlineStore.DUOStore
...
@@ -110,7 +110,7 @@ namespace OnlineStore.DUOStore
int
position
=
FormUtil
.
GetIntValue
(
txtAPosition
);
int
position
=
FormUtil
.
GetIntValue
(
txtAPosition
);
int
speed
=
FormUtil
.
GetIntValue
(
txtASpeed
);
int
speed
=
FormUtil
.
GetIntValue
(
txtASpeed
);
LogUtil
.
info
(
"点击【相对运动】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】位置【"
+
position
+
"】速度【"
+
speed
+
"】"
);
LogUtil
.
info
(
"点击【相对运动】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】位置【"
+
position
+
"】速度【"
+
speed
+
"】"
);
A
CServerManager
.
RelMove
(
PortName
,
SlvAddr
,
position
,
speed
);
A
xisManager
.
instance
.
RelMove
(
PortName
,
SlvAddr
,
position
,
speed
,
ptpAcc
,
ptpDec
);
}
}
private
void
btnAxisVMove_Click
(
object
sender
,
EventArgs
e
)
private
void
btnAxisVMove_Click
(
object
sender
,
EventArgs
e
)
...
@@ -121,13 +121,13 @@ namespace OnlineStore.DUOStore
...
@@ -121,13 +121,13 @@ namespace OnlineStore.DUOStore
}
}
int
speed
=
FormUtil
.
GetIntValue
(
txtASpeed
);
int
speed
=
FormUtil
.
GetIntValue
(
txtASpeed
);
LogUtil
.
info
(
"点击【匀速运动】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 速度【"
+
speed
+
"】"
);
LogUtil
.
info
(
"点击【匀速运动】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 速度【"
+
speed
+
"】"
);
A
CServerManager
.
SpeedMove
(
PortName
,
SlvAddr
,
speed
);
A
xisManager
.
instance
.
SpeedMove
(
PortName
,
SlvAddr
,
speed
);
}
}
private
void
btnAxisStop_Click
(
object
sender
,
EventArgs
e
)
private
void
btnAxisStop_Click
(
object
sender
,
EventArgs
e
)
{
{
LogUtil
.
info
(
"点击【停止运动】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 "
);
LogUtil
.
info
(
"点击【停止运动】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 "
);
A
CServerManager
.
SuddenStop
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
SuddenStop
(
PortName
,
SlvAddr
);
if
(
btnAddMove
.
BackColor
==
Color
.
Green
)
if
(
btnAddMove
.
BackColor
==
Color
.
Green
)
{
{
btnAddMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
btnAddMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
...
@@ -143,9 +143,9 @@ namespace OnlineStore.DUOStore
...
@@ -143,9 +143,9 @@ namespace OnlineStore.DUOStore
private
void
btnComAlarmClear_Click
(
object
sender
,
EventArgs
e
)
private
void
btnComAlarmClear_Click
(
object
sender
,
EventArgs
e
)
{
{
LogUtil
.
info
(
"点击【清理报警】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 "
);
LogUtil
.
info
(
"点击【清理报警】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 "
);
A
CServerManager
.
AlarmClear
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
AlarmClear
(
PortName
,
SlvAddr
);
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
100
);
A
CServerManager
.
ServoOn
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
ServoOn
(
PortName
,
SlvAddr
);
}
}
private
void
btnAxisReturnHome_Click
(
object
sender
,
EventArgs
e
)
private
void
btnAxisReturnHome_Click
(
object
sender
,
EventArgs
e
)
...
@@ -156,25 +156,25 @@ namespace OnlineStore.DUOStore
...
@@ -156,25 +156,25 @@ namespace OnlineStore.DUOStore
}
}
int
speed
=
FormUtil
.
GetIntValue
(
txtASpeed
);
int
speed
=
FormUtil
.
GetIntValue
(
txtASpeed
);
LogUtil
.
info
(
"点击【原点返回】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 速度【"
+
speed
+
"】"
);
LogUtil
.
info
(
"点击【原点返回】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 速度【"
+
speed
+
"】"
);
A
CServerManager
.
HomeMove
(
PortName
,
SlvAddr
,
speed
);
A
xisManager
.
instance
.
HomeMove
(
PortName
,
SlvAddr
,
50
,
1
,
speed
);
}
}
private
void
btnGetAlarm_Click
(
object
sender
,
EventArgs
e
)
private
void
btnGetAlarm_Click
(
object
sender
,
EventArgs
e
)
{
{
this
.
txtAlarmStatus
.
Text
=
A
CServerManager
.
GetAlarmStatus
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtAlarmStatus
.
Text
=
A
xisManager
.
instance
.
GetAlarmStatus
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtBusyStatus
.
Text
=
A
CServerManager
.
GetBusyStatus
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtBusyStatus
.
Text
=
A
xisManager
.
instance
.
GetBusyStatus
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtStb
.
Text
=
ACServerManager
.
GetSTBState
(
PortName
,
SlvAddr
).
ToString
();
//this.txtStb.Text = AxisManager.instance
.GetSTBState(PortName, SlvAddr).ToString();
this
.
txtHomeStatus
.
Text
=
A
CServerManager
.
GetHomeEndStatus
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtHomeStatus
.
Text
=
A
xisManager
.
instance
.
GetHomeEndStatus
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtHomeSingle
.
Text
=
A
CServerManager
.
GetHomeSingle
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtHomeSingle
.
Text
=
A
xisManager
.
instance
.
GetHomeSingle
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtLimit1
.
Text
=
A
CServerManager
.
GetLimitPositiveSingle
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtLimit1
.
Text
=
A
xisManager
.
instance
.
GetLimitPositiveSingle
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtLimit2
.
Text
=
A
CServerManager
.
GetLimitNegativeSingle
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtLimit2
.
Text
=
A
xisManager
.
instance
.
GetLimitNegativeSingle
(
PortName
,
SlvAddr
).
ToString
();
txtServoStatue
.
Text
=
A
CServerManager
.
ServerOnStatus
(
PortName
,
SlvAddr
)
?
"✔"
:
"✘"
;
txtServoStatue
.
Text
=
A
xisManager
.
instance
.
IsServeoOn
(
PortName
,
SlvAddr
)
?
"✔"
:
"✘"
;
}
}
private
void
btnReadPosition_Click
(
object
sender
,
EventArgs
e
)
private
void
btnReadPosition_Click
(
object
sender
,
EventArgs
e
)
{
{
lblCountPulse
.
Text
=
A
CServerManager
.
GetActualtPosition
(
PortName
,
SlvAddr
).
ToString
();
lblCountPulse
.
Text
=
A
xisManager
.
instance
.
GetActualtPosition
(
PortName
,
SlvAddr
).
ToString
();
}
}
...
@@ -254,7 +254,7 @@ namespace OnlineStore.DUOStore
...
@@ -254,7 +254,7 @@ namespace OnlineStore.DUOStore
private
void
AxisMove
(
int
speed
)
private
void
AxisMove
(
int
speed
)
{
{
LogUtil
.
info
(
"【"
+
PortName
+
"_"
+
SlvAddr
+
"】点动: 速度:"
+
speed
);
LogUtil
.
info
(
"【"
+
PortName
+
"_"
+
SlvAddr
+
"】点动: 速度:"
+
speed
);
A
CServerManager
.
SpeedMove
(
PortName
,
SlvAddr
,
speed
);
A
xisManager
.
instance
.
SpeedMove
(
PortName
,
SlvAddr
,
speed
);
}
}
private
void
btnAddMove_MouseDown
(
object
sender
,
MouseEventArgs
e
)
private
void
btnAddMove_MouseDown
(
object
sender
,
MouseEventArgs
e
)
{
{
...
@@ -280,7 +280,7 @@ namespace OnlineStore.DUOStore
...
@@ -280,7 +280,7 @@ namespace OnlineStore.DUOStore
if
(
btnAddMove
.
BackColor
==
Color
.
Green
)
if
(
btnAddMove
.
BackColor
==
Color
.
Green
)
{
{
btnAddMove
.
BackColor
=
Color
.
White
;
btnAddMove
.
BackColor
=
Color
.
White
;
A
CServerManager
.
SuddenStop
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
SuddenStop
(
PortName
,
SlvAddr
);
btnReadPosition_Click
(
null
,
null
);
btnReadPosition_Click
(
null
,
null
);
}
}
}
}
...
@@ -309,7 +309,7 @@ namespace OnlineStore.DUOStore
...
@@ -309,7 +309,7 @@ namespace OnlineStore.DUOStore
if
(
btnDelMove
.
BackColor
==
Color
.
Green
)
if
(
btnDelMove
.
BackColor
==
Color
.
Green
)
{
{
btnDelMove
.
BackColor
=
Color
.
White
;
btnDelMove
.
BackColor
=
Color
.
White
;
A
CServerManager
.
SuddenStop
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
SuddenStop
(
PortName
,
SlvAddr
);
btnReadPosition_Click
(
null
,
null
);
btnReadPosition_Click
(
null
,
null
);
}
}
}
}
...
...
source/DeviceLibrary/AXIS/AxisManager.cs
0 → 100644
查看文件 @
1c43d39
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary
{
public
abstract
class
AxisManager
{
public
bool
IsShowMsg
=
false
;
public
static
AxisManager
instance
;
public
static
bool
UseHCBoard
=
true
;
public
static
void
Init
()
{
// UseHCBoard = ConfigAppSettings.GetIntValue(Setting_Init.UseHCBoard).Equals(1);
if
(
UseHCBoard
)
{
instance
=
new
HCAxisManager
();
}
else
{
//instance = new ACServerManager();
}
}
#
region
485
通信方法
public
abstract
bool
OpenPort
(
string
portName
);
/// <summary>
/// 松下专用
/// </summary>
/// <param name="portName"></param>
public
abstract
void
ColsePort
(
string
portName
);
/// <summary>
/// 松下专用
/// </summary>
public
abstract
void
CloseAllPort
();
/// <summary>
/// 松下专用
/// </summary>
public
abstract
void
ClearSpeed
();
/// <summary>
/// 松下专用
/// </summary>
/// <param name="portName"></param>
/// <param name="slvAddr"></param>
/// <param name="targetSpeed"></param>
/// <param name="addSpeed"></param>
/// <param name="delSpeed"></param>
public
abstract
void
InitSlvAddr
(
string
portName
,
short
slvAddr
,
int
targetSpeed
,
int
addSpeed
,
int
delSpeed
);
public
abstract
bool
IsServeoOn
(
string
portName
,
short
slvAddr
);
#
endregion
public
abstract
bool
OpenCard
();
public
abstract
bool
CloseCard
();
public
abstract
bool
IsHomeMoveEnd
(
string
portName
,
short
slvAddr
);
public
abstract
bool
AbsMoveIsEnd
(
string
portName
,
short
axisNo
,
int
targetPosition
,
int
canErrorCount
,
out
bool
countError
);
public
abstract
void
ServoOn
(
string
portName
,
short
slvAddr
);
public
abstract
void
ServoOff
(
string
portName
,
short
slvAddr
);
public
abstract
void
RelMove
(
string
portName
,
short
slvAddr
,
int
position
,
int
targetSpeed
,
int
ptpAcc
,
int
ptpDec
);
public
abstract
void
HomeMove
(
string
portName
,
short
slvAddr
,
int
highVel
,
int
lowVel
,
int
acc
);
public
abstract
void
SpeedMove
(
string
portName
,
short
slvAddr
,
int
speed
);
public
abstract
void
SuddenStop
(
string
portName
,
short
slvAddr
);
public
abstract
bool
isInPosition
(
string
portName
,
short
slvAddr
,
int
PPosition
,
int
canErrorCount
,
bool
isLog
=
false
);
public
abstract
void
AbsMove
(
string
portName
,
short
slvAddr
,
int
targetPosition
,
int
targetSpeed
,
int
ptpAcc
,
int
ptpDec
);
public
abstract
void
AlarmClear
(
string
portName
,
short
slvAddr
);
public
abstract
int
GetTargetPosition
(
string
portName
,
short
slvAddr
);
public
abstract
int
GetActualtPosition
(
string
portName
,
short
slvAddr
);
public
abstract
int
GetAlarmStatus
(
string
portName
,
short
slvAddr
);
public
abstract
int
GetBusyStatus
(
string
portName
,
short
slvAddr
);
public
abstract
int
GetHomeEndStatus
(
string
portName
,
short
slvAddr
);
public
abstract
int
GetHomeSingle
(
string
portName
,
short
slvAddr
);
/// <summary>
/// 负极限
/// </summary>
public
abstract
int
GetLimitNegativeSingle
(
string
portName
,
short
slvAddr
);
/// <summary>
/// 正极限
/// </summary>
public
abstract
int
GetLimitPositiveSingle
(
string
portName
,
short
slvAddr
);
public
abstract
short
GetErrorCode
(
string
portName
,
short
slvAddr
);
}
}
source/DeviceLibrary/AXIS/HC/HCAxisManager.cs
0 → 100644
查看文件 @
1c43d39
using
HuichuanLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary
{
public
class
HCAxisManager
:
AxisManager
{
public
override
bool
OpenCard
()
{
return
HCBoardManager
.
OpenCard
();
}
public
override
bool
CloseCard
()
{
return
HCBoardManager
.
CloseCard
();
}
public
override
void
AbsMove
(
string
portName
,
short
slvAddr
,
int
targetPosition
,
int
targetSpeed
,
int
ptpAcc
,
int
ptpDec
)
{
HCBoardManager
.
AbsMove
((
short
)
slvAddr
,
targetPosition
,
targetSpeed
,
ptpAcc
,
ptpDec
);
}
public
override
void
AlarmClear
(
string
portName
,
short
slvAddr
)
{
HCBoardManager
.
ClearAxisSts
((
short
)
slvAddr
);
}
public
override
bool
OpenPort
(
string
portName
)
{
return
true
;
}
public
override
void
ClearSpeed
()
{
}
public
override
void
CloseAllPort
()
{
}
public
override
void
ColsePort
(
string
portName
)
{
}
public
override
void
InitSlvAddr
(
string
portName
,
short
slvAddr
,
int
targetSpeed
,
int
addSpeed
,
int
delSpeed
)
{
}
public
override
int
GetActualtPosition
(
string
portName
,
short
slvAddr
)
{
return
(
int
)
HCBoardManager
.
GetAxisCurrPos
(
slvAddr
);
}
public
override
int
GetAlarmStatus
(
string
portName
,
short
slvAddr
)
{
AxisSts
axisS
=
HCBoardManager
.
GetAxisSts
(
slvAddr
);
return
axisS
.
ALM
;
}
public
override
int
GetBusyStatus
(
string
portName
,
short
slvAddr
)
{
AxisSts
axisS
=
HCBoardManager
.
GetAxisSts
(
slvAddr
);
return
axisS
.
BUSY
;
}
public
override
int
GetHomeEndStatus
(
string
portName
,
short
slvAddr
)
{
return
(
int
)
HCBoardManager
.
GetHomeStatus
(
slvAddr
);
}
public
override
int
GetHomeSingle
(
string
portName
,
short
slvAddr
)
{
AxisSts
axisS
=
HCBoardManager
.
GetAxisSts
(
slvAddr
);
return
axisS
.
ALM
;
}
public
override
int
GetLimitNegativeSingle
(
string
portName
,
short
slvAddr
)
{
AxisSts
axisS
=
HCBoardManager
.
GetAxisSts
(
slvAddr
);
return
axisS
.
NEL
;
}
public
override
int
GetLimitPositiveSingle
(
string
portName
,
short
slvAddr
)
{
AxisSts
axisS
=
HCBoardManager
.
GetAxisSts
(
slvAddr
);
return
axisS
.
PEL
;
}
public
override
int
GetTargetPosition
(
string
portName
,
short
slvAddr
)
{
return
(
int
)
HCBoardManager
.
GetAxisPrfPos
(
slvAddr
);
}
public
override
void
HomeMove
(
string
portName
,
short
slvAddr
,
int
highVel
,
int
lowVel
,
int
acc
)
{
HCBoardManager
.
StartHomeMove
(
slvAddr
,(
uint
)
highVel
,
(
uint
)
lowVel
,
(
uint
)
acc
);
}
public
override
bool
IsHomeMoveEnd
(
string
portName
,
short
slvAddr
)
{
return
HCBoardManager
.
HomeingIsEnd
(
slvAddr
);
}
public
override
bool
isInPosition
(
string
portName
,
short
slvAddr
,
int
PPosition
,
int
canErrorCount
,
bool
isLog
=
false
)
{
return
HCBoardManager
.
IsInPosition
(
slvAddr
,
PPosition
,
canErrorCount
);
}
public
override
void
RelMove
(
string
portName
,
short
slvAddr
,
int
position
,
int
targetSpeed
,
int
ptpAcc
,
int
ptpDec
)
{
HCBoardManager
.
RelMove
(
slvAddr
,
position
,
targetSpeed
,
ptpAcc
,
ptpDec
);
}
public
override
bool
IsServeoOn
(
string
portName
,
short
slvAddr
)
{
AxisSts
axisS
=
HCBoardManager
.
GetAxisSts
(
slvAddr
);
return
axisS
.
ServoOn
.
Equals
(
1
);
}
public
override
void
ServoOff
(
string
portName
,
short
slvAddr
)
{
HCBoardManager
.
ServoOff
(
slvAddr
);
}
public
override
void
ServoOn
(
string
portName
,
short
slvAddr
)
{
HCBoardManager
.
ServoOn
(
slvAddr
);
}
public
override
void
SpeedMove
(
string
portName
,
short
slvAddr
,
int
speed
)
{
HCBoardManager
.
SpeedMove
(
slvAddr
,
speed
);
}
public
override
void
SuddenStop
(
string
portName
,
short
slvAddr
)
{
HCBoardManager
.
AxisStop
(
slvAddr
);
}
public
override
bool
AbsMoveIsEnd
(
string
portName
,
short
axisNo
,
int
targetPosition
,
int
canErrorCount
,
out
bool
countError
)
{
countError
=
false
;
bool
isOk
=
HCBoardManager
.
MoveIsEnd
(
axisNo
);
if
(
isOk
)
{
if
(
HCBoardManager
.
IsInPosition
(
axisNo
,
targetPosition
,
canErrorCount
))
{
return
true
;
}
else
{
countError
=
true
;
}
}
return
false
;
}
public
override
short
GetErrorCode
(
string
portName
,
short
slvAddr
)
{
return
HCBoardManager
.
GetAxErrCode
(
slvAddr
);
}
}
}
source/DeviceLibrary/AXIS/PanasonicServo/ACCMDManager.cs
0 → 100644
查看文件 @
1c43d39
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
OnlineStore.DeviceLibrary
{
public
class
ACCMDManager
{
/// <summary>
/// 0132h 原点接近传感器输入 (HOME) 状态 ReadOnly 0: 输入 OFF 1: 输入 ON
/// </summary>
public
static
string
Home_Single
=
"0132"
;
//
//
/// <summary>
/// 0022h 负方向驱动禁止输入(NOT) ReadOnly 0: 输入 OFF、 1: 输入 ON
/// </summary>
public
static
string
Limit_Negative_Single
=
"0022"
;
/// <summary>
/// 0023h 正方向驱动禁止输入(POT) ReadOnly 0: 输入 OFF、 1: 输入 ON
/// </summary>
public
static
string
Limit_Positive_Single
=
"0023"
;
/// <summary>
///速度 4601
/// </summary>
public
static
string
Speed_Addr
=
"4601"
;
/// <summary>
/// 0060h 伺服 On 输入 (SRV-ON) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary>
public
static
string
ServerOn_Addr
=
"0060"
;
/// <summary>
/// 0120h 选通输入 (STB) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary>
public
static
string
STB_Addr
=
"0120"
;
/// <summary>
/// 0124h 减速停止输入 (S-STOP) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary>
public
static
string
Stop_Addr
=
"0124"
;
/// <summary>
/// 0123h 紧急停止输入 (H-STOP) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary>
public
static
string
SDStop_Addr
=
"0123"
;
/// <summary>
/// 0061h 报警清除输入 (A-CLR) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary>
public
static
string
Clear_Alarm_Addr
=
"0061"
;
/// <summary>
/// 1020h Save all parameters - 0 - 4294967295 2 R/W 参数写入 EEPROM 写入“6173h”后,实行 EEPROM 写入
/// </summary>
public
static
string
EEPROM_Param_Addr
=
"1020"
;
/// <summary>
/// 目标位置=600B
/// </summary>
public
static
string
TargetPostion
=
"600B"
;
/// <summary>
/// 实际位置=600F
/// </summary>
public
static
string
ActualPosition
=
"600F"
;
/// <summary>
/// BUSY状态=0140,0140h 动作执行状态 (BUSY) ReadOnly 0:未执行 1:执行中
public
static
string
BUSYStatus
=
"0140"
;
/// <summary>
/// HOME-CMP=0141,0141h 回原点完成状态 (HOME-CMP) ReadOnly 0:未完成 1:完成
/// </summary>
public
static
string
HOME_CMP_Status
=
"0141"
;
/// <summary>
/// 私服Ready状态,00A0h 伺服 Ready 状态 (S-RDY) ReadOnly 0:Ready OFF 1:Ready ON
/// </summary>
public
static
string
ServerOn_Status
=
"00A0"
;
/// <summary>
/// 报警状态=00A1,00A1h 报警状态 (ALM) ReadOnly 0:报警未发生 1:报警发生
/// </summary>
public
static
string
Alarm_Status
=
"00A1"
;
/// <summary>
/// 指定BlockNo=4414
/// </summary>
public
static
string
BlockNo
=
"4414"
;
/// <summary>
/// 读线圈01
/// </summary>
public
static
byte
CMD_ReadCoil
=
0x01
;
/// <summary>
/// 写线圈 05
/// </summary>
public
static
byte
CMD_WriteCoil
=
0x05
;
/// <summary>
/// 读寄存器03
/// </summary>
public
static
byte
CMD_ReadRegisters
=
0x03
;
/// <summary>
/// 写寄存器06
/// </summary>
public
static
byte
CMD_WriteRegisters
=
0x06
;
/// <summary>
/// 写多个线圈 0f
/// </summary>
public
static
byte
CMD_WriteMCoil
=
0x0F
;
/// <summary>
/// 写多个寄存器10
/// </summary>
public
static
byte
CMD_WriteMRegisters
=
0x10
;
/// <summary>
/// block0=原点返回,正方向
/// </summary>
public
static
string
Block_HomeMove0
=
"0"
;
/// <summary>
/// block1=原点返回,反方向
/// </summary>
public
static
string
Block_HomeMove1
=
"1"
;
/// <summary>
/// block2=绝对位置运动
/// </summary>
public
static
string
Block_AbsMove
=
"2"
;
/// <summary>
/// block3=相对位置运动
/// </summary>
public
static
string
Block_RelMove
=
"3"
;
/// <summary>
/// block4=正方向匀速运动
/// </summary>
public
static
string
Block_VolMove0
=
"4"
;
/// <summary>
/// block5=反方向匀速运动
/// </summary>
public
static
string
Block_VolMove1
=
"5"
;
/// <summary>
/// block6=减速停止
/// </summary>
public
static
string
Block_DelSpeedStop
=
"6"
;
/// <summary>
/// block7=紧急停止
/// </summary>
public
static
string
Block_SuddenStop
=
"7"
;
public
static
byte
[]
buildCheckData
(
byte
[]
sendData
,
int
length
)
{
ushort
pChecksum
=
0
;
AcSerialBean
.
CalculateCRC
(
sendData
,
length
,
out
pChecksum
);
string
checkStr
=
Convert
.
ToString
(
pChecksum
,
16
);
byte
[]
checkByte
=
AcSerialBean
.
StringToByte
(
checkStr
);
if
(
checkByte
.
Length
==
1
)
{
sendData
[
length
]
=
checkByte
[
0
];
sendData
[
length
+
1
]
=
0x00
;
}
else
{
sendData
[
length
+
1
]
=
checkByte
[
0
];
sendData
[
length
]
=
checkByte
[
1
];
}
return
sendData
;
}
public
static
byte
[]
GetWriteData
(
int
slvAddr
,
byte
cmd
,
string
addr
,
string
dataValue
,
int
length
)
{
// ( 2) 读取寄存器( 03h)
if
(
cmd
.
Equals
(
CMD_ReadRegisters
))
{
return
Get03WriteData
(
slvAddr
,
addr
,
length
);
}
else
if
(
cmd
.
Equals
(
CMD_WriteRegisters
))
{
// ( 4) 写入寄存器( 06h)
return
Get06WriteData
(
slvAddr
,
addr
,
dataValue
);
}
else
if
(
cmd
.
Equals
(
CMD_WriteCoil
))
{
return
Get05WriteData
(
slvAddr
,
addr
,
dataValue
);
}
else
if
(
cmd
.
Equals
(
CMD_ReadCoil
))
{
return
Get01WriteData
(
slvAddr
,
addr
,
length
);
}
return
null
;
}
private
static
byte
[]
Get05WriteData
(
int
slvAddr
,
string
addr
,
string
dataValue
)
{
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
(
byte
)
slvAddr
;
sendData
[
1
]
=
CMD_WriteCoil
;
byte
[]
addrByte
=
AcSerialBean
.
StringToByte
(
addr
.
ToString
());
if
(
addrByte
.
Length
==
1
)
{
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
addrByte
[
0
];
}
else
if
(
addrByte
.
Length
==
2
)
{
sendData
[
3
]
=
addrByte
[
1
];
sendData
[
2
]
=
addrByte
[
0
];
}
byte
[]
dataByte
=
AcSerialBean
.
StringToByte
(
dataValue
);
if
(
dataByte
.
Length
==
1
)
{
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
dataByte
[
0
];
}
else
if
(
dataByte
.
Length
==
2
)
{
sendData
[
5
]
=
dataByte
[
1
];
sendData
[
4
]
=
dataByte
[
0
];
}
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
return
sendData
;
}
private
static
byte
[]
Get01WriteData
(
int
slvAddr
,
string
addr
,
int
length
)
{
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
(
byte
)
slvAddr
;
sendData
[
1
]
=
CMD_ReadCoil
;
byte
[]
addrByte
=
AcSerialBean
.
StringToByte
(
addr
.
ToString
());
if
(
addrByte
.
Length
==
1
)
{
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
addrByte
[
0
];
}
else
if
(
addrByte
.
Length
==
2
)
{
sendData
[
3
]
=
addrByte
[
1
];
sendData
[
2
]
=
addrByte
[
0
];
}
byte
[]
dataByte
=
AcSerialBean
.
StringToByte
(
length
.
ToString
());
if
(
dataByte
.
Length
==
1
)
{
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
dataByte
[
0
];
}
else
if
(
dataByte
.
Length
==
2
)
{
sendData
[
4
]
=
dataByte
[
1
];
sendData
[
5
]
=
dataByte
[
0
];
}
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
return
sendData
;
}
private
static
byte
[]
Get03WriteData
(
int
slvAddr
,
string
addr
,
int
length
)
{
// ( 2) 读取寄存器( 03h)
//发送
//从站地址
//03h
//寄存器起始地址 高位
//低位
//寄存器数(N) 高位
//低位
//CRC 低位
//高位
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
(
byte
)
slvAddr
;
sendData
[
1
]
=
CMD_ReadRegisters
;
byte
[]
addrByte
=
AcSerialBean
.
StringToByte
(
addr
.
ToString
());
if
(
addrByte
.
Length
==
1
)
{
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
addrByte
[
0
];
}
else
if
(
addrByte
.
Length
==
2
)
{
sendData
[
3
]
=
addrByte
[
1
];
sendData
[
2
]
=
addrByte
[
0
];
}
byte
[]
dataByte
=
AcSerialBean
.
StringToByte
(
length
.
ToString
());
if
(
dataByte
.
Length
==
1
)
{
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
dataByte
[
0
];
}
else
if
(
dataByte
.
Length
==
2
)
{
sendData
[
4
]
=
dataByte
[
1
];
sendData
[
5
]
=
dataByte
[
0
];
}
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
return
sendData
;
}
private
static
byte
[]
Get06WriteData
(
int
slvAddr
,
string
addr
,
string
dataValue
)
{
// ( 4) 写入寄存器( 06h)
//从站地址
//06h
//地址 高位
//低位
//変更数据 高位
//低位
//CRC 低位
//高位
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
(
byte
)
slvAddr
;
sendData
[
1
]
=
CMD_WriteRegisters
;
byte
[]
addrByte
=
AcSerialBean
.
StringToByte
(
addr
.
ToString
());
if
(
addrByte
.
Length
==
1
)
{
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
addrByte
[
0
];
}
else
if
(
addrByte
.
Length
==
2
)
{
sendData
[
3
]
=
addrByte
[
1
];
sendData
[
2
]
=
addrByte
[
0
];
}
byte
[]
dataByte
=
AcSerialBean
.
StringToByte
(
dataValue
);
if
(
dataByte
.
Length
==
1
)
{
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
dataByte
[
0
];
}
else
if
(
dataByte
.
Length
==
2
)
{
sendData
[
4
]
=
dataByte
[
0
];
sendData
[
5
]
=
dataByte
[
1
];
//sendData[4] = dataByte[1];
//sendData[5] = dataByte[0];
}
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
return
sendData
;
}
}
}
source/DeviceLibrary/AXIS/PanasonicServo/ACServerManager.cs
0 → 100644
查看文件 @
1c43d39
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.IO.Ports
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
namespace
OnlineStore.DeviceLibrary
{
/// <summary>
/// 外部调用的接口放在此文件中
/// </summary>
public
partial
class
ACServerManager
:
AxisManager
{
private
int
SleepMSendons
=
20
;
private
int
ReviceOutTimeMS
=
100
;
private
Dictionary
<
string
,
Dictionary
<
string
,
int
>>
ComAddrValue
=
new
Dictionary
<
string
,
Dictionary
<
string
,
int
>>();
private
string
mapObj
=
""
;
private
int
GetAddrValue
(
string
portName
,
short
slvAddr
,
string
addr
)
{
int
value
=
-
1
;
try
{
string
name
=
portName
+
"_"
+
slvAddr
;
Dictionary
<
string
,
int
>
map
=
null
;
ComAddrValue
.
TryGetValue
(
name
,
out
map
);
if
(
map
==
null
)
{
return
-
1
;
}
if
(
map
.
ContainsKey
(
addr
))
{
return
map
[
addr
];
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"UpdateAddrValue出错:"
+
ex
.
ToString
());
}
return
value
;
}
private
void
UpdateAddrValue
(
string
portName
,
short
slvAddr
,
string
addr
,
int
value
)
{
try
{
lock
(
mapObj
)
{
string
name
=
portName
+
"_"
+
slvAddr
;
Dictionary
<
string
,
int
>
map
=
null
;
ComAddrValue
.
TryGetValue
(
name
,
out
map
);
if
(
map
==
null
)
{
map
=
new
Dictionary
<
string
,
int
>();
ComAddrValue
.
Add
(
name
,
map
);
}
if
(
map
.
ContainsKey
(
addr
))
{
ComAddrValue
[
name
][
addr
]
=
value
;
}
else
{
ComAddrValue
[
name
].
Add
(
addr
,
value
);
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"UpdateAddrValue出错:"
+
ex
.
ToString
());
}
}
public
override
void
ClearSpeed
()
{
LogUtil
.
info
(
"清理之前设置保存的速度列表"
);
ComAddrValue
=
new
Dictionary
<
string
,
Dictionary
<
string
,
int
>>();
}
public
override
bool
OpenPort
(
string
portName
)
{
if
(
serialBeanMap
.
ContainsKey
(
portName
))
{
return
true
;
}
int
ACBaudRate
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
ACBaudRate
);
if
(
ACBaudRate
<=
0
)
{
ACBaudRate
=
115200
;
}
AcSerialBean
bean
=
new
AcSerialBean
(
portName
,
ACBaudRate
,
Parity
.
Even
,
8
,
StopBits
.
One
);
bool
result
=
bean
.
openPort
();
if
(!
result
)
{
LogUtil
.
info
(
"打开串口【"
+
portName
+
"】【"
+
ACBaudRate
+
"】失败"
);
return
false
;
}
LogUtil
.
info
(
"打开串口【"
+
portName
+
"】【"
+
ACBaudRate
+
"】成功"
);
//bean.DataReceived += DataReceived;
if
(
serialBeanMap
.
ContainsKey
(
portName
))
{
serialBeanMap
.
Remove
(
portName
);
}
serialBeanMap
.
Add
(
portName
,
bean
);
return
true
;
}
public
override
void
ColsePort
(
string
portName
)
{
AcSerialBean
bean
=
GetSerialBean
(
portName
);
if
(
bean
==
null
)
{
LogUtil
.
info
(
"串口【"
+
portName
+
"】未打开,不需要关闭"
);
return
;
}
//清理缓存
bean
.
clearInBuffer
();
bean
.
clearOutBuffer
();
bean
.
closePort
();
if
(
serialBeanMap
.
ContainsKey
(
portName
))
{
serialBeanMap
.
Remove
(
portName
);
}
LogUtil
.
info
(
"ACServerManager 关闭串口【"
+
portName
+
"】 "
);
}
public
override
void
CloseAllPort
()
{
List
<
string
>
kes
=
new
List
<
string
>(
serialBeanMap
.
Keys
);
foreach
(
string
key
in
kes
)
{
ColsePort
(
key
);
}
}
/// <summary>
/// 是否成功打开伺服
/// </summary>
public
override
bool
IsServeoOn
(
string
portName
,
short
slvAddr
)
{
if
(!
serialBeanMap
.
ContainsKey
(
portName
))
{
return
false
;
}
PreReadCoilAddr
=
ACCMDManager
.
ServerOn_Addr
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
PreReadCoilAddr
,
"0000"
,
1
);
//SendData(portName,dataArray);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
int
result
=
GetCoilData
(
portName
,
reviceData
,
PreReadCoilAddr
);
//TODO
return
result
>=
1
;
}
/// <summary>
/// 是否原点返回完成
/// </summary>
public
override
bool
IsHomeMoveEnd
(
string
portName
,
short
slvAddr
)
{
int
status
=
GetHomeEndStatus
(
portName
,
slvAddr
);
if
(
status
>=
1
)
{
return
true
;
}
return
false
;
}
//把数字转换为四位的字符串
public
string
SpeedToStr
(
int
speed
,
int
length
)
{
string
str
=
String
.
Format
(
"{0:X}"
,
speed
);
return
str
.
PadLeft
(
length
,
'0'
);
}
public
override
void
InitSlvAddr
(
string
portName
,
short
slvAddr
,
int
targetSpeed
,
int
addSpeed
,
int
delSpeed
)
//public void InitSlvAddr(string portName, short slvAddr,int targetSpeed,int addSpeed,int delSpeed,int homeHighSpeed,int homeLowSpeed,int homeAddSpeed)
{
LogUtil
.
info
(
"开始初始化伺服【"
+
portName
+
"】【"
+
slvAddr
+
"】"
);
//写入block
int
sleep
=
20
;
string
slvAddrStr
=
string
.
Format
(
strFromat
,
slvAddr
);
//block0=原点返回,正方向
string
str0
=
slvAddrStr
+
"104800 000408 00000420 00000000 ffff"
;
SendStrAndSleep
(
portName
,
str0
,
sleep
);
//block1=原点返回,反方向
string
str1
=
slvAddrStr
+
"104804 000408 04000420 00000000 ffff"
;
SendStrAndSleep
(
portName
,
str1
,
sleep
);
//block2=绝对位置运动
string
str2
=
slvAddrStr
+
"104808 000408 10000211EC78FFFF ffff"
;
SendStrAndSleep
(
portName
,
str2
,
sleep
);
//block3=相对位置运动
string
str3
=
slvAddrStr
+
"10480C 000408 10000111EC78FFFF ffff"
;
SendStrAndSleep
(
portName
,
str3
,
sleep
);
//block4=正方向匀速运动
string
str4
=
slvAddrStr
+
"104810 000408 10000311 00000000 ffff"
;
SendStrAndSleep
(
portName
,
str4
,
sleep
);
//block5=反方向匀速运动
string
str5
=
slvAddrStr
+
"104814 000408 14000311 00000000 ffff"
;
SendStrAndSleep
(
portName
,
str5
,
sleep
);
//block6=减速停止
string
str6
=
slvAddrStr
+
"104818 000408 00000500 00000000 ffff"
;
SendStrAndSleep
(
portName
,
str6
,
sleep
);
//block7=紧急停止
string
str7
=
slvAddrStr
+
"10481c 000408 00000510 00000000 ffff"
;
SendStrAndSleep
(
portName
,
str7
,
sleep
);
//0106460001009D12
//速度 V1 =100
string
v1
=
slvAddrStr
+
"064601 "
+
SpeedToStr
(
targetSpeed
,
4
)
+
" ffff"
;
SendStrAndSleep
(
portName
,
v1
,
sleep
);
//加速度 A1 =30
string
a1
=
slvAddrStr
+
"064611 "
+
SpeedToStr
(
addSpeed
,
4
)
+
" ffff"
;
SendStrAndSleep
(
portName
,
a1
,
sleep
);
//减速度 D1=30
string
d1
=
slvAddrStr
+
"064621 "
+
SpeedToStr
(
delSpeed
,
4
)
+
" ffff"
;
SendStrAndSleep
(
portName
,
d1
,
sleep
);
////原点返回高速 homeHighSpeed=100
//SendStrAndSleep(portName, slvAddrStr + "06 4637 " + SpeedToStr(homeHighSpeed, 4) + " ffff", sleep);
////原点返回抵速 homeLowSpeed=50
//SendStrAndSleep(portName, slvAddrStr + "06 4638 " + SpeedToStr(homeLowSpeed, 4) + " ffff", sleep);
////原点返回加速度=30
//SendStrAndSleep(portName, slvAddrStr + "06 4639 " + SpeedToStr(homeAddSpeed, 4) + " ffff", sleep);
//UpdateEEPROM(portName, slvAddr);
}
public
void
UpdateEEPROM
(
string
portName
,
short
slvAddr
)
{
string
addr
=
ACCMDManager
.
EEPROM_Param_Addr
;
string
data
=
"6173"
;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteRegisters
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
,
5
);
}
public
override
void
ServoOn
(
string
portName
,
short
slvAddr
)
{
string
addr
=
ACCMDManager
.
ServerOn_Addr
;
string
data
=
"FF00"
;
//byte cmd = 0x05;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
public
override
void
ServoOff
(
string
portName
,
short
slvAddr
)
{
string
addr
=
ACCMDManager
.
ServerOn_Addr
;
string
data
=
"0000"
;
//byte cmd = 0x05;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
public
override
void
RelMove
(
string
portName
,
short
slvAddr
,
int
position
,
int
targetSpeed
=
0
,
int
ptpAcc
=
0
,
int
ptpDec
=
0
)
{
if
(
targetSpeed
!=
0
)
{
//先更新速度
string
slvAddrStr
=
string
.
Format
(
strFromat
,
slvAddr
);
string
v1
=
slvAddrStr
+
"064601 "
+
SpeedToStr
(
targetSpeed
,
4
)
+
" ffff"
;
SendStrAndSleep
(
portName
,
v1
,
SleepMSendons
);
}
RelMove
(
portName
,
slvAddr
,
position
);
}
private
void
RelMove
(
string
portName
,
short
slvAddr
,
int
position
)
{
//int position = Convert.ToInt32(txtPosition.Text);
byte
[]
positionData
=
AcSerialBean
.
StringToByte
(
position
.
ToString
(
"X8"
));
byte
[]
data
=
AcSerialBean
.
StringToByte
(
"0110480C 000408 10000111EC78FFFF ffff"
);
data
[
0
]
=
(
byte
)
slvAddr
;
data
[
data
.
Length
-
1
]
=
0x00
;
data
[
data
.
Length
-
2
]
=
0x00
;
if
(
positionData
.
Length
==
4
)
{
data
[
11
]
=
positionData
[
2
];
data
[
12
]
=
positionData
[
3
];
data
[
13
]
=
positionData
[
0
];
data
[
14
]
=
positionData
[
1
];
}
else
if
(
positionData
.
Length
==
3
)
{
data
[
11
]
=
positionData
[
1
];
data
[
12
]
=
positionData
[
2
];
data
[
13
]
=
0x00
;
data
[
14
]
=
positionData
[
0
];
}
else
if
(
positionData
.
Length
==
2
)
{
data
[
11
]
=
positionData
[
0
];
data
[
12
]
=
positionData
[
1
];
data
[
13
]
=
0x00
;
data
[
14
]
=
0x00
;
}
else
if
(
positionData
.
Length
==
1
)
{
data
[
11
]
=
0x00
;
data
[
12
]
=
positionData
[
0
];
data
[
13
]
=
0x00
;
data
[
14
]
=
0x00
;
}
data
=
ACCMDManager
.
buildCheckData
(
data
,
data
.
Length
-
2
);
SendData
(
portName
,
data
);
System
.
Threading
.
Thread
.
Sleep
(
SleepMSendons
);
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_RelMove
);
OpenAndCloseSTB
(
portName
,
slvAddr
);
}
public
override
void
HomeMove
(
string
portName
,
short
slvAddr
,
int
highVel
,
int
lowVel
,
int
acc
)
{
try
{
int
speed
=
highVel
;
//先判断是否在原点,如果已经在原点,先向正方向走2000
int
homeSingle
=
GetHomeSingle
(
portName
,
slvAddr
);
if
(
homeSingle
.
Equals
(
1
))
{
int
isHomeEnd
=
GetHomeEndStatus
(
portName
,
slvAddr
);
if
(
isHomeEnd
.
Equals
(
1
))
{
int
value
=
2000
;
LogUtil
.
info
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】原点返回时发现原点已亮且回过原点,需要先相对走"
+
value
);
RelMove
(
portName
,
slvAddr
,
value
);
bool
isStop
=
false
;
for
(
int
i
=
0
;
i
<=
10
;
i
++)
{
Thread
.
Sleep
(
200
);
if
(
GetBusyStatus
(
portName
,
slvAddr
).
Equals
(
0
))
{
isStop
=
true
;
LogUtil
.
info
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】 相对走"
+
value
+
"已结束"
);
break
;
}
}
if
(!
isStop
)
{
LogUtil
.
info
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】 相对走"
+
value
+
"已等待2分钟,直接停止"
);
SuddenStop
(
portName
,
slvAddr
);
}
}
else
{
int
volSpeed
=
Math
.
Abs
(
speed
/
5
);
int
time
=
1500
;
LogUtil
.
info
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】原点返回时发现原点已亮但未回过原点,先匀速向上走"
+
time
+
",速度["
+
volSpeed
+
"]"
);
//需要匀速向上走
SpeedMove
(
portName
,
slvAddr
,
volSpeed
);
Thread
.
Sleep
(
time
);
LogUtil
.
info
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】匀速 已等待"
+
time
+
",直接停止"
);
SuddenStop
(
portName
,
slvAddr
);
Thread
.
Sleep
(
100
);
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】原点返回前验证是否在原点出错:"
+
ex
.
StackTrace
);
}
//默认负方向原点返回
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_HomeMove1
);
Thread
.
Sleep
(
SleepMSendons
);
OpenAndCloseSTB
(
portName
,
slvAddr
);
}
private
void
SetSpeed
(
string
portName
,
short
slvAddr
,
int
speed
)
{
int
preSpeed
=
GetAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
);
if
((
preSpeed
.
Equals
(-
1
))
||
(!
preSpeed
.
Equals
(
Math
.
Abs
(
speed
))))
{
string
v1
=
slvAddr
+
"064601 "
+
SpeedToStr
(
speed
,
4
)
+
" ffff"
;
LogUtil
.
debug
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】更新速度为【"
+
speed
+
"】,发送数据【"
+
v1
+
"】"
);
Thread
.
Sleep
(
SleepMSendons
);
for
(
int
i
=
1
;
i
<=
3
;
i
++)
{
bool
result
=
SendStrAndSleep
(
portName
,
v1
,
SleepMSendons
);
if
(
result
)
{
break
;
}
else
{
LogUtil
.
error
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】更新速度为【"
+
speed
+
"】,发送数据【"
+
v1
+
"】,第【"
+
i
+
"】次失败"
);
Thread
.
Sleep
(
SleepMSendons
);
}
}
UpdateAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
,
Math
.
Abs
(
speed
));
Thread
.
Sleep
(
SleepMSendons
);
}
}
public
override
void
SpeedMove
(
string
portName
,
short
slvAddr
,
int
speed
)
{
SetSpeed
(
portName
,
slvAddr
,
speed
);
if
(
speed
>
0
)
{
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_VolMove0
);
}
else
{
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_VolMove1
);
}
//Thread.Sleep(SleepMSendons);
OpenAndCloseSTB
(
portName
,
slvAddr
);
}
public
override
bool
isInPosition
(
string
portName
,
short
slvAddr
,
int
PPosition
,
int
canErrorCount
,
bool
isLog
=
false
)
{
string
Name
=
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】"
;
int
outCount
=
GetActualtPosition
(
portName
,
slvAddr
);
int
errorCount
=
Math
.
Abs
(
outCount
-
PPosition
);
if
(
errorCount
<=
canErrorCount
)
{
if
(
isLog
)
{
LogUtil
.
info
(
"【"
+
Name
+
"】isInPosition【"
+
PPosition
+
"】,当前实时位置:【"
+
outCount
+
"】 return true"
);
}
return
true
;
}
else
{
if
(
isLog
)
{
LogUtil
.
info
(
"【"
+
Name
+
"】isInPosition【"
+
PPosition
+
"】,当前实时位置:【"
+
outCount
+
"】 return false"
);
}
return
false
;
}
}
public
override
void
AbsMove
(
string
portName
,
short
slvAddr
,
int
targetPosition
,
int
targetSpeed
=
0
,
int
ptpAcc
=
0
,
int
ptpDec
=
0
)
{
//先更新速度
string
slvAddrStr
=
string
.
Format
(
strFromat
,
slvAddr
);
if
(
targetSpeed
!=
0
)
{
int
preSpeed
=
GetAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
);
if
((
preSpeed
.
Equals
(-
1
))
||
(!
preSpeed
.
Equals
(
targetSpeed
)))
{
//速度 V1 =100
string
v1
=
slvAddrStr
+
"064601 "
+
SpeedToStr
(
targetSpeed
,
4
)
+
" ffff"
;
SendStrAndSleep
(
portName
,
v1
,
SleepMSendons
);
UpdateAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
,
targetSpeed
);
}
}
//绝对运动
AbsMove
(
portName
,
slvAddr
,
targetPosition
);
}
private
void
AbsMove
(
string
portName
,
short
slvAddr
,
int
position
)
{
//int position = Convert.ToInt32(txtPosition.Text, 10);
byte
[]
positionData
=
AcSerialBean
.
StringToByte
(
position
.
ToString
(
"X8"
));
byte
[]
data
=
AcSerialBean
.
StringToByte
(
"01104808 000408 10000211 EC78FFFF ffff"
);
data
[
0
]
=
(
byte
)
slvAddr
;
data
[
data
.
Length
-
1
]
=
0x00
;
data
[
data
.
Length
-
2
]
=
0x00
;
if
(
positionData
.
Length
==
4
)
{
data
[
11
]
=
positionData
[
2
];
data
[
12
]
=
positionData
[
3
];
data
[
13
]
=
positionData
[
0
];
data
[
14
]
=
positionData
[
1
];
}
else
if
(
positionData
.
Length
==
3
)
{
data
[
11
]
=
positionData
[
1
];
data
[
12
]
=
positionData
[
2
];
data
[
13
]
=
0x00
;
data
[
14
]
=
positionData
[
0
];
}
else
if
(
positionData
.
Length
==
2
)
{
data
[
11
]
=
positionData
[
0
];
data
[
12
]
=
positionData
[
1
];
data
[
13
]
=
0x00
;
data
[
14
]
=
0x00
;
}
else
if
(
positionData
.
Length
==
1
)
{
data
[
11
]
=
0x00
;
data
[
12
]
=
positionData
[
0
];
data
[
13
]
=
0x00
;
data
[
14
]
=
0x00
;
}
data
=
ACCMDManager
.
buildCheckData
(
data
,
data
.
Length
-
2
);
SendData
(
portName
,
data
);
Thread
.
Sleep
(
SleepMSendons
);
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_AbsMove
);
//data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, ACCMDManager.Block_AbsMove, 2);
//SendData(portName, data);
//Thread.Sleep(SleepMSendons);
OpenAndCloseSTB
(
portName
,
slvAddr
);
}
public
override
bool
AbsMoveIsEnd
(
string
portName
,
short
axisNo
,
int
targetPosition
,
int
canErrorCount
,
out
bool
countError
)
{
countError
=
false
;
bool
isOk
=
AxisManager
.
instance
.
GetBusyStatus
(
portName
,
axisNo
).
Equals
(
0
);
int
CurrPosition
=
AxisManager
.
instance
.
GetActualtPosition
(
portName
,
axisNo
);
int
errorCount
=
Math
.
Abs
(
CurrPosition
-
targetPosition
);
if
(
isOk
)
{
if
(
errorCount
<=
canErrorCount
)
{
return
true
;
}
else
{
countError
=
true
;
}
}
return
false
;
}
public
override
short
GetErrorCode
(
string
portName
,
short
slvAddr
)
{
return
0
;
}
}
}
source/DeviceLibrary/AXIS/PanasonicServo/ACServerManager_Partial.cs
0 → 100644
查看文件 @
1c43d39
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.IO.Ports
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
namespace
OnlineStore.DeviceLibrary
{
partial
class
ACServerManager
{
private
Dictionary
<
int
,
Dictionary
<
string
,
RegisterInfo
>>
LastDataMap
=
new
Dictionary
<
int
,
Dictionary
<
string
,
RegisterInfo
>>();
private
string
strFromat
=
"{0:X2}"
;
private
Dictionary
<
string
,
AcSerialBean
>
serialBeanMap
=
new
Dictionary
<
string
,
AcSerialBean
>();
private
AcSerialBean
GetSerialBean
(
string
portName
)
{
if
(
serialBeanMap
.
ContainsKey
(
portName
))
{
return
serialBeanMap
[
portName
];
}
return
null
;
}
private
bool
SendStrAndSleep
(
string
portName
,
string
str
,
int
sleepS
)
{
byte
[]
data
=
AcSerialBean
.
StringToByte
(
str
);
data
[
data
.
Length
-
1
]
=
0x00
;
data
[
data
.
Length
-
2
]
=
0x00
;
data
=
ACCMDManager
.
buildCheckData
(
data
,
data
.
Length
-
2
);
bool
result
=
SendData
(
portName
,
data
);
System
.
Threading
.
Thread
.
Sleep
(
sleepS
);
return
result
;
}
private
void
SaveData
(
string
portName
,
byte
slvAddr
,
string
regAddr
,
int
value
)
{
if
(
LastDataMap
.
ContainsKey
(
slvAddr
))
{
if
(
LastDataMap
[
slvAddr
].
ContainsKey
(
regAddr
))
{
LastDataMap
[
slvAddr
][
regAddr
]
=
new
RegisterInfo
(
slvAddr
,
regAddr
,
value
);
}
else
{
LastDataMap
[
slvAddr
].
Add
(
regAddr
,
new
RegisterInfo
(
slvAddr
,
regAddr
,
value
));
}
}
else
{
Dictionary
<
string
,
RegisterInfo
>
map
=
new
Dictionary
<
string
,
RegisterInfo
>();
map
.
Add
(
regAddr
,
new
RegisterInfo
(
slvAddr
,
regAddr
,
value
));
LastDataMap
.
Add
(
slvAddr
,
map
);
}
}
private
RegisterInfo
GetData
(
string
portName
,
byte
slvAddr
,
string
regAddr
)
{
if
(
LastDataMap
.
ContainsKey
(
slvAddr
))
{
if
(
LastDataMap
[
slvAddr
].
ContainsKey
(
regAddr
))
{
return
LastDataMap
[
slvAddr
][
regAddr
];
}
}
return
null
;
}
private
void
SendData
(
string
portName
,
byte
[]
data
,
int
reviceLength
)
{
if
(
data
==
null
)
{
return
;
}
byte
[]
returnData
=
SendCommand
(
portName
,
data
,
ReviceOutTimeMS
,
reviceLength
);
string
strSend
=
""
;
for
(
int
i
=
0
;
i
<
returnData
.
Length
;
i
++)
{
strSend
+=
string
.
Format
(
"{0:X2} "
,
returnData
[
i
]);
}
if
(
IsShowMsg
)
{
LogUtil
.
info
(
"串口"
+
portName
+
" 收到数据:"
+
strSend
+
""
);
}
}
private
bool
SendData
(
string
portName
,
byte
[]
data
)
{
if
(
data
==
null
)
{
return
false
;
}
bool
result
=
false
;
byte
[]
returnData
=
SendCommand
(
portName
,
data
,
ReviceOutTimeMS
,
8
,
out
result
);
if
(
returnData
!=
null
)
{
string
strSend
=
""
;
for
(
int
i
=
0
;
i
<
returnData
.
Length
;
i
++)
{
strSend
+=
string
.
Format
(
"{0:X2} "
,
returnData
[
i
]);
}
if
(
IsShowMsg
)
{
LogUtil
.
info
(
"串口"
+
portName
+
" 收到数据:"
+
strSend
+
""
);
}
}
return
result
;
}
/// <summary>
/// 发送数据并获取返回值
/// </summary>
/// <param name="data">发送的数据</param>
/// <param name="outTime">超时时间</param>
/// <returns>返回值的长度</returns>
private
byte
[]
SendCommand
(
string
portName
,
byte
[]
data
,
int
outTime
,
int
reviceLength
)
{
if
(
outTime
<
100
)
{
outTime
=
100
;
}
byte
[]
returnData
=
null
;
try
{
if
(
data
==
null
)
{
return
returnData
;
}
string
strSend
=
""
;
for
(
int
i
=
0
;
i
<
data
.
Length
;
i
++)
{
strSend
+=
string
.
Format
(
"{0:X2} "
,
data
[
i
]);
}
if
(
strSend
.
Equals
(
""
))
{
return
returnData
;
}
if
(
IsShowMsg
)
{
LogUtil
.
info
(
"串口"
+
portName
+
" 写入数据:"
+
strSend
+
""
);
}
AcSerialBean
bean
=
GetSerialBean
(
portName
);
if
(
bean
==
null
)
{
LogUtil
.
debug
(
"ACServerManager SendCommand 试图向未打开串口【"
+
portName
+
"】写入数据:"
+
strSend
+
"。"
);
}
else
{
int
ret
=
bean
.
SendCommand
(
data
,
ref
returnData
,
outTime
,
reviceLength
);
if
(!
ret
.
Equals
(
reviceLength
))
{
LogUtil
.
error
(
"串口"
+
portName
+
" 写入数据:"
+
strSend
+
",预计返回字节数【"
+
reviceLength
+
"】实际返回【"
+
ret
+
"】"
);
}
System
.
Threading
.
Thread
.
Sleep
(
2
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
info
(
ex
.
ToString
());
}
return
returnData
;
}
/// <summary>
/// 发送数据并获取返回值
/// </summary>
/// <param name="data">发送的数据</param>
/// <param name="outTime">超时时间</param>
/// <param name="result">返回结果,是否发送成功</param>
/// <returns>返回值的长度</returns>
private
byte
[]
SendCommand
(
string
portName
,
byte
[]
data
,
int
outTime
,
int
reviceLength
,
out
bool
result
)
{
if
(
outTime
<
100
)
{
outTime
=
100
;
}
byte
[]
returnData
=
null
;
result
=
false
;
try
{
if
(
data
==
null
)
{
return
returnData
;
}
string
strSend
=
""
;
for
(
int
i
=
0
;
i
<
data
.
Length
;
i
++)
{
strSend
+=
string
.
Format
(
"{0:X2} "
,
data
[
i
]);
}
if
(
strSend
.
Equals
(
""
))
{
return
returnData
;
}
if
(
IsShowMsg
)
{
LogUtil
.
info
(
"串口"
+
portName
+
" 写入数据:"
+
strSend
+
""
);
}
AcSerialBean
bean
=
GetSerialBean
(
portName
);
if
(
bean
==
null
)
{
LogUtil
.
debug
(
"ACServerManager SendCommand 试图向未打开串口【"
+
portName
+
"】写入数据:"
+
strSend
+
"。"
);
}
else
{
int
ret
=
bean
.
SendCommand
(
data
,
ref
returnData
,
outTime
,
reviceLength
);
if
(!
ret
.
Equals
(
reviceLength
))
{
LogUtil
.
error
(
"串口"
+
portName
+
" 写入数据:"
+
strSend
+
",预计返回字节数【"
+
reviceLength
+
"】实际返回【"
+
ret
+
"】"
);
}
else
{
result
=
true
;
}
System
.
Threading
.
Thread
.
Sleep
(
2
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
info
(
ex
.
ToString
());
}
return
returnData
;
}
private
void
WriteData
(
string
portName
,
short
slvAddr
,
string
addr
,
string
data
,
byte
cmd
,
int
length
)
{
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
cmd
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
private
void
SendStr
(
string
portName
,
short
slvAddr
,
string
str
)
{
//string str = txtSendStr.Text;
byte
[]
data
=
AcSerialBean
.
StringToByte
(
str
);
data
[
data
.
Length
-
1
]
=
0x00
;
data
[
data
.
Length
-
2
]
=
0x00
;
data
=
ACCMDManager
.
buildCheckData
(
data
,
data
.
Length
-
2
);
SendData
(
portName
,
data
);
}
public
override
void
SuddenStop
(
string
portName
,
short
slvAddr
)
{
// RunBlock(7);
string
addr
=
ACCMDManager
.
SDStop_Addr
;
string
data
=
"FF00"
;
//byte cmd = 0x05;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
System
.
Threading
.
Thread
.
Sleep
(
500
);
data
=
"0000"
;
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
private
void
OpenAndCloseSTB
(
string
portName
,
short
slvAddr
)
{
OnlyOpenSTB
(
portName
,
slvAddr
);
System
.
Threading
.
Thread
.
Sleep
(
200
);
CloseSTB
(
portName
,
slvAddr
);
System
.
Threading
.
Thread
.
Sleep
(
SleepMSendons
);
}
private
void
OnlyOpenSTB
(
string
portName
,
short
slvAddr
)
{
string
addr
=
ACCMDManager
.
STB_Addr
;
string
data
=
"FF00"
;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
private
void
CloseSTB
(
string
portName
,
short
slvAddr
)
{
string
addr
=
ACCMDManager
.
STB_Addr
;
string
data
=
"0000"
;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
private
void
UpdateBlock
(
string
portName
,
short
slvAddr
,
string
blockNum
)
{
int
preNum
=
GetAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
BlockNo
);
if
(
preNum
.
Equals
(-
1
)
||
(!
preNum
.
ToString
().
Equals
(
blockNum
)))
{
byte
[]
data
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteRegisters
,
ACCMDManager
.
BlockNo
,
blockNum
,
2
);
SendData
(
portName
,
data
);
int
value
=
Convert
.
ToInt16
(
blockNum
);
UpdateAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
BlockNo
,
value
);
Thread
.
Sleep
(
SleepMSendons
);
}
}
public
override
void
AlarmClear
(
string
portName
,
short
slvAddr
)
{
string
addr
=
ACCMDManager
.
Clear_Alarm_Addr
;
string
data
=
"FF00"
;
//byte cmd = 0x05;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
System
.
Threading
.
Thread
.
Sleep
(
200
);
data
=
"0000"
;
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
private
void
CloseAlarmClear
(
string
portName
,
short
slvAddr
)
{
string
addr
=
ACCMDManager
.
Clear_Alarm_Addr
;
string
data
=
"0000"
;
//byte cmd = 0x05;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
private
string
PreReadAddr
=
""
;
private
string
PreReadCoilAddr
=
""
;
private
int
GetRegisterData
(
string
portName
,
byte
[]
reviceData
,
string
Address
)
{
if
(
reviceData
!=
null
&&
reviceData
.
Length
>
0
)
{
string
strSend
=
""
;
for
(
int
i
=
0
;
i
<
reviceData
.
Length
;
i
++)
{
strSend
+=
string
.
Format
(
"{0:X2} "
,
reviceData
[
i
]);
}
if
(
IsShowMsg
)
{
LogUtil
.
info
(
"串口"
+
portName
+
" 收到数据:"
+
strSend
+
""
);
}
string
strFromat
=
"{0:X2}"
;
byte
slvAddrR
=
reviceData
[
0
];
int
lenth
=
reviceData
[
2
];
byte
cmd
=
reviceData
[
1
];
if
(
cmd
.
Equals
(
ACCMDManager
.
CMD_ReadRegisters
)
&&
reviceData
.
Length
>
6
&&
lenth
==
4
)
{
string
str
=
string
.
Format
(
strFromat
,
reviceData
[
5
])
+
string
.
Format
(
strFromat
,
reviceData
[
6
])
+
string
.
Format
(
strFromat
,
reviceData
[
3
])
+
string
.
Format
(
strFromat
,
reviceData
[
4
]);
int
value
=
Convert
.
ToInt32
(
str
.
Trim
().
Replace
(
" "
,
""
),
16
);
SaveData
(
portName
,
slvAddrR
,
Address
,
value
);
return
value
;
}
}
return
-
1
;
}
public
override
int
GetTargetPosition
(
string
portName
,
short
slvAddr
)
{
PreReadAddr
=
ACCMDManager
.
TargetPostion
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadRegisters
,
ACCMDManager
.
TargetPostion
,
"0000"
,
2
);
// SendData(portName,dataArray);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
9
);
return
GetRegisterData
(
portName
,
reviceData
,
ACCMDManager
.
TargetPostion
);
}
public
override
int
GetActualtPosition
(
string
portName
,
short
slvAddr
)
{
PreReadAddr
=
ACCMDManager
.
ActualPosition
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadRegisters
,
ACCMDManager
.
ActualPosition
,
"0000"
,
2
);
// SendData(portName,dataArray);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
9
);
int
result
=
-
1
;
for
(
int
i
=
1
;
i
<=
3
;
i
++)
{
result
=
GetRegisterData
(
portName
,
reviceData
,
ACCMDManager
.
ActualPosition
);
if
(!
result
.
Equals
(-
1
))
{
break
;
}
else
{
LogUtil
.
error
(
"第"
+
i
+
"次获取"
+
portName
+
"_"
+
slvAddr
+
"的实时位置"
+
result
);
}
}
return
result
;
}
private
int
GetCoilData
(
string
portName
,
byte
[]
reviceData
,
string
Address
)
{
if
(
reviceData
!=
null
&&
reviceData
.
Length
>
0
)
{
string
strSend
=
""
;
for
(
int
i
=
0
;
i
<
reviceData
.
Length
;
i
++)
{
strSend
+=
string
.
Format
(
"{0:X2} "
,
reviceData
[
i
]);
}
if
(
IsShowMsg
)
{
LogUtil
.
info
(
"串口"
+
portName
+
" 收到数据:"
+
strSend
+
""
);
}
string
strFromat
=
"{0:X2}"
;
byte
slvAddrR
=
reviceData
[
0
];
int
lenth
=
reviceData
[
2
];
byte
cmd
=
reviceData
[
1
];
if
(
cmd
.
Equals
(
ACCMDManager
.
CMD_ReadCoil
)
&&
reviceData
.
Length
>=
6
&&
lenth
==
1
)
{
string
str
=
string
.
Format
(
strFromat
,
reviceData
[
3
]);
int
value
=
Convert
.
ToInt32
(
str
.
Trim
().
Replace
(
" "
,
""
),
16
);
SaveData
(
portName
,
slvAddrR
,
Address
,
value
);
return
value
;
}
}
return
-
1
;
}
public
override
int
GetAlarmStatus
(
string
portName
,
short
slvAddr
)
{
PreReadCoilAddr
=
ACCMDManager
.
Alarm_Status
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
PreReadCoilAddr
,
"0000"
,
1
);
//SendData(portName,dataArray);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
return
GetCoilData
(
portName
,
reviceData
,
PreReadCoilAddr
);
}
public
override
int
GetBusyStatus
(
string
portName
,
short
slvAddr
)
{
PreReadCoilAddr
=
ACCMDManager
.
BUSYStatus
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
ACCMDManager
.
BUSYStatus
,
"0000"
,
1
);
//SendData(portName,dataArray);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
return
GetCoilData
(
portName
,
reviceData
,
ACCMDManager
.
BUSYStatus
);
}
public
override
int
GetHomeEndStatus
(
string
portName
,
short
slvAddr
)
{
PreReadCoilAddr
=
ACCMDManager
.
HOME_CMP_Status
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
ACCMDManager
.
HOME_CMP_Status
,
"0000"
,
1
);
//SendData(portName,dataArray);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
return
GetCoilData
(
portName
,
reviceData
,
ACCMDManager
.
HOME_CMP_Status
);
}
public
override
int
GetHomeSingle
(
string
portName
,
short
slvAddr
)
{
PreReadCoilAddr
=
ACCMDManager
.
Home_Single
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
ACCMDManager
.
Home_Single
,
"0000"
,
1
);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
return
GetCoilData
(
portName
,
reviceData
,
ACCMDManager
.
Home_Single
);
}
/// <summary>
/// 负极限
/// </summary>
public
override
int
GetLimitNegativeSingle
(
string
portName
,
short
slvAddr
)
{
PreReadCoilAddr
=
ACCMDManager
.
Home_Single
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
ACCMDManager
.
Limit_Negative_Single
,
"0000"
,
1
);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
return
GetCoilData
(
portName
,
reviceData
,
ACCMDManager
.
Home_Single
);
}
/// <summary>
/// 负极限
/// </summary>
/// <summary>
/// 正极限
/// </summary>
public
override
int
GetLimitPositiveSingle
(
string
portName
,
short
slvAddr
)
{
PreReadCoilAddr
=
ACCMDManager
.
Home_Single
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
ACCMDManager
.
Limit_Positive_Single
,
"0000"
,
1
);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
return
GetCoilData
(
portName
,
reviceData
,
ACCMDManager
.
Home_Single
);
}
public
override
bool
OpenCard
()
{
return
true
;
}
public
override
bool
CloseCard
()
{
return
true
;
}
}
/// <summary>
/// 记录最后一次获得的寄存器的值
/// </summary>
public
class
RegisterInfo
{
public
RegisterInfo
(
short
slv
,
string
addr
,
int
data
)
{
this
.
SlvAddr
=
slv
;
this
.
RegisterAddr
=
addr
;
this
.
LastData
=
data
;
this
.
LastTime
=
new
DateTime
();
}
public
short
SlvAddr
{
get
;
set
;
}
public
string
RegisterAddr
{
get
;
set
;
}
public
int
LastData
{
get
;
set
;
}
public
DateTime
LastTime
{
get
;
set
;
}
}
}
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
1c43d39
...
@@ -46,13 +46,12 @@
...
@@ -46,13 +46,12 @@
<Reference Include="CodeLibrary">
<Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
</Reference>
<Reference Include="DeviceLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\DeviceLib.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<Reference Include="halcondotnet">
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
</Reference>
</Reference>
<Reference Include="HuichuanLibrary">
<HintPath>..\..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\HuichuanLibrary.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath>
<HintPath>..\..\dll\log4net.dll</HintPath>
...
@@ -68,6 +67,12 @@
...
@@ -68,6 +67,12 @@
<Reference Include="System.Xml" />
<Reference Include="System.Xml" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile Include="AXIS\AxisManager.cs" />
<Compile Include="AXIS\HC\HCAxisManager.cs" />
<Compile Include="AXIS\PanasonicServo\ACCMDManager.cs" />
<Compile Include="AXIS\PanasonicServo\ACServerManager.cs" />
<Compile Include="AXIS\PanasonicServo\ACServerManager_Partial.cs" />
<Compile Include="device\IO\HCIOManager.cs" />
<Compile Include="duoStore\AxisBean.cs" />
<Compile Include="duoStore\AxisBean.cs" />
<Compile Include="duoStore\BoxBean.cs" />
<Compile Include="duoStore\BoxBean.cs" />
<Compile Include="duoStore\BoxBean_Partial.cs" />
<Compile Include="duoStore\BoxBean_Partial.cs" />
...
...
source/DeviceLibrary/StoreConfig/StoreConfig.csv
查看文件 @
1c43d39
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
,
AXIS,,T1_提升机构升降轴,T1_Batch_Axis,1,COM3,,250,500,500,100,200,1000,10,1000,0,0
AXIS,,T1_提升机构升降轴,T1_Batch_Axis,1,COM3,,250,500,500,100,200,1000,10,1000,0,0
,
AXIS,,T2_取料机构旋转轴,T2_Middle_Axis,2,COM3,,1000,1000,1000,200,500,500,10,1000,0,0
AXIS,,T2_取料机构旋转轴,T2_Middle_Axis,2,COM3,,1000,1000,1000,200,500,500,10,1000,0,0
,
AXIS,,T3_取料机构上下轴,T3_Updown_Axis,3,COM3,,800,1000,1000,200,500,500,10,1000,0,0
AXIS,,T3_取料机构上下轴,T3_Updown_Axis,3,COM3,,800,1000,1000,200,500,500,10,1000,0,0
,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,
PRO,,IO模块对应的DI数量,IO_DILength,192.168.201.21#16;192.168.201.22#16;192.168.200.23#8,,,,,,,,,,,,
PRO,,IO模块对应的DI数量,IO_DILength,192.168.201.21#16;192.168.201.22#16;192.168.200.23#8,,,,,,,,,,,,
,
PRO,,IO模块对应的DO数量,IO_DOLength,192.168.201.21#16;192.168.201.22#16;192.168.200.23#8,,,,,,,,,,,,
PRO,,IO模块对应的DO数量,IO_DOLength,192.168.201.21#16;192.168.201.22#16;192.168.200.23#8,,,,,,,,,,,,
,
PRO,,第一块IO模块IP,PRO_AIO_IP_1,192.168.200.21,,,,,,,,,,,,
PRO,,第一块IO模块IP,PRO_AIO_IP_1,192.168.200.21,,,,,,,,,,,,
,
PRO,,第二块IO模块IP,PRO_AIO_IP_2,192.168.200.22,,,,,,,,,,,,
PRO,,第二块IO模块IP,PRO_AIO_IP_2,192.168.200.22,,,,,,,,,,,,
,
PRO,,第三块IO模块IP,PRO_AIO_IP_3,192.168.200.23,,,,,,,,,,,,
PRO,,第三块IO模块IP,PRO_AIO_IP_3,192.168.200.23,,,,,,,,,,,,
,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,
DI,0,急停,SuddenStop_BTN,0,PRO_AIO_IP_1,X01,,,,,,,,,,
DI,0,急停,SuddenStop_BTN,0,PRO_AIO_IP_1,X01,
X00,急停
,,,,,,,,,
DI,0,复位,Reset_BTN,1,PRO_AIO_IP_1,X02,,,,,,,,,,
DI,0,复位,Reset_BTN,1,PRO_AIO_IP_1,X02,
X01,复位
,,,,,,,,,
DI,0,启动,AutoRun_BTN,2,PRO_AIO_IP_1,X03,,,,,,,,,,
DI,0,启动,AutoRun_BTN,2,PRO_AIO_IP_1,X03,
*,
,,,,,,,,,
DI,0,气压检测,Airpressure_Check,3,PRO_AIO_IP_1,X04,,,,,,,,,,
DI,0,气压检测,Airpressure_Check,3,PRO_AIO_IP_1,X04,
X02,气压检测
,,,,,,,,,
DI,0,线体入口料串检测,Line_InCheck,4,PRO_AIO_IP_1,X05,,,,,,,,,,
DI,0,线体入口料串检测,Line_InCheck,4,PRO_AIO_IP_1,X05,
X03,线体入口料串检测
,,,,,,,,,
DI,0,线体上料等待区检测,Line_WaitCheck,5,PRO_AIO_IP_1,X06,,,,,,,,,,
DI,0,线体上料等待区检测,Line_WaitCheck,5,PRO_AIO_IP_1,X06,
X04,线体上料等待区检测
,,,,,,,,,
DI,0,线体上料区料串检测,Line_WorkCheck,6,PRO_AIO_IP_1,X07,,,,,,,,,,
DI,0,线体上料区料串检测,Line_WorkCheck,6,PRO_AIO_IP_1,X07,,,,,,,,,,
,
DI,0,料串识别检测1,ShelfCheck1,7,PRO_AIO_IP_1,X08,,,,,,,,,,
DI,0,料串识别检测1,ShelfCheck1,7,PRO_AIO_IP_1,X08,,,,,,,,,,
,
DI,0,料串识别检测2,ShelfCheck2,8,PRO_AIO_IP_1,X09,,,,,,,,,,
DI,0,料串识别检测2,ShelfCheck2,8,PRO_AIO_IP_1,X09,,,,,,,,,,
,
DI,0,料串识别检测3,ShelfCheck3,9,PRO_AIO_IP_1,X10,,,,,,,,,,
DI,0,料串识别检测3,ShelfCheck3,9,PRO_AIO_IP_1,X10,,,,,,,,,,
,
DI,0,料串识别检测4,ShelfCheck4,10,PRO_AIO_IP_1,X11,,,,,,,,,,
DI,0,料串识别检测4,ShelfCheck4,10,PRO_AIO_IP_1,X11,,,,,,,,,,
,
DI,0,线体后端料串堆积检测,Line_BufferCheck,11,PRO_AIO_IP_1,X12,,,,,,,,,,
DI,0,线体后端料串堆积检测,Line_BufferCheck,11,PRO_AIO_IP_1,X12,,,,,,,,,,
,
DI,0,线体后端料串检测,Line_OutCheck,12,PRO_AIO_IP_1,X13,,,,,,,,,,
DI,0,线体后端料串检测,Line_OutCheck,12,PRO_AIO_IP_1,X13,,,,,,,,,,
,
DI,0,线体顶升气缸上升端,TopCylinder_Up,13,PRO_AIO_IP_1,X14,,,,,,,,,,
DI,0,线体顶升气缸上升端,TopCylinder_Up,13,PRO_AIO_IP_1,X14,,,,,,,,,,
,
DI,0,线体顶升气缸下降端,TopCylinder_Down,14,PRO_AIO_IP_1,X15,,,,,,,,,,
DI,0,线体顶升气缸下降端,TopCylinder_Down,14,PRO_AIO_IP_1,X15,,,,,,,,,,
,
DI,0,取料提升机构前进端,Hoister_Forward,15,PRO_AIO_IP_1,X16,,,,,,,,,,
DI,0,取料提升机构前进端,Hoister_Forward,15,PRO_AIO_IP_1,X16,,,,,,,,,,
,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,
DO,0,自动指示灯,AutoRun_HddLed,0,PRO_AIO_IP_1,Y01,,,,,,,,,,
DO,0,自动指示灯,AutoRun_HddLed,0,PRO_AIO_IP_1,Y01,
Y00,自动指示灯
,,,,,,,,,
DO,0,故障指示灯,Alarm_HddLed,1,PRO_AIO_IP_1,Y02,,,,,,,,,,
DO,0,故障指示灯,Alarm_HddLed,1,PRO_AIO_IP_1,Y02,
Y01,故障指示灯
,,,,,,,,,
DO,0,待机指示灯,RunSign_HddLed,2,PRO_AIO_IP_1,Y03,,,,,,,,,,
DO,0,待机指示灯,RunSign_HddLed,2,PRO_AIO_IP_1,Y03,
Y02,待机指示灯
,,,,,,,,,
DO,0,报警蜂鸣器,Alarm_Buzzer,3,PRO_AIO_IP_1,Y04,,,,,,,,,,
DO,0,报警蜂鸣器,Alarm_Buzzer,3,PRO_AIO_IP_1,Y04,
Y03,报警蜂鸣器
,,,,,,,,,
DO,1,左侧料口物料指示灯绿色,DoorLed_Green,4,PRO_AIO_IP_1,Y05,,,,,,,,,,
DO,1,左侧料口物料指示灯绿色,DoorLed_Green,4,PRO_AIO_IP_1,Y05,
Y04,左侧料口绿色指示灯
,,,,,,,,,
DO,1,左侧料口物料指示灯红色,DoorLed_Red,5,PRO_AIO_IP_1,Y06,,,,,,,,,,
DO,1,左侧料口物料指示灯红色,DoorLed_Red,5,PRO_AIO_IP_1,Y06,
Y05,左侧料口红色指示灯
,,,,,,,,,
DO,2,右侧料口物料指示灯绿色,DoorLed_Green,6,PRO_AIO_IP_1,Y07,,,,,,,,,,
DO,2,右侧料口物料指示灯绿色,DoorLed_Green,6,PRO_AIO_IP_1,Y07,
Y06,右侧料口绿色指示灯
,,,,,,,,,
DO,2,右侧料口物料指示灯红色,DoorLed_Red,7,PRO_AIO_IP_1,Y08,,,,,,,,,,
DO,2,右侧料口物料指示灯红色,DoorLed_Red,7,PRO_AIO_IP_1,Y08,
Y07,右侧料口红色指示灯
,,,,,,,,,
DO,0,取料提升机构电机前进,Hoister_Forward,8,PRO_AIO_IP_1,Y09,,,,,,,,,,
DO,0,取料提升机构电机前进,Hoister_Forward,8,PRO_AIO_IP_1,Y09,,,,,,,,,,
,
DO,0,取料提升机构电机后退,Hoister_Back,9,PRO_AIO_IP_1,Y10,,,,,,,,,,
DO,0,取料提升机构电机后退,Hoister_Back,9,PRO_AIO_IP_1,Y10,,,,,,,,,,
,
DO,0,相机光源ON,Camera_Led,10,PRO_AIO_IP_1,Y11,,,,,,,,,,
DO,0,相机光源ON,Camera_Led,10,PRO_AIO_IP_1,Y11,
Y09,相机光源开启
,,,,,,,,,
DO,1,
左侧料仓升降轴刹车ON,UpdownAxis_Break,11,PRO_AIO_IP_1,Y12
,,,,,,,,,,
DO,1,
*左侧料仓升降轴刹车ON,UpdownAxis_Break,11,PRO_AIO_IP_1,Y12,*
,,,,,,,,,,
DO,2,
右侧料仓升降轴刹车ON,UpdownAxis_Break,12,PRO_AIO_IP_1,Y13
,,,,,,,,,,
DO,2,
*右侧料仓升降轴刹车ON,UpdownAxis_Break,12,PRO_AIO_IP_1,Y13,*
,,,,,,,,,,
DO,0,
提升机构升降轴刹车ON,BatchAxis_Break,13,PRO_AIO_IP_1,Y14
,,,,,,,,,,
DO,0,
*提升机构升降轴刹车ON,BatchAxis_Break,13,PRO_AIO_IP_1,Y14,*
,,,,,,,,,,
DO,0,
移栽机构上下轴刹车ON,MoveAxis_Break,14,PRO_AIO_IP_1,Y15
,,,,,,,,,,
DO,0,
*移栽机构上下轴刹车ON,MoveAxis_Break,14,PRO_AIO_IP_1,Y15,*
,,,,,,,,,,
DO,1,
左侧料仓伺服ON,Axis_Run,15,PRO_AIO_IP_1,Y16
,,,,,,,,,,
DO,1,
*左侧料仓伺服ON,Axis_Run,15,PRO_AIO_IP_1,Y16,*
,,,,,,,,,,
,,,,,,, ,,,,,,,,,
,,,,,,, ,,,,,,,,,
,
DI,0,取料提升机构后退端,Hoister_Back,0,PRO_AIO_IP_2,X21, ,,,,,,,,,
DI,0,取料提升机构后退端,Hoister_Back,0,PRO_AIO_IP_2,X21, ,,,,,,,,,
,
DI,0,提升机构料盘检测,BatchAxis_Check,1,PRO_AIO_IP_2,X22,,,,,,,,,,
DI,0,提升机构料盘检测,BatchAxis_Check,1,PRO_AIO_IP_2,X22,,,,,,,,,,
,
DI,0,
取料气缸放松端,ClampCylinder_Relax,2,PRO_AIO_IP_2,X23
,,,,,,,,,,
DI,0,
*取料气缸放松端,ClampCylinder_Relax,2,PRO_AIO_IP_2,X23,*
,,,,,,,,,,
DI,0,
取料气缸夹紧端,ClampCylinder_Clamp,3,PRO_AIO_IP_2,X24
,,,,,,,,,,
DI,0,
*取料气缸夹紧端,ClampCylinder_Clamp,3,PRO_AIO_IP_2,X24,*
,,,,,,,,,,
DI,1,左侧出料口安全光栅,OutDoor_SafeSignal,4,PRO_AIO_IP_2,X25,,,,,,,,,,
DI,1,左侧出料口安全光栅,OutDoor_SafeSignal,4,PRO_AIO_IP_2,X25,
X12,左侧出料口安全光栅
,,,,,,,,,
DI,1,左侧暂存区料盘检测,InDoor_Check,5,PRO_AIO_IP_2,X26,,,,,,,,,,
DI,1,左侧暂存区料盘检测,InDoor_Check,5,PRO_AIO_IP_2,X26,
X11,左侧暂存区料盘检测
,,,,,,,,,
DI,1,左侧出料口门上升/打开端,OutDoor_Up,6,PRO_AIO_IP_2,X27,,,,,,,,,,
DI,1,左侧出料口门上升/打开端,OutDoor_Up,6,PRO_AIO_IP_2,X27,
X13,左侧出料口门上升端
,,,,,,,,,
DI,1,左侧出料口门下降/关闭端,OutDoor_Down,7,PRO_AIO_IP_2,X28,,,,,,,,,,
DI,1,左侧出料口门下降/关闭端,OutDoor_Down,7,PRO_AIO_IP_2,X28,
X14,左侧出料口门下降端
,,,,,,,,,
DI,1,左侧出料口料盘检测,OutDoor_Check,8,PRO_AIO_IP_2,X29,,,,,,,,,,
DI,1,左侧出料口料盘检测,OutDoor_Check,8,PRO_AIO_IP_2,X29,
X15,左侧出料口料盘检测
,,,,,,,,,
DI,1,左侧料叉料盘检测,Fixture_Check,9,PRO_AIO_IP_2,X30,,,,,,,,,,
DI,1,左侧料叉料盘检测,Fixture_Check,9,PRO_AIO_IP_2,X30,
X16,左侧料叉料盘检测
,,,,,,,,,
DI,2,右侧出料口安全光栅,OutDoor_SafeSignal,10,PRO_AIO_IP_2,X31,,,,,,,,,,
DI,2,右侧出料口安全光栅,OutDoor_SafeSignal,10,PRO_AIO_IP_2,X31,
X19,右侧出料口安全光栅
,,,,,,,,,
DI,2,右侧暂存区料盘检测,InDoor_Check,11,PRO_AIO_IP_2,X32,,,,,,,,,,
DI,2,右侧暂存区料盘检测,InDoor_Check,11,PRO_AIO_IP_2,X32,
X18,右侧暂存区料盘检测
,,,,,,,,,
DI,2,右侧出料口门上升/打开端,OutDoor_Up,12,PRO_AIO_IP_2,X33,,,,,,,,,,
DI,2,右侧出料口门上升/打开端,OutDoor_Up,12,PRO_AIO_IP_2,X33,
X20,右侧出料口门上升端
,,,,,,,,,
DI,2,右侧出料口门下降/关闭端,OutDoor_Down,13,PRO_AIO_IP_2,X34,,,,,,,,,,
DI,2,右侧出料口门下降/关闭端,OutDoor_Down,13,PRO_AIO_IP_2,X34,
X21,右侧出料口门下降端
,,,,,,,,,
DI,2,右侧料叉料盘检测,Fixture_Check,14,PRO_AIO_IP_2,X35,,,,,,,,,,
DI,2,右侧料叉料盘检测,Fixture_Check,14,PRO_AIO_IP_2,X35,
X23,右侧料叉料盘检测
,,,,,,,,,
DI,2,右侧出料口料盘检测,OutDoor_Check,15,PRO_AIO_IP_2,X36,,,,,,,,,,
DI,2,右侧出料口料盘检测,OutDoor_Check,15,PRO_AIO_IP_2,X36,
X22,右侧出料口料盘检测
,,,,,,,,,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,
DO,2,
右侧料仓伺服ON,Axis_Run,0,PRO_AIO_IP_2,Y21
,,,,,,,,,,
DO,2,
*右侧料仓伺服ON,Axis_Run,0,PRO_AIO_IP_2,Y21,*
,,,,,,,,,,
DO,0,
取料机构伺服ON,MoveAxis_Run,1,PRO_AIO_IP_2,Y22
,,,,,,,,,,
DO,0,
*取料机构伺服ON,MoveAxis_Run,1,PRO_AIO_IP_2,Y22,*
,,,,,,,,,,
DO,0,线体皮带正转,Line_Run,2,PRO_AIO_IP_2,Y23,,,,,,,,,,
DO,0,线体皮带正转,Line_Run,2,PRO_AIO_IP_2,Y23,
Y11,横移电机正转
,,,,,,,,,
DO,0,线体皮带反转,Line_BackRun,3,PRO_AIO_IP_2,Y24,,,,,,,,,,
DO,0,线体皮带反转,Line_BackRun,3,PRO_AIO_IP_2,Y24,
Y12,横移电机反转
,,,,,,,,,
DO,0,线体等待区阻挡1上升,Line_Stop1_Wait,4,PRO_AIO_IP_2,Y25,,,,,,,,,,
DO,0,线体等待区阻挡1上升,Line_Stop1_Wait,4,PRO_AIO_IP_2,Y25,
Y16,线体等待区阻挡上升
,,,,,,,,,
DO,0,线体上料区阻挡2上升,Line_Stop2_Work,5,PRO_AIO_IP_2,Y26,,,,,,,,,,
DO,0,线体上料区阻挡2上升,Line_Stop2_Work,5,PRO_AIO_IP_2,Y26,
Y17,线体上料区阻挡上升
,,,,,,,,,
DO,0,线体出料区阻挡3上升,Line_Stop3_Buffer,6,PRO_AIO_IP_2,Y27,,,,,,,,,,
DO,0,线体出料区阻挡3上升,Line_Stop3_Buffer,6,PRO_AIO_IP_2,Y27,,,,,,,,,,
,
DO,0,线体放行阻挡4上升,Line_Stop4_Out,7,PRO_AIO_IP_2,Y28,,,,,,,,,,
DO,0,线体放行阻挡4上升,Line_Stop4_Out,7,PRO_AIO_IP_2,Y28,
Y18,线体放行阻挡上升
,,,,,,,,,
DO,0,线体顶升气缸上升SOL,TopCylinder_Up,8,PRO_AIO_IP_2,Y29,,,,,,,,,,
DO,0,线体顶升气缸上升SOL,TopCylinder_Up,8,PRO_AIO_IP_2,Y29,
Y19,线体横移顶升上升
,,,,,,,,,
DO,0,线体顶升气缸下降SOL,TopCylinder_Down,9,PRO_AIO_IP_2,Y30,,,,,,,,,,
DO,0,线体顶升气缸下降SOL,TopCylinder_Down,9,PRO_AIO_IP_2,Y30,
Y20,线体横移顶升下降
,,,,,,,,,
DO,0,取料气缸放松SOL,ClampCylinder_Relax,10,PRO_AIO_IP_2,Y31,,,,,,,,,,
DO,0,取料气缸放松SOL,ClampCylinder_Relax,10,PRO_AIO_IP_2,Y31,
*,
,,,,,,,,,
DO,0,取料气缸夹紧SOL,ClampCylinder_Clamp,11,PRO_AIO_IP_2,Y32,,,,,,,,,,
DO,0,取料气缸夹紧SOL,ClampCylinder_Clamp,11,PRO_AIO_IP_2,Y32,
*,
,,,,,,,,,
DO,1,左侧出料口门上升/打开SOL,OutDoor_Up,12,PRO_AIO_IP_2,Y33,,,,,,,,,,
DO,1,左侧出料口门上升/打开SOL,OutDoor_Up,12,PRO_AIO_IP_2,Y33,
Y25,左侧出料口门上升
,,,,,,,,,
DO,1,左侧出料口门下降/关闭SOL,OutDoor_Down,13,PRO_AIO_IP_2,Y34,,,,,,,,,,
DO,1,左侧出料口门下降/关闭SOL,OutDoor_Down,13,PRO_AIO_IP_2,Y34,
Y26,左侧出料口门下降
,,,,,,,,,
DO,2,右侧出料口门上升/打开SOL,OutDoor_Up,14,PRO_AIO_IP_2,Y35,,,,,,,,,,
DO,2,右侧出料口门上升/打开SOL,OutDoor_Up,14,PRO_AIO_IP_2,Y35,
Y29,右侧出料口门上升
,,,,,,,,,
DO,2,右侧出料口门下降/关闭SOL,OutDoor_Down,15,PRO_AIO_IP_2,Y36,,,,,,,,,,
DO,2,右侧出料口门下降/关闭SOL,OutDoor_Down,15,PRO_AIO_IP_2,Y36,
Y30,右侧出料口门下降
,,,,,,,,,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,
DI,0,
取料气缸料盘检测,ClampCylinder_Check,0,PRO_AIO_IP_3,X41
,,,,,,,,,,
DI,0,
*取料气缸料盘检测,ClampCylinder_Check,0,PRO_AIO_IP_3,X41,
,,,,,,,,,,
DI,0,
线体出口放行信号,LineOut_BTN,1,PRO_AIO_IP_3,X42
,,,,,,,,,,
DI,0,
*线体出口放行信号,LineOut_BTN,1,PRO_AIO_IP_3,X42,
,,,,,,,,,,
,0,,,2,PRO_AIO_IP_3,X43,,,,,,,,,,
,0,,,2,PRO_AIO_IP_3,X43,,,,,,,,,,
,
,0,,,3,PRO_AIO_IP_3,X44,,,,,,,,,,
,0,,,3,PRO_AIO_IP_3,X44,,,,,,,,,,
,
,0,,,4,PRO_AIO_IP_3,X45,,,,,,,,,,
,0,,,4,PRO_AIO_IP_3,X45,,,,,,,,,,
,
,0,,,5,PRO_AIO_IP_3,X46,,,,,,,,,,
,0,,,5,PRO_AIO_IP_3,X46,,,,,,,,,,
,
,0,,,6,PRO_AIO_IP_3,X47,,,,,,,,,,
,0,,,6,PRO_AIO_IP_3,X47,,,,,,,,,,
,
,0,,,7,PRO_AIO_IP_3,X48,,,,,,,,,,
,0,,,7,PRO_AIO_IP_3,X48,,,,,,,,,,
,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,
DO,0,
线体入口指示灯,LineIn_Led,0,PRO_AIO_IP_3,Y41
,,,,,,,,,,
DO,0,
*线体入口指示灯,LineIn_Led,0,PRO_AIO_IP_3,Y41,
,,,,,,,,,,
DO,0,
线体出口指示灯,LineOut_Led,1,PRO_AIO_IP_3,Y42
,,,,,,,,,,
DO,0,
*线体出口指示灯,LineOut_Led,1,PRO_AIO_IP_3,Y42,
,,,,,,,,,,
DO,0,设备内部照明ON,Device_Led,2,PRO_AIO_IP_3,Y43,
,,,,,,,,,
DO,0,设备内部照明ON,Device_Led,2,PRO_AIO_IP_3,Y43,
Y08,设备内部照明开启,,,,,,,,,Y08
,0,,,3,PRO_AIO_IP_3,Y44,,,,,,,,,,
,0,,,3,PRO_AIO_IP_3,Y44,,,,,,,,,,
,
,0,,,4,PRO_AIO_IP_3,Y45,,,,,,,,,,
,0,,,4,PRO_AIO_IP_3,Y45,,,,,,,,,,
,
,0,,,5,PRO_AIO_IP_3,Y46,,,,,,,,,,
,0,,,5,PRO_AIO_IP_3,Y46,,,,,,,,,,
,
,0,,,6,PRO_AIO_IP_3,Y47,,,,,,,,,,
,0,,,6,PRO_AIO_IP_3,Y47,,,,,,,,,,
,
,0,,,7,PRO_AIO_IP_3,Y48,,,,,,,,,,
,0,,,7,PRO_AIO_IP_3,Y48,,,,,,,,,,
,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,
PRO,0,T1_提升轴待机点 P1,BatchAxis_P1,5000,,,,, ,,,,,,,
PRO,0,T1_提升轴待机点 P1,BatchAxis_P1,5000,,,,, ,,,,,,,
,
PRO,0,T1_提升轴上升目标点_P2,BatchAxis_P2,4000,,,,, ,,,,,,,
PRO,0,T1_提升轴上升目标点_P2,BatchAxis_P2,4000,,,,, ,,,,,,,
,
PRO,0,T1_提升轴P1速度,BatchAxis_P1Speed,4000,,,,,,,,,,,,
PRO,0,T1_提升轴P1速度,BatchAxis_P1Speed,4000,,,,,,,,,,,,
,
PRO,0,T1_提升轴P2速度,BatchAxis_P2Speed,500,,,,, ,,,,,,,
PRO,0,T1_提升轴P2速度,BatchAxis_P2Speed,500,,,,, ,,,,,,,
,
PRO,0,T1_提升轴高度转换系数(1mm对应的脉冲),BatchAxis_ChangeValue,11000,,,,,,,,,,,,
PRO,0,T1_提升轴高度转换系数(1mm对应的脉冲),BatchAxis_ChangeValue,11000,,,,,,,,,,,,
,
,,,,,,,,,,,,,,,,T2_旋转轴_料串取放料点P4:
,,,,,,,,,,,,,,,,T2_旋转轴_料串取放料点P4:
,
PRO,0,T2_旋转轴待机点/取放料点 P1,MiddleAxis_P1,5000,,,,,,,,,,,,
PRO,0,T2_旋转轴待机点/取放料点 P1,MiddleAxis_P1,5000,,,,,,,,,,,,
,
PRO,0,T2_旋转轴左侧料仓取放料点_P2,MiddleAxis_P2,59002,,,,,,,,,,,,
PRO,0,T2_旋转轴左侧料仓取放料点_P2,MiddleAxis_P2,59002,,,,,,,,,,,,
,
PRO,0,T2_旋转轴右侧料仓取放料点_P3,MiddleAxis_P3,59003,,,,,,,,,,,,
PRO,0,T2_旋转轴右侧料仓取放料点_P3,MiddleAxis_P3,59003,,,,,,,,,,,,
,
PRO,0,T2_旋转轴_料串取放料点_P4,MiddleAxis_P4,59004,,,,,,,,,,,,
PRO,0,T2_旋转轴_料串取放料点_P4,MiddleAxis_P4,59004,,,,,,,,,,,,
,
PRO,0,T2_旋转轴P1速度,MiddleAxis_P1Speed,500,,,,,,,,,,,,
PRO,0,T2_旋转轴P1速度,MiddleAxis_P1Speed,500,,,,,,,,,,,,
,
PRO,0,T2_旋转轴P2速度,MiddleAxis_P2Speed,500,,,,,,,,,,,,
PRO,0,T2_旋转轴P2速度,MiddleAxis_P2Speed,500,,,,,,,,,,,,
,
PRO,0,T2_旋转轴P3速度,MiddleAxis_P3Speed,500,,,,,,,,,,,,
PRO,0,T2_旋转轴P3速度,MiddleAxis_P3Speed,500,,,,,,,,,,,,
,
PRO,0,T2_旋转轴P4速度,MiddleAxis_P4Speed,500,,,,,,,,,,,,
PRO,0,T2_旋转轴P4速度,MiddleAxis_P4Speed,500,,,,,,,,,,,,
,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,
PRO,0,T3_升降轴料串取放料低点 P1,UpdownAxis_P1,5000,,,,,,,,,,,,
PRO,0,T3_升降轴料串取放料低点 P1,UpdownAxis_P1,5000,,,,,,,,,,,,
,
PRO,0,T3_升降轴料串取放料高点/待机点 P2,UpdownAxis_P2,5001,,,,,,,,,,,,
PRO,0,T3_升降轴料串取放料高点/待机点 P2,UpdownAxis_P2,5001,,,,,,,,,,,,
,
PRO,0,T3_升降轴左侧料仓取放料低点 P3,UpdownAxis_P3,5002,,,,,,,,,,,,
PRO,0,T3_升降轴左侧料仓取放料低点 P3,UpdownAxis_P3,5002,,,,,,,,,,,,
,
PRO,0,T3_升降轴左侧料仓取放料高点 P4,UpdownAxis_P4,5003,,,,,,,,,,,,
PRO,0,T3_升降轴左侧料仓取放料高点 P4,UpdownAxis_P4,5003,,,,,,,,,,,,
,
PRO,0,T3_升降轴右侧料仓取放料低点 P5,UpdownAxis_P5,5004,,,,,,,,,,,,
PRO,0,T3_升降轴右侧料仓取放料低点 P5,UpdownAxis_P5,5004,,,,,,,,,,,,
,
PRO,0,T3_升降轴右侧料仓取放料高点 P6,UpdownAxis_P6,5005,,,,,,,,,,,,
PRO,0,T3_升降轴右侧料仓取放料高点 P6,UpdownAxis_P6,5005,,,,,,,,,,,,
,
PRO,0,T2_升降轴P1速度/慢速度,UpdownAxis_P1Speed,500,,,,,,,,,,,,
PRO,0,T2_升降轴P1速度/慢速度,UpdownAxis_P1Speed,500,,,,,,,,,,,,
,
PRO,0,T2_升降轴P2速度/快速度,UpdownAxis_P2Speed,501,,,,,,,,,,,,
PRO,0,T2_升降轴P2速度/快速度,UpdownAxis_P2Speed,501,,,,,,,,,,,,
,
PRO,0,T2_升降轴P3速度/慢速度,UpdownAxis_P3Speed,502,,,,,,,,,,,,
PRO,0,T2_升降轴P3速度/慢速度,UpdownAxis_P3Speed,502,,,,,,,,,,,,
,
PRO,0,T2_升降轴P4速度/快速度,UpdownAxis_P4Speed,503,,,,,,,,,,,,
PRO,0,T2_升降轴P4速度/快速度,UpdownAxis_P4Speed,503,,,,,,,,,,,,
,
PRO,0,T2_升降轴P5速度/慢速度,UpdownAxis_P5Speed,504,,,,,,,,,,,,
PRO,0,T2_升降轴P5速度/慢速度,UpdownAxis_P5Speed,504,,,,,,,,,,,,
,
PRO,0,T2_升降轴P6速度/快速度,UpdownAxis_P6Speed,505,,,,,,,,,,,,
PRO,0,T2_升降轴P6速度/快速度,UpdownAxis_P6Speed,505,,,,,,,,,,,,
,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,
PRO,,预警温度,WarnTemperate,80,,,,,,,,,,,,
PRO,,预警温度,WarnTemperate,80,,,,,,,,,,,,
,
PRO,,预警湿度,WarnHumidity,80,,,,,,,,,,,,
PRO,,预警湿度,WarnHumidity,80,,,,,,,,,,,,
,
PRO,,出入库多少次,会自动重置旋转轴,Box_ResetMCount,1000,,,,,,,,,,,,
PRO,,出入库多少次,会自动重置旋转轴,Box_ResetMCount,1000,,,,,,,,,,,,
,
PRO,,出入库多少次,会自动重置所有轴操作,Box_ResetACount,100,,,,,,,,,,,,
PRO,,出入库多少次,会自动重置所有轴操作,Box_ResetACount,100,,,,,,,,,,,,
,
PRO,,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,,,,,,,,
PRO,,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,,,,,,,,
,
PRO,,需要吹气的温度(温度标准),Max_Temperature,0,,,,,,,,,,,,
PRO,,需要吹气的温度(温度标准),Max_Temperature,0,,,,,,,,,,,,
,
PRO,,需要吹气的湿度(湿度标准),Max_Humidity,10,,,,,,,,,,,,
PRO,,需要吹气的湿度(湿度标准),Max_Humidity,10,,,,,,,,,,,,
,
PRO,,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,,,,,,,
PRO,,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,,,,,,,
,
PRO,,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,,,,,,,
PRO,,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,,,,,,,
,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,
PRO,0,是否调试状态(1=调试,0=正常),IsDebug,1,,,,,,,,,,,,
PRO,0,是否调试状态(1=调试,0=正常),IsDebug,1,,,,,,,,,,,,
,
PRO,,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,,,,,,,,,,
PRO,,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,,,,,,,,,,
,
PRO,,所有料仓的CID(用#号分隔),All_CIDs,packing-1#packing-2,,,,,,,,,,,,
PRO,,所有料仓的CID(用#号分隔),All_CIDs,packing-1#packing-2,,,,,,,,,,,,
,
PRO,,扫码的相机名称(多个用#分隔),CameraNameList,GigE:MV-CE200-10GC (00D76546875),,,,,,,,,,,,
PRO,,扫码的相机名称(多个用#分隔),CameraNameList,GigE:MV-CE200-10GC (00D76546875),,,,,,,,,,,,
,
source/DeviceLibrary/device/IO/AIOBOX/AIOBOXManager.cs
查看文件 @
1c43d39
...
@@ -15,6 +15,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -15,6 +15,9 @@ namespace OnlineStore.DeviceLibrary
{
{
public
class
AIOBOXManager
:
IOManager
public
class
AIOBOXManager
:
IOManager
{
{
//public static uint DefaultDICount = 16;
//public static uint DefaultDOCount = 16;
public
Dictionary
<
string
,
AIOBOX
>
AIOMap
=
new
Dictionary
<
string
,
AIOBOX
>();
public
Dictionary
<
string
,
AIOBOX
>
AIOMap
=
new
Dictionary
<
string
,
AIOBOX
>();
public
Dictionary
<
string
,
List
<
Box_Sta
>>
DIValueMap
=
new
Dictionary
<
string
,
List
<
Box_Sta
>>();
public
Dictionary
<
string
,
List
<
Box_Sta
>>
DIValueMap
=
new
Dictionary
<
string
,
List
<
Box_Sta
>>();
...
@@ -25,18 +28,19 @@ namespace OnlineStore.DeviceLibrary
...
@@ -25,18 +28,19 @@ namespace OnlineStore.DeviceLibrary
private
object
DILock
=
""
;
private
object
DILock
=
""
;
private
object
DOLock
=
""
;
private
object
DOLock
=
""
;
private
List
<
string
>
IoIPLIst
=
new
List
<
string
>();
private
System
.
Timers
.
Timer
conTimer
=
null
;
public
override
void
ConnectionIOList
(
List
<
string
>
DIONameList
)
public
override
void
ConnectionIOList
(
List
<
string
>
DIONameList
)
{
{
foreach
(
string
ip
in
DIONameList
)
foreach
(
string
ip
in
DIONameList
)
{
{
ConnectionIP
(
ip
);
ConnectionIP
(
ip
);
}
}
}
}
private
bool
isProcess
=
false
;
private
bool
isProcess
=
false
;
private
DateTime
lastTime
=
DateTime
.
Now
;
private
DateTime
lastTime
=
DateTime
.
Now
;
public
void
ConnectionIP
(
string
ioIp
)
public
void
ConnectionIP
(
string
ioIp
)
{
{
AIOBOX
aioBox
=
null
;
AIOBOX
aioBox
=
null
;
...
@@ -65,46 +69,80 @@ namespace OnlineStore.DeviceLibrary
...
@@ -65,46 +69,80 @@ namespace OnlineStore.DeviceLibrary
{
{
DOValueMap
.
Remove
(
ioIp
);
DOValueMap
.
Remove
(
ioIp
);
}
}
int
DIMS
=
ConfigAppSettings
.
GetIntValue
(
"DIMS"
);
if
(
DIMS
<=
0
)
{
DIMS
=
150
;
}
else
if
(
DIMS
<
20
)
{
DIMS
=
100
;
}
int
DOMS
=
ConfigAppSettings
.
GetIntValue
(
"DOMS"
);
if
(
DOMS
<=
0
)
{
DOMS
=
300
;
}
else
if
(
DOMS
<
100
)
{
DOMS
=
300
;
}
int
DILength
=
StoreManager
.
Config
.
GetDILength
(
ioIp
);
int
DILength
=
StoreManager
.
Config
.
GetDILength
(
ioIp
);
int
DOLength
=
StoreManager
.
Config
.
GetDOLength
(
ioIp
);
int
DOLength
=
StoreManager
.
Config
.
GetDOLength
(
ioIp
);
string
logName
=
"IO模块["
+
ioIp
+
"] DI["
+
DILength
+
"] DO["
+
DOLength
+
"]
"
;
string
logName
=
"IO模块["
+
ioIp
+
"] DI["
+
DILength
+
"] DO["
+
DOLength
+
"]
,["
+
DIMS
+
"] ["
+
DOMS
+
"]
"
;
try
try
{
{
aioBox
=
new
AIOBOX
(
"AIOBOX"
);
// Create new modbus master and add event functions
aioBox
.
SetType
(
Asa
.
IOModule
.
Box_Type
.
DI
,
DILength
,
Asa
.
IOModule
.
Box_Type
.
DO
,
DOLength
);
aioBox
=
new
AIOBOX
();
aioBox
.
SetType
(
Box_Type
.
DI
,
DILength
,
Box_Type
.
DO
,
DOLength
);
//aioBox.LogPath(Application.StartupPath + @"\logs\aio\", LogType.OnlyError);
aioBox
.
IP
=
ioIp
;
aioBox
.
IP
=
ioIp
;
aioBox
.
Upload
=
false
;
// bool rtn = aioBox.AutoIP(ioIp);
// aioBox.SetInput(Asa.IOModule.Box_Type.DI, DILength);
// aioBox.SetOutput(Asa.IOModule.Box_Type.DO, DOLength);
//DI主动上传
// aioBox.AutoReadInput(true, DIMS);
// aioBox.AutoReadOutput(false, DOMS);
aioBox
.
DI_Changed_Event
+=
AioBox_DI_Changed_Event
;
;
aioBox
.
DI_Changed_Event
+=
AioBox_DI_Changed_Event
;
;
aioBox
.
DO_Changed_Event
+=
AioBox_DO_Changed_Event
;
aioBox
.
DO_Changed_Event
+=
AioBox_DO_Changed_Event
;
LogUtil
.
info
(
"开始连接:"
+
logName
+
":"
);
aioBox
.
Connect
();
bool
conRes
=
aioBox
.
Connect
();
LogUtil
.
info
(
"开始连接:"
+
logName
+
":"
+
conRes
.
ToString
());
AIOMap
.
Add
(
ioIp
,
aioBox
);
AIOMap
.
Add
(
ioIp
,
aioBox
);
Thread
.
Sleep
(
5
);
Thread
.
Sleep
(
5
);
//读取所有的DO
//读取所有的DO
ReadAllDI
(
ioIp
,
0
);
ReadAllDI
(
ioIp
,
0
);
Thread
.
Sleep
(
5
);
Thread
.
Sleep
(
5
);
GC
.
Collect
();
GC
.
Collect
();
}
}
catch
(
Exception
error
)
catch
(
Exception
error
)
{
{
LogUtil
.
error
(
"连接IO模块 "
+
logName
+
" 出错:"
+
error
.
ToString
());
LogUtil
.
error
(
"连接IO模块 "
+
logName
+
" 出错:"
+
error
.
ToString
());
}
}
}
}
private
DateTime
lastLogTime
=
DateTime
.
Now
;
private
DateTime
lastLogTime
=
DateTime
.
Now
;
private
void
AioBox_Log_Out_Event
(
AIOBOX
box
,
string
[]
s
)
{
foreach
(
string
str
in
s
)
{
LogUtil
.
AIOLog
.
Debug
(
"["
+
box
.
IP
+
"]"
+
str
);
}
}
private
void
AioBox_DI_Changed_Event
(
AIOBOX
box
,
Box_Sta
[]
sta
)
private
void
AioBox_DI_Changed_Event
(
AIOBOX
box
,
Box_Sta
[]
sta
)
{
{
try
try
{
{
UpdateAllDI
(
box
.
IP
,
sta
);
UpdateAllDI
(
box
.
IP
,
sta
);
//LogUtil.info("ReadAllDI [" + box.IP + "]:" + string.Join(" ", sta));
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -123,6 +161,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -123,6 +161,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
"AioBox_DO_Changed_Event出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"AioBox_DO_Changed_Event出错:"
+
ex
.
ToString
());
}
}
}
}
private
void
UpdateAllDI
(
string
ip
,
Box_Sta
[]
sta
)
private
void
UpdateAllDI
(
string
ip
,
Box_Sta
[]
sta
)
{
{
if
(
sta
!=
null
&&
sta
.
Length
>=
StoreManager
.
Config
.
GetDILength
(
ip
))
if
(
sta
!=
null
&&
sta
.
Length
>=
StoreManager
.
Config
.
GetDILength
(
ip
))
...
@@ -171,7 +210,12 @@ namespace OnlineStore.DeviceLibrary
...
@@ -171,7 +210,12 @@ namespace OnlineStore.DeviceLibrary
newList
.
AddRange
(
sta
);
newList
.
AddRange
(
sta
);
List
<
Box_Sta
>
oldList
=
null
;
List
<
Box_Sta
>
oldList
=
null
;
DOValueMap
.
TryGetValue
(
ip
,
out
oldList
);
DOValueMap
.
TryGetValue
(
ip
,
out
oldList
);
//string result = "UpdateAllDO ip[" + ip + "], sta :";
//for (int i = 0; i < newList.Count; i++)
//{
// result += newList[i] + ",";
//}
//LogUtil.info(result);
if
(
oldList
==
null
||
oldList
.
Count
.
Equals
(
newList
.
Count
).
Equals
(
false
))
if
(
oldList
==
null
||
oldList
.
Count
.
Equals
(
newList
.
Count
).
Equals
(
false
))
{
{
needUpdate
=
true
;
needUpdate
=
true
;
...
@@ -247,7 +291,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -247,7 +291,7 @@ namespace OnlineStore.DeviceLibrary
}
}
else
else
{
{
LogUtil
.
error
(
"WriteSingleDO出错 没有连接IO模块:"
+
ioIp
);
LogUtil
.
error
(
"WriteSingleDO出错 没有连接IO模块:"
+
ioIp
);
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -272,11 +316,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -272,11 +316,11 @@ namespace OnlineStore.DeviceLibrary
try
try
{
{
aioBox
.
WriteDO
(
StartAddress
,
aioBox
.
ReverseStatus
(
currBox_Sta
));
aioBox
.
WriteDO
(
StartAddress
,
aioBox
.
ReverseStatus
(
currBox_Sta
));
LogUtil
.
debug
(
"**********定时回写入 IO ["
+
ioIp
+
"] ["
+
StartAddress
+
"]值"
+
aioBox
.
ReverseStatus
(
currBox_Sta
)
+
"】:"
);
LogUtil
.
debug
(
"**********定时回写入 IO ["
+
ioIp
+
"] ["
+
StartAddress
+
"]值"
+
aioBox
.
ReverseStatus
(
currBox_Sta
)
+
"】:"
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"**********定时回写入 出错:"
+
ex
.
ToString
()
);
LogUtil
.
error
(
"**********定时回写入 出错:"
+
ex
.
StackTrace
);
}
}
};
};
mytimer
.
AutoReset
=
false
;
//设置是否自动重启,即自动执行多次;
mytimer
.
AutoReset
=
false
;
//设置是否自动重启,即自动执行多次;
...
@@ -285,7 +329,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -285,7 +329,7 @@ namespace OnlineStore.DeviceLibrary
}
}
else
else
{
{
LogUtil
.
error
(
"AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"] 出错 没有连接IO模块:"
+
ioIp
);
LogUtil
.
error
(
"AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"] 出错 没有连接IO模块:"
+
ioIp
);
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -328,7 +372,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -328,7 +372,7 @@ namespace OnlineStore.DeviceLibrary
}
}
public
override
IO_VALUE
GetDOValue
(
string
ioIP
,
byte
slaveId
,
ushort
StartAddress
)
public
override
IO_VALUE
GetDOValue
(
string
ioIP
,
byte
slaveId
,
ushort
StartAddress
)
{
{
IO_VALUE
value
=
IO_VALUE
.
None
;
IO_VALUE
value
=
IO_VALUE
.
LOW
;
try
try
{
{
AIOBOX
aioBox
=
getAIO
(
ioIP
);
AIOBOX
aioBox
=
getAIO
(
ioIP
);
...
@@ -345,10 +389,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -345,10 +389,6 @@ namespace OnlineStore.DeviceLibrary
{
{
value
=
IO_VALUE
.
HIGH
;
value
=
IO_VALUE
.
HIGH
;
}
}
else
{
value
=
IO_VALUE
.
LOW
;
}
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -360,7 +400,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -360,7 +400,7 @@ namespace OnlineStore.DeviceLibrary
public
override
IO_VALUE
GetDIValue
(
string
ioIP
,
byte
slaveId
,
ushort
StartAddress
)
public
override
IO_VALUE
GetDIValue
(
string
ioIP
,
byte
slaveId
,
ushort
StartAddress
)
{
{
IO_VALUE
value
=
IO_VALUE
.
None
;
IO_VALUE
value
=
IO_VALUE
.
LOW
;
for
(
int
i
=
1
;
i
<=
3
;
i
++)
for
(
int
i
=
1
;
i
<=
3
;
i
++)
{
{
try
try
...
@@ -383,44 +423,32 @@ namespace OnlineStore.DeviceLibrary
...
@@ -383,44 +423,32 @@ namespace OnlineStore.DeviceLibrary
{
{
value
=
IO_VALUE
.
HIGH
;
value
=
IO_VALUE
.
HIGH
;
}
}
else
{
value
=
IO_VALUE
.
LOW
;
}
}
}
break
;
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
if
(
i
<=
1
)
LogUtil
.
error
(
"GetDIValue ["
+
ioIP
+
"] ["
+
StartAddress
+
"] ["
+
i
+
"] 出错:"
+
ex
.
ToString
());
{
LogUtil
.
debug
(
" 第【"
+
i
+
"】次 GetDIValue ["
+
ioIP
+
"] ["
+
StartAddress
+
"] 出错:"
+
ex
.
ToString
());
}
else
{
LogUtil
.
error
(
" 第【"
+
i
+
"】次 GetDIValue ["
+
ioIP
+
"] ["
+
StartAddress
+
"] 出错:"
+
ex
.
ToString
());
}
}
}
}
}
return
value
;
return
value
;
}
}
public
override
IO_VALUE
GetIOValue
(
ConfigIO
configIO
)
public
override
IO_VALUE
GetIOValue
(
ConfigIO
configIO
)
{
{
IO_VALUE
value
=
IO_VALUE
.
None
;
IO_VALUE
value
=
IO_VALUE
.
LOW
;
try
try
{
{
if
(
configIO
.
ProType
.
Equals
(
ConfigItemType
.
DI
))
if
(
configIO
.
ProType
.
Equals
(
ConfigItemType
.
DI
))
{
{
return
GetDIValue
(
configIO
.
IO_IP
,
0
,
configIO
.
GetIOAddr
());
return
GetDIValue
(
configIO
.
IO_IP
,
configIO
.
SlaveID
,
configIO
.
GetIOAddr
());
}
}
else
if
(
configIO
.
ProType
.
Equals
(
ConfigItemType
.
DO
))
else
if
(
configIO
.
ProType
.
Equals
(
ConfigItemType
.
DO
))
{
{
return
GetDOValue
(
configIO
.
IO_IP
,
0
,
configIO
.
GetIOAddr
());
return
GetDOValue
(
configIO
.
IO_IP
,
configIO
.
SlaveID
,
configIO
.
GetIOAddr
());
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
" GetIOValue ["
+
configIO
.
IO_IP
+
"] ["
+
configIO
.
GetIOAddr
()
+
"] 获取数据出错:"
,
ex
);
LogUtil
.
error
(
" GetIOValue ["
+
configIO
.
IO_IP
+
"] ["
+
configIO
.
GetIOAddr
()
+
"] 获取数据出错:"
+
ex
.
ToString
()
);
}
}
return
value
;
return
value
;
}
}
...
@@ -448,4 +476,5 @@ namespace OnlineStore.DeviceLibrary
...
@@ -448,4 +476,5 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
}
}
\ No newline at end of file
\ No newline at end of file
source/DeviceLibrary/device/IO/HCIOManager.cs
0 → 100644
查看文件 @
1c43d39
using
HuichuanLibrary
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary.IO
{
public
class
HCIOManager
:
IOManager
{
public
override
void
CloseAllConnection
()
{
}
public
override
void
CloseAllDO
()
{
HCBoardManager
.
CloseAllDO
();
}
public
override
void
ConnectionIOList
(
List
<
string
>
dIODeviceNameList
)
{
if
(
dIODeviceNameList
.
Count
>
0
&&
dIODeviceNameList
.
Contains
(
"HC"
))
{
if
(!
HCBoardManager
.
CardInitOk
())
{
HCBoardManager
.
OpenCard
();
}
}
}
public
override
IO_VALUE
GetDIValue
(
string
deviceName
,
byte
slaveID
,
ushort
index
)
{
short
v
=
HCBoardManager
.
GetBitDI
((
short
)
index
);
return
(
IO_VALUE
)
v
;
}
public
override
IO_VALUE
GetDOValue
(
string
deviceName
,
byte
slaveID
,
ushort
index
)
{
short
v
=
HCBoardManager
.
GetBitDO
((
short
)
index
);
return
(
IO_VALUE
)
v
;
}
public
override
IO_VALUE
GetIOValue
(
ConfigIO
configIO
)
{
short
index
=(
short
)
configIO
.
GetIOAddr
();
short
v
=
HCBoardManager
.
GetBitDO
(
index
);
return
(
IO_VALUE
)
v
;
}
public
override
void
ReadAllDI
(
string
deviceName
,
byte
slaveId
)
{
}
public
override
void
ReadAllDO
(
string
deviceName
,
byte
slaveId
)
{
}
public
override
void
WriteSingleDO
(
string
deviceName
,
byte
slaveId
,
ushort
index
,
IO_VALUE
value
,
int
time
)
{
try
{
short
v
=
(
short
)
value
;
HCBoardManager
.
SetBitDO
((
short
)
index
,
v
);
short
targetV
=
0
;
if
(
v
.
Equals
((
short
)
0
))
{
targetV
=
1
;
}
//写入之后,等待指定间隔后回写
System
.
Timers
.
Timer
mytimer
=
new
System
.
Timers
.
Timer
(
time
);
mytimer
.
Elapsed
+=
(
o1
,
e1
)
=>
{
try
{
HCBoardManager
.
SetBitDO
((
short
)
index
,
targetV
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"**********定时回写入 出错:"
+
ex
.
StackTrace
);
}
};
mytimer
.
AutoReset
=
false
;
mytimer
.
Enabled
=
true
;
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"AIO WriteSingleDO ["
+
index
+
"] 出错:"
+
ex
.
ToString
());
}
}
public
override
void
WriteSingleDO
(
string
deviceName
,
byte
slaveId
,
ushort
index
,
IO_VALUE
value
)
{
short
v
=
(
short
)
value
;
HCBoardManager
.
SetBitDO
((
short
)
index
,
v
);
}
}
}
source/DeviceLibrary/device/IO/IOManager.cs
查看文件 @
1c43d39
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.DeviceLibrary.IO
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -18,11 +19,15 @@ namespace OnlineStore.DeviceLibrary
...
@@ -18,11 +19,15 @@ namespace OnlineStore.DeviceLibrary
#
region
KNDIO
#
region
KNDIO
public
static
void
IOMove
(
string
ioType
,
IO_VALUE
ioValue
,
int
subType
)
public
static
void
IOMove
(
string
ioType
,
IO_VALUE
ioValue
,
int
subType
)
{
{
if
(
string
.
IsNullOrEmpty
(
ioType
))
{
return
;
}
ConfigIO
configIo
=
GetDO
(
ioType
,
subType
);
ConfigIO
configIo
=
GetDO
(
ioType
,
subType
);
if
(
configIo
!=
null
)
if
(
configIo
!=
null
)
{
{
instance
.
WriteSingleDO
(
configIo
.
IO_IP
,
0
,
configIo
.
GetIOAddr
(),
ioValue
);
instance
.
WriteSingleDO
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
(),
ioValue
);
Thread
.
Sleep
(
1
);
Thread
.
Sleep
(
1
0
);
}
}
else
else
{
{
...
@@ -32,7 +37,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -32,7 +37,11 @@ namespace OnlineStore.DeviceLibrary
public
static
IO_VALUE
IOValue
(
string
ioType
,
int
subType
)
public
static
IO_VALUE
IOValue
(
string
ioType
,
int
subType
)
{
{
IO_VALUE
ioValue
=
IO_VALUE
.
LOW
;
if
(
string
.
IsNullOrEmpty
(
ioType
))
{
return
IO_VALUE
.
None
;
}
IO_VALUE
ioValue
=
IO_VALUE
.
None
;
ConfigIO
configIo
=
GetDI
(
ioType
,
subType
);
ConfigIO
configIo
=
GetDI
(
ioType
,
subType
);
if
(
configIo
==
null
)
if
(
configIo
==
null
)
{
{
...
@@ -43,12 +52,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -43,12 +52,11 @@ namespace OnlineStore.DeviceLibrary
{
{
if
(
configIo
.
ProType
.
Equals
(
ConfigItemType
.
DI
))
if
(
configIo
.
ProType
.
Equals
(
ConfigItemType
.
DI
))
{
{
ioValue
=
instance
.
GetDIValue
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
());
ioValue
=
instance
.
GetDIValue
(
configIo
.
IO_IP
,
0
,
configIo
.
GetIOAddr
());
}
}
else
else
{
{
ioValue
=
instance
.
GetDOValue
(
configIo
.
IO_IP
,
0
,
configIo
.
GetIOAddr
());
ioValue
=
instance
.
GetDOValue
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
());
}
}
}
}
else
else
...
@@ -57,14 +65,18 @@ namespace OnlineStore.DeviceLibrary
...
@@ -57,14 +65,18 @@ namespace OnlineStore.DeviceLibrary
}
}
return
ioValue
;
return
ioValue
;
}
}
public
static
IO_VALUE
DOValue
(
string
ioType
,
int
subType
=
0
)
public
static
IO_VALUE
DOValue
(
string
ioType
,
int
subType
)
{
{
IO_VALUE
ioValue
=
IO_VALUE
.
LOW
;
if
(
string
.
IsNullOrEmpty
(
ioType
))
{
return
IO_VALUE
.
None
;
}
IO_VALUE
ioValue
=
IO_VALUE
.
None
;
ConfigIO
configIo
=
GetDO
(
ioType
,
subType
);
ConfigIO
configIo
=
GetDO
(
ioType
,
subType
);
if
(
configIo
!=
null
)
if
(
configIo
!=
null
)
{
{
ioValue
=
instance
.
GetDOValue
(
configIo
.
IO_IP
,
0
,
configIo
.
GetIOAddr
());
ioValue
=
instance
.
GetDOValue
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
());
}
}
else
else
{
{
...
@@ -72,7 +84,34 @@ namespace OnlineStore.DeviceLibrary
...
@@ -72,7 +84,34 @@ namespace OnlineStore.DeviceLibrary
}
}
return
ioValue
;
return
ioValue
;
}
}
private
static
ConfigIO
GetDI
(
string
ioType
,
int
subType
)
public
static
IO_VALUE
DIValue
(
string
ioType
,
int
subType
)
{
if
(
string
.
IsNullOrEmpty
(
ioType
))
{
return
IO_VALUE
.
None
;
}
IO_VALUE
ioValue
=
IO_VALUE
.
None
;
ConfigIO
configIo
=
GetDI
(
ioType
,
subType
);
if
(
configIo
!=
null
)
{
ioValue
=
instance
.
GetDIValue
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
());
}
else
{
LogUtil
.
error
(
"未找到 DI ["
+
ioType
+
"]["
+
subType
+
"]"
);
}
return
ioValue
;
}
internal
static
ConfigIO
GetIO
(
string
ioType
,
int
subType
)
{
ConfigIO
configIo
=
GetDI
(
ioType
,
subType
);
if
(
configIo
==
null
)
{
configIo
=
GetDO
(
ioType
,
subType
);
}
return
configIo
;
}
internal
static
ConfigIO
GetDI
(
string
ioType
,
int
subType
)
{
{
ConfigIO
configIo
=
null
;
ConfigIO
configIo
=
null
;
if
(
subType
<=
0
)
if
(
subType
<=
0
)
...
@@ -84,19 +123,25 @@ namespace OnlineStore.DeviceLibrary
...
@@ -84,19 +123,25 @@ namespace OnlineStore.DeviceLibrary
}
}
else
else
{
{
if
(
StoreManager
.
A
llConfigMap
.
ContainsKey
(
subType
))
if
(
StoreManager
.
a
llConfigMap
.
ContainsKey
(
subType
))
{
{
string
newType
=
ioType
.
Replace
(
"SW1_"
,
"SW_"
).
Replace
(
"SW2_"
,
"SW_"
).
Replace
(
"SW3_"
,
"SW_"
).
Replace
(
"SW4_"
,
"SW_"
);
if
(
StoreManager
.
allConfigMap
[
subType
].
DIList
.
ContainsKey
(
ioType
))
if
(
StoreManager
.
AllConfigMap
[
subType
].
DIList
.
ContainsKey
(
newType
))
{
{
return
StoreManager
.
AllConfigMap
[
subType
].
DIList
[
new
Type
];
return
StoreManager
.
allConfigMap
[
subType
].
DIList
[
io
Type
];
}
}
}
}
}
}
if
(
configIo
==
null
&&
subType
>
0
)
{
if
(
StoreManager
.
Config
.
DIList
.
ContainsKey
(
ioType
))
{
return
StoreManager
.
Config
.
DIList
[
ioType
];
}
}
return
configIo
;
return
configIo
;
}
}
private
static
ConfigIO
GetDO
(
string
ioType
,
int
subType
)
internal
static
ConfigIO
GetDO
(
string
ioType
,
int
subType
)
{
{
ConfigIO
configIo
=
null
;
ConfigIO
configIo
=
null
;
if
(
subType
<=
0
)
if
(
subType
<=
0
)
...
@@ -108,48 +153,44 @@ namespace OnlineStore.DeviceLibrary
...
@@ -108,48 +153,44 @@ namespace OnlineStore.DeviceLibrary
}
}
else
else
{
{
if
(
StoreManager
.
A
llConfigMap
.
ContainsKey
(
subType
))
if
(
StoreManager
.
a
llConfigMap
.
ContainsKey
(
subType
))
{
{
string
newType
=
ioType
.
Replace
(
"SW1_"
,
"SW_"
).
Replace
(
"SW2_"
,
"SW_"
).
Replace
(
"SW3_"
,
"SW_"
).
Replace
(
"SW4_"
,
"SW_"
);
if
(
StoreManager
.
allConfigMap
[
subType
].
DOList
.
ContainsKey
(
ioType
))
if
(
StoreManager
.
AllConfigMap
[
subType
].
DOList
.
ContainsKey
(
newType
))
{
{
return
StoreManager
.
AllConfigMap
[
subType
].
DOList
[
new
Type
];
return
StoreManager
.
allConfigMap
[
subType
].
DOList
[
io
Type
];
}
}
}
}
}
}
return
configIo
;
if
(
configIo
==
null
&&
subType
>
0
)
}
public
static
void
CloseDeviceDO
(
List
<
ConfigIO
>
DoList
)
{
foreach
(
ConfigIO
io
in
DoList
)
{
{
instance
.
WriteSingleDO
(
io
.
IO_IP
,
0
,
io
.
GetIOAddr
(),
IO_VALUE
.
LOW
);
if
(
StoreManager
.
Config
.
DOList
.
ContainsKey
(
ioType
))
Thread
.
Sleep
(
60
);
{
return
StoreManager
.
Config
.
DOList
[
ioType
];
}
}
}
return
configIo
;
}
}
public
static
void
CloseDeviceDO
(
int
subType
)
#
endregion
public
static
void
Init
()
{
{
List
<
ConfigIO
>
DoList
=
new
List
<
ConfigIO
>(
);
bool
UseHCBoard
=
true
;
// ConfigAppSettings.GetIntValue(Setting_Init.UseHCBoard).Equals(1
);
if
(
subType
<=
0
)
if
(
UseHCBoard
)
{
{
DoList
=
new
List
<
ConfigIO
>(
StoreManager
.
Config
.
DOList
.
Values
);
instance
=
new
HCIOManager
(
);
}
}
else
else
{
{
if
(
StoreManager
.
AllConfigMap
.
ContainsKey
(
subType
)
)
bool
isAIOBox
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
UseAIOBOX
).
Equals
(
1
);
if
(
isAIOBox
)
{
{
DoList
=
new
List
<
ConfigIO
>(
StoreManager
.
AllConfigMap
[
subType
].
DOList
.
Values
);
instance
=
new
AIOBOXManager
(
);
}
}
//else
//{
// instance = new KNDManager();
//}
}
}
CloseDeviceDO
(
DoList
);
}
#
endregion
public
static
void
Init
()
{
instance
=
new
AIOBOXManager
();
}
}
public
abstract
void
ReadAllDI
(
string
deviceName
,
byte
slaveId
);
public
abstract
void
ReadAllDI
(
string
deviceName
,
byte
slaveId
);
public
abstract
void
ReadAllDO
(
string
deviceName
,
byte
slaveId
);
public
abstract
void
ReadAllDO
(
string
deviceName
,
byte
slaveId
);
...
@@ -158,11 +199,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -158,11 +199,11 @@ namespace OnlineStore.DeviceLibrary
public
abstract
void
WriteSingleDO
(
string
deviceName
,
byte
slaveId
,
ushort
index
,
IO_VALUE
value
);
public
abstract
void
WriteSingleDO
(
string
deviceName
,
byte
slaveId
,
ushort
index
,
IO_VALUE
value
);
public
abstract
IO_VALUE
GetDIValue
(
string
deviceName
,
byte
slaveID
,
ushort
v
);
public
abstract
IO_VALUE
GetDIValue
(
string
deviceName
,
byte
slaveID
,
ushort
index
);
public
abstract
IO_VALUE
GetDOValue
(
string
deviceName
,
byte
slaveID
,
ushort
v
);
public
abstract
IO_VALUE
GetDOValue
(
string
deviceName
,
byte
slaveID
,
ushort
index
);
public
abstract
IO_VALUE
GetIOValue
(
ConfigIO
configIO
);
public
abstract
IO_VALUE
GetIOValue
(
ConfigIO
configIO
);
...
...
source/DeviceLibrary/duoStore/AxisBean.cs
查看文件 @
1c43d39
using
DeviceLib
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -14,41 +13,43 @@ namespace OnlineStore.DeviceLibrary
...
@@ -14,41 +13,43 @@ namespace OnlineStore.DeviceLibrary
{
{
public
ConfigMoveAxis
Config
=
null
;
public
ConfigMoveAxis
Config
=
null
;
public
static
int
TimeoutInterval
=
500
;
public
static
int
TimeoutInterval
=
500
;
/// <summary>
/// 正常工作过程中判断位置是否到达时使用
/// </summary>
public
int
LastPosition
=
0
;
public
int
LastPosition
=
0
;
public
string
AxisName
;
public
string
AxisName
;
public
AxisBean
(
ConfigMoveAxis
axisConfig
,
string
deviceName
)
public
AxisBean
(
ConfigMoveAxis
axisConfig
,
string
deviceName
)
{
{
this
.
Config
=
axisConfig
;
this
.
Config
=
axisConfig
;
AxisName
=
"["
+
Config
.
Explain
+
"_"
+
Config
.
DeviceName
+
"_
"
+
Config
.
GetAxisValue
()
+
"]"
;
AxisName
=
deviceName
+
" "
+
Config
.
Explain
+
"["
+
Config
.
DeviceName
+
"-
"
+
Config
.
GetAxisValue
()
+
"]"
;
}
}
private
bool
IsIntSlvBlock
=
false
;
private
bool
IsIntSlvBlock
=
false
;
public
bool
Open
(
bool
isCheck
,
out
string
Msg
)
public
bool
Open
(
bool
isCheck
,
out
string
Msg
)
{
{
Msg
=
""
;
Msg
=
""
;
string
portName
=
Config
.
DeviceName
;
string
portName
=
Config
.
DeviceName
;
in
t
slvAddr
=
Config
.
GetAxisValue
();
shor
t
slvAddr
=
Config
.
GetAxisValue
();
//打开所有轴
//打开所有轴
int
bot
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
ACBaudRate
);
AxisManager
.
instance
.
OpenPort
(
Config
.
DeviceName
);
ACServerManager
.
OpenPort
(
Config
.
DeviceName
,
bot
);
Thread
.
Sleep
(
50
);
Thread
.
Sleep
(
50
);
//初始化
//初始化
if
(!
IsIntSlvBlock
)
if
(!
IsIntSlvBlock
)
{
{
A
CServerManager
.
InitSlvAddr
(
portName
,
slvAddr
,
Config
.
TargetSpeed
,
Config
.
AddSpeed
,
Config
.
DelSpeed
);
A
xisManager
.
instance
.
InitSlvAddr
(
portName
,
slvAddr
,
Config
.
TargetSpeed
,
Config
.
AddSpeed
,
Config
.
DelSpeed
);
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
100
);
}
}
A
CServerManager
.
AlarmClear
(
portName
,
slvAddr
);
A
xisManager
.
instance
.
AlarmClear
(
portName
,
slvAddr
);
Thread
.
Sleep
(
10
0
);
Thread
.
Sleep
(
5
0
);
A
CServerManager
.
ServoOn
(
portName
,
slvAddr
);
A
xisManager
.
instance
.
ServoOn
(
portName
,
slvAddr
);
Thread
.
Sleep
(
1000
);
//打开所有轴
//打开所有轴
if
(
isCheck
)
if
(
isCheck
)
{
{
Thread
.
Sleep
(
1000
);
if
(!
OpenAxis
(
out
Msg
))
if
(!
AxisIsOpen
(
out
Msg
))
{
{
return
false
;
return
false
;
}
}
...
@@ -56,33 +57,36 @@ namespace OnlineStore.DeviceLibrary
...
@@ -56,33 +57,36 @@ namespace OnlineStore.DeviceLibrary
IsIntSlvBlock
=
true
;
IsIntSlvBlock
=
true
;
return
true
;
return
true
;
}
}
/// <summary>
public
bool
AxisIsOpen
(
out
string
msg
)
/// 打开所有轴
/// </summary>
/// <returns></returns>
private
bool
OpenAxis
(
out
string
msg
)
{
{
msg
=
""
;
msg
=
""
;
//判断轴是否正常
//判断轴是否正常
string
portName
=
Config
.
DeviceName
;
string
portName
=
Config
.
DeviceName
;
in
t
slvAddr
=
Config
.
GetAxisValue
();
shor
t
slvAddr
=
Config
.
GetAxisValue
();
if
(
A
CServerManager
.
ServerOnStatus
(
portName
,
slvAddr
))
if
(
A
xisManager
.
instance
.
IsServeoOn
(
portName
,
slvAddr
))
{
{
LogUtil
.
info
(
AxisName
+
"成功打开"
);
LogUtil
.
info
(
AxisName
+
"成功打开"
);
}
}
else
else
{
{
//清理报警,再重新打开一次
//清理报警,再重新打开一次
LogUtil
.
info
(
AxisName
+
"
打开失败,清理报警,重新打开
"
);
LogUtil
.
info
(
AxisName
+
"
第一次打开失败,先清理一下报警,再重新打开一次
"
);
A
CServerManager
.
AlarmClear
(
portName
,
slvAddr
);
A
xisManager
.
instance
.
AlarmClear
(
portName
,
slvAddr
);
System
.
Threading
.
Thread
.
Sleep
(
1200
);
System
.
Threading
.
Thread
.
Sleep
(
1200
);
A
CServerManager
.
ServoOn
(
portName
,
slvAddr
);
A
xisManager
.
instance
.
ServoOn
(
portName
,
slvAddr
);
System
.
Threading
.
Thread
.
Sleep
(
3
00
);
System
.
Threading
.
Thread
.
Sleep
(
1
00
);
if
(
A
CServerManager
.
ServerOnStatus
(
portName
,
slvAddr
))
if
(
A
xisManager
.
instance
.
IsServeoOn
(
portName
,
slvAddr
))
{
{
LogUtil
.
info
(
AxisName
+
"
重新打开成功"
);
LogUtil
.
info
(
AxisName
+
"
清理报警后重新打卡轴成功:"
+
Config
.
Explain
);
}
}
else
else
{
{
A
CServerManager
.
ServoOff
(
portName
,
slvAddr
);
A
xisManager
.
instance
.
ServoOff
(
portName
,
slvAddr
);
msg
=
AxisName
+
"打开
失败 "
;
msg
=
"打开轴"
+
Config
.
Explain
+
"
失败 "
;
LogUtil
.
info
(
AxisName
+
msg
);
LogUtil
.
info
(
AxisName
+
msg
);
return
false
;
return
false
;
}
}
...
@@ -93,16 +97,19 @@ namespace OnlineStore.DeviceLibrary
...
@@ -93,16 +97,19 @@ namespace OnlineStore.DeviceLibrary
public
void
ServoOff
()
public
void
ServoOff
()
{
{
LogUtil
.
info
(
"ServoOff【"
+
AxisName
+
"】"
);
LogUtil
.
info
(
"ServoOff【"
+
AxisName
+
"】"
);
A
CServerManager
.
ServoOff
(
Config
.
DeviceName
,
Config
.
GetAxisValue
());
A
xisManager
.
instance
.
ServoOff
(
Config
.
DeviceName
,
Config
.
GetAxisValue
());
}
}
public
void
HomeMove
(
StoreMoveInfo
MoveInfo
)
public
void
HomeMove
(
StoreMoveInfo
MoveInfo
)
{
{
Config
.
TargetPosition
=
0
;
Config
.
TargetPosition
=
0
;
LogUtil
.
info
(
AxisName
+
"speed["
+
Config
.
TargetSpeed
+
"]开始原点返回"
);
LogUtil
.
info
(
AxisName
+
"speed["
+
Config
.
TargetSpeed
+
"]开始原点返回"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAxis
(
Config
,
true
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAxis
(
Config
,
true
));
A
CServerManager
.
HomeMove
(
Config
.
DeviceName
,
(
short
)
Config
.
GetAxisValue
(),
Config
.
HomeHigh
Speed
);
A
xisManager
.
instance
.
HomeMove
(
Config
.
DeviceName
,
(
short
)
Config
.
GetAxisValue
(),
Config
.
HomeHighSpeed
,
Config
.
HomeLowSpeed
,
Config
.
HomeAdd
Speed
);
}
}
/// <summary>
/// 松下伺服电机运动
/// </summary>
public
void
AbsMove
(
StoreMoveInfo
MoveInfo
,
int
targetPosition
,
int
targetSpeed
)
public
void
AbsMove
(
StoreMoveInfo
MoveInfo
,
int
targetPosition
,
int
targetSpeed
)
{
{
if
(
MoveInfo
==
null
)
if
(
MoveInfo
==
null
)
...
@@ -113,18 +120,21 @@ namespace OnlineStore.DeviceLibrary
...
@@ -113,18 +120,21 @@ namespace OnlineStore.DeviceLibrary
{
{
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAxis
(
Config
,
targetPosition
,
targetSpeed
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAxis
(
Config
,
targetPosition
,
targetSpeed
));
Config
.
TargetPosition
=
targetPosition
;
Config
.
TargetPosition
=
targetPosition
;
A
CServerManager
.
AbsMove
(
Config
.
DeviceName
,
Config
.
GetAxisValue
(),
targetPosition
,
target
Speed
);
A
xisManager
.
instance
.
AbsMove
(
Config
.
DeviceName
,
Config
.
GetAxisValue
(),
targetPosition
,
targetSpeed
,
Config
.
AddSpeed
,
Config
.
Del
Speed
);
}
}
}
}
/// <summary>
/// 判断AC伺服电机轴是否运动完成
/// </summary>
public
static
bool
ACAxisMoveIsEnd
(
StoreMoveInfo
MoveInfo
,
ConfigMoveAxis
axis
,
int
targetPosition
,
int
targetSpeed
,
out
string
msg
)
public
static
bool
ACAxisMoveIsEnd
(
StoreMoveInfo
MoveInfo
,
ConfigMoveAxis
axis
,
int
targetPosition
,
int
targetSpeed
,
out
string
msg
)
{
{
msg
=
""
;
msg
=
""
;
string
deviceName
=
axis
.
DeviceName
;
string
deviceName
=
axis
.
DeviceName
;
short
axisNo
=
axis
.
GetAxisValue
();
short
axisNo
=
axis
.
GetAxisValue
();
bool
isOk
=
A
CServerManager
.
GetBusyStatus
(
deviceName
,
axisNo
).
Equals
(
0
);
bool
isOk
=
A
xisManager
.
instance
.
GetBusyStatus
(
deviceName
,
axisNo
).
Equals
(
0
);
int
outCount
=
A
CServerManager
.
GetActualtPosition
(
deviceName
,
axisNo
);
int
outCount
=
A
xisManager
.
instance
.
GetActualtPosition
(
deviceName
,
axisNo
);
int
errorCount
=
Math
.
Abs
(
outCount
-
targetPosition
);
int
errorCount
=
Math
.
Abs
(
outCount
-
targetPosition
);
if
(
isOk
)
if
(
isOk
)
{
{
...
@@ -139,32 +149,32 @@ namespace OnlineStore.DeviceLibrary
...
@@ -139,32 +149,32 @@ namespace OnlineStore.DeviceLibrary
//判断轴是否报警
//判断轴是否报警
if
(
MoveInfo
.
CanWhileCount
<=
3
)
if
(
MoveInfo
.
CanWhileCount
<=
3
)
{
{
int
isAlarm
=
A
CServerManager
.
GetAlarmStatus
(
deviceName
,
axisNo
);
int
isAlarm
=
A
xisManager
.
instance
.
GetAlarmStatus
(
deviceName
,
axisNo
);
if
(
isAlarm
.
Equals
(
1
))
if
(
isAlarm
.
Equals
(
1
))
{
{
clearMsg
=
"清理报警,"
;
clearMsg
=
"清理报警,"
;
A
CServerManager
.
AlarmClear
(
deviceName
,
axisNo
);
A
xisManager
.
instance
.
AlarmClear
(
deviceName
,
axisNo
);
Thread
.
Sleep
(
200
);
Thread
.
Sleep
(
200
);
A
CServerManager
.
ServoOn
(
deviceName
,
axisNo
);
A
xisManager
.
instance
.
ServoOn
(
deviceName
,
axisNo
);
Thread
.
Sleep
(
500
);
Thread
.
Sleep
(
500
);
}
}
}
}
if
(
String
.
IsNullOrEmpty
(
clearMsg
))
if
(
String
.
IsNullOrEmpty
(
clearMsg
))
{
{
A
CServerManager
.
SuddenStop
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
A
xisManager
.
instance
.
SuddenStop
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
100
);
}
}
LogUtil
.
error
(
MoveInfo
.
Name
+
axis
.
DisplayStr
+
"目标位置["
+
targetPosition
+
"]当前位置["
+
outCount
+
LogUtil
.
error
(
MoveInfo
.
Name
+
axis
.
DisplayStr
+
"目标位置["
+
targetPosition
+
"]当前位置["
+
outCount
+
"],误差过大,"
+
clearMsg
+
"重新开始运动,剩余["
+
MoveInfo
.
CanWhileCount
+
"]次"
);
"],误差过大,"
+
clearMsg
+
"重新开始运动,剩余["
+
MoveInfo
.
CanWhileCount
+
"]次"
);
A
CServerManager
.
AbsMove
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
targetPosition
,
target
Speed
);
A
xisManager
.
instance
.
AbsMove
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
targetPosition
,
targetSpeed
,
axis
.
AddSpeed
,
axis
.
Del
Speed
);
MoveInfo
.
CanWhileCount
--;
MoveInfo
.
CanWhileCount
--;
Thread
.
Sleep
(
200
);
Thread
.
Sleep
(
200
);
}
}
else
else
{
{
msg
=
" "
+
MoveInfo
.
MoveStep
+
MoveInfo
.
Name
+
axis
.
DisplayStr
+
",目标位置["
+
targetPosition
+
"]当前位置["
+
outCount
msg
=
" "
+
MoveInfo
.
SLog
+
MoveInfo
.
Name
+
axis
.
DisplayStr
+
",目标位置["
+
targetPosition
+
"]当前位置["
+
outCount
+
"],误差过大,需要报警"
;
+
"],误差过大,需要报警"
;
LogUtil
.
error
(
msg
,
MoveInfo
.
ErrorLogType
);
LogUtil
.
error
(
msg
,
600
);
}
}
}
}
return
false
;
return
false
;
...
@@ -172,10 +182,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -172,10 +182,10 @@ namespace OnlineStore.DeviceLibrary
public
static
bool
HomeMoveIsEnd
(
StoreMoveInfo
MoveInfo
,
ConfigMoveAxis
axis
,
out
string
msg
)
public
static
bool
HomeMoveIsEnd
(
StoreMoveInfo
MoveInfo
,
ConfigMoveAxis
axis
,
out
string
msg
)
{
{
msg
=
""
;
msg
=
""
;
if
(
A
CServerManager
.
IsHomeMoveEnd
(
axis
.
DeviceName
,
axis
.
GetAxisValue
()))
if
(
A
xisManager
.
instance
.
IsHomeMoveEnd
(
axis
.
DeviceName
,
axis
.
GetAxisValue
()))
{
{
//原点完成并且位置=0
//原点完成并且位置=0
int
outCount
=
A
CServerManager
.
GetActualtPosition
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
int
outCount
=
A
xisManager
.
instance
.
GetActualtPosition
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
int
errorCount
=
Math
.
Abs
(
outCount
);
int
errorCount
=
Math
.
Abs
(
outCount
);
if
(
errorCount
<=
axis
.
CanErrorCountMax
)
if
(
errorCount
<=
axis
.
CanErrorCountMax
)
{
{
...
@@ -186,12 +196,12 @@ namespace OnlineStore.DeviceLibrary
...
@@ -186,12 +196,12 @@ namespace OnlineStore.DeviceLibrary
{
{
LogUtil
.
error
(
MoveInfo
.
Name
+
axis
.
DisplayStr
+
"收到原点完成信号,当前位置["
+
outCount
+
"],重新回原点,剩余["
+
MoveInfo
.
CanWhileCount
+
"]次"
);
LogUtil
.
error
(
MoveInfo
.
Name
+
axis
.
DisplayStr
+
"收到原点完成信号,当前位置["
+
outCount
+
"],重新回原点,剩余["
+
MoveInfo
.
CanWhileCount
+
"]次"
);
//LogUtil.error( StoreName + moveAxis.DisplayStr + "重新回原点");
//LogUtil.error( StoreName + moveAxis.DisplayStr + "重新回原点");
A
CServerManager
.
HomeMove
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
axis
.
HomeHighSpeed
,
true
);
A
xisManager
.
instance
.
HomeMove
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
axis
.
HomeHighSpeed
,
axis
.
HomeLowSpeed
,
axis
.
HomeAddSpeed
);
MoveInfo
.
CanWhileCount
--;
MoveInfo
.
CanWhileCount
--;
}
}
else
else
{
{
msg
=
MoveInfo
.
Name
+
" "
+
MoveInfo
.
MoveStep
+
axis
.
DisplayStr
+
",收到原点完成信号,当前位置["
+
outCount
+
"],误差过大,需要报警"
;
msg
=
MoveInfo
.
Name
+
" "
+
MoveInfo
.
SLog
+
axis
.
DisplayStr
+
",收到原点完成信号,当前位置["
+
outCount
+
"],误差过大,需要报警"
;
LogUtil
.
error
(
msg
);
LogUtil
.
error
(
msg
);
}
}
}
}
...
@@ -200,7 +210,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -200,7 +210,7 @@ namespace OnlineStore.DeviceLibrary
public
int
GetAclPosition
()
public
int
GetAclPosition
()
{
{
int
p
=
A
CServerManager
.
GetActualtPosition
(
Config
.
DeviceName
,
Config
.
GetAxisValue
());
int
p
=
A
xisManager
.
instance
.
GetActualtPosition
(
Config
.
DeviceName
,
Config
.
GetAxisValue
());
return
p
;
return
p
;
}
}
public
bool
IsInPosition
(
int
targetP
)
public
bool
IsInPosition
(
int
targetP
)
...
@@ -214,6 +224,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -214,6 +224,9 @@ namespace OnlineStore.DeviceLibrary
}
}
return
false
;
return
false
;
}
}
/// <summary>
/// 绝对运动至点,不等待结果
/// </summary>
private
void
AbsMove
(
int
targetPos
,
double
targetSpeed
)
private
void
AbsMove
(
int
targetPos
,
double
targetSpeed
)
{
{
if
(
targetPos
.
Equals
(-
1
))
if
(
targetPos
.
Equals
(-
1
))
...
@@ -230,23 +243,15 @@ namespace OnlineStore.DeviceLibrary
...
@@ -230,23 +243,15 @@ namespace OnlineStore.DeviceLibrary
{
{
targetSpeed
=
Config
.
TargetSpeed
*
targetSpeed
;
targetSpeed
=
Config
.
TargetSpeed
*
targetSpeed
;
}
}
A
CServerManager
.
AbsMove
(
Config
.
DeviceName
,
Config
.
GetAxisValue
(),
targetPos
,
(
int
)
target
Speed
);
A
xisManager
.
instance
.
AbsMove
(
Config
.
DeviceName
,
Config
.
GetAxisValue
(),
targetPos
,
(
int
)
targetSpeed
,
Config
.
AddSpeed
,
Config
.
Del
Speed
);
}
}
public
void
SuddenStop
(
bool
needCheck
=
false
)
public
void
SuddenStop
()
{
{
if
(
needCheck
)
AxisManager
.
instance
.
SuddenStop
(
Config
.
DeviceName
,
Config
.
GetAxisValue
());
{
if
(
ACServerManager
.
GetBusyStatus
(
Config
.
DeviceName
,
Config
.
GetAxisValue
()).
Equals
(
0
))
{
return
;
}
}
ACServerManager
.
SuddenStop
(
Config
.
DeviceName
,
Config
.
GetAxisValue
());
}
}
#
region
匀速上升处理
#
region
匀速上升处理
private
System
.
Timers
.
Timer
axisCheckTimer
=
null
;
private
System
.
Timers
.
Timer
axisCheckTimer
=
null
;
internal
string
TargetIoType
=
""
;
internal
string
TargetIoType
=
""
;
...
@@ -313,3 +318,4 @@ namespace OnlineStore.DeviceLibrary
...
@@ -313,3 +318,4 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
source/DeviceLibrary/duoStore/BoxBean.cs
查看文件 @
1c43d39
using
Asa
;
using
Asa
;
using
DeviceLib
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System
;
...
@@ -224,7 +222,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -224,7 +222,7 @@ namespace OnlineStore.DeviceLibrary
case
StoreMoveStep
.
BOX_H02_InoutToP1
:
case
StoreMoveStep
.
BOX_H02_InoutToP1
:
//如果此时轴三还在报警,需要提示错误并等待
//如果此时轴三还在报警,需要提示错误并等待
if
(
A
CServerManager
.
GetAlarmStatus
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
())
>
0
)
if
(
A
xisManager
.
instance
.
GetAlarmStatus
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
())
>
0
)
{
{
LogUtil
.
error
(
Name
+
MoveInfo
.
MoveType
+
"复位失败: "
+
Config
.
InOut_Axis
.
Explain
+
"报警"
);
LogUtil
.
error
(
Name
+
MoveInfo
.
MoveType
+
"复位失败: "
+
Config
.
InOut_Axis
.
Explain
+
"报警"
);
WarnMsg
=
Name
+
"复位失败: "
+
Config
.
InOut_Axis
.
Explain
+
"报警"
;
WarnMsg
=
Name
+
"复位失败: "
+
Config
.
InOut_Axis
.
Explain
+
"报警"
;
...
@@ -370,10 +368,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -370,10 +368,10 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
EndMove
();
MoveInfo
.
EndMove
();
IOMove
(
IO_Type
.
UpdownAxis_Break
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
UpdownAxis_Break
,
IO_VALUE
.
LOW
);
//运动版停止
//运动版停止
MiddleAxis
.
SuddenStop
(
true
);
MiddleAxis
.
SuddenStop
();
UpdownAxis
.
SuddenStop
(
true
);
UpdownAxis
.
SuddenStop
();
InoutAxis
.
SuddenStop
(
true
);
InoutAxis
.
SuddenStop
();
ComAxis
.
SuddenStop
(
true
);
ComAxis
.
SuddenStop
();
CloseAllAxis
();
CloseAllAxis
();
LogInfo
(
"StopMove"
);
LogInfo
(
"StopMove"
);
isInPro
=
false
;
isInPro
=
false
;
...
...
source/DeviceLibrary/duoStore/BoxBean_Partial.cs
查看文件 @
1c43d39
using
Asa
;
using
Asa
;
using
DeviceLib
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System
;
...
@@ -20,7 +19,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -20,7 +19,7 @@ namespace OnlineStore.DeviceLibrary
#
region
出入库结果验证
#
region
出入库结果验证
private
bool
AcInPosition
(
ConfigMoveAxis
axis
,
int
p
)
private
bool
AcInPosition
(
ConfigMoveAxis
axis
,
int
p
)
{
{
return
A
CServerManager
.
isInPosition
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
p
,
axis
.
CanErrorCountMax
);
return
A
xisManager
.
instance
.
isInPosition
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
p
,
axis
.
CanErrorCountMax
);
}
}
private
static
DateTime
lastComRHomeTime
=
DateTime
.
Now
;
private
static
DateTime
lastComRHomeTime
=
DateTime
.
Now
;
...
...
source/DeviceLibrary/duoStore/DUOStoreBean.cs
查看文件 @
1c43d39
...
@@ -294,7 +294,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -294,7 +294,6 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
}
}
public
override
void
StopMove
()
public
override
void
StopMove
()
{
{
foreach
(
BoxBean
equip
in
this
.
BoxMap
.
Values
)
foreach
(
BoxBean
equip
in
this
.
BoxMap
.
Values
)
...
@@ -304,16 +303,14 @@ namespace OnlineStore.DeviceLibrary
...
@@ -304,16 +303,14 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
EndMove
();
MoveInfo
.
EndMove
();
hoisterCylinder
.
Stop
();
hoisterCylinder
.
Stop
();
//轴运动停止
//轴运动停止
T3_UpdownAxis
.
SuddenStop
(
true
);
T3_UpdownAxis
.
SuddenStop
();
T2_MiddleAxis
.
SuddenStop
(
true
);
T2_MiddleAxis
.
SuddenStop
();
T1_BatchAxis
.
SuddenStop
(
true
);
T1_BatchAxis
.
SuddenStop
();
CloseAllAxis
();
CloseAllAxis
();
LineStop
();
LineStop
();
}
}
public
override
void
StopRun
()
public
override
void
StopRun
()
{
{
mainTimer
.
Enabled
=
false
;
mainTimer
.
Enabled
=
false
;
...
@@ -323,7 +320,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -323,7 +320,7 @@ namespace OnlineStore.DeviceLibrary
foreach
(
BoxBean
equip
in
BoxMap
.
Values
)
foreach
(
BoxBean
equip
in
BoxMap
.
Values
)
{
{
equip
.
StopRun
();
equip
.
StopRun
();
}
}
runStatus
=
StoreRunStatus
.
Wait
;
runStatus
=
StoreRunStatus
.
Wait
;
// RFIDManager.Close();
// RFIDManager.Close();
TimeSpan
span
=
DateTime
.
Now
-
StartTime
;
TimeSpan
span
=
DateTime
.
Now
-
StartTime
;
...
@@ -657,7 +654,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -657,7 +654,6 @@ namespace OnlineStore.DeviceLibrary
public
bool
OpenAllAxis
(
bool
isCheck
=
true
)
public
bool
OpenAllAxis
(
bool
isCheck
=
true
)
{
{
if
(
RunMultiAxis
(
isCheck
,
IO_Type
.
MoveAxis_Run
,
IO_Type
.
MoveAxis_Break
,
new
AxisBean
[]{
T3_UpdownAxis
,
T2_MiddleAxis
}))
if
(
RunMultiAxis
(
isCheck
,
IO_Type
.
MoveAxis_Run
,
IO_Type
.
MoveAxis_Break
,
new
AxisBean
[]{
T3_UpdownAxis
,
T2_MiddleAxis
}))
{
{
if
(
RunAxis
(
isCheck
,
T1_BatchAxis
)
)
if
(
RunAxis
(
isCheck
,
T1_BatchAxis
)
)
...
...
source/DeviceLibrary/duoStore/DUOStoreBean_Partial.cs
查看文件 @
1c43d39
using
DeviceLib
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -48,7 +47,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -48,7 +47,7 @@ namespace OnlineStore.DeviceLibrary
{
{
LogUtil
.
debug
(
Name
+
"CheckWaitResult 检测到"
+
T1_BatchAxis
.
TargetIoType
+
"="
+
T1_BatchAxis
.
TargetIoValue
+
",停止运行"
);
LogUtil
.
debug
(
Name
+
"CheckWaitResult 检测到"
+
T1_BatchAxis
.
TargetIoType
+
"="
+
T1_BatchAxis
.
TargetIoValue
+
",停止运行"
);
T1_BatchAxis
.
StopAxisCheckMove
();
T1_BatchAxis
.
StopAxisCheckMove
();
if
(
A
CServerManager
.
GetBusyStatus
(
wait
.
AxisInfo
.
DeviceName
,
wait
.
AxisInfo
.
GetAxisValue
()).
Equals
(
1
))
if
(
A
xisManager
.
instance
.
GetBusyStatus
(
wait
.
AxisInfo
.
DeviceName
,
wait
.
AxisInfo
.
GetAxisValue
()).
Equals
(
1
))
{
{
T1_BatchAxis
.
SuddenStop
();
T1_BatchAxis
.
SuddenStop
();
}
}
...
@@ -56,7 +55,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -56,7 +55,7 @@ namespace OnlineStore.DeviceLibrary
}
}
else
else
{
{
bool
isOk
=
A
CServerManager
.
GetBusyStatus
(
wait
.
AxisInfo
.
DeviceName
,
wait
.
AxisInfo
.
GetAxisValue
()).
Equals
(
0
);
bool
isOk
=
A
xisManager
.
instance
.
GetBusyStatus
(
wait
.
AxisInfo
.
DeviceName
,
wait
.
AxisInfo
.
GetAxisValue
()).
Equals
(
0
);
if
(
isOk
)
if
(
isOk
)
{
{
//TODO 判断是否达到高度,如果未达到,继续上升
//TODO 判断是否达到高度,如果未达到,继续上升
...
...
source/DeviceLibrary/duoStore/EquipBase.cs
查看文件 @
1c43d39
using
DeviceLib
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -147,7 +146,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -147,7 +146,7 @@ namespace OnlineStore.DeviceLibrary
{
{
short
axis
=
axisInfo
.
Config
.
GetAxisValue
();
short
axis
=
axisInfo
.
Config
.
GetAxisValue
();
string
deviceName
=
axisInfo
.
Config
.
GetNameStr
();
string
deviceName
=
axisInfo
.
Config
.
GetNameStr
();
int
value
=
A
CServerManager
.
GetAlarmStatus
(
deviceName
,
axis
);
int
value
=
A
xisManager
.
instance
.
GetAlarmStatus
(
deviceName
,
axis
);
//if (value.Equals(-1))
//if (value.Equals(-1))
//{
//{
// value = ACServerManager.GetAlarmStatus(deviceName, axis);
// value = ACServerManager.GetAlarmStatus(deviceName, axis);
...
...
source/DeviceLibrary/duoStore/StoreManager.cs
查看文件 @
1c43d39
using
DeviceLib
;
using
log4net
;
using
log4net
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System
;
...
@@ -18,7 +17,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -18,7 +17,7 @@ namespace OnlineStore.DeviceLibrary
public
static
DUOStoreBean
Store
=
null
;
public
static
DUOStoreBean
Store
=
null
;
public
static
Store_Config
Config
=
null
;
public
static
Store_Config
Config
=
null
;
public
static
Dictionary
<
int
,
BaseConfig
>
A
llConfigMap
=
null
;
public
static
Dictionary
<
int
,
BaseConfig
>
a
llConfigMap
=
null
;
private
static
bool
isInit
=
false
;
private
static
bool
isInit
=
false
;
public
static
bool
IsConnectServer
=
!
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
).
Equals
(
""
);
public
static
bool
IsConnectServer
=
!
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
).
Equals
(
""
);
public
StoreManager
()
public
StoreManager
()
...
@@ -48,7 +47,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -48,7 +47,7 @@ namespace OnlineStore.DeviceLibrary
{
{
try
try
{
{
A
llConfigMap
=
new
Dictionary
<
int
,
BaseConfig
>();
a
llConfigMap
=
new
Dictionary
<
int
,
BaseConfig
>();
BaseConfig
.
ProIOIpMap
=
new
Dictionary
<
string
,
string
>();
BaseConfig
.
ProIOIpMap
=
new
Dictionary
<
string
,
string
>();
if
(!
isInit
)
if
(!
isInit
)
{
{
...
@@ -77,7 +76,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -77,7 +76,7 @@ namespace OnlineStore.DeviceLibrary
string
linefilePath
=
appPath
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
Store_ConfigPath
);
string
linefilePath
=
appPath
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
Store_ConfigPath
);
Config
=
CSVConfigReader
.
LoadLineConfig
(
0
,
CID
,
"Line"
,
linefilePath
);
Config
=
CSVConfigReader
.
LoadLineConfig
(
0
,
CID
,
"Line"
,
linefilePath
);
A
llConfigMap
.
Add
(
0
,
Config
);
a
llConfigMap
.
Add
(
0
,
Config
);
string
moveEquipConfig
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
BOX_ConfigPath
);
string
moveEquipConfig
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
BOX_ConfigPath
);
for
(
int
i
=
1
;
i
<=
count
;
i
++)
for
(
int
i
=
1
;
i
<=
count
;
i
++)
...
@@ -88,7 +87,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -88,7 +87,7 @@ namespace OnlineStore.DeviceLibrary
string
boxCid
=
ConfigAppSettings
.
GetValue
(
storeIdConfig
);
string
boxCid
=
ConfigAppSettings
.
GetValue
(
storeIdConfig
);
BOX_Config
moveConfig
=
CSVConfigReader
.
LoadBoxConfig
(
i
,
boxCid
,
"BOX"
,
config
);
BOX_Config
moveConfig
=
CSVConfigReader
.
LoadBoxConfig
(
i
,
boxCid
,
"BOX"
,
config
);
moveConfig
.
SetIO
(
i
);
moveConfig
.
SetIO
(
i
);
A
llConfigMap
.
Add
(
i
,
moveConfig
);
a
llConfigMap
.
Add
(
i
,
moveConfig
);
storeConfig
.
Add
(
i
,
moveConfig
);
storeConfig
.
Add
(
i
,
moveConfig
);
}
}
string
positionConfigFile
=
appPath
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
Store_Position_Config
);
string
positionConfigFile
=
appPath
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
Store_Position_Config
);
...
@@ -108,7 +107,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -108,7 +107,6 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
"加载料仓完成!"
);
LogUtil
.
info
(
"加载料仓完成!"
);
}
}
ACServerManager
.
LogEvent
+=
ACServerManager_LogEvent
;
Store
=
new
DUOStoreBean
(
Config
,
storeConfig
);
Store
=
new
DUOStoreBean
(
Config
,
storeConfig
);
}
}
}
}
...
@@ -137,7 +135,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -137,7 +135,7 @@ namespace OnlineStore.DeviceLibrary
{
{
LogUtil
.
error
(
"保存配置文件失败:"
+
configFile
);
LogUtil
.
error
(
"保存配置文件失败:"
+
configFile
);
}
}
A
llConfigMap
[
storeConfig
.
Id
]
=
storeConfig
;
a
llConfigMap
[
storeConfig
.
Id
]
=
storeConfig
;
Store
.
BoxConfigMap
[
storeConfig
.
Id
]
=
storeConfig
;
Store
.
BoxConfigMap
[
storeConfig
.
Id
]
=
storeConfig
;
Store
.
BoxMap
[
storeConfig
.
Id
].
Config
=
storeConfig
;
Store
.
BoxMap
[
storeConfig
.
Id
].
Config
=
storeConfig
;
Store
.
BoxMap
[
storeConfig
.
Id
].
MoveAxisConfig
();
Store
.
BoxMap
[
storeConfig
.
Id
].
MoveAxisConfig
();
...
@@ -176,21 +174,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -176,21 +174,7 @@ namespace OnlineStore.DeviceLibrary
}
}
return
false
;
return
false
;
}
}
private
static
void
ACServerManager_LogEvent
(
InfoType
type
,
string
msg
)
{
if
(
type
.
Equals
(
InfoType
.
Error
))
{
LogUtil
.
error
(
msg
);
}
else
if
(
type
.
Equals
(
InfoType
.
Info
))
{
LogUtil
.
info
(
msg
);
}
else
{
LogUtil
.
debug
(
msg
);
}
}
#
endregion
#
endregion
#
region
位置加载
#
region
位置加载
...
...
source/DeviceLibrary/store/KTK_Store.cs
查看文件 @
1c43d39
using
DeviceLib
;
using
log4net
;
using
log4net
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System
;
...
@@ -458,7 +457,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -458,7 +457,7 @@ namespace OnlineStore.DeviceLibrary
#
region
多个伺服运动
#
region
多个伺服运动
public
bool
RunMultiAxis
(
bool
isCheck
,
string
serverOnDO
,
string
breakOnDO
,
params
AxisBean
[]
axisArray
)
public
bool
RunMultiAxis
(
bool
isCheck
,
params
AxisBean
[]
axisArray
)
{
{
IOManager
.
IOMove
(
serverOnDO
,
IO_VALUE
.
HIGH
,
baseConfig
.
Id
);
IOManager
.
IOMove
(
serverOnDO
,
IO_VALUE
.
HIGH
,
baseConfig
.
Id
);
string
msg
=
""
;
string
msg
=
""
;
...
@@ -474,18 +473,18 @@ namespace OnlineStore.DeviceLibrary
...
@@ -474,18 +473,18 @@ namespace OnlineStore.DeviceLibrary
}
}
Thread
.
Sleep
(
500
);
Thread
.
Sleep
(
500
);
//打开所有轴
//打开所有轴
if
(
isCheck
)
//
if (isCheck)
{
//
{
foreach
(
AxisBean
axis
in
axisArray
)
//
foreach (AxisBean axis in axisArray)
{
//
{
if
(!
axis
.
AxisIsOpen
(
out
msg
))
// if (!axis.OpenAxis
(out msg))
{
//
{
SetWarnMsg
(
Name
+
msg
);
//
SetWarnMsg(Name + msg);
Alarm
(
AlarmType
.
AxisAlarm
);
//
Alarm(AlarmType.AxisAlarm);
return
false
;
//
return false;
}
//
}
}
//
}
}
//
}
IOManager
.
IOMove
(
breakOnDO
,
IO_VALUE
.
HIGH
,
baseConfig
.
Id
);
IOManager
.
IOMove
(
breakOnDO
,
IO_VALUE
.
HIGH
,
baseConfig
.
Id
);
return
true
;
return
true
;
}
}
...
...
source/LoadCVSLibrary/storeConfig/ConfigItemBase.cs
查看文件 @
1c43d39
...
@@ -51,6 +51,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -51,6 +51,7 @@ namespace OnlineStore.LoadCSVLibrary
throw
new
CVSFieldNotMatchingExection
(
ConfigStr
+
",【类型:"
+
ProType
+
"】【名称:"
+
ProName
+
"】【属性值:"
+
ProValue
+
"】必须配置值!"
);
throw
new
CVSFieldNotMatchingExection
(
ConfigStr
+
",【类型:"
+
ProType
+
"】【名称:"
+
ProName
+
"】【属性值:"
+
ProValue
+
"】必须配置值!"
);
}
}
}
}
public
byte
SlaveID
=
0
;
}
}
/// <summary>
/// <summary>
/// 运动轴配置
/// 运动轴配置
...
...
source/LoadCVSLibrary/storeConfig/config/IO_Type.cs
查看文件 @
1c43d39
...
@@ -36,7 +36,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -36,7 +36,7 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// <summary>
/// DI,0,启动,AutoRun_BTN,2,PRO_AOI_IP_1,X03,
/// DI,0,启动,AutoRun_BTN,2,PRO_AOI_IP_1,X03,
/// </summary>
/// </summary>
public
static
string
AutoRun_BTN
=
"AutoRun_BTN"
;
//
public static string AutoRun_BTN = "AutoRun_BTN";
/// <summary>
/// <summary>
/// DI,0,气压检测,Airpressure_Check,3,PRO_AOI_IP_1,X04,
/// DI,0,气压检测,Airpressure_Check,3,PRO_AOI_IP_1,X04,
/// </summary>
/// </summary>
...
@@ -126,22 +126,22 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -126,22 +126,22 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// <summary>
/// DO,1,左侧料仓升降轴刹车ON,UpdownAxis_Break,11,PRO_AOI_IP_1,Y12,
/// DO,1,左侧料仓升降轴刹车ON,UpdownAxis_Break,11,PRO_AOI_IP_1,Y12,
/// </summary>
/// </summary>
public
static
string
UpdownAxis_Break
=
"UpdownAxis_Break"
;
//
public static string UpdownAxis_Break = "UpdownAxis_Break";
/// <summary>
/// <summary>
/// DO,0,提升机构升降轴刹车ON,BatchAxis_Break,13,PRO_AOI_IP_1,Y14,
/// DO,0,提升机构升降轴刹车ON,BatchAxis_Break,13,PRO_AOI_IP_1,Y14,
/// </summary>
/// </summary>
public
static
string
BatchAxis_Break
=
"BatchAxis_Break"
;
//
public static string BatchAxis_Break = "BatchAxis_Break";
/// <summary>
/// <summary>
/// DO,0,移栽机构上下轴刹车ON,MoveAxis_Break,14,PRO_AOI_IP_1,Y15,
/// DO,0,移栽机构上下轴刹车ON,MoveAxis_Break,14,PRO_AOI_IP_1,Y15,
/// </summary>
/// </summary>
public
static
string
MoveAxis_Break
=
"MoveAxis_Break"
;
//
public static string MoveAxis_Break = "MoveAxis_Break";
/// <summary>
/// <summary>
/// DO,1,左侧料仓伺服ON,Axis_Run,15,PRO_AOI_IP_1,Y16,
/// DO,1,左侧料仓伺服ON,Axis_Run,15,PRO_AOI_IP_1,Y16,
/// </summary>
/// </summary>
public
static
string
Axis_Run
=
"Axis_Run"
;
//
public static string Axis_Run = "Axis_Run";
/// <summary>
/// <summary>
...
@@ -213,19 +213,19 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -213,19 +213,19 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// <summary>
/// DI,0,取料气缸料盘检测,ClampCylinder_Check,0,PRO_AOI_IP_3,X41,
/// DI,0,取料气缸料盘检测,ClampCylinder_Check,0,PRO_AOI_IP_3,X41,
/// </summary>
/// </summary>
public
static
string
ClampCylinder_Check
=
"ClampCylinder_Check"
;
//
public static string ClampCylinder_Check = "ClampCylinder_Check";
/// <summary>
/// <summary>
/// DI,0,线体出口放行信号,LineOut_BTN,1,PRO_AOI_IP_3,X42,
/// DI,0,线体出口放行信号,LineOut_BTN,1,PRO_AOI_IP_3,X42,
/// </summary>
/// </summary>
public
static
string
LineOut_BTN
=
"LineOut_BTN"
;
//
public static string LineOut_BTN = "LineOut_BTN";
/// <summary>
/// <summary>
/// DO,0,线体入口指示灯,LineIn_Led,0,PRO_AOI_IP_3,Y41,
/// DO,0,线体入口指示灯,LineIn_Led,0,PRO_AOI_IP_3,Y41,
/// </summary>
/// </summary>
public
static
string
LineIn_Led
=
"LineIn_Led"
;
//
public static string LineIn_Led = "LineIn_Led";
/// <summary>
/// <summary>
/// DO,0,线体出口指示灯,LineOut_Led,1,PRO_AOI_IP_3,Y42,
/// DO,0,线体出口指示灯,LineOut_Led,1,PRO_AOI_IP_3,Y42,
/// </summary>
/// </summary>
public
static
string
LineOut_Led
=
"LineOut_Led"
;
//
public static string LineOut_Led = "LineOut_Led";
/// <summary>
/// <summary>
/// DO,0,设备内部照明ON,Device_Led,2,PRO_AOI_IP_3,Y43,
/// DO,0,设备内部照明ON,Device_Led,2,PRO_AOI_IP_3,Y43,
/// </summary>
/// </summary>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论