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
1d242aa2
Commit
1d242aa2
authored
Apr 13, 2024
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修复 IO口 需要显示 X0~X15
2.添加 电容测厚仪模拟器地址设置,机架参数设置
parent
59a400e8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
682 additions
and
310 deletions
+682
-310
TDGage.cs
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/Server/TDGage.cs
+2
-6
TDGage.cs
....Thick.BlowingScan/FLY.Thick.BlowingScan/Server/TDGage.cs
+2
-4
PgMain.xaml
Project.FLY.Thick.Cap/FLY.Thick.Cap.UI.Server/PgMain.xaml
+28
-2
IOStyle.xaml
...FLY.Thick.Cap/FLY.Thick.Cap.UI.Server/Themes/IOStyle.xaml
+2
-1
FlyADIODefine.cs
Project.FLY.Thick.Cap/FLY.Thick.Cap/Common/FlyADIODefine.cs
+1
-8
TDGage.cs
Project.FLY.Thick.Cap/FLY.Thick.Cap/Server/TDGage.cs
+2
-5
App.xaml.cs
...Y.Thick.Cap/Project.CapSimulator/CapSimulator/App.xaml.cs
+58
-2
CapSimulator.csproj
...Cap/Project.CapSimulator/CapSimulator/CapSimulator.csproj
+9
-3
MainWindow.xaml
...ick.Cap/Project.CapSimulator/CapSimulator/MainWindow.xaml
+115
-85
MainWindow.xaml.cs
....Cap/Project.CapSimulator/CapSimulator/MainWindow.xaml.cs
+62
-37
WdAddr.xaml
...Y.Thick.Cap/Project.CapSimulator/CapSimulator/WdAddr.xaml
+33
-0
WdAddr.xaml.cs
...hick.Cap/Project.CapSimulator/CapSimulator/WdAddr.xaml.cs
+79
-0
WdBlowingVm.cs
...hick.Cap/Project.CapSimulator/CapSimulator/WdBlowingVm.cs
+0
-16
WindowBlowing.xaml
....Cap/Project.CapSimulator/CapSimulator/WindowBlowing.xaml
+116
-77
WindowBlowing.xaml.cs
...p/Project.CapSimulator/CapSimulator/WindowBlowing.xaml.cs
+76
-46
GageAD.cs
...Cap/Project.CapSimulator/FLY.Simulation.Blowing/GageAD.cs
+75
-2
FLYAD7.cs
....Cap/Project.CapSimulator/FLY.Simulation.Flyad7/FLYAD7.cs
+1
-1
IODefinition.cs
...k.Cap/Project.CapSimulator/FLY.Simulation/IODefinition.cs
+20
-14
thick_public
thick_public
+1
-1
No files found.
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/Server/TDGage.cs
View file @
1d242aa2
...
...
@@ -211,12 +211,8 @@ namespace FLY.Thick.Blowing.Server
flyAd
.
Connect
();
flyAdService
.
Init
(
flyAd
,
Ad2Thk
);
Misc
.
BindingOperations
.
SetBinding
(
flyAd
,
nameof
(
flyAd
.
HardwareVersion
),
()
=>
{
FlyADIODefine
.
SetInstance
(
new
FlyADIODefine
());
FlyADIODefine
.
Instance
.
SerVersion
(
flyAd
.
HardwareVersion
);
});
FlyADIODefine
.
SetInstance
(
new
FlyADIODefine
());
FlyADIODefine
.
Instance
.
SetFlyAD
(
flyAd
);
Misc
.
BindingOperations
.
SetBinding
(
flyAd
,
nameof
(
flyAd
.
IStatus
),
DynArea
,
nameof
(
DynArea
.
IStatus
));
Misc
.
BindingOperations
.
SetBinding
(
flyAd
,
nameof
(
flyAd
.
OStatus
),
DynArea
,
nameof
(
DynArea
.
OStatus
));
...
...
Project.FLY.Thick.BlowingScan/FLY.Thick.BlowingScan/Server/TDGage.cs
View file @
1d242aa2
...
...
@@ -315,10 +315,8 @@ namespace FLY.Thick.BlowingScan.Server
flyAd
.
Connect
();
flyAdService
.
Init
(
flyAd
,
Ad2Thk
);
Misc
.
BindingOperations
.
SetBinding
(
flyAd
,
nameof
(
flyAd
.
HardwareVersion
),
()
=>
{
FlyADIODefine
.
SetInstance
(
new
FlyADIODefine
());
FlyADIODefine
.
Instance
.
SerVersion
(
flyAd
.
HardwareVersion
);
});
FlyADIODefine
.
SetInstance
(
new
FlyADIODefine
());
FlyADIODefine
.
Instance
.
SetFlyAD
(
flyAd
);
Misc
.
BindingOperations
.
SetBinding
(
initParam
,
nameof
(
initParam
.
PosLength
),
flyAd
,
nameof
(
flyAd
.
PosLen
));
...
...
Project.FLY.Thick.Cap/FLY.Thick.Cap.UI.Server/PgMain.xaml
View file @
1d242aa2
...
...
@@ -129,7 +129,7 @@
</StackPanel>
</StackPanel>
</Grid>
<UniformGrid Columns="
9
" Margin="2,0" VerticalAlignment="Top" HorizontalAlignment="Left">
<UniformGrid Columns="
20
" Margin="2,0" VerticalAlignment="Top" HorizontalAlignment="Left">
<UniformGrid.Resources>
<Style TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.IO}"/>
</UniformGrid.Resources>
...
...
@@ -138,26 +138,52 @@
<TextBlock Text="1" />
<TextBlock Text="2" />
<TextBlock Text="3" />
<Grid/>
<TextBlock Text="4" />
<TextBlock Text="5" />
<TextBlock Text="6" />
<TextBlock Text="7" />
<Grid/>
<TextBlock Text="8" />
<TextBlock Text="9" />
<TextBlock Text="10" />
<TextBlock Text="11" />
<Grid/>
<TextBlock Text="12" />
<TextBlock Text="13" />
<TextBlock Text="14" />
<TextBlock Text="15" />
<TextBlock FontWeight="Bold" Text="X" />
<Border Tag="{Binding IStatus, ConverterParameter=0, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding IStatus, ConverterParameter=1, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding IStatus, ConverterParameter=2, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding IStatus, ConverterParameter=3, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Grid/>
<Border Tag="{Binding IStatus, ConverterParameter=4, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding IStatus, ConverterParameter=5, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding IStatus, ConverterParameter=6, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding IStatus, ConverterParameter=7, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Grid/>
<Border Tag="{Binding IStatus, ConverterParameter=8, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding IStatus, ConverterParameter=9, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding IStatus, ConverterParameter=10, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding IStatus, ConverterParameter=11, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Grid/>
<Border Tag="{Binding IStatus, ConverterParameter=12, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding IStatus, ConverterParameter=13, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding IStatus, ConverterParameter=14, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding IStatus, ConverterParameter=15, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<TextBlock FontWeight="Bold" Text="Y" />
<Border Tag="{Binding OStatus, ConverterParameter=0, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding OStatus, ConverterParameter=1, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding OStatus, ConverterParameter=2, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding OStatus, ConverterParameter=3, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Grid/>
<Border Tag="{Binding OStatus, ConverterParameter=4, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding OStatus, ConverterParameter=5, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding OStatus, ConverterParameter=6, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
<Border Tag="{Binding OStatus, ConverterParameter=7, Converter={StaticResource io2bconv}}" Style="{StaticResource Styles.Border.IO}" />
</UniformGrid>
</StackPanel>
...
...
Project.FLY.Thick.Cap/FLY.Thick.Cap.UI.Server/Themes/IOStyle.xaml
View file @
1d242aa2
...
...
@@ -7,7 +7,7 @@
<Setter Property="Background" Value="{StaticResource Brush.LenOff}"/>
<Setter Property="Height" Value="12"/>
<Setter Property="Width" Value="10"/>
<Setter Property="Margin" Value="
3
,1"/>
<Setter Property="Margin" Value="
1
,1"/>
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Tag}" Value="True">
<Setter Property="Background" Value="{StaticResource Brush.LedOn}"/>
...
...
@@ -16,5 +16,6 @@
</Style>
<Style TargetType="TextBlock" x:Key="Styles.Text.IO">
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="10"/>
</Style>
</ResourceDictionary>
\ No newline at end of file
Project.FLY.Thick.Cap/FLY.Thick.Cap/Common/FlyADIODefine.cs
View file @
1d242aa2
...
...
@@ -23,12 +23,6 @@ namespace FLY.Thick.Cap.Common
public
int
OutNo_PushDown
{
get
;
protected
set
;
}
=
1
;
/// <summary>
/// 新版本只需要下压,没前推
/// </summary>
[
Description
(
"前推"
)]
public
int
OutNo_PushForward
{
get
;
private
set
;
}
=
2
;
public
FlyADIODefine
()
{
OutNo_Sync
=
0
;
...
...
@@ -60,8 +54,7 @@ namespace FLY.Thick.Cap.Common
{
return
new
List
<
string
>
{
nameof
(
OutNo_Sync
),
nameof
(
OutNo_PushDown
),
nameof
(
OutNo_PushForward
)
nameof
(
OutNo_PushDown
)
};
}
...
...
Project.FLY.Thick.Cap/FLY.Thick.Cap/Server/TDGage.cs
View file @
1d242aa2
...
...
@@ -315,11 +315,8 @@ namespace FLY.Thick.Cap.Server
flyAd
.
Connect
();
flyAdService
.
Init
(
flyAd
,
flyAd7WithCapSensor
,
Ad2Thk
);
Misc
.
BindingOperations
.
SetBinding
(
flyAd
,
nameof
(
flyAd
.
HardwareVersion
),
()
=>
{
FlyADIODefine
.
SetInstance
(
new
FlyADIODefine
());
FlyADIODefine
.
Instance
.
SerVersion
(
flyAd
.
HardwareVersion
);
});
FlyADIODefine
.
SetInstance
(
new
FlyADIODefine
());
FlyADIODefine
.
Instance
.
SetFlyAD
(
flyAd
);
Misc
.
BindingOperations
.
SetBinding
(
initParam
,
nameof
(
initParam
.
PosLength
),
flyAd
,
nameof
(
flyAd
.
PosLen
));
...
...
Project.FLY.Thick.Cap/Project.CapSimulator/CapSimulator/App.xaml.cs
View file @
1d242aa2
using
System
;
using
Newtonsoft.Json
;
using
System
;
using
System.Diagnostics
;
using
System.IO
;
using
System.Threading.Tasks
;
using
System.Windows
;
...
...
@@ -32,6 +34,10 @@ namespace CapSimulator
/// </summary>
FLY
.
Simulation
.
CapSensor
.
CapSensor2
capSensor
;
/// <summary>
/// app 的参数
/// </summary>
AppConfig
appConfig
;
public
App
()
{
appjustone
=
new
FLY
.
AppHelper
.
AppJustOne
(
this
);
...
...
@@ -55,7 +61,7 @@ namespace CapSimulator
var
ver
=
new
Misc
.
Ver
();
ver
.
SrcType
=
this
.
GetType
();
main
.
Title
=
ver
.
ToString
();
main
.
Init
(
gageAd
,
flyad7
,
capSensor
,
plcLink
,
blowing
);
main
.
Init
(
gageAd
,
flyad7
,
capSensor
,
plcLink
,
blowing
,
appConfig
);
this
.
MainWindow
=
main
;
...
...
@@ -67,17 +73,24 @@ namespace CapSimulator
void
Init
()
{
appConfig
=
new
AppConfig
();
if
(!
appConfig
.
Load
())
appConfig
.
Save
();
blowing
=
new
FLY
.
Simulation
.
Blowing
.
Blowing
();
plcLink
=
new
FLY
.
Simulation
.
Blowing
.
KeXinPlc
();
plcLink
.
PlcAddr
=
appConfig
.
PlcAddr
;
plcLink
.
Init
(
blowing
,
blowing
.
mAirRing2
);
gageAd
=
new
FLY
.
Simulation
.
Blowing
.
GageAD
();
gageAd
.
Init
(
blowing
);
flyad7
=
new
FLY
.
Simulation
.
Flyad7
.
FLYAD7
();
flyad7
.
Addr
=
appConfig
.
FlyAd7Addr
;
capSensor
=
new
FLY
.
Simulation
.
CapSensor
.
CapSensor2
();
capSensor
.
Addr
=
appConfig
.
CapSensorAddr
;
flyad7
.
Init
(
gageAd
);
...
...
@@ -115,4 +128,47 @@ namespace CapSimulator
});
}
}
public
class
AppConfig
{
[
JsonIgnore
]
public
string
filePath
=
"appConfig.json"
;
public
bool
Save
()
{
try
{
File
.
WriteAllText
(
filePath
,
JsonConvert
.
SerializeObject
(
this
,
Formatting
.
Indented
));
}
catch
{
//异常,没有json 编码失败
return
false
;
}
return
true
;
}
public
bool
Load
()
{
try
{
if
(
File
.
Exists
(
filePath
))
{
string
json
=
File
.
ReadAllText
(
filePath
);
JsonConvert
.
PopulateObject
(
json
,
this
);
return
true
;
}
}
catch
{
//异常,没有json 解码失败
return
false
;
}
return
false
;
}
public
string
CapSensorAddr
{
get
;
set
;
}
=
"0.0.0.0:20021"
;
public
string
FlyAd7Addr
{
get
;
set
;
}
=
"0.0.0.0:20006"
;
public
string
PlcAddr
{
get
;
set
;
}
=
"0.0.0.0:502"
;
}
}
Project.FLY.Thick.Cap/Project.CapSimulator/CapSimulator/CapSimulator.csproj
View file @
1d242aa2
...
...
@@ -67,9 +67,8 @@
<Compile
Include=
"Converters\IO2BinConverter.cs"
/>
<Compile
Include=
"Converters\IO2BitBoolConverter.cs"
/>
<Compile
Include=
"Converters\VisibilityConverter.cs"
/>
<Compile
Include=
"WdBlowingVm.cs"
>
<DependentUpon>
WindowBlowing.xaml
</DependentUpon>
<SubType>
Code
</SubType>
<Compile
Include=
"WdAddr.xaml.cs"
>
<DependentUpon>
WdAddr.xaml
</DependentUpon>
</Compile>
<Compile
Include=
"WindowBlowing.xaml.cs"
>
<DependentUpon>
WindowBlowing.xaml
</DependentUpon>
...
...
@@ -99,6 +98,10 @@
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</Page>
<Page
Include=
"WdAddr.xaml"
>
<SubType>
Designer
</SubType>
<Generator>
MSBuild:Compile
</Generator>
</Page>
<Page
Include=
"WindowBlowing.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
...
...
@@ -161,6 +164,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference
Include=
"CommunityToolkit.Mvvm"
>
<Version>
8.0.0
</Version>
</PackageReference>
<PackageReference
Include=
"Costura.Fody"
>
<Version>
5.7.0
</Version>
<IncludeAssets>
runtime; build; native; contentfiles; analyzers; buildtransitive
</IncludeAssets>
...
...
Project.FLY.Thick.Cap/Project.CapSimulator/CapSimulator/MainWindow.xaml
View file @
1d242aa2
This diff is collapsed.
Click to expand it.
Project.FLY.Thick.Cap/Project.CapSimulator/CapSimulator/MainWindow.xaml.cs
View file @
1d242aa2
...
...
@@ -18,6 +18,7 @@ using System.Threading.Tasks;
using
System.Windows.Threading
;
using
FLY.Simulation.Blowing
;
using
FLY.Simulation.CapSensor
;
using
CommunityToolkit.Mvvm.Input
;
namespace
CapSimulator
{
...
...
@@ -30,50 +31,23 @@ namespace CapSimulator
FLY
.
Simulation
.
Flyad7
.
FLYAD7
flyad7
;
FLY
.
Simulation
.
Blowing
.
Blowing
blowing
;
KeXinPlc
plc
;
AppConfig
appConfig
;
public
MainWindow
()
{
InitializeComponent
();
}
public
void
Init
(
GageAD
gageAd
,
FLYAD7
flyad7
,
CapSensor2
capSensor
,
KeXinPlc
plc
,
Blowing
blowing
)
public
void
Init
(
GageAD
gageAd
,
FLYAD7
flyad7
,
CapSensor2
capSensor
,
KeXinPlc
plc
,
Blowing
blowing
,
AppConfig
appConfig
)
{
this
.
flyad7
=
flyad7
;
this
.
blowing
=
blowing
;
this
.
plc
=
plc
;
this
.
appConfig
=
appConfig
;
viewModel
=
new
MainVm
();
viewModel
.
Init
(
gageAd
,
flyad7
,
capSensor
,
plc
);
viewModel
.
Init
(
gageAd
,
flyad7
,
capSensor
,
plc
,
blowing
,
appConfig
);
this
.
DataContext
=
viewModel
;
}
private
void
button1_Click
(
object
sender
,
RoutedEventArgs
e
)
{
WindowBlowing
wb
=
new
WindowBlowing
();
wb
.
Init
(
blowing
,
plc
);
wb
.
ShowDialog
();
}
private
void
btnPressScramClick
(
object
sender
,
RoutedEventArgs
e
)
{
flyad7
.
ManualStop
();
}
private
void
btnReleaseScramClick
(
object
sender
,
RoutedEventArgs
e
)
{
flyad7
.
ManualRelease
();
}
private
void
btnManualForwordClick
(
object
sender
,
RoutedEventArgs
e
)
{
flyad7
.
ManualForw
();
}
private
void
btnManualBackwordClick
(
object
sender
,
RoutedEventArgs
e
)
{
flyad7
.
ManualBackw
();
}
}
...
...
@@ -107,31 +81,82 @@ namespace CapSimulator
public
int
Surplus
{
get
;
set
;
}
=
8000
;
private
DispatcherTimer
timer
;
private
FLYAD7
flyad
;
private
KeXinPlc
plc
;
private
CapSensor2
capSensor
;
GageAD
gageAd
;
public
RelayCommand
OpenBlowingSetupCmd
{
get
;
private
set
;
}
public
RelayCommand
OpenAppConfigCmd
{
get
;
private
set
;
}
public
RelayCommand
PressScramCmd
{
get
;
private
set
;
}
public
RelayCommand
ReleaseScramCmd
{
get
;
private
set
;
}
public
RelayCommand
ManualForwordCmd
{
get
;
private
set
;
}
public
RelayCommand
ManualBackwordCmd
{
get
;
private
set
;
}
public
FLY
.
Simulation
.
Flyad7
.
FLYAD7
FlyAd
=>
flyad
;
public
KeXinPlc
Plc
=>
plc
;
public
GageAD
GageAD
=>
gageAd
;
public
CapSensor2
CapSensor
=>
capSensor
;
private
DispatcherTimer
timer
;
FLYAD7
flyad
;
KeXinPlc
plc
;
CapSensor2
capSensor
;
GageAD
gageAd
;
Blowing
blowing
;
AppConfig
appConfig
;
public
MainVm
()
{
OpenBlowingSetupCmd
=
new
RelayCommand
(
OpenBlowingSetup
);
OpenAppConfigCmd
=
new
RelayCommand
(
OpenAppConfig
);
PressScramCmd
=
new
RelayCommand
(
PressScram
);
ReleaseScramCmd
=
new
RelayCommand
(
ReleaseScram
);
ManualForwordCmd
=
new
RelayCommand
(
ManualForword
);
ManualBackwordCmd
=
new
RelayCommand
(
ManualBackword
);
}
public
void
Init
(
GageAD
gageAd
,
FLYAD7
flyad
,
CapSensor2
capSensor
,
KeXinPlc
plc
)
public
void
Init
(
GageAD
gageAd
,
FLYAD7
flyad
,
CapSensor2
capSensor
,
KeXinPlc
plc
,
Blowing
blowing
,
AppConfig
appConfig
)
{
this
.
gageAd
=
gageAd
;
this
.
flyad
=
flyad
;
this
.
plc
=
plc
;
this
.
capSensor
=
capSensor
;
this
.
blowing
=
blowing
;
this
.
appConfig
=
appConfig
;
timer
=
new
DispatcherTimer
();
timer
.
Interval
=
TimeSpan
.
FromSeconds
(
0.1
);
timer
.
Tick
+=
new
EventHandler
(
timer_Tick
);
timer
.
Start
();
}
private
void
OpenBlowingSetup
()
{
WindowBlowing
wb
=
new
WindowBlowing
();
wb
.
Init
(
blowing
,
plc
,
gageAd
);
wb
.
ShowDialog
();
}
private
void
OpenAppConfig
()
{
WdAddr
w
=
new
WdAddr
();
w
.
Init
(
appConfig
);
w
.
ShowDialog
();
}
private
void
PressScram
()
{
flyad
.
ManualStop
();
}
private
void
ReleaseScram
()
{
flyad
.
ManualRelease
();
}
private
void
ManualForword
()
{
flyad
.
ManualForw
();
}
private
void
ManualBackword
()
{
flyad
.
ManualBackw
();
}
void
timer_Tick
(
object
sender
,
EventArgs
e
)
{
...
...
Project.FLY.Thick.Cap/Project.CapSimulator/CapSimulator/WdAddr.xaml
0 → 100644
View file @
1d242aa2
<Window x:Class="CapSimulator.WdAddr"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CapSimulator"
mc:Ignorable="d"
Title="WdAddr" Height="250" Width="350" >
<Grid>
<StackPanel Margin="{StaticResource ControlMargin}" Grid.Column="1" >
<StackPanel.Resources>
<Style TargetType="TextBlock" x:Key="Styles.Text.FieldHeader.Editable" BasedOn="{StaticResource Styles.Text.FieldHeader.Editable}">
<Setter Property="Width" Value="130"/>
</Style>
</StackPanel.Resources>
<StackPanel Orientation="Horizontal" Margin="2">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="电容传感器地址"/>
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding CapSensorAddr}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="2">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="AD盒地址"/>
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding FlyAd7Addr}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="2">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="PLC地址"/>
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding PlcAddr}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource Styles.Button.Square.Accent2}" Content="应用" Command="{Binding SaveCmd}"/>
</StackPanel>
</StackPanel>
</Grid>
</Window>
Project.FLY.Thick.Cap/Project.CapSimulator/CapSimulator/WdAddr.xaml.cs
0 → 100644
View file @
1d242aa2
using
CommunityToolkit.Mvvm.Input
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Shapes
;
namespace
CapSimulator
{
/// <summary>
/// WdAddr.xaml 的交互逻辑
/// </summary>
public
partial
class
WdAddr
:
Window
{
WdAddrVm
viewModel
;
public
WdAddr
()
{
InitializeComponent
();
}
public
void
Init
(
AppConfig
appConfig
)
{
viewModel
=
new
WdAddrVm
();
viewModel
.
Init
(
appConfig
);
this
.
DataContext
=
viewModel
;
}
}
public
class
WdAddrVm
:
INotifyPropertyChanged
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
public
string
CapSensorAddr
{
get
;
set
;
}
public
string
FlyAd7Addr
{
get
;
set
;
}
public
string
PlcAddr
{
get
;
set
;
}
public
RelayCommand
SaveCmd
{
get
;
set
;
}
AppConfig
appConfig
;
public
WdAddrVm
()
{
SaveCmd
=
new
RelayCommand
(
Save
);
}
public
void
Init
(
AppConfig
appConfig
)
{
this
.
appConfig
=
appConfig
;
CapSensorAddr
=
appConfig
.
CapSensorAddr
;
FlyAd7Addr
=
appConfig
.
FlyAd7Addr
;
PlcAddr
=
appConfig
.
PlcAddr
;
}
private
void
Save
()
{
if
(
MessageBox
.
Show
(
"需要重启,才能生效"
,
"提示"
,
MessageBoxButton
.
OKCancel
)
==
MessageBoxResult
.
OK
)
{
appConfig
.
CapSensorAddr
=
CapSensorAddr
;
appConfig
.
FlyAd7Addr
=
FlyAd7Addr
;
appConfig
.
PlcAddr
=
PlcAddr
;
appConfig
.
Save
();
FLY
.
AppHelper
.
AppJustOne
.
Restart
();
}
}
}
}
Project.FLY.Thick.Cap/Project.CapSimulator/CapSimulator/WdBlowingVm.cs
deleted
100644 → 0
View file @
59a400e8
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
CapSimulator
{
public
class
WdBlowingVm
:
INotifyPropertyChanged
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
}
}
Project.FLY.Thick.Cap/Project.CapSimulator/CapSimulator/WindowBlowing.xaml
View file @
1d242aa2
This diff is collapsed.
Click to expand it.
Project.FLY.Thick.Cap/Project.CapSimulator/CapSimulator/WindowBlowing.xaml.cs
View file @
1d242aa2
...
...
@@ -7,22 +7,24 @@ using System.Windows;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Forms.DataVisualization.Charting
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Shapes
;
using
System.Windows.Threading
;
using
CommunityToolkit.Mvvm.Input
;
using
FLY.Simulation.Blowing
;
namespace
CapSimulator
{
/// <summary>
/// WindowBlowing.xaml 的交互逻辑
/// </summary>
public
partial
class
WindowBlowing
:
Window
{
Blowing
mBlowing
;
KeXinPlc
plcLink
;
WdBlowingVm
viewModel
;
public
WindowBlowing
()
{
InitializeComponent
();
...
...
@@ -146,50 +148,84 @@ namespace CapSimulator
this
.
chart2
.
BackColor
=
System
.
Drawing
.
Color
.
Transparent
;
}
public
void
Init
(
Blowing
blowing
,
KeXinPlc
plc
Link
)
public
void
Init
(
Blowing
blowing
,
KeXinPlc
plc
,
GageAD
gageAD
)
{
this
.
mBlowing
=
blowing
;
this
.
plcLink
=
plcLink
;
this
.
DataContext
=
mBlowing
;
spPlc
.
DataContext
=
plcLink
;
mBlowing
.
PropertyChanged
+=
new
System
.
ComponentModel
.
PropertyChangedEventHandler
(
mBlowing_PropertyChanged
);
DataBindAll
();
chart1
.
ChartAreas
[
"Default"
].
CursorX
.
Position
=
mBlowing
.
TestPos
;
viewModel
=
new
WdBlowingVm
();
viewModel
.
Init
(
blowing
,
plc
,
gageAD
,
chart1
,
chart2
,
Dispatcher
);
this
.
DataContext
=
viewModel
;
DataBindAll_chart2
();
}
}
public
class
WdBlowingVm
:
INotifyPropertyChanged
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
public
RelayCommand
TestCmd
{
get
;
private
set
;
}
public
RelayCommand
SaveCmd
{
get
;
private
set
;
}
public
Blowing
Blowing
=>
blowing
;
public
KeXinPlc
Plc
=>
plc
;
public
GageAD
GageAD
=>
gageAD
;
Blowing
blowing
;
KeXinPlc
plc
;
GageAD
gageAD
;
Chart
chart1
;
Chart
chart2
;
Dispatcher
dispatcher
;
public
WdBlowingVm
()
{
TestCmd
=
new
RelayCommand
(
Test
);
SaveCmd
=
new
RelayCommand
(
Save
);
}
private
void
Window_Loaded
(
object
sender
,
RoutedEventArgs
e
)
public
void
Init
(
Blowing
blowing
,
KeXinPlc
plc
,
GageAD
gageAD
,
Chart
chart1
,
Chart
chart2
,
Dispatcher
dispatcher
)
{
this
.
blowing
=
blowing
;
this
.
plc
=
plc
;
this
.
gageAD
=
gageAD
;
this
.
chart1
=
chart1
;
this
.
chart2
=
chart2
;
this
.
dispatcher
=
dispatcher
;
this
.
blowing
.
PropertyChanged
+=
new
System
.
ComponentModel
.
PropertyChangedEventHandler
(
mBlowing_PropertyChanged
);
DataBindAll
();
chart1
.
ChartAreas
[
"Default"
].
CursorX
.
Position
=
blowing
.
TestPos
;
DataBindAll_chart2
();
}
void
mBlowing_PropertyChanged
(
object
sender
,
System
.
ComponentModel
.
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
nameof
(
mBlowing
.
TestPos
))
if
(
e
.
PropertyName
==
nameof
(
blowing
.
TestPos
))
{
chart1
.
ChartAreas
[
"Default"
].
CursorX
.
Position
=
mB
lowing
.
TestPos
;
chart1
.
ChartAreas
[
"Default"
].
CursorX
.
Position
=
b
lowing
.
TestPos
;
}
else
if
(
e
.
PropertyName
==
nameof
(
mBlowing
.
AfterDatas
))
else
if
(
e
.
PropertyName
==
nameof
(
blowing
.
AfterDatas
))
{
this
.
D
ispatcher
.
Invoke
(
new
Action
(
DataBindAll2_chart2
));
this
.
D
ispatcher
.
Invoke
(
new
Action
(
DataBindAll2
));
d
ispatcher
.
Invoke
(
new
Action
(
DataBindAll2_chart2
));
d
ispatcher
.
Invoke
(
new
Action
(
DataBindAll2
));
}
}
public
void
DataBindAll
()
{
chart1
.
Series
[
"Series 1"
].
Points
.
Clear
();
for
(
int
i
=
0
;
i
<
mB
lowing
.
AfterDatas
.
Count
();
i
++)
for
(
int
i
=
0
;
i
<
b
lowing
.
AfterDatas
.
Count
();
i
++)
{
chart1
.
Series
[
"Series 1"
].
Points
.
AddXY
(
i
,
mB
lowing
.
AfterDatas
[
i
]);
chart1
.
Series
[
"Series 1"
].
Points
.
AddXY
(
i
,
b
lowing
.
AfterDatas
[
i
]);
}
int
max
=
mB
lowing
.
AfterDatas
.
Max
();
int
min
=
mB
lowing
.
AfterDatas
.
Min
();
int
avg
=
(
int
)
mB
lowing
.
AfterDatas
.
Average
();
int
max
=
b
lowing
.
AfterDatas
.
Max
();
int
min
=
b
lowing
.
AfterDatas
.
Min
();
int
avg
=
(
int
)
b
lowing
.
AfterDatas
.
Average
();
if
(
max
==
min
)
{
max
=
(
int
)(
avg
*
1.1
);
...
...
@@ -199,16 +235,16 @@ namespace CapSimulator
chart1
.
ChartAreas
[
"Default"
].
AxisY
.
Minimum
=
min
-
(
max
-
min
);
chart1
.
ChartAreas
[
"Default"
].
AxisX
.
Maximum
=
mB
lowing
.
AfterDatas
.
Count
();
chart1
.
ChartAreas
[
"Default"
].
AxisX
.
Maximum
=
b
lowing
.
AfterDatas
.
Count
();
chart1
.
ChartAreas
[
"Default"
].
AxisX
.
Minimum
=
0
;
chart1
.
Invalidate
();
}
public
void
DataBindAll2
()
{
for
(
int
i
=
0
;
i
<
mB
lowing
.
AfterDatas
.
Count
();
i
++)
for
(
int
i
=
0
;
i
<
b
lowing
.
AfterDatas
.
Count
();
i
++)
{
chart1
.
Series
[
"Series 1"
].
Points
[
i
].
SetValueY
(
mB
lowing
.
AfterDatas
[
i
]);
chart1
.
Series
[
"Series 1"
].
Points
[
i
].
SetValueY
(
b
lowing
.
AfterDatas
[
i
]);
}
chart1
.
Invalidate
();
}
...
...
@@ -216,49 +252,43 @@ namespace CapSimulator
public
void
DataBindAll_chart2
()
{
chart2
.
Series
[
"Series 1"
].
Points
.
Clear
();
for
(
int
i
=
0
;
i
<
mB
lowing
.
mAirRing2
.
Heats
.
Count
();
i
++)
for
(
int
i
=
0
;
i
<
b
lowing
.
mAirRing2
.
Heats
.
Count
();
i
++)
{
chart2
.
Series
[
"Series 1"
].
Points
.
AddXY
(
i
,
mB
lowing
.
mAirRing2
.
Heats
[
i
]);
chart2
.
Series
[
"Series 1"
].
Points
.
AddXY
(
i
,
b
lowing
.
mAirRing2
.
Heats
[
i
]);
}
chart2
.
ChartAreas
[
"Default"
].
AxisY
.
Maximum
=
100
;
chart2
.
ChartAreas
[
"Default"
].
AxisY
.
Minimum
=
0
;
chart2
.
ChartAreas
[
"Default"
].
AxisX
.
Maximum
=
mB
lowing
.
mAirRing2
.
Heats
.
Count
();
chart2
.
ChartAreas
[
"Default"
].
AxisX
.
Maximum
=
b
lowing
.
mAirRing2
.
Heats
.
Count
();
chart2
.
ChartAreas
[
"Default"
].
AxisX
.
Minimum
=
0
;
chart2
.
Invalidate
();
}
public
void
DataBindAll2_chart2
()
{
for
(
int
i
=
0
;
i
<
mB
lowing
.
mAirRing2
.
Heats
.
Count
();
i
++)
for
(
int
i
=
0
;
i
<
b
lowing
.
mAirRing2
.
Heats
.
Count
();
i
++)
{
chart2
.
Series
[
"Series 1"
].
Points
[
i
].
SetValueY
(
mB
lowing
.
mAirRing2
.
Heats
[
i
]);
chart2
.
Series
[
"Series 1"
].
Points
[
i
].
SetValueY
(
b
lowing
.
mAirRing2
.
Heats
[
i
]);
}
chart2
.
Invalidate
();
}
private
void
button1_Click
(
object
sender
,
RoutedEventArgs
e
)
{
mBlowing
.
Test
();
}
private
void
btnSaveClick
(
object
sender
,
RoutedEventArgs
e
)
private
void
Save
()
{
if
(
MessageBox
.
Show
(
"需要重启,才能生效"
,
"提示"
,
MessageBoxButton
.
OKCancel
)
==
MessageBoxResult
.
OK
)
{
mBlowing
.
Save
();
if
(
MessageBox
.
Show
(
"需要重启,才能生效"
,
"提示"
,
MessageBoxButton
.
OKCancel
)
==
MessageBoxResult
.
OK
)
{
blowing
.
Save
();
gageAD
.
Save
();
FLY
.
AppHelper
.
AppJustOne
.
Restart
();
}
}
private
void
CheckBox_Checked
(
object
sender
,
RoutedEventArgs
e
)
{
}
private
void
CheckBox_Unchecked
(
object
sender
,
RoutedEventArgs
e
)
private
void
Test
(
)
{
blowing
.
Test
();
}
}
...
...
Project.FLY.Thick.Cap/Project.CapSimulator/FLY.Simulation.Blowing/GageAD.cs
View file @
1d242aa2
using
System
;
using
AutoMapper
;
using
Newtonsoft.Json
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.IO
;
using
System.Linq
;
namespace
FLY.Simulation.Blowing
...
...
@@ -82,6 +85,9 @@ namespace FLY.Simulation.Blowing
public
GageAD
()
{
curve
=
new
CurveCollection
();
if
(!
Load
())
Save
();
}
public
void
Init
(
Blowing
blowing
)
{
...
...
@@ -250,7 +256,7 @@ namespace FLY.Simulation.Blowing
/// <returns></returns>
public
UInt16
GetInput
()
{
UInt16
istatus
=
0x
0
fff
;
UInt16
istatus
=
0x
f
fff
;
if
(!
mBlowing
.
IsShieldI9
)
{
...
...
@@ -309,6 +315,73 @@ namespace FLY.Simulation.Blowing
{
this
.
position
=
position
;
}
private
string
param_path
=
"simulation_gage.json"
;
public
bool
Save
()
{
return
GageADJsonDb
.
Save
(
this
,
param_path
);
}
bool
Load
()
{
return
GageADJsonDb
.
Load
(
this
,
param_path
);
}
}
public
class
GageADJsonDb
{
static
Mapper
Mapper
{
get
;
}
=
new
AutoMapper
.
Mapper
(
new
MapperConfiguration
(
c
=>
{
c
.
CreateMap
<
GageAD
,
GageADJsonDb
>().
ReverseMap
();
}));
public
static
bool
Save
(
GageAD
src
,
string
filePath
)
{
try
{
var
jsondb
=
Mapper
.
Map
<
GageADJsonDb
>(
src
);
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
jsondb
,
Formatting
.
Indented
);
File
.
WriteAllText
(
filePath
,
json
);
return
true
;
}
catch
{
return
false
;
}
}
public
static
bool
Load
(
GageAD
src
,
string
filePath
)
{
if
(!
File
.
Exists
(
filePath
))
return
false
;
try
{
string
json
=
File
.
ReadAllText
(
filePath
);
var
jsondb
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
GageADJsonDb
>(
json
);
Mapper
.
Map
(
jsondb
,
src
);
return
true
;
}
catch
{
return
false
;
}
}
/// <summary>
/// 1脉冲 = ? mm
/// </summary>
public
double
Mmpp
{
get
;
set
;
}
=
0.075
;
/// <summary>
/// 机架总长 mm
/// </summary>
public
int
TotalLengthMm
{
get
;
set
;
}
=
845
;
/// <summary>
/// 原点信号位置
/// </summary>
public
int
OrgSignMm
{
get
;
set
;
}
=
30
;
}
}
...
...
Project.FLY.Thick.Cap/Project.CapSimulator/FLY.Simulation.Flyad7/FLYAD7.cs
View file @
1d242aa2
...
...
@@ -708,7 +708,7 @@ namespace FLY.Simulation.Flyad7
public
UInt16
IStatus
{
get
;
set
;
}
public
UInt16
OStatus
{
get
;
set
;
}
=
0xf
;
public
UInt16
OStatus
{
get
;
set
;
}
=
0xf
f
;
public
void
SetOutput
(
ushort
mask
,
ushort
enable
)
...
...
Project.FLY.Thick.Cap/Project.CapSimulator/FLY.Simulation/IODefinition.cs
View file @
1d242aa2
...
...
@@ -5,6 +5,7 @@ using System.Text;
namespace
FLY.Simulation
{
//大AD盒
public
class
IODefinition
{
/// <summary>
...
...
@@ -12,18 +13,7 @@ namespace FLY.Simulation
/// </summary>
public
const
int
IN_Sync
=
0
;
/// <summary>
/// X1 归0
/// </summary>
public
const
int
IN_Origin
=
1
;
/// <summary>
/// X2 反向限位
/// </summary>
public
const
int
IN_Minimum
=
2
;
/// <summary>
/// X3 正向限位
/// </summary>
public
const
int
IN_Maximum
=
3
;
/// <summary>
/// X4 下压按钮
...
...
@@ -54,10 +44,26 @@ namespace FLY.Simulation
/// </summary>
public
const
int
IN_TurnSign1
=
9
;
/// <summary>
/// X12 归0
/// </summary>
public
const
int
IN_Origin
=
12
;
/// <summary>
/// X13 反向限位
/// </summary>
public
const
int
IN_Minimum
=
13
;
/// <summary>
/// X14 线速度
/// </summary>
public
const
int
IN_Roll
=
14
;
/// <summary>
/// X1
0 线速度
/// X1
5 正向限位
/// </summary>
public
const
int
IN_
Roll
=
10
;
public
const
int
IN_
Maximum
=
15
;
/// <summary>
/// Y0 同步信号
...
...
thick_public
@
0b3ae5b9
Subproject commit
70d4619c783bcc73f24a486c8521dea8dc4ff257
Subproject commit
0b3ae5b97be51891534edde1b8a1152d7da7d7ae
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