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
bd130581
Commit
bd130581
authored
May 03, 2022
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 PLC旋转顺序逻辑
parent
52a2953f
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
457 additions
and
156 deletions
+457
-156
TempAreaPanel2.xaml
...wing.UI.Client/UiModule/TempAreaPanel/TempAreaPanel2.xaml
+54
-35
UcTcSet.xaml
...DownBlowing.UI.Client/UiModule/TempAreaPanel/UcTcSet.xaml
+1
-1
MainWindow.xaml
...FLY.DownBlowing/FLY.DownBlowing.UI.Server/MainWindow.xaml
+1
-1
PgMain.xaml
...ect.FLY.DownBlowing/FLY.DownBlowing.UI.Server/PgMain.xaml
+51
-13
WdRotary.xaml
...t.FLY.DownBlowing/FLY.DownBlowing.UI.Server/WdRotary.xaml
+18
-7
WdRotary.xaml.cs
...LY.DownBlowing/FLY.DownBlowing.UI.Server/WdRotary.xaml.cs
+1
-0
DownBlowingSystem.cs
...Y.DownBlowing/FLY.DownBlowing/Server/DownBlowingSystem.cs
+12
-1
RotarySystem.cs
...ct.FLY.DownBlowing/FLY.DownBlowing/Server/RotarySystem.cs
+105
-31
TDGage.cs
Project.FLY.DownBlowing/FLY.DownBlowing/Server/TDGage.cs
+4
-2
RotarySerivceClient.cs
...Thick.Blowing.RotaryMachine/Client/RotarySerivceClient.cs
+7
-3
IRotarySerivce.cs
...LY.Thick.Blowing.RotaryMachine/IService/IRotarySerivce.cs
+7
-3
AssemblyInfo.cs
...LY.Thick.BlowingScan.UI.Client/Properties/AssemblyInfo.cs
+2
-2
MainWindow.xaml
Project.FLY.Winder/FLY.Winder.UI.Server/MainWindow.xaml
+1
-1
PgMain.xaml
Project.FLY.Winder/FLY.Winder.UI.Server/PgMain.xaml
+52
-14
AssemblyInfo.cs
...LY.Winder/FLY.Winder.UI.Server/Properties/AssemblyInfo.cs
+3
-3
WdRotary.xaml
Project.FLY.Winder/FLY.Winder.UI.Server/WdRotary.xaml
+17
-2
WdRotary.xaml.cs
Project.FLY.Winder/FLY.Winder.UI.Server/WdRotary.xaml.cs
+6
-0
RotarySystem.cs
Project.FLY.Winder/FLY.Winder/Server/RotarySystem.cs
+114
-37
WinderSystem.cs
Project.FLY.Winder/FLY.Winder/Server/WinderSystem.cs
+1
-0
No files found.
Project.FLY.DownBlowing/FLY.DownBlowing.UI.Client/UiModule/TempAreaPanel/TempAreaPanel2.xaml
View file @
bd130581
...
...
@@ -27,42 +27,61 @@
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Style="{StaticResource Styles.Button.Empty}" Tag="{Binding .}" Click="btnTAreaClick">
<UniformGrid Columns="1" >
<UniformGrid.Resources>
<Style TargetType="ContentControl">
<Setter Property="Margin" Value="{StaticResource ControlMargin}"/>
<Setter Property="MinWidth" Value="150"/>
<Setter Property="MinHeight" Value="116"/>
</Style>
</UniformGrid.Resources>
<Border Style="{StaticResource Styles.Module.Border}" Background="{StaticResource Color_background}" CornerRadius="5,5,0,0" >
<Viewbox >
<TextBlock Text="{Binding Number}" Foreground="{StaticResource Color_title}"
FontSize="100" FontWeight="Bold" FontFamily="Arial Black" TextAlignment="Right" />
</Viewbox>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Style="{StaticResource Styles.Module.Border}" Background="{StaticResource Color_background}" CornerRadius="5,5,0,0" Margin="{StaticResource ControlMargin}">
<TextBlock Text="{Binding Number}" Foreground="{StaticResource Color_title}"
FontSize="50" FontWeight="Bold" FontFamily="Arial Black" TextAlignment="Center" />
</Border>
<Viewbox Stretch="Uniform" StretchDirection="DownOnly">
<ContentControl ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[0]}"/>
</Viewbox>
<Viewbox Stretch="Uniform" StretchDirection="DownOnly">
<ContentControl ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[1]}"/>
</Viewbox>
<Viewbox Stretch="Uniform" StretchDirection="DownOnly">
<ContentControl ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[2]}"/>
</Viewbox>
<Viewbox Stretch="Uniform" StretchDirection="DownOnly">
<ContentControl ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[3]}"/>
</Viewbox>
<Viewbox Stretch="Uniform" StretchDirection="DownOnly">
<ContentControl ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[4]}"/>
</Viewbox>
<Viewbox Stretch="Uniform" StretchDirection="DownOnly">
<ContentControl ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[5]}"/>
</Viewbox>
<Viewbox Stretch="Uniform" StretchDirection="DownOnly">
<ContentControl ContentTemplate="{StaticResource TmTemplate}" Content="{Binding .}"/>
</Viewbox>
</UniformGrid>
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[0]}" Margin="{StaticResource ControlMargin}"/>
<ContentControl Grid.Row="2" ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[1]}" Margin="{StaticResource ControlMargin}"/>
<ContentControl Grid.Row="3" ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[2]}" Margin="{StaticResource ControlMargin}"/>
<ContentControl Grid.Row="4" ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[3]}" Margin="{StaticResource ControlMargin}"/>
<ContentControl Grid.Row="5" ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[4]}" Margin="{StaticResource ControlMargin}"/>
<ContentControl Grid.Row="6" ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[5]}" Margin="{StaticResource ControlMargin}"/>
<ContentControl Grid.Row="7" ContentTemplate="{StaticResource TmTemplate}" Content="{Binding .}" Margin="{StaticResource ControlMargin}"/>
<!--<UniformGrid Columns="1" Grid.Row="1">
<UniformGrid.Resources>
<Style TargetType="ContentControl">
<Setter Property="Margin" Value="{StaticResource ControlMargin}"/>
<Setter Property="MinWidth" Value="150"/>
<Setter Property="MinHeight" Value="116"/>
</Style>
</UniformGrid.Resources>
<Viewbox Stretch="Uniform" StretchDirection="DownOnly" >
<ContentControl ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[0]}" Width="250" />
</Viewbox>
<Viewbox Stretch="Uniform" StretchDirection="DownOnly">
<ContentControl ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[1]}"/>
</Viewbox>
<Viewbox Stretch="Uniform" StretchDirection="DownOnly">
<ContentControl ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[2]}"/>
</Viewbox>
<Viewbox Stretch="Uniform" StretchDirection="DownOnly">
<ContentControl ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[3]}"/>
</Viewbox>
<Viewbox Stretch="Uniform" StretchDirection="DownOnly">
<ContentControl ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[4]}"/>
</Viewbox>
<Viewbox Stretch="Uniform" StretchDirection="DownOnly">
<ContentControl ContentTemplate="{StaticResource TcTemplate}" Content="{Binding Temperatures[5]}"/>
</Viewbox>
<Viewbox Stretch="Uniform" StretchDirection="DownOnly">
<ContentControl ContentTemplate="{StaticResource TmTemplate}" Content="{Binding .}"/>
</Viewbox>
</UniformGrid>-->
</Grid>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
...
...
Project.FLY.DownBlowing/FLY.DownBlowing.UI.Client/UiModule/TempAreaPanel/UcTcSet.xaml
View file @
bd130581
...
...
@@ -23,7 +23,7 @@
Content="{ Binding Source={StaticResource downBlowingSystemUt}, Path=TAreas[0].Temperatures[0]}"/>
<ContentControl Width="240" Margin="{StaticResource ControlMargin}" ContentTemplate="{StaticResource TcAllSetTemplate}"
Content="{ Binding Source={StaticResource downBlowingSystemUt}, Path=TAreas[0]}"/>
<ContentControl
Width="116"
Margin="{StaticResource ControlMargin}" ContentTemplate="{StaticResource TcTemplate}"
<ContentControl Margin="{StaticResource ControlMargin}" ContentTemplate="{StaticResource TcTemplate}"
Content="{ Binding Source={StaticResource downBlowingSystemUt}, Path=TAreas[0].Temperatures[0]}"/>
<ContentControl MinWidth="150" MinHeight="116" Margin="{StaticResource ControlMargin}" ContentTemplate="{StaticResource TmTemplate}"
Content="{ Binding Source={StaticResource downBlowingSystemUt}, Path=TAreas[1]}"/>
...
...
Project.FLY.DownBlowing/FLY.DownBlowing.UI.Server/MainWindow.xaml
View file @
bd130581
<NavigationWindow x:Class="FLY.DownBlowing.UI.Server.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow"
ResizeMode="NoResize"
SizeToContent="WidthAndHeight" MinWidth="400" MinHeight="200"
Title="MainWindow" SizeToContent="WidthAndHeight" MinWidth="400" MinHeight="200"
ShowsNavigationUI="False"
Loaded="NavigationWindow_Loaded">
</NavigationWindow>
\ No newline at end of file
Project.FLY.DownBlowing/FLY.DownBlowing.UI.Server/PgMain.xaml
View file @
bd130581
...
...
@@ -11,9 +11,22 @@
<Page.Resources>
<local:TimeSpan2msConverter x:Key="timespan2msConv"/>
<local:PgMainVmUt x:Key="viewModel"/>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_Led">
<Setter Property="Margin" Value="2"/>
<Setter Property="Text" Value="[x]"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="Gray"/>
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=Self} ,Path=Tag}" Value="true">
<Setter Property="Text" Value="[√]"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Background" Value="Yellow"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Page.Resources>
<Grid d:DataContext="{StaticResource viewModel}">
<StackPanel Margin="5">
<StackPanel
Orientation="Horizontal"
Margin="5">
<GroupBox Header="PLC" Margin="5">
<StackPanel>
<ItemsControl x:Name="itemcontrol" ItemsSource="{Binding PLCs}">
...
...
@@ -61,16 +74,19 @@
<StackPanel Margin="4" >
<TextBlock Text="旋转启动" />
<TextBlock
FontSize="20" Text="{Binding IsRotaryOn}"
/>
<TextBlock
Style="{StaticResource TextBlockStyle_Led}" Tag="{Binding IsRotaryOn}"
/>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="顺时针旋转(反)" />
<TextBlock
FontSize="20" Text="{Binding IsBackw}"
/>
<TextBlock
Style="{StaticResource TextBlockStyle_Led}" Tag="{Binding IsBackw}"
/>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="逆时针旋转(正)" />
<TextBlock
FontSize="20" Text="{Binding IsForw}"
/>
<TextBlock
Style="{StaticResource TextBlockStyle_Led}" Tag="{Binding IsForw}"
/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="4" >
<TextBlock Text="电机频率" />
<StackPanel Orientation="Horizontal">
...
...
@@ -92,33 +108,55 @@
<TextBlock Text="p" VerticalAlignment="Bottom"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="全局角度" />
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="20" Text="{Binding Angle,StringFormat={}{0:F0}}"/>
<TextBlock Text="°" VerticalAlignment="Top"/>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="4" >
<TextBlock Text="换向信号0" />
<TextBlock>
<Run Text="{Binding IsTurnSign0}"/>[<Run FontSize="20" Text="{Binding RPosAtTurnSign0,StringFormat={}{0:F0}}"/>p]
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_Led}" Tag="{Binding IsTurnSign0}" />
<TextBlock><Run FontSize="20" Text="{Binding RPosAtTurnSign0,StringFormat={}{0:F0}}"/>p
(<Run FontSize="20" Text="{Binding TurnSign0Cnt}"/>)
</TextBlock>
</TextBlock>
</StackPanel>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="复位原点信号" />
<TextBlock>
<Run Text="{Binding IsOrgSign}"/>[<Run FontSize="20" Text="{Binding RPosAtOrgSign,StringFormat={}{0:F0}}"/>p]
</TextBlock>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_Led}" Tag="{Binding IsOrgSign}" />
<TextBlock><Run FontSize="20" Text="{Binding RPosAtOrgSign,StringFormat={}{0:F0}}"/>p
</TextBlock>
</StackPanel>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="换向信号1" />
<TextBlock>
<Run Text="{Binding IsTurnSign1}"/>[<Run FontSize="20" Text="{Binding RPosAtTurnSign1,StringFormat={}{0:F0}}"/>p]
</TextBlock>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_Led}" Tag="{Binding IsTurnSign1}" />
<TextBlock><Run FontSize="20" Text="{Binding RPosAtTurnSign1,StringFormat={}{0:F0}}"/>p
</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="4" >
<TextBlock Text="牵引速度" />
<TextBlock>
<Run FontSize="20" Text="{Binding TractionVelocity,StringFormat={}{0:F1}}"/>m/min
</TextBlock>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="1圈脉冲" />
<TextBlock>
<Run FontSize="20" Text="{Binding RPosOfR,StringFormat={}{0:F0}}"/>p
</TextBlock>
</StackPanel>
<Button Content="配置" Padding="20,5" Margin="5" HorizontalAlignment="Left" Click="btnRotaryClick"></Button>
</StackPanel>
</StackPanel>
...
...
Project.FLY.DownBlowing/FLY.DownBlowing.UI.Server/WdRotary.xaml
View file @
bd130581
...
...
@@ -5,15 +5,26 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FLY.DownBlowing.UI.Server"
mc:Ignorable="d"
Title="WdRotary" Height="
101.4" Width="518.1
">
Title="WdRotary" Height="
300" Width="400
">
<Grid>
<StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="5" x:Name="spRotary">
<CheckBox Content="反向" IsChecked="{Binding IsReversed}"/>
</StackPanel>
<Button Content="确定" Padding="20,5" Margin="5" Click="btnOkClick"/>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="5" x:Name="spRotary">
<CheckBox Content="反向" IsChecked="{Binding IsReversed}"/>
</StackPanel>
<Button Content="确定" Padding="20,5" Margin="5" Click="btnOkClick"/>
</StackPanel>
<DataGrid x:Name="dgSigns" Grid.Row="1" Margin="5" AutoGenerateColumns="False" IsReadOnly="True" >
<DataGrid.Columns>
<DataGridTextColumn Header="时间" Binding="{Binding Time,StringFormat={}{0:HH:mm:ss.f}}" />
<DataGridTextColumn Header="信号" Binding="{Binding No}" />
<DataGridTextColumn Header="全局脉冲" Binding="{Binding RPosGlobal,StringFormat={}{0:F0}}"/>
<DataGridTextColumn Header="相对脉冲" Binding="{Binding RPos,StringFormat={}{0:F0}}"/>
<DataGridTextColumn Header="频率(Hz)" Binding="{Binding RotaryFreqSet,StringFormat={}{0:F0}}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>
Project.FLY.DownBlowing/FLY.DownBlowing.UI.Server/WdRotary.xaml.cs
View file @
bd130581
...
...
@@ -31,6 +31,7 @@ namespace FLY.DownBlowing.UI.Server
{
this
.
rotarySystem
=
rotarySystem
;
spRotary
.
DataContext
=
rotarySystem
;
dgSigns
.
ItemsSource
=
rotarySystem
.
Signs
;
}
private
void
btnOkClick
(
object
sender
,
RoutedEventArgs
e
)
{
...
...
Project.FLY.DownBlowing/FLY.DownBlowing/Server/DownBlowingSystem.cs
View file @
bd130581
...
...
@@ -57,7 +57,7 @@ namespace FLY.DownBlowing.Server
p
rivate
PLCProxySystem
plcos
=
new
PLCProxySystem
();
p
ublic
PLCProxySystem
plcos
=
new
PLCProxySystem
();
/// <summary>
/// PLC代理系统
/// </summary>
...
...
@@ -117,6 +117,17 @@ namespace FLY.DownBlowing.Server
//step 3 历史数据记录
//添加任务
PLCos
.
SetPlan
(
nameof
(
WinderData
),
new
string
[]
{
nameof
(
WinderData
.
IsRotaryOn
),
nameof
(
WinderData
.
T1Velocity
),
nameof
(
WinderData
.
RotaryFreqSet
),
nameof
(
WinderData
.
RotaryFreq
),
nameof
(
WinderData
.
IsRotaryForw
),
nameof
(
WinderData
.
IsRotaryBackw
),
nameof
(
WinderData
.
IsRotaryBackwTurn
),
nameof
(
WinderData
.
IsRotaryForwTurn
),
nameof
(
WinderData
.
IsRotaryOrgSign
)
},
0
);
//--------------------------------------------------------------------------------
//last step PLC 更新计划服务初始化
...
...
Project.FLY.DownBlowing/FLY.DownBlowing/Server/RotarySystem.cs
View file @
bd130581
using
FLY.DownBlowing.Common
;
using
FLY.Thick.Blowing.RotaryMachine.IService
;
using
Newtonsoft.Json
;
using
System
;
...
...
@@ -11,6 +11,8 @@ using System.Text;
using
System.Threading.Tasks
;
using
System.Windows.Threading
;
using
WinderAccessory
=
FLY
.
DownBlowing
.
Common
.
WinderData
;
namespace
FLY.DownBlowing.Server
{
public
class
RotarySystem
:
IRotarySerivce
...
...
@@ -65,6 +67,11 @@ namespace FLY.DownBlowing.Server
/// </summary>
public
double
RPosAtOrgSign
{
get
;
set
;
}
=
double
.
NaN
;
/// <summary>
/// 从换向信号1 到 原点信号, 灭到亮 发生时, 旋转架脉冲 (中值)
/// </summary>
public
double
RPosAtOrgSign1
{
get
;
set
;
}
=
double
.
NaN
;
/// <summary>
/// 旋转塔逆时针换向信号发生时, 旋转架脉冲(大值)
/// </summary>
...
...
@@ -74,6 +81,9 @@ namespace FLY.DownBlowing.Server
///旋转架全局脉冲, 当前旋转架脉冲 = GlobalRPos - OrgRPos;
/// </summary>
public
double
RPosGlobal
{
get
;
set
;
}
=
0
;
public
double
RPosOfR
{
get
;
set
;
}
=
10000
;
public
double
Angle
{
get
;
set
;
}
/// <summary>
/// 旋转塔开启指示
...
...
@@ -87,7 +97,10 @@ namespace FLY.DownBlowing.Server
#
endregion
public
int
TurnSign0Cnt
{
get
;
set
;
}
WinderData
winderAccessory
;
public
List
<
SignCell
>
Signs
=
new
List
<
SignCell
>();
WinderAccessory
winderAccessory
;
DispatcherTimer
dispatcherTimer
;
Stopwatch
stopwatch_rpos
;
...
...
@@ -95,7 +108,7 @@ namespace FLY.DownBlowing.Server
{
}
public
void
Init
(
Winder
Data
_winderAccessory
)
public
void
Init
(
Winder
Accessory
_winderAccessory
)
{
winderAccessory
=
_winderAccessory
;
...
...
@@ -109,27 +122,14 @@ namespace FLY.DownBlowing.Server
Misc
.
BindingOperations
.
SetBinding
(
winderAccessory
,
nameof
(
winderAccessory
.
IsRotaryOn
),
this
,
nameof
(
IsRotaryOn
));
Misc
.
BindingOperations
.
SetBinding
(
winderAccessory
,
nameof
(
winderAccessory
.
IsRotaryForw
),
()
=>
{
IsForw
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryForw
:
winderAccessory
.
IsRotaryBackw
;
IsBackw
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryBackw
:
winderAccessory
.
IsRotaryForw
;
});
Misc
.
BindingOperations
.
SetBinding
(
winderAccessory
,
nameof
(
winderAccessory
.
IsRotaryBackw
),
()
=>
{
IsForw
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryForw
:
winderAccessory
.
IsRotaryBackw
;
IsBackw
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryBackw
:
winderAccessory
.
IsRotaryForw
;
});
Misc
.
BindingOperations
.
SetBinding
(
winderAccessory
,
new
string
[]{
nameof
(
winderAccessory
.
IsRotaryForw
),
nameof
(
winderAccessory
.
IsRotaryBackw
),
nameof
(
winderAccessory
.
IsRotaryForwTurn
),
nameof
(
winderAccessory
.
IsRotaryBackwTurn
)},
updateSign
);
Misc
.
BindingOperations
.
SetBinding
(
winderAccessory
,
nameof
(
winderAccessory
.
IsRotaryForwTurn
),
()
=>
{
IsTurnSign1
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryForwTurn
:
winderAccessory
.
IsRotaryBackwTurn
;
IsTurnSign0
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryBackwTurn
:
winderAccessory
.
IsRotaryForwTurn
;
});
Misc
.
BindingOperations
.
SetBinding
(
winderAccessory
,
nameof
(
winderAccessory
.
IsRotaryBackwTurn
),
()
=>
{
IsTurnSign1
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryForwTurn
:
winderAccessory
.
IsRotaryBackwTurn
;
IsTurnSign0
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryBackwTurn
:
winderAccessory
.
IsRotaryForwTurn
;
});
Misc
.
BindingOperations
.
SetBinding
(
winderAccessory
,
nameof
(
winderAccessory
.
IsRotaryOrgSign
),
this
,
nameof
(
IsOrgSign
));
...
...
@@ -150,6 +150,23 @@ namespace FLY.DownBlowing.Server
dispatcherTimer
.
Tick
+=
DispatcherTimer_Tick
;
stopwatch_rpos
=
new
Stopwatch
();
}
void
updateSign
()
{
if
(!
IsReversed
)
{
IsForw
=
winderAccessory
.
IsRotaryForw
;
IsBackw
=
winderAccessory
.
IsRotaryBackw
;
IsTurnSign0
=
winderAccessory
.
IsRotaryForwTurn
;
IsTurnSign1
=
winderAccessory
.
IsRotaryBackwTurn
;
}
else
{
IsForw
=
winderAccessory
.
IsRotaryBackw
;
IsBackw
=
winderAccessory
.
IsRotaryForw
;
IsTurnSign0
=
winderAccessory
.
IsRotaryBackwTurn
;
IsTurnSign1
=
winderAccessory
.
IsRotaryForwTurn
;
}
}
void
updateRSpeed
()
{
if
(
IsForw
)
...
...
@@ -182,6 +199,10 @@ namespace FLY.DownBlowing.Server
return
;
}
RPosGlobal
+=
RSpeed
*
totalSeconds
;
double
p
=
RPosGlobal
-
RPosAtTurnSign0
;
Angle
=
360
*
(
p
-
RPosOfR
/
2
)
/
RPosOfR
;
}
public
void
StartMeasureRPos
()
...
...
@@ -195,42 +216,66 @@ namespace FLY.DownBlowing.Server
dispatcherTimer
.
Stop
();
}
void
AddSign
(
SignCell
sign
)
{
Signs
.
Insert
(
0
,
sign
);
while
(
Signs
.
Count
>
100
)
Signs
.
RemoveAt
(
Signs
.
Count
()
-
1
);
}
void
AddSign
(
int
no
)
{
AddSign
(
new
SignCell
()
{
No
=
no
,
RPosGlobal
=
RPosGlobal
,
Time
=
DateTime
.
Now
,
RPos
=
RPosGlobal
-
RPosAtTurnSign0
,
RotaryFreqSet
=
RotaryFreqSet
});
}
private
void
RotarySystem_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
nameof
(
IsReversed
))
{
IsForw
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryForw
:
winderAccessory
.
IsRotaryBackw
;
IsBackw
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryBackw
:
winderAccessory
.
IsRotaryForw
;
IsTurnSign0
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryBackwTurn
:
winderAccessory
.
IsRotaryForwTurn
;
IsTurnSign1
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryForwTurn
:
winderAccessory
.
IsRotaryBackwTurn
;
updateSign
();
}
else
if
(
e
.
PropertyName
==
nameof
(
IsTurnSign0
))
{
if
(
IsTurnSign0
)
{
RPosAtTurnSign0
=
RPosGlobal
;
AddSign
(
0
);
TurnSign0Cnt
++;
}
}
else
if
(
e
.
PropertyName
==
nameof
(
IsTurnSign1
))
{
if
(
IsTurnSign1
)
{
RPosAtTurnSign1
=
RPosGlobal
;
RPosOfR
=
RPosAtTurnSign1
-
RPosAtTurnSign0
;
AddSign
(
1
);
}
}
else
if
(
e
.
PropertyName
==
nameof
(
IsOrgSign
))
{
if
(
Is
OrgSign
)
if
(
Is
Forw
)
{
if
(
Is
Forw
)
if
(
Is
OrgSign
)
{
RPosAtOrgSign
=
RPosGlobal
;
AddSign
(
20
);
}
else
{
RPosAtOrgSign1
=
RPosGlobal
;
AddSign
(
21
);
}
}
else
else
if
(
IsBackw
)
{
if
(
IsBackw
)
if
(
IsOrgSign
)
{
RPosAtOrgSign1
=
RPosGlobal
;
AddSign
(
21
);
}
else
if
(!
IsOrgSign
)
{
RPosAtOrgSign
=
RPosGlobal
;
AddSign
(
20
);
}
}
}
...
...
@@ -309,5 +354,34 @@ namespace FLY.DownBlowing.Server
public
bool
IsReversed
=
true
;
}
public
class
SignCell
:
INotifyPropertyChanged
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
/// <summary>
/// 信号
/// </summary>
public
int
No
{
get
;
set
;
}
/// <summary>
/// 全局脉冲
/// </summary>
public
double
RPosGlobal
{
get
;
set
;
}
/// <summary>
/// 时间
/// </summary>
public
DateTime
Time
{
get
;
set
;
}
/// <summary>
/// 相对脉冲
/// </summary>
public
double
RPos
{
get
;
set
;
}
/// <summary>
/// 旋转频率设置Hz
/// </summary>
public
double
RotaryFreqSet
{
get
;
set
;
}
}
}
Project.FLY.DownBlowing/FLY.DownBlowing/Server/TDGage.cs
View file @
bd130581
...
...
@@ -73,8 +73,10 @@ namespace FLY.DownBlowing.Server
rotarySystem
.
Init
(
mData
.
WinderData
);
Misc
.
BindingOperations
.
SetBinding
(
mData
.
PLCos
,
nameof
(
IPLCProxySystemService
.
IsConnectedWithPLC
),
()
=>
{
if
(
mData
.
PLCos
.
IsConnectedWithPLC
)
Misc
.
BindingOperations
.
SetBinding
(
mData
.
plcos
.
PLCs
[
0
].
Client
,
nameof
(
Modbus
.
WithThread
.
ClientTCP
.
IsConnected
),
()
=>
{
if
(
mData
.
plcos
.
PLCs
[
0
].
Client
.
IsConnected
)
rotarySystem
.
StartMeasureRPos
();
else
rotarySystem
.
StopMeasureRPos
();
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.RotaryMachine/Client/RotarySerivceClient.cs
View file @
bd130581
...
...
@@ -50,17 +50,21 @@ namespace FLY.Thick.Blowing.RotaryMachine.Client
public
double
RSpeed
{
get
;
set
;
}
/// <summary>
///
旋转塔顺时针换向信号
发生时, 旋转架脉冲 (小值)
///
换向信号0
发生时, 旋转架脉冲 (小值)
/// </summary>
public
double
RPosAtTurnSign0
{
get
;
set
;
}
/// <summary>
///
旋转塔顺复位原点信号
发生时, 旋转架脉冲 (中值)
///
从换向信号0 到 原点信号, 灭到亮
发生时, 旋转架脉冲 (中值)
/// </summary>
public
double
RPosAtOrgSign
{
get
;
set
;
}
/// <summary>
/// 从换向信号1 到 原点信号, 灭到亮 发生时, 旋转架脉冲 (中值)
/// </summary>
public
double
RPosAtOrgSign1
{
get
;
set
;
}
/// <summary>
///
旋转塔逆时针换向信号
发生时, 旋转架脉冲(大值)
///
换向信号1
发生时, 旋转架脉冲(大值)
/// </summary>
public
double
RPosAtTurnSign1
{
get
;
set
;
}
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.RotaryMachine/IService/IRotarySerivce.cs
View file @
bd130581
...
...
@@ -46,17 +46,21 @@ namespace FLY.Thick.Blowing.RotaryMachine.IService
double
RSpeed
{
get
;
}
/// <summary>
///
旋转塔顺时针换向信号
发生时, 旋转架脉冲 (小值)
///
换向信号0
发生时, 旋转架脉冲 (小值)
/// </summary>
double
RPosAtTurnSign0
{
get
;
}
/// <summary>
///
旋转塔顺复位原点信号
发生时, 旋转架脉冲 (中值)
///
从换向信号0 到 原点信号, 灭到亮
发生时, 旋转架脉冲 (中值)
/// </summary>
double
RPosAtOrgSign
{
get
;
}
/// <summary>
/// 从换向信号1 到 原点信号, 灭到亮 发生时, 旋转架脉冲 (中值)
/// </summary>
double
RPosAtOrgSign1
{
get
;
}
/// <summary>
///
旋转塔逆时针换向信号
发生时, 旋转架脉冲(大值)
///
换向信号1
发生时, 旋转架脉冲(大值)
/// </summary>
double
RPosAtTurnSign1
{
get
;
}
...
...
Project.FLY.Thick.BlowingScan/FLY.Thick.BlowingScan.UI.Client/Properties/AssemblyInfo.cs
View file @
bd130581
...
...
@@ -51,6 +51,6 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.0.
2
")]
[assembly: AssemblyFileVersion("7.0.
2
")]
[assembly: AssemblyVersion("7.0.
3
")]
[assembly: AssemblyFileVersion("7.0.
3
")]
[assembly: Guid("38E0D8EC-4D1C-49FF-AB08-6289294C5BD4")]
Project.FLY.Winder/FLY.Winder.UI.Server/MainWindow.xaml
View file @
bd130581
...
...
@@ -2,7 +2,7 @@
<NavigationWindow x:Class="FLY.Winder.UI.Server.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow"
ResizeMode="NoResize"
SizeToContent="WidthAndHeight" MinWidth="400" MinHeight="200"
Title="MainWindow" SizeToContent="WidthAndHeight" MinWidth="400" MinHeight="200"
ShowsNavigationUI="False"
Loaded="NavigationWindow_Loaded">
</NavigationWindow>
Project.FLY.Winder/FLY.Winder.UI.Server/PgMain.xaml
View file @
bd130581
...
...
@@ -8,9 +8,22 @@
Title="PgMain" >
<Page.Resources>
<local:PgMainVmUt x:Key="viewModel"/>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_Led">
<Setter Property="Margin" Value="2"/>
<Setter Property="Text" Value="[x]"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="Gray"/>
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=Self} ,Path=Tag}" Value="true">
<Setter Property="Text" Value="[√]"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Background" Value="Yellow"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Page.Resources>
<Grid d:DataContext="{StaticResource viewModel}">
<StackPanel Margin="5">
<StackPanel
Orientation="Horizontal"
Margin="5">
<GroupBox Header="PLC" Margin="5">
<StackPanel>
<ItemsControl x:Name="itemcontrol" ItemsSource="{Binding PLCs}">
...
...
@@ -55,19 +68,22 @@
<GroupBox x:Name="gbRotary" Header="旋转架" Margin="5">
<StackPanel>
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="4" >
<TextBlock Text="旋转启动" />
<TextBlock
FontSize="20" Text="{Binding IsRotaryOn}"
/>
<TextBlock
Style="{StaticResource TextBlockStyle_Led}" Tag="{Binding IsRotaryOn}"
/>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="顺时针旋转(反)" />
<TextBlock
FontSize="20" Text="{Binding IsBackw}"
/>
<TextBlock
Style="{StaticResource TextBlockStyle_Led}" Tag="{Binding IsBackw}"
/>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="逆时针旋转(正)" />
<TextBlock
FontSize="20" Text="{Binding IsForw}"
/>
<TextBlock
Style="{StaticResource TextBlockStyle_Led}" Tag="{Binding IsForw}"
/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="4" >
<TextBlock Text="电机频率" />
<StackPanel Orientation="Horizontal">
...
...
@@ -89,33 +105,55 @@
<TextBlock Text="p" VerticalAlignment="Bottom"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="全局角度" />
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="20" Text="{Binding Angle,StringFormat={}{0:F0}}"/>
<TextBlock Text="°" VerticalAlignment="Top"/>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="4" >
<TextBlock Text="换向信号0" />
<TextBlock>
<Run Text="{Binding IsTurnSign0}"/>[<Run FontSize="20" Text="{Binding RPosAtTurnSign0,StringFormat={}{0:F0}}"/>p]
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_Led}" Tag="{Binding IsTurnSign0}" />
<TextBlock><Run FontSize="20" Text="{Binding RPosAtTurnSign0,StringFormat={}{0:F0}}"/>p
(<Run FontSize="20" Text="{Binding TurnSign0Cnt}"/>)
</TextBlock>
</TextBlock>
</StackPanel>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="复位原点信号" />
<TextBlock>
<Run Text="{Binding IsOrgSign}"/>[<Run FontSize="20" Text="{Binding RPosAtOrgSign,StringFormat={}{0:F0}}"/>p]
</TextBlock>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_Led}" Tag="{Binding IsOrgSign}" />
<TextBlock><Run FontSize="20" Text="{Binding RPosAtOrgSign,StringFormat={}{0:F0}}"/>p
</TextBlock>
</StackPanel>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="换向信号1" />
<TextBlock>
<Run Text="{Binding IsTurnSign1}"/>[<Run FontSize="20" Text="{Binding RPosAtTurnSign1,StringFormat={}{0:F0}}"/>p]
</TextBlock>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_Led}" Tag="{Binding IsTurnSign1}" />
<TextBlock><Run FontSize="20" Text="{Binding RPosAtTurnSign1,StringFormat={}{0:F0}}"/>p
</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="4" >
<TextBlock Text="牵引速度" />
<TextBlock>
<Run FontSize="20" Text="{Binding TractionVelocity,StringFormat={}{0:F1}}"/>m/min
</TextBlock>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="1圈脉冲" />
<TextBlock>
<Run FontSize="20" Text="{Binding RPosOfR,StringFormat={}{0:F0}}"/>p
</TextBlock>
</StackPanel>
<Button Content="配置" Padding="20,5" Margin="5" HorizontalAlignment="Left" Click="btnRotaryClick"></Button>
</StackPanel>
</StackPanel>
...
...
Project.FLY.Winder/FLY.Winder.UI.Server/Properties/AssemblyInfo.cs
View file @
bd130581
...
...
@@ -12,7 +12,7 @@ using System.Windows;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("佛山市枫莱尔自动化技术有限公司")]
[assembly: AssemblyProduct("收卷服务器")]
[assembly: AssemblyCopyright("Copyright © 202
1
FlyAutomation")]
[assembly: AssemblyCopyright("Copyright © 202
2
FlyAutomation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
...
...
@@ -51,6 +51,6 @@ using System.Windows;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.0.
2
.0")]
[assembly: AssemblyFileVersion("7.0.
2
.0")]
[assembly: AssemblyVersion("7.0.
4
.0")]
[assembly: AssemblyFileVersion("7.0.
4
.0")]
[assembly: Guid("0CE35EA7-927A-41C0-9DC6-80511329760B")]
Project.FLY.Winder/FLY.Winder.UI.Server/WdRotary.xaml
View file @
bd130581
...
...
@@ -5,9 +5,13 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FLY.Winder.UI.Server"
mc:Ignorable="d"
Title="WdRotary" Height="
101.4" Width="518.1
">
Title="WdRotary" Height="
300" Width="400
">
<Grid>
<StackPanel>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal">
<StackPanel Margin="5" x:Name="spRotary">
<CheckBox Content="反向" IsChecked="{Binding IsReversed}"/>
...
...
@@ -15,5 +19,16 @@
<Button Content="确定" Padding="20,5" Margin="5" Click="btnOkClick"/>
</StackPanel>
</StackPanel>
<DataGrid x:Name="dgSigns" Grid.Row="1" Margin="5" AutoGenerateColumns="False" IsReadOnly="True" >
<DataGrid.Columns>
<DataGridTextColumn Header="时间" Binding="{Binding Time,StringFormat={}{0:HH:mm:ss.f}}" />
<DataGridTextColumn Header="信号" Binding="{Binding No}" />
<DataGridTextColumn Header="全局脉冲" Binding="{Binding RPosGlobal,StringFormat={}{0:F0}}"/>
<DataGridTextColumn Header="相对脉冲" Binding="{Binding RPos,StringFormat={}{0:F0}}"/>
<DataGridTextColumn Header="频率(Hz)" Binding="{Binding RotaryFreqSet,StringFormat={}{0:F0}}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>
Project.FLY.Winder/FLY.Winder.UI.Server/WdRotary.xaml.cs
View file @
bd130581
...
...
@@ -30,10 +30,16 @@ namespace FLY.Winder.UI.Server
{
this
.
rotarySystem
=
rotarySystem
;
spRotary
.
DataContext
=
rotarySystem
;
dgSigns
.
ItemsSource
=
rotarySystem
.
Signs
;
}
private
void
btnOkClick
(
object
sender
,
RoutedEventArgs
e
)
{
rotarySystem
.
Save
();
}
private
void
btnApplyClick
(
object
sender
,
RoutedEventArgs
e
)
{
}
}
}
Project.FLY.Winder/FLY.Winder/Server/RotarySystem.cs
View file @
bd130581
...
...
@@ -65,6 +65,11 @@ namespace FLY.Winder.Server
/// </summary>
public
double
RPosAtOrgSign
{
get
;
set
;
}
=
double
.
NaN
;
/// <summary>
/// 从换向信号1 到 原点信号, 灭到亮 发生时, 旋转架脉冲 (中值)
/// </summary>
public
double
RPosAtOrgSign1
{
get
;
set
;
}
=
double
.
NaN
;
/// <summary>
/// 旋转塔逆时针换向信号发生时, 旋转架脉冲(大值)
/// </summary>
...
...
@@ -74,6 +79,9 @@ namespace FLY.Winder.Server
///旋转架全局脉冲, 当前旋转架脉冲 = GlobalRPos - OrgRPos;
/// </summary>
public
double
RPosGlobal
{
get
;
set
;
}
=
0
;
public
double
RPosOfR
{
get
;
set
;
}
=
10000
;
public
double
Angle
{
get
;
set
;
}
/// <summary>
/// 旋转塔开启指示
...
...
@@ -87,12 +95,16 @@ namespace FLY.Winder.Server
#
endregion
public
int
TurnSign0Cnt
{
get
;
set
;
}
public
List
<
SignCell
>
Signs
=
new
List
<
SignCell
>();
WinderAccessory
winderAccessory
;
DispatcherTimer
dispatcherTimer
;
Stopwatch
stopwatch_rpos
;
public
RotarySystem
()
{
public
RotarySystem
()
{
}
public
void
Init
(
WinderAccessory
_winderAccessory
)
{
...
...
@@ -108,27 +120,14 @@ namespace FLY.Winder.Server
Misc
.
BindingOperations
.
SetBinding
(
winderAccessory
,
nameof
(
winderAccessory
.
IsRotaryOn
),
this
,
nameof
(
IsRotaryOn
));
Misc
.
BindingOperations
.
SetBinding
(
winderAccessory
,
nameof
(
winderAccessory
.
IsRotaryForw
),
()
=>
{
IsForw
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryForw
:
winderAccessory
.
IsRotaryBackw
;
IsBackw
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryBackw
:
winderAccessory
.
IsRotaryForw
;
});
Misc
.
BindingOperations
.
SetBinding
(
winderAccessory
,
nameof
(
winderAccessory
.
IsRotaryBackw
),
()
=>
{
IsForw
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryForw
:
winderAccessory
.
IsRotaryBackw
;
IsBackw
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryBackw
:
winderAccessory
.
IsRotaryForw
;
});
Misc
.
BindingOperations
.
SetBinding
(
winderAccessory
,
new
string
[]{
nameof
(
winderAccessory
.
IsRotaryForw
),
nameof
(
winderAccessory
.
IsRotaryBackw
),
nameof
(
winderAccessory
.
IsRotaryForwTurn
),
nameof
(
winderAccessory
.
IsRotaryBackwTurn
)},
updateSign
);
Misc
.
BindingOperations
.
SetBinding
(
winderAccessory
,
nameof
(
winderAccessory
.
IsRotaryForwTurn
),
()
=>
{
IsTurnSign1
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryForwTurn
:
winderAccessory
.
IsRotaryBackwTurn
;
IsTurnSign0
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryBackwTurn
:
winderAccessory
.
IsRotaryForwTurn
;
});
Misc
.
BindingOperations
.
SetBinding
(
winderAccessory
,
nameof
(
winderAccessory
.
IsRotaryBackwTurn
),
()
=>
{
IsTurnSign1
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryForwTurn
:
winderAccessory
.
IsRotaryBackwTurn
;
IsTurnSign0
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryBackwTurn
:
winderAccessory
.
IsRotaryForwTurn
;
});
Misc
.
BindingOperations
.
SetBinding
(
winderAccessory
,
nameof
(
winderAccessory
.
IsRotaryOrgSign
),
this
,
nameof
(
IsOrgSign
));
...
...
@@ -149,7 +148,24 @@ namespace FLY.Winder.Server
dispatcherTimer
.
Tick
+=
DispatcherTimer_Tick
;
stopwatch_rpos
=
new
Stopwatch
();
}
void
updateRSpeed
()
void
updateSign
()
{
if
(!
IsReversed
)
{
IsForw
=
winderAccessory
.
IsRotaryForw
;
IsBackw
=
winderAccessory
.
IsRotaryBackw
;
IsTurnSign0
=
winderAccessory
.
IsRotaryForwTurn
;
IsTurnSign1
=
winderAccessory
.
IsRotaryBackwTurn
;
}
else
{
IsForw
=
winderAccessory
.
IsRotaryBackw
;
IsBackw
=
winderAccessory
.
IsRotaryForw
;
IsTurnSign0
=
winderAccessory
.
IsRotaryBackwTurn
;
IsTurnSign1
=
winderAccessory
.
IsRotaryForwTurn
;
}
}
void
updateRSpeed
()
{
if
(
IsForw
)
{
...
...
@@ -169,66 +185,95 @@ namespace FLY.Winder.Server
double
totalSeconds
=
stopwatch_rpos
.
Elapsed
.
TotalSeconds
;
stopwatch_rpos
.
Restart
();
if
(!
IsBackw
&&
!
IsForw
)
if
(!
IsBackw
&&
!
IsForw
)
{
//没有运行
return
;
}
if
(
IsTurnSign0
||
IsTurnSign1
)
{
if
(
IsTurnSign0
||
IsTurnSign1
)
{
//转向信号触发时, 脉冲没有变化
return
;
}
RPosGlobal
+=
RSpeed
*
totalSeconds
;
double
p
=
RPosGlobal
-
RPosAtTurnSign0
;
Angle
=
360
*
(
p
-
RPosOfR
/
2
)
/
RPosOfR
;
}
public
void
StartMeasureRPos
()
public
void
StartMeasureRPos
()
{
stopwatch_rpos
.
Restart
();
dispatcherTimer
.
Start
();
}
public
void
StopMeasureRPos
()
public
void
StopMeasureRPos
()
{
stopwatch_rpos
.
Stop
();
dispatcherTimer
.
Stop
();
}
void
AddSign
(
SignCell
sign
)
{
Signs
.
Insert
(
0
,
sign
);
while
(
Signs
.
Count
>
100
)
Signs
.
RemoveAt
(
Signs
.
Count
()
-
1
);
}
void
AddSign
(
int
no
)
{
AddSign
(
new
SignCell
()
{
No
=
no
,
RPosGlobal
=
RPosGlobal
,
Time
=
DateTime
.
Now
,
RPos
=
RPosGlobal
-
RPosAtTurnSign0
,
RotaryFreqSet
=
RotaryFreqSet
});
}
private
void
RotarySystem_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
nameof
(
IsReversed
))
{
IsForw
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryForw
:
winderAccessory
.
IsRotaryBackw
;
IsBackw
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryBackw
:
winderAccessory
.
IsRotaryForw
;
IsTurnSign0
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryBackwTurn
:
winderAccessory
.
IsRotaryForwTurn
;
IsTurnSign1
=
(!
IsReversed
)
?
winderAccessory
.
IsRotaryForwTurn
:
winderAccessory
.
IsRotaryBackwTurn
;
updateSign
();
}
else
if
(
e
.
PropertyName
==
nameof
(
IsTurnSign0
))
{
if
(
IsTurnSign0
)
{
RPosAtTurnSign0
=
RPosGlobal
;
AddSign
(
0
);
TurnSign0Cnt
++;
}
}
else
if
(
e
.
PropertyName
==
nameof
(
IsTurnSign1
))
{
if
(
IsTurnSign1
)
{
RPosAtTurnSign1
=
RPosGlobal
;
RPosOfR
=
RPosAtTurnSign1
-
RPosAtTurnSign0
;
AddSign
(
1
);
}
}
else
if
(
e
.
PropertyName
==
nameof
(
IsOrgSign
))
{
if
(
Is
OrgSign
)
if
(
Is
Forw
)
{
if
(
Is
Forw
)
if
(
Is
OrgSign
)
{
RPosAtOrgSign
=
RPosGlobal
;
AddSign
(
20
);
}
else
{
RPosAtOrgSign1
=
RPosGlobal
;
AddSign
(
21
);
}
}
else
else
if
(
IsBackw
)
{
if
(
IsBackw
)
if
(
IsOrgSign
)
{
RPosAtOrgSign1
=
RPosGlobal
;
AddSign
(
21
);
}
else
if
(!
IsOrgSign
)
{
RPosAtOrgSign
=
RPosGlobal
;
AddSign
(
20
);
}
}
}
...
...
@@ -236,7 +281,8 @@ namespace FLY.Winder.Server
{
updateRSpeed
();
}
else
if
(
e
.
PropertyName
==
nameof
(
IsBackw
))
{
else
if
(
e
.
PropertyName
==
nameof
(
IsBackw
))
{
updateRSpeed
();
}
}
...
...
@@ -245,7 +291,8 @@ namespace FLY.Winder.Server
public
event
PropertyChangedEventHandler
PropertyChanged
;
public
bool
Save
()
{
public
bool
Save
()
{
return
RotarySystemJsonDb
.
Save
(
this
,
filePath
);
}
bool
Load
()
...
...
@@ -305,5 +352,35 @@ namespace FLY.Winder.Server
public
bool
IsReversed
=
true
;
}
public
class
SignCell
:
INotifyPropertyChanged
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
/// <summary>
/// 信号
/// </summary>
public
int
No
{
get
;
set
;
}
/// <summary>
/// 全局脉冲
/// </summary>
public
double
RPosGlobal
{
get
;
set
;
}
/// <summary>
/// 时间
/// </summary>
public
DateTime
Time
{
get
;
set
;
}
/// <summary>
/// 相对脉冲
/// </summary>
public
double
RPos
{
get
;
set
;
}
/// <summary>
/// 旋转频率设置Hz
/// </summary>
public
double
RotaryFreqSet
{
get
;
set
;
}
}
}
Project.FLY.Winder/FLY.Winder/Server/WinderSystem.cs
View file @
bd130581
...
...
@@ -114,6 +114,7 @@ namespace FLY.Winder.Server
nameof
(
Accessory
.
Traction2TensionKg
),
nameof
(
Accessory
.
RotaryCurrent
),
nameof
(
Accessory
.
RotaryFreq
),
nameof
(
Accessory
.
RotaryFreqSet
),
nameof
(
Accessory
.
IsRotaryForw
),
nameof
(
Accessory
.
IsRotaryBackw
),
...
...
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