Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hemei
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
hemei
Commits
32c61afd
Commit
32c61afd
authored
Oct 23, 2022
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 浙江班奈特 真实环境调试。
parent
e12c6823
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
21 deletions
+33
-21
RotaryPlc.cs
FLY.Winder.BanNaiTe.UI.Server/RotaryPlc.cs
+19
-11
RotarySystem.cs
FLY.Winder.BanNaiTe.UI.Server/RotarySystem.cs
+14
-10
No files found.
FLY.Winder.BanNaiTe.UI.Server/RotaryPlc.cs
View file @
32c61afd
...
@@ -17,11 +17,19 @@ namespace FLY.Winder.BanNaiTe.UI.Server
...
@@ -17,11 +17,19 @@ namespace FLY.Winder.BanNaiTe.UI.Server
{
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
public
event
PropertyChangedEventHandler
PropertyChanged
;
const
string
ADDR_CW
=
"DB107.0.0"
;
//顺时针(正方向) ,程序会直接读取 DB7.0.0~DB7.0.4
const
string
ADDR_SIGNBASE
=
"DB107.0.0"
;
//信号地址
const
string
ADDR_CCW
=
"DB107.0.1"
;
//逆时针(反方向)
const
int
SIGN_CNT
=
5
;
const
string
ADDR_Sign0
=
"DB107.0.2"
;
//转向信号0 (撞了它, 变为正方向运行)
const
int
SIGN_INDEX_FORW
=
0
;
//正方向
const
string
ADDR_Sign1
=
"DB107.0.3"
;
//转向信号1 (撞了它, 变为反方向运行)
const
int
SIGN_INDEX_BACKW
=
1
;
//反方向
const
string
ADDR_OrgSign
=
"DB107.0.4"
;
//复位原点信号 (撞了它后,证明在中间)
const
int
SIGN_INDEX_1
=
2
;
//转向信号1 (撞了它, 变为反方向运行)
const
int
SIGN_INDEX_0
=
3
;
//转向信号0(撞了它, 变为正方向运行)
const
int
SIGN_INDEX_ORG
=
4
;
//复位原点信号 (撞了它后,证明在中间)
//const string ADDR_FORW = "DB107.0.0";//顺时针(正方向) ,程序会直接读取 DB7.0.0~DB7.0.4
//const string ADDR_BACKW = "DB107.0.1";//逆时针(反方向)
//const string ADDR_Sign1 = "DB107.0.2";//转向信号1 (撞了它, 变为反方向运行)
//const string ADDR_Sign0 = "DB107.0.3";//转向信号0 (撞了它, 变为正方向运行)
//const string ADDR_OrgSign = "DB107.0.4";//复位原点信号 (撞了它后,证明在中间)
const
string
ADDR_RotaryVelocity
=
"DB107.2"
;
//旋转塔速度% 有正负
const
string
ADDR_RotaryVelocity
=
"DB107.2"
;
//旋转塔速度% 有正负
NLog
.
Logger
logger
=
NLog
.
LogManager
.
GetCurrentClassLogger
();
NLog
.
Logger
logger
=
NLog
.
LogManager
.
GetCurrentClassLogger
();
...
@@ -219,14 +227,14 @@ namespace FLY.Winder.BanNaiTe.UI.Server
...
@@ -219,14 +227,14 @@ namespace FLY.Winder.BanNaiTe.UI.Server
bool
Read
()
bool
Read
()
{
{
var
resultBools
=
device
.
ReadBool
(
ADDR_
CW
,
5
);
var
resultBools
=
device
.
ReadBool
(
ADDR_
SIGNBASE
,
SIGN_CNT
);
if
(!
SetState
(
resultBools
))
if
(!
SetState
(
resultBools
))
return
false
;
return
false
;
IsForw
=
resultBools
.
Content
[
0
];
IsForw
=
resultBools
.
Content
[
SIGN_INDEX_FORW
];
IsBackw
=
resultBools
.
Content
[
1
];
IsBackw
=
resultBools
.
Content
[
SIGN_INDEX_BACKW
];
IsTurnSign0
=
resultBools
.
Content
[
2
];
IsTurnSign0
=
resultBools
.
Content
[
SIGN_INDEX_0
];
IsTurnSign1
=
resultBools
.
Content
[
3
];
IsTurnSign1
=
resultBools
.
Content
[
SIGN_INDEX_1
];
IsOrgSign
=
resultBools
.
Content
[
4
];
IsOrgSign
=
resultBools
.
Content
[
SIGN_INDEX_ORG
];
var
resultFloat
=
device
.
ReadFloat
(
ADDR_RotaryVelocity
);
var
resultFloat
=
device
.
ReadFloat
(
ADDR_RotaryVelocity
);
if
(!
SetState
(
resultFloat
))
if
(!
SetState
(
resultFloat
))
...
...
FLY.Winder.BanNaiTe.UI.Server/RotarySystem.cs
View file @
32c61afd
...
@@ -133,7 +133,7 @@ namespace FLY.Winder.BanNaiTe.UI.Server
...
@@ -133,7 +133,7 @@ namespace FLY.Winder.BanNaiTe.UI.Server
rposOfRInFile
=
LoadRPosOfR
();
rposOfRInFile
=
LoadRPosOfR
();
if
(
double
.
IsNaN
(
rposOfRInFile
))
if
(
double
.
IsNaN
(
rposOfRInFile
))
{
{
rposOfRInFile
=
2
000
0
;
rposOfRInFile
=
2
5
*
19.1
*
6
0
;
SaveRPosOfR
(
rposOfRInFile
);
SaveRPosOfR
(
rposOfRInFile
);
}
}
...
@@ -145,13 +145,13 @@ namespace FLY.Winder.BanNaiTe.UI.Server
...
@@ -145,13 +145,13 @@ namespace FLY.Winder.BanNaiTe.UI.Server
RPosAtTurnSign1
=
RPosOfR
/
2
;
RPosAtTurnSign1
=
RPosOfR
/
2
;
Misc
.
BindingOperations
.
SetBinding
(
this
.
plc
,
nameof
(
plc
.
IsPlcConnected
),
this
,
nameof
(
IsPlcConnected
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
plc
,
nameof
(
plc
.
IsPlcConnected
),
this
,
nameof
(
IsPlcConnected
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
plc
,
nameof
(
plc
.
IsForw
),
this
,
nameof
(
Is
For
w
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
plc
,
nameof
(
plc
.
IsForw
),
this
,
nameof
(
Is
Back
w
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
plc
,
nameof
(
plc
.
IsBackw
),
this
,
nameof
(
Is
Back
w
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
plc
,
nameof
(
plc
.
IsBackw
),
this
,
nameof
(
Is
For
w
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
plc
,
nameof
(
plc
.
IsTurnSign0
),
this
,
nameof
(
IsTurnSign
0
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
plc
,
nameof
(
plc
.
IsTurnSign0
),
this
,
nameof
(
IsTurnSign
1
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
plc
,
nameof
(
plc
.
IsTurnSign1
),
this
,
nameof
(
IsTurnSign
1
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
plc
,
nameof
(
plc
.
IsTurnSign1
),
this
,
nameof
(
IsTurnSign
0
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
plc
,
nameof
(
plc
.
IsOrgSign
),
this
,
nameof
(
IsOrgSign
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
plc
,
nameof
(
plc
.
IsOrgSign
),
this
,
nameof
(
IsOrgSign
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
plc
,
nameof
(
plc
.
RotaryVelocity
),()=>
{
Misc
.
BindingOperations
.
SetBinding
(
this
.
plc
,
nameof
(
plc
.
RotaryVelocity
),()=>
{
RSpeed
=
plc
.
RotaryVelocity
;
RSpeed
=
-
plc
.
RotaryVelocity
;
});
});
updateMinuteOfR
();
updateMinuteOfR
();
...
@@ -269,13 +269,13 @@ namespace FLY.Winder.BanNaiTe.UI.Server
...
@@ -269,13 +269,13 @@ namespace FLY.Winder.BanNaiTe.UI.Server
RPosAtTurnSign0
=
RPosGlobal
;
RPosAtTurnSign0
=
RPosGlobal
;
isReal_RPosAtTurnSign0
=
true
;
isReal_RPosAtTurnSign0
=
true
;
if
(
isReal_RPosAtTurnSign1
)
if
(
isReal_RPosAtTurnSign
0
&&
isReal_RPosAtTurnSign
1
)
{
{
updateRPosOfR
();
updateRPosOfR
();
}
}
//-------------------------------------------------------------
//-------------------------------------------------------------
//位置预测
//位置预测
, SIGN1 还没触发
if
(!
isReal_RPosAtTurnSign1
)
if
(!
isReal_RPosAtTurnSign1
)
{
{
if
(!
isReal_RPosAtOrgSign
)
//原点信号 还没发生
if
(!
isReal_RPosAtOrgSign
)
//原点信号 还没发生
...
@@ -285,6 +285,7 @@ namespace FLY.Winder.BanNaiTe.UI.Server
...
@@ -285,6 +285,7 @@ namespace FLY.Winder.BanNaiTe.UI.Server
else
//原点信号 发生了
else
//原点信号 发生了
{
{
RPosOfR
=
(
RPosAtOrgSign
-
RPosAtTurnSign0
)
*
2
;
RPosOfR
=
(
RPosAtOrgSign
-
RPosAtTurnSign0
)
*
2
;
//通过原点计算的 RPosOfR,不会保存
}
}
RPosAtTurnSign1
=
RPosAtTurnSign0
+
RPosOfR
;
RPosAtTurnSign1
=
RPosAtTurnSign0
+
RPosOfR
;
}
}
...
@@ -298,7 +299,7 @@ namespace FLY.Winder.BanNaiTe.UI.Server
...
@@ -298,7 +299,7 @@ namespace FLY.Winder.BanNaiTe.UI.Server
RPosAtTurnSign1
=
RPosGlobal
;
RPosAtTurnSign1
=
RPosGlobal
;
isReal_RPosAtTurnSign1
=
true
;
isReal_RPosAtTurnSign1
=
true
;
if
(
isReal_RPosAtTurnSign0
)
if
(
isReal_RPosAtTurnSign0
&&
isReal_RPosAtTurnSign1
)
{
{
updateRPosOfR
();
updateRPosOfR
();
}
}
...
@@ -314,6 +315,7 @@ namespace FLY.Winder.BanNaiTe.UI.Server
...
@@ -314,6 +315,7 @@ namespace FLY.Winder.BanNaiTe.UI.Server
else
//原点信号 发生了
else
//原点信号 发生了
{
{
RPosOfR
=
(
RPosAtTurnSign1
-
RPosAtOrgSign
)
*
2
;
RPosOfR
=
(
RPosAtTurnSign1
-
RPosAtOrgSign
)
*
2
;
//通过原点计算的 RPosOfR,不会保存
}
}
RPosAtTurnSign0
=
RPosAtTurnSign1
-
RPosOfR
;
RPosAtTurnSign0
=
RPosAtTurnSign1
-
RPosOfR
;
}
}
...
@@ -424,11 +426,13 @@ namespace FLY.Winder.BanNaiTe.UI.Server
...
@@ -424,11 +426,13 @@ namespace FLY.Winder.BanNaiTe.UI.Server
else
if
(
isReal_RPosAtTurnSign0
&&
!
isReal_RPosAtTurnSign1
)
//信号0 发生了,信号1 还没发生
else
if
(
isReal_RPosAtTurnSign0
&&
!
isReal_RPosAtTurnSign1
)
//信号0 发生了,信号1 还没发生
{
{
RPosOfR
=
(
RPosAtOrgSign
-
RPosAtTurnSign0
)
*
2
;
RPosOfR
=
(
RPosAtOrgSign
-
RPosAtTurnSign0
)
*
2
;
//通过原点计算的 RPosOfR,不会保存
RPosAtTurnSign1
=
RPosAtTurnSign0
+
RPosOfR
;
RPosAtTurnSign1
=
RPosAtTurnSign0
+
RPosOfR
;
}
}
else
if
(!
isReal_RPosAtTurnSign0
&&
isReal_RPosAtTurnSign1
)
//信号0 还没发生,信号1 发生了
else
if
(!
isReal_RPosAtTurnSign0
&&
isReal_RPosAtTurnSign1
)
//信号0 还没发生,信号1 发生了
{
{
RPosOfR
=
(
RPosAtOrgSign
-
RPosAtTurnSign0
)
*
2
;
RPosOfR
=
(
RPosAtTurnSign1
-
RPosAtOrgSign
)
*
2
;
//通过原点计算的 RPosOfR,不会保存
RPosAtTurnSign0
=
RPosAtTurnSign1
-
RPosOfR
;
RPosAtTurnSign0
=
RPosAtTurnSign1
-
RPosOfR
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment