Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
thick-casting
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
潘栩锋
thick-casting
Commits
39bb3d32
Commit
39bb3d32
authored
Feb 21, 2022
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自动模头程序 通过 模拟器调试。 应该没问题
parent
8bc081e4
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
106 additions
and
144 deletions
+106
-144
ERRNOs.cs
...mCasting.AutoDie/FLY.FilmCasting.AutoDie/Common/ERRNOs.cs
+2
-2
IFeedbackHeatService.cs
.../FLY.FilmCasting.AutoDie/IService/IFeedbackHeatService.cs
+0
-6
IPLCLink.cs
...ting.AutoDie/FLY.FilmCasting.AutoDie/IService/IPLCLink.cs
+5
-9
FeedbackHeat.cs
...ng.AutoDie/FLY.FilmCasting.AutoDie/Server/FeedbackHeat.cs
+67
-87
HeatCheck.cs
...sting.AutoDie/FLY.FilmCasting.AutoDie/Server/HeatCheck.cs
+2
-1
PLCLink.cs
...Casting.AutoDie/FLY.FilmCasting.AutoDie/Server/PLCLink.cs
+25
-34
BoltMapFilmCastingServiceClient.cs
...ick.FilmCasting/Client/BoltMapFilmCastingServiceClient.cs
+3
-3
IBoltMapFilmCastingService.cs
....Thick.FilmCasting/IService/IBoltMapFilmCastingService.cs
+1
-1
thick_public
thick_public
+1
-1
No files found.
Project.FLY.FilmCasting.AutoDie/FLY.FilmCasting.AutoDie/Common/ERRNOs.cs
View file @
39bb3d32
...
...
@@ -10,10 +10,10 @@ namespace FLY.FilmCasting.AutoDie.Common
{
static
ERRNOs
()
{
ERRNO_PLC_DISCONNECTED
=
new
ERRNO
()
{
Code
=
65535
,
Descrption
=
"
风环
PLC连接断开"
};
ERRNO_PLC_DISCONNECTED
=
new
ERRNO
()
{
Code
=
65535
,
Descrption
=
"PLC连接断开"
};
#
region
收卷
ERRNO_NO_FAN
=
new
ERRNO
()
{
Code
=
0
,
Descrption
=
"
风机没
开,不能加热"
};
ERRNO_NO_FAN
=
new
ERRNO
()
{
Code
=
0
,
Descrption
=
"
总开关没打
开,不能加热"
};
ERRNO_OPEN_CIRCUIT
=
new
ERRNO
()
{
Code
=
1
,
Descrption
=
"加热棒断路"
};
ERRNO_SHORT_CIRCUIT
=
new
ERRNO
()
{
Code
=
2
,
Descrption
=
"加热控制板短路"
};
ERRNO_POWER_OFF
=
new
ERRNO
()
{
Code
=
3
,
Descrption
=
"电源没开启或电流计损坏"
};
...
...
Project.FLY.FilmCasting.AutoDie/FLY.FilmCasting.AutoDie/IService/IFeedbackHeatService.cs
View file @
39bb3d32
...
...
@@ -96,12 +96,6 @@ namespace FLY.FilmCasting.AutoDie.IService
/// </summary>
bool
CheckEnable
{
set
;
get
;
}
/// <summary>
/// 当前正在检测的加热通道
/// </summary>
int
CheckNo
{
get
;
}
/// <summary>
/// 烧了的加热棒
/// </summary>
...
...
Project.FLY.FilmCasting.AutoDie/FLY.FilmCasting.AutoDie/IService/IPLCLink.cs
View file @
39bb3d32
...
...
@@ -11,14 +11,10 @@ namespace FLY.FilmCasting.AutoDie.Server
public
interface
IPLCLink
:
INotifyPropertyChanged
{
#
region
输出
/// <summary>
/// 加热通道数
/// </summary>
UInt16
ChannelCnt
{
get
;
set
;
}
/// <summary>
/// 加热量更新 写
/// </summary>
UInt16
HeatUpdate
{
get
;
set
;
}
void
SetChannelCnt
(
UInt16
channelCnt
);
void
SetHeatUpdate
(
UInt16
heatUpdate
);
/// <summary>
/// 设置加热量
/// </summary>
...
...
@@ -43,7 +39,7 @@ namespace FLY.FilmCasting.AutoDie.Server
#
endregion
#
region
状态
int
Errno
{
get
;
s
et
;
}
bool
IsConected
{
g
et
;
}
#
endregion
}
...
...
Project.FLY.FilmCasting.AutoDie/FLY.FilmCasting.AutoDie/Server/FeedbackHeat.cs
View file @
39bb3d32
...
...
@@ -121,23 +121,11 @@ namespace FLY.FilmCasting.AutoDie.Server
/// </summary>
public
bool
HasCheckFilmVelocity
{
get
;
set
;
}
/// <summary>
/// 当前正在检测的加热通道
/// </summary>
public
int
CheckNo
{
get
;
set
;
}
=
-
2
;
/// <summary>
/// 正在检测中
/// </summary>
public
bool
CheckEnable
{
get
;
set
;
}
=
false
;
/// <summary>
/// 1块加热控制板 接多少路加热
/// </summary>
public
int
HeatsOfGroup
{
get
;
set
;
}
=
12
;
#
endregion
#
endregion
...
...
@@ -178,9 +166,10 @@ namespace FLY.FilmCasting.AutoDie.Server
public
FeedbackHeat
()
{
Load
();
if
(!
Load
())
Save
();
plc
=
new
PLCLink
(
Misc
.
StringConverter
.
ToIPEndPoint
(
"192.168.50.60:502"
));
}
...
...
@@ -194,16 +183,28 @@ namespace FLY.FilmCasting.AutoDie.Server
)
{
this
.
boltMapFilmCasting
=
boltMapFilmCasting
;
this
.
bulkDb
=
bulkDb
;
this
.
gageService
=
gageService
;
mWarning
=
warning
;
mHistoryDb
=
historyDb
;
plc
.
PropertyChanged
+=
new
PropertyChangedEventHandler
(
hmi_PropertyChanged
);
HasElectricity
=
plc
.
HasElectricity
;
HasFan
=
plc
.
HasFan
;
plc
=
new
PLCLink
(
Misc
.
StringConverter
.
ToIPEndPoint
(
PLCep
));
Misc
.
BindingOperations
.
SetBinding
(
plc
,
nameof
(
plc
.
IsConected
),
this
,
nameof
(
IsConnectedWithPLC
));
Misc
.
BindingOperations
.
SetBinding
(
plc
,
nameof
(
plc
.
HasElectricity
),
this
,
nameof
(
HasElectricity
));
Misc
.
BindingOperations
.
SetBinding
(
plc
,
nameof
(
plc
.
HasFan
),
this
,
nameof
(
HasFan
));
Misc
.
BindingOperations
.
SetBinding
(
plc
,
nameof
(
plc
.
IsConected
),
()
=>
{
if
(
plc
.
IsConected
==
true
)
{
//刚成功连接上
//重新复制数据到 PLC
RecoverPLC
();
}
});
...
...
@@ -291,12 +292,9 @@ namespace FLY.FilmCasting.AutoDie.Server
Misc
.
BindingOperations
.
SetBinding
(
this
,
nameof
(
HasElectricity
),
mHeatCheck
,
nameof
(
mHeatCheck
.
HasElectricity
));
Misc
.
BindingOperations
.
SetBinding
(
this
,
nameof
(
HasCheck
),
mHeatCheck
,
nameof
(
mHeatCheck
.
Has
));
Misc
.
BindingOperations
.
SetBinding
(
mHeatCheck
,
nameof
(
mHeatCheck
.
Enable
),
this
,
nameof
(
CheckEnable
),
Misc
.
BindingOperations
.
BindingMode
.
TwoWay
);
Misc
.
BindingOperations
.
SetBinding
(
mHeatCheck
,
nameof
(
mHeatCheck
.
CheckNo
),
this
,
nameof
(
CheckNo
));
Misc
.
BindingOperations
.
SetBinding
(
mHeatCheck
,
nameof
(
mHeatCheck
.
Bads
),
this
,
nameof
(
Bads
));
Misc
.
BindingOperations
.
SetBinding
(
this
,
nameof
(
HeatsOfGroup
),
mHeatCheck
,
nameof
(
mHeatCheck
.
HeatsOfGroup
));
//mHeatCell.Init3(blowingService);
Misc
.
BindingOperations
.
SetBinding
(
boltMapFilmCasting
,
nameof
(
boltMapFilmCasting
.
NBolts
),
this
,
nameof
(
ChannelCnt
));
...
...
@@ -465,7 +463,7 @@ namespace FLY.FilmCasting.AutoDie.Server
void
InitBuf
()
{
plc
.
ChannelCnt
=
(
UInt16
)
ChannelCnt
;
plc
.
SetChannelCnt
((
UInt16
)
ChannelCnt
)
;
//Currs = new int[ChannelCnt];
mHeatBuf
.
Init
(
ChannelCnt
);
mHeatCell
.
Init2
(
ChannelCnt
);
...
...
@@ -476,36 +474,7 @@ namespace FLY.FilmCasting.AutoDie.Server
//复位undo模块
resetUndo
();
}
void
hmi_PropertyChanged
(
object
s
,
PropertyChangedEventArgs
_e
)
{
FObjBase
.
PollModule
.
Current
.
Dispatcher
.
Invoke
(
new
PropertyChangedEventHandler
(
(
sender
,
e
)
=>
{
if
(
e
.
PropertyName
==
nameof
(
plc
.
Errno
))
{
if
(
plc
.
Errno
==
-
1
)
{
IsConnectedWithPLC
=
false
;
}
else
{
IsConnectedWithPLC
=
true
;
//刚成功连接上
//重新复制数据到 PLC
RecoverPLC
();
}
}
else
if
(
e
.
PropertyName
==
nameof
(
plc
.
HasElectricity
))
{
HasElectricity
=
plc
.
HasElectricity
;
}
else
if
(
e
.
PropertyName
==
nameof
(
plc
.
HasFan
))
{
HasFan
=
plc
.
HasFan
;
}
}),
s
,
_e
);
}
...
...
@@ -660,11 +629,11 @@ namespace FLY.FilmCasting.AutoDie.Server
UInt16
heatupdate
=
(
UInt16
)(
plc
.
HeatUpdate_R
+
1
);
if
(
heatupdate
>
100
)
heatupdate
=
1
;
plc
.
HeatUpdate
=
heatupdate
;
plc
.
SetHeatUpdate
(
heatupdate
)
;
}
void
RecoverPLC
()
{
plc
.
ChannelCnt
=
(
UInt16
)
ChannelCnt
;
plc
.
SetChannelCnt
((
UInt16
)
ChannelCnt
)
;
if
(
lastHeats
!=
null
)
{
plc
.
SetHeat
(
lastHeats
.
Select
(
h
=>
(
UInt16
)
h
));
...
...
@@ -675,10 +644,15 @@ namespace FLY.FilmCasting.AutoDie.Server
//设置全部0进去
plc
.
SetHeat
(
new
UInt16
[
ChannelCnt
]);
}
//这里是在 plc.IsConnected = true, 才会触发。
//只有读取一次PLC后,IsConnected 才会=true,
//所以 HeatUpdate_R 肯定是对的
UInt16
heatupdate
=
(
UInt16
)(
plc
.
HeatUpdate_R
+
1
);
if
(
heatupdate
>
100
)
heatupdate
=
1
;
plc
.
HeatUpdate
=
heatupdate
;
plc
.
SetHeatUpdate
(
heatupdate
)
;
}
...
...
@@ -773,37 +747,11 @@ namespace FLY.FilmCasting.AutoDie.Server
string
file_path
=
"feedback.json"
;
bool
Load
()
{
if
(
File
.
Exists
(
file_path
))
{
try
{
string
json
=
File
.
ReadAllText
(
file_path
);
var
jsonDb
=
JsonConvert
.
DeserializeObject
<
FeedbackHeatJsonDb
>(
json
);
FeedbackHeatJsonDb
.
Mapper
.
Map
(
jsonDb
,
this
);
return
true
;
}
catch
{
//异常,没有json 解码失败
}
return
false
;
}
return
false
;
return
FeedbackHeatJsonDb
.
Load
(
this
,
file_path
);
}
void
Save
()
{
try
{
var
jsonDb
=
FeedbackHeatJsonDb
.
Mapper
.
Map
<
FeedbackHeatJsonDb
>(
this
);
string
json
=
JsonConvert
.
SerializeObject
(
jsonDb
,
Formatting
.
Indented
);
File
.
WriteAllText
(
file_path
,
json
);
}
catch
{
//异常,没有json 编码失败
}
FeedbackHeatJsonDb
.
Save
(
this
,
file_path
);
}
#
region
撤销
...
...
@@ -956,9 +904,45 @@ namespace FLY.FilmCasting.AutoDie.Server
});
}));
public
static
bool
Load
(
FeedbackHeat
src
,
string
file_path
)
{
if
(!
File
.
Exists
(
file_path
))
return
false
;
try
{
string
json
=
File
.
ReadAllText
(
file_path
);
var
jsonDb
=
JsonConvert
.
DeserializeObject
<
FeedbackHeatJsonDb
>(
json
);
FeedbackHeatJsonDb
.
Mapper
.
Map
(
jsonDb
,
src
);
return
true
;
}
catch
{
//异常,没有json 解码失败
return
false
;
}
}
public
static
bool
Save
(
FeedbackHeat
src
,
string
file_path
)
{
try
{
var
jsonDb
=
FeedbackHeatJsonDb
.
Mapper
.
Map
<
FeedbackHeatJsonDb
>(
src
);
string
json
=
JsonConvert
.
SerializeObject
(
jsonDb
,
Formatting
.
Indented
);
File
.
WriteAllText
(
file_path
,
json
);
return
true
;
}
catch
{
//异常,没有json 编码失败
}
return
false
;
}
#
region
参数
public
string
PLCep
;
public
string
PLCep
=
"192.168.50.60:502"
;
/// <summary>
/// 加热后起效延时(s)
...
...
@@ -987,10 +971,6 @@ namespace FLY.FilmCasting.AutoDie.Server
/// </summary>
public
bool
HasCheckFilmVelocity
;
/// <summary>
/// 1块加热控制板 接多少路加热
/// </summary>
public
int
HeatsOfGroup
=
12
;
#
endregion
}
...
...
Project.FLY.FilmCasting.AutoDie/FLY.FilmCasting.AutoDie/Server/HeatCheck.cs
View file @
39bb3d32
...
...
@@ -15,6 +15,7 @@ namespace FLY.FilmCasting.AutoDie.Server
class
HeatCheck
:
IHeatCheck
,
INotifyPropertyChanged
{
const
int
HEAT_WAIT
=
3
;
//3s
const
int
HeatsOfGroup
=
12
;
//1块加热板 12路
HeatCell
mHeatCell
;
enum
CHECK_MODE
...
...
@@ -39,7 +40,7 @@ namespace FLY.FilmCasting.AutoDie.Server
CHECK_MODE
checkMode
=
CHECK_MODE
.
IDLE
;
int
counter
=
0
;
#
region
IHeatCheck
public
int
HeatsOfGroup
{
get
;
set
;
}
=
12
;
/// <summary>
/// 有这个功能
/// </summary>
...
...
Project.FLY.FilmCasting.AutoDie/FLY.FilmCasting.AutoDie/Server/PLCLink.cs
View file @
39bb3d32
...
...
@@ -41,17 +41,6 @@ namespace FLY.FilmCasting.AutoDie.Server
public
TimeSpan
ActUpdateInterval
{
get
;
private
set
;
}
/// <summary>
/// 加热通道数
/// </summary>
[
DoNotCheckEquality
]
public
UInt16
ChannelCnt
{
get
;
set
;
}
/// <summary>
/// 加热量更新
/// </summary>
[
DoNotCheckEquality
]
public
UInt16
HeatUpdate
{
get
;
set
;
}
/// <summary>
/// 当前电流 有没?
/// </summary>
...
...
@@ -65,8 +54,7 @@ namespace FLY.FilmCasting.AutoDie.Server
/// </summary>
public
UInt16
HeatUpdate_R
{
get
;
private
set
;
}
public
int
Errno
{
get
;
set
;
}
=
-
1
;
public
bool
IsConected
{
get
;
private
set
;
}
public
event
PropertyChangedEventHandler
PropertyChanged
;
...
...
@@ -84,7 +72,6 @@ namespace FLY.FilmCasting.AutoDie.Server
public
PLCLink
(
IPEndPoint
ep
)
{
mclient
=
new
Modbus
.
WithThread
.
ClientTCP
(
ep
);
this
.
PropertyChanged
+=
PLCLink_PropertyChanged
;
}
class
RegWrite
...
...
@@ -102,29 +89,30 @@ namespace FLY.FilmCasting.AutoDie.Server
}
List
<
RegWrite
>
rws
=
new
List
<
RegWrite
>();
private
void
PLCLink_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
nameof
(
ChannelCnt
))
public
void
SetChannelCnt
(
UInt16
channelCnt
)
{
if
(!
IsConected
)
return
;
//D200 4x201 通道数量
RegWrite
regWrite
=
new
RegWrite
(
PLCAddressArea
.
Register
,
200
,
new
UInt16
[]
{
C
hannelCnt
});
RegWrite
regWrite
=
new
RegWrite
(
PLCAddressArea
.
Register
,
200
,
new
UInt16
[]
{
c
hannelCnt
});
lock
(
rws
)
{
rws
.
Add
(
regWrite
);
}
}
else
if
(
e
.
PropertyName
==
nameof
(
HeatUpdate
))
public
void
SetHeatUpdate
(
UInt16
heatUpdate
)
{
if
(!
IsConected
)
return
;
//D201 4x202 设置值 更新
RegWrite
regWrite
=
new
RegWrite
(
PLCAddressArea
.
Register
,
201
,
new
UInt16
[]
{
H
eatUpdate
});
RegWrite
regWrite
=
new
RegWrite
(
PLCAddressArea
.
Register
,
201
,
new
UInt16
[]
{
h
eatUpdate
});
lock
(
rws
)
{
rws
.
Add
(
regWrite
);
}
}
}
public
void
Start
()
{
...
...
@@ -196,7 +184,7 @@ namespace FLY.FilmCasting.AutoDie.Server
goto
_error
;
//连接断开,终止更新线程
}
Errno
=
0
;
IsConected
=
true
;
}
//输出写入数据
...
...
@@ -212,13 +200,13 @@ namespace FLY.FilmCasting.AutoDie.Server
}
_error
:
Errno
=
-
1
;
IsConected
=
false
;
ErrorCnt
++;
goto
_connect
;
_end
:
mclient
.
Close
();
Errno
=
-
1
;
IsConected
=
true
;
IsRunning
=
false
;
}
...
...
@@ -270,6 +258,9 @@ namespace FLY.FilmCasting.AutoDie.Server
/// <param name="values"></param>
public
void
SetHeat
(
IEnumerable
<
UInt16
>
values
)
{
if
(!
IsConected
)
return
;
UInt16
[]
buf
=
values
.
ToArray
();
List
<
RegWrite
>
writes
=
new
List
<
RegWrite
>();
//D400 4x401 设置值 160个
...
...
Project.FLY.Thick.FilmCasting/FLY.Thick.FilmCasting/Client/BoltMapFilmCastingServiceClient.cs
View file @
39bb3d32
...
...
@@ -57,7 +57,7 @@ namespace FLY.Thick.FilmCasting.Client
/// <summary>
/// 收缩率 Uniform(均匀区)Shrink(收缩)Percent(比例)
/// </summary>
public
double
UniformShrinkPercent
{
get
;
set
;
}
public
double
UniformShrinkPercent
{
get
;
set
;
}
=
0.03
;
/// <summary>
/// 膜中心位置偏移 mm
...
...
@@ -67,12 +67,12 @@ namespace FLY.Thick.FilmCasting.Client
/// <summary>
/// 总分区数
/// </summary>
public
int
NBolts
{
get
;
set
;
}
public
int
NBolts
{
get
;
set
;
}
=
100
;
/// <summary>
/// 第1个分区号
/// </summary>
public
int
FirstBoltNo
{
get
;
set
;
}
public
int
FirstBoltNo
{
get
;
set
;
}
=
1
;
#
endregion
...
...
Project.FLY.Thick.FilmCasting/FLY.Thick.FilmCasting/IService/IBoltMapFilmCastingService.cs
View file @
39bb3d32
thick_public
@
e1da2583
Subproject commit
f445c84c07690898037a1034fd1f1320c7907920
Subproject commit
e1da25832b00c4020934eaa83041354b7d545cff
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