Commit 23b74050 authored by 潘栩锋's avatar 潘栩锋 :bicyclist:

Merge remote-tracking branch 'remotes/origin/dev7.0' into dev7.0-blowing

......@@ -3,7 +3,8 @@
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:MultiLayout"
xmlns:local="clr-namespace:MultiLayout" xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:flyctrl="clr-namespace:FLY.ControlLibrary;assembly=FLY.ControlLibrary"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800" Loaded="MainWindow_Loaded">
<Window.Resources>
......@@ -17,8 +18,11 @@
</Window.Resources>
<Grid d:DataContext="{StaticResource viewModel}">
<Frame Name="frame" NavigationUIVisibility="Hidden"/>
<Button Style="{StaticResource Styles.Button.Empty}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,50,0"
Visibility="{Binding IsErrMsgVisable,Converter={StaticResource visbilityconv}}" Click="btnErrMsgClick">
<Button x:Name="btnErrMsg" Style="{StaticResource Styles.Button.Empty}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,50,0"
Visibility="{Binding IsErrMsgVisable,Converter={StaticResource visbilityconv}}" Click="btnErrMsgClick" >
<b:Interaction.Behaviors>
<flyctrl:DrapMoveXBehavior Move="DrapMoveXBehavior_Move" />
</b:Interaction.Behaviors>
<Border Background="Red" CornerRadius="0, 0 10 10" Style="{StaticResource Styles.Shadow}">
<StackPanel Orientation="Horizontal">
<Grid Width="15"/>
......
......@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -93,12 +94,59 @@ namespace MultiLayout
//启动Poll系统
//FObjBase.PollModule.Current.Start();
ErrMsgJsonDb jsonDb = new ErrMsgJsonDb();
if (jsonDb.Load()) {
var m = btnErrMsg.Margin;
m.Right = jsonDb.Right;
btnErrMsg.Margin = m;
}
}
private void btnErrMsgClick(object sender, RoutedEventArgs e)
{
manager.ErrMsgClick?.Invoke();
}
private void DrapMoveXBehavior_Move(object sender, EventArgs e)
{
ErrMsgJsonDb jsonDb = new ErrMsgJsonDb();
jsonDb.Right = (int)btnErrMsg.Margin.Right;
jsonDb.Save();
}
}
public class ErrMsgJsonDb
{
public int Right;
private string filePath = "errMsgPosition.json";
public bool Save()
{
try
{
string json = Newtonsoft.Json.JsonConvert.SerializeObject(this);
File.WriteAllText(filePath, json);
return true;
}
catch
{
return false;
}
}
public bool Load()
{
if (!File.Exists(filePath))
return false;
try
{
string json = File.ReadAllText(filePath);
Newtonsoft.Json.JsonConvert.PopulateObject(json, this);
return true;
}
catch {
return false;
}
}
}
public class WdMainVm:INotifyPropertyChanged
{
......
using Microsoft.Xaml.Behaviors;
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.Input;
using System.Windows.Threading;
namespace FLY.ControlLibrary
{
/// <summary>
/// BUTTON 移动行为,附加行为。
/// </summary>
public class DrapMoveXBehavior : Behavior<UIElement>
{
//
// 摘要:
// 发生时 System.Windows.Controls.Button 时发生。
[Category("Behavior")]
public event EventHandler Move;
bool isDown = false;
Point downPoint;
/// <summary>
/// Move 事件滞后5秒触发
/// </summary>
public bool IsMoveEventDelayTrigger { get; set; } = true;
T GetParent<T>(DependencyObject dobj) where T : DependencyObject
{
//一直向上找,直到找到window
do
{
if (dobj is T)
{
break;
}
dobj = System.Windows.Media.VisualTreeHelper.GetParent(dobj);
} while (dobj != null);
return (T)dobj;
}
DispatcherTimer timer = new DispatcherTimer();
/// <summary>
///
/// </summary>
public DrapMoveXBehavior()
{
timer.Tick += Timer_Tick;
timer.Interval = TimeSpan.FromSeconds(3);
}
private void Timer_Tick(object sender, EventArgs e)
{
timer.Stop();
Move?.Invoke(AssociatedObject, null);
}
/// <summary>
///
/// </summary>
protected override void OnAttached()
{
base.OnAttached();
UIElement dobj = AssociatedObject;
dobj.MouseRightButtonDown += Dobj_MouseRightButtonDown;
dobj.MouseRightButtonUp += Dobj_MouseRightButtonUp;
dobj.MouseMove += Dobj_MouseMove;
dobj.MouseLeave += Dobj_MouseLeave;
parent = GetParent<Grid>(dobj);
}
private void Dobj_MouseLeave(object sender, MouseEventArgs e)
{
isDown = false;
}
private void Dobj_MouseMove(object sender, MouseEventArgs e)
{
//string json = Newtonsoft.Json.JsonConvert.SerializeObject(e);
if (!isDown)
return;
FrameworkElement fe = (FrameworkElement)AssociatedObject;
var downPoint = e.GetPosition(parent);
string json = Newtonsoft.Json.JsonConvert.SerializeObject(downPoint);
//移动
int x = (int)(downPoint.X - this.downPoint.X);
if (Math.Abs(x) < 2)
return;
this.downPoint = downPoint;
var m = fe.Margin;
if (fe.HorizontalAlignment == HorizontalAlignment.Center)
{
m.Right -= x * 2;
}
else if(fe.HorizontalAlignment == HorizontalAlignment.Right)
{
m.Right -= x;
}
else if(fe.HorizontalAlignment == HorizontalAlignment.Left)
{
m.Left += x;
}
fe.Margin = m;
if (IsMoveEventDelayTrigger)
{
timer.Start();
}
else
{
Move?.Invoke(AssociatedObject, null);
}
}
Grid parent;
private void Dobj_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
downPoint = e.GetPosition(parent);
string json = Newtonsoft.Json.JsonConvert.SerializeObject(downPoint);
isDown = true;
}
private void Dobj_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
isDown = false;
}
/// <summary>
///
/// </summary>
protected override void OnDetaching()
{
base.OnDetaching();
timer.Stop();
UIElement dobj = AssociatedObject;
dobj.MouseRightButtonDown -= Dobj_MouseRightButtonDown;
dobj.MouseRightButtonUp -= Dobj_MouseRightButtonUp;
dobj.MouseMove -= Dobj_MouseMove;
dobj.MouseLeave -= Dobj_MouseLeave;
}
}
}
......@@ -61,6 +61,7 @@
<Compile Include="COMMON.cs" />
<Compile Include="Converter\Item2IndexConverter.cs" />
<Compile Include="Converter\RatioConverter.cs" />
<Compile Include="DrapMoveXBehavior.cs" />
<Compile Include="GraphRange_coslight.cs" />
<Compile Include="GraphScan3.cs" />
<Compile Include="GraphScan4.xaml.cs">
......
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Simulation.Casting
{
public class AutoDie
{
/// <summary>
/// 加热通过
/// </summary>
public int ChannelCnt;
/// <summary>
/// 加热量, 数据量为 ChannelCnt
/// </summary>
public int[] Heats;
/// <summary>
/// 第1个加热棒,对应的 数据序号, 数据量为 1000, BeforeData.Count
/// </summary>
public int Channel1stIndex;
/// <summary>
/// 加热 对 厚度的影响
/// </summary>
public double Factor;
//需要别人赋值
/// <summary>
/// 原始数据!! 数据量为1000
/// </summary>
public ObservableCollection<int> BeforeDatas;
/// <summary>
/// 加热后的数据!!!! 数据量为BeforeDatas.Count
/// </summary>
public ObservableCollection<int> AfterDatas;
double[] p;// 一个凸起来的数组 0 1 4 9 16 9 4 1 0
void p_init()
{
int size = ChannelCnt / 10;
p = new double[size];
for (int i = 0; i < size; i++)
{
int index1 = i;
int index2 = size - 1 - i;
double d = i * i;
p[index1] = d;
p[index2] = d;
if (Math.Abs(index2 - index1) <= 1)
break;
}
double sum_p = p.Max();
for (int i = 0; i < size; i++)
{
p[i] = p[i] / sum_p;
}
}
public AutoDie(int channelcnt)
{
SetChannelCnt(channelcnt);
p_init();
Factor = 5;
}
public void Init(ObservableCollection<int> before_datas, ObservableCollection<int> after_datas, int channel1stIndex)
{
BeforeDatas = before_datas;
AfterDatas = after_datas;
Channel1stIndex = channel1stIndex;
}
public void SetChannelCnt(int channelcnt)
{
ChannelCnt = channelcnt;
Heats = new int[ChannelCnt];
Array.Clear(Heats, 0, ChannelCnt);
}
public event Action<ObservableCollection<int>> AfterDatasUpdateEvent;
public void HeatApply()
{
int boltcnt = BeforeDatas.Count();
double b_c = (double)(boltcnt) / ChannelCnt;
int b = Channel1stIndex;
double beforeavg = BeforeDatas.Average();
int[] datas = new int[boltcnt];
for (int i = 0; i < ChannelCnt; i++)
{
int heat = Heats[i];
int e = (int)((i + 1) * b_c) + Channel1stIndex;
if (e >= boltcnt)
e -= boltcnt;
else if (e < 0)
e += boltcnt;
int j = b;
while (j != e)
{
datas[j] = (int)(BeforeDatas[j] - beforeavg * heat / Factor / 100);
j++;
if (j >= boltcnt)
j -= boltcnt;
}
b = e;
}
double afteravg = datas.Average();
for (int j = 0; j < boltcnt; j++)
{
AfterDatas[j] = (int)(beforeavg * datas[j] / afteravg);
}
if (AfterDatasUpdateEvent != null)
{
AfterDatasUpdateEvent(AfterDatas);
}
}
public void Test(int idx, int offset)
{
idx -= p.Count() / 2;
if (idx < 0)
idx += ChannelCnt;
else if (idx >= ChannelCnt)
idx -= ChannelCnt;
for (int i = 0; i < p.Count(); i++)
{
int index = idx + i;
if (index < 0)
index += ChannelCnt;
else if (index >= ChannelCnt)
index -= ChannelCnt;
int heat = Heats[index] + (int)(offset * p[i]);
if (heat > 100)
heat = 100;
else if (heat < 0)
heat = 0;
Heats[index] = heat;
}
HeatApply();
}
}
}
......@@ -43,7 +43,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AutoDie.cs" />
<Compile Include="GageAD.cs" />
<Compile Include="PlcLink.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
......@@ -51,6 +53,10 @@
<Project>{5EE61AC6-5269-4F0F-B8FA-4334FE4A678F}</Project>
<Name>Misc</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.ModbusMapper\FLY.ModbusMapper\FLY.ModbusMapper.csproj">
<Project>{6d4b9bda-2a66-4583-b244-758bc4213d9f}</Project>
<Name>FLY.ModbusMapper</Name>
</ProjectReference>
<ProjectReference Include="..\FLY.Simulation\FLY.Simulation.csproj">
<Project>{150F2411-FE62-4042-A968-33E416DC56A1}</Project>
<Name>FLY.Simulation</Name>
......
......@@ -47,11 +47,17 @@ namespace FLY.Simulation.Casting
/// 机架总长 mm
/// </summary>
public int TotalLength { get; set; } = 3000;
PlcLink plcLink;
Random random;
public GageAD()
{
curve = new CurveCollection();
plcLink = new PlcLink();
plcLink.Init();
Load();
random = new Random();
}
public int GetAD(int mm)
......@@ -61,7 +67,8 @@ namespace FLY.Simulation.Casting
else if (mm >= datas_horizontal.Count())
mm = datas_horizontal.Count() - 1;
int ad = datas_horizontal[mm];
ad += (int)(ad * (random.NextDouble() * 0.01 - 0.005));
return ad;
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Net;
using System.IO;
namespace FLY.Simulation.Casting
{
public class PlcLink : INotifyPropertyChanged
{
//D200 4x201 通道数量
//D201 4x202 设置值 更新
//D202 4x203 当前值 更新 //不用
//D400 4x401 设置值 160个
//D600 4x601 当前值 160个 //不用
//M3 0x4 风环开关
//M4 0x5 检测电流
const int ADDR_M_HasElectricity = 3;//检测电流
const int ADDR_M_HasFan = 4;//风环开关
const int ADDR_D_ChannelCnt = 200;
const int ADDR_D_HeatUpdate = 201;
const int ADDR_D_CurrentUpdate = 202;
const UInt16 ADDR_D_Heats = 400;
const UInt16 ADDR_D_Currents = 600;
/// <summary>
/// 加热通道数
/// </summary>
public UInt16 ChannelCnt { get; set; }
/// <summary>
/// 加热量更新
/// </summary>
public UInt16 HeatUpdate { get; set; }
/// <summary>
/// 当前量更新
/// </summary>
public UInt16 CurrentUpdate { get; set; }
/// <summary>
/// 当前电流 有没?
/// </summary>
public bool HasElectricity { get; set; }
/// <summary>
/// 风机是否启动?
/// </summary>
public bool HasFan { get; set; } = true;
UInt16 heatupdate_last = 1;
UInt16[] heats;
bool[] Bads;
AutoDie mAutoDie;
FLY.Modbus.WithThread.ServerTCP mbServer;
public PlcLink()
{
heats = new UInt16[160];
Bads = new bool[160];
Bads[2] = true;
Bads[30] = true;
HeatUpdate = 1;
heatupdate_last = 1;
CurrentUpdate = 1;
}
public void Init()
{
//this.mAutoDie = autoDie;
PlcLinkJsonDb plcLink = new PlcLinkJsonDb();
ChannelCnt = 100;// (UInt16)mAutoDie.ChannelCnt;
mbServer = new Modbus.WithThread.ServerTCP(
Misc.StringConverter.ToIPEndPoint(plcLink.Addr),
GetValue, SetValue);
mbServer.Start();
this.PropertyChanged += PlcLink_PropertyChanged;
}
private void PlcLink_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(ChannelCnt)) {
//mAutoDie.SetChannelCnt(ChannelCnt);
}
}
void GetValue(int addr, object values)
{
if (values is bool[])
GetValue_M(addr, (bool[])values);
else
GetValue_D(addr, (UInt16[])values);
}
void SetValue(int addr, object values)
{
if (values is bool[])
SetValue_M(addr, (bool[])values);
else
SetValue_D(addr, (UInt16[])values);
}
void GetValue_M(int addr, bool[] values)
{
for (int i = 0; i < values.Count(); i++)
{
int single_addr = addr + i;
switch (single_addr)
{
case ADDR_M_HasElectricity:
{
values[i] = HasElectricity;
}
break;
case ADDR_M_HasFan:
{
values[i] = HasFan;
}
break;
}
}
}
void GetValue_D(int addr, UInt16[] values)
{
for (int i = 0; i < values.Count(); i++)
{
int single_addr = addr + i;
if (single_addr == ADDR_D_ChannelCnt)
{
values[i] = ChannelCnt;
}
else if (single_addr == ADDR_D_HeatUpdate)
{
values[i] = HeatUpdate;
}
else if (single_addr == ADDR_D_CurrentUpdate)
{
values[i] = CurrentUpdate;
}
else if (single_addr >= ADDR_D_Heats && single_addr < ADDR_D_Heats + 160)
{
int index = single_addr - ADDR_D_Heats;
values[i] = heats[index];
}
else if (single_addr >= ADDR_D_Currents && single_addr < ADDR_D_Currents + 160)
{
int index = single_addr - ADDR_D_Currents;
values[i] = heats[index];
//if (index < mAutoDie.Heats.Count())
//{
// values[i] = (UInt16)mAutoDie.Heats[index];
//}
}
}
}
void SetValue_M(int addr, bool[] values)
{
}
void SetValue_D(int addr, UInt16[] values)
{
for (int i = 0; i < values.Count(); i++)
{
int single_addr = addr + i;
if (single_addr == ADDR_D_ChannelCnt)
{
ChannelCnt = values[i];
}
else if (single_addr == ADDR_D_HeatUpdate)
{
HeatUpdate = values[i];
if (HeatUpdate != heatupdate_last) {
heatupdate_last = HeatUpdate;
//for (int j = 0; j < ChannelCnt; j++) {
// mAutoDie.Heats[j] = heats[j];
//}
//mAutoDie.HeatApply();
if (heats.Take(ChannelCnt).Any(h => h > 0))
HasElectricity = true;
else
HasElectricity = false;
}
CurrentUpdate++;
}
else if (single_addr == ADDR_D_CurrentUpdate)
{
CurrentUpdate = values[i];
}
else if (single_addr >= ADDR_D_Heats && single_addr < ADDR_D_Heats + 160)
{
int index = single_addr - ADDR_D_Heats;
heats[index] = values[i];
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
public class PlcLinkJsonDb
{
public string Addr = "0.0.0.0:502";
private string filePath = "plclink.json";
public bool Save()
{
try
{
string json = Newtonsoft.Json.JsonConvert.SerializeObject(this);
File.WriteAllText(filePath, json);
return true;
}
catch {
return false;
}
}
public bool Load()
{
if (!File.Exists(filePath)) {
return false;
}
try
{
string json = File.ReadAllText(filePath);
Newtonsoft.Json.JsonConvert.PopulateObject(json, this);
return true;
}
catch {
return false;
}
}
}
}
......@@ -642,6 +642,7 @@ namespace FLY.Simulation.Flyad7
public int Speed { get; set; }
public int AD { get; set; }
public int ADMax
......@@ -871,6 +872,12 @@ namespace FLY.Simulation.Flyad7
}
}
}
/// <summary>
/// 逻辑横向脉冲偏移 Pos1 + Pos1LCShift = Pos1LC
/// </summary>
public int Pos2LCShift { get; set; }
private int position2;
/// <summary>
/// 纵向脉冲,也叫主轴脉冲
......
......@@ -44,6 +44,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLY.Simulation.Calender.GuR
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLY.Simulation.Calender.GuRuiShiYe.UI", "FLY.Simulation.Calender.GuRuiShiYe.UI\FLY.Simulation.Calender.GuRuiShiYe.UI.csproj", "{517847E4-5708-4ACE-BDF0-BB2C4495136D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlyAd2021", "FlyAd2021\FlyAd2021.csproj", "{9521A8F9-7310-49B3-A951-594EFE9D3EF0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlyAd2021_WPF", "FlyAd2021_WPF\FlyAd2021_WPF.csproj", "{CE1BE9F6-8565-429D-B3CB-425B51A337E4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLY.ModbusMapper", "..\Project.FLY.ModbusMapper\FLY.ModbusMapper\FLY.ModbusMapper.csproj", "{6D4B9BDA-2A66-4583-B244-758BC4213D9F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -242,6 +248,40 @@ Global
{517847E4-5708-4ACE-BDF0-BB2C4495136D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{517847E4-5708-4ACE-BDF0-BB2C4495136D}.Release|x86.ActiveCfg = Release|Any CPU
{517847E4-5708-4ACE-BDF0-BB2C4495136D}.Release|x86.Build.0 = Release|Any CPU
{9521A8F9-7310-49B3-A951-594EFE9D3EF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9521A8F9-7310-49B3-A951-594EFE9D3EF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9521A8F9-7310-49B3-A951-594EFE9D3EF0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{9521A8F9-7310-49B3-A951-594EFE9D3EF0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{9521A8F9-7310-49B3-A951-594EFE9D3EF0}.Debug|x86.ActiveCfg = Debug|Any CPU
{9521A8F9-7310-49B3-A951-594EFE9D3EF0}.Debug|x86.Build.0 = Debug|Any CPU
{9521A8F9-7310-49B3-A951-594EFE9D3EF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9521A8F9-7310-49B3-A951-594EFE9D3EF0}.Release|Any CPU.Build.0 = Release|Any CPU
{9521A8F9-7310-49B3-A951-594EFE9D3EF0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{9521A8F9-7310-49B3-A951-594EFE9D3EF0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{9521A8F9-7310-49B3-A951-594EFE9D3EF0}.Release|x86.ActiveCfg = Release|Any CPU
{9521A8F9-7310-49B3-A951-594EFE9D3EF0}.Release|x86.Build.0 = Release|Any CPU
{CE1BE9F6-8565-429D-B3CB-425B51A337E4}.Debug|Any CPU.ActiveCfg = Debug|x86
{CE1BE9F6-8565-429D-B3CB-425B51A337E4}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{CE1BE9F6-8565-429D-B3CB-425B51A337E4}.Debug|Mixed Platforms.Build.0 = Debug|x86
{CE1BE9F6-8565-429D-B3CB-425B51A337E4}.Debug|x86.ActiveCfg = Debug|x86
{CE1BE9F6-8565-429D-B3CB-425B51A337E4}.Debug|x86.Build.0 = Debug|x86
{CE1BE9F6-8565-429D-B3CB-425B51A337E4}.Release|Any CPU.ActiveCfg = Release|x86
{CE1BE9F6-8565-429D-B3CB-425B51A337E4}.Release|Mixed Platforms.ActiveCfg = Release|x86
{CE1BE9F6-8565-429D-B3CB-425B51A337E4}.Release|Mixed Platforms.Build.0 = Release|x86
{CE1BE9F6-8565-429D-B3CB-425B51A337E4}.Release|x86.ActiveCfg = Release|x86
{CE1BE9F6-8565-429D-B3CB-425B51A337E4}.Release|x86.Build.0 = Release|x86
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Debug|x86.ActiveCfg = Debug|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Debug|x86.Build.0 = Debug|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Release|Any CPU.Build.0 = Release|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Release|x86.ActiveCfg = Release|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
This diff is collapsed.
......@@ -45,6 +45,16 @@ namespace FlyADBase
/// </summary>
int Speed { get; }
/// <summary>
/// 纵向脉冲,也叫主轴脉冲
/// </summary>
int Position2 { get; }
/// <summary>
/// 纵向速度
/// </summary>
int Speed2 { get; }
/// <summary>
/// 1000ms从AD卡获取(或推送)1个AD值。此AD值只用于调试,定点
/// </summary>
......@@ -73,11 +83,6 @@ namespace FlyADBase
/// <param name="enable"></param>
void SetOutput(UInt16 mask, UInt16 enable);
/// <summary>
/// 读取参数, 全部!!!!
/// </summary>
void UpdateParam();
#region 运动参数
/// <summary>
/// 设置 运动参数
......@@ -86,7 +91,7 @@ namespace FlyADBase
/// <param name="motortype">电机类型</param>
/// <param name="ratio01">脉冲比例 分母(电机脉冲)</param>
/// <param name="ratio02">脉冲比例 分子(编码器脉冲)</param>
void SetSysParam(UInt16 posOfGrid, MOTORTYPE motortype, UInt16 ratio01, UInt16 ratio02);
//void SetSysParam(UInt16 posOfGrid, MOTORTYPE motortype, UInt16 ratio01, UInt16 ratio02);
/// <summary>
/// 电机类型
/// </summary>
......@@ -267,54 +272,21 @@ namespace FlyADBase
/// 同步用标示
/// </summary>
Int32 Marker { get; }
#region 横向脉冲
/// <summary>
/// 逻辑横向脉冲偏移 Pos1 + Pos1LCShift = Pos1LC
/// </summary>
int Pos1LCShift { get; set; }
#endregion
#region 主轴脉冲
/// <summary>
/// 纵向脉冲,也叫主轴脉冲
/// </summary>
int Position2 { get; }
/// <summary>
/// 纵向速度
/// </summary>
int Speed2 { get; }
/// <summary>
/// 设置纵向位置
/// 逻辑纵向脉冲偏移 Pos2 + Pos2LCShift = Pos2LC
/// </summary>
/// <param name="postion2"></param>
[Obsolete("pos2 不应该被修改")]
void SetPos2(int postion2);
int Pos2LCShift { get; set; }
/// <summary>
/// 纵向偏移,这个是相对量
/// </summary>
[Obsolete("pos2 不应该被修改")]
void SetPos2Offset(int offset);
/// <summary>
/// 纵向同步事件,0-1事件
/// </summary>
/// <param name="pos2"></param>
/// <param name="immediately">只要是 01,就立刻修正</param>
[Obsolete("pos2 不应该被修改")]
void SetPos2At01(int pos2, bool immediately);
#endregion
#region 同步控制 同步状态转换规则
/// <summary>
/// 进入同步状态
/// </summary>
/// <param name="pos2"></param>
[Obsolete("pos2 不应该被修改")]
void SyncBegin(int pos2);
/// <summary>
/// 进入同步状态
/// </summary>
void SyncBegin();
/// <summary>
/// 退出同步状态
......@@ -324,24 +296,19 @@ namespace FlyADBase
/// 清空同步指令
/// </summary>
void SyncClear();
/// <summary>
/// 清空POS2同步列表
/// </summary>
[Obsolete("pos2 不应该被修改")]
void SyncPos2Clear();
#endregion
#region 同步扫描 脚本指令
/// <summary>
/// 同步扫描至;
/// D+0xE0+开始主轴位置+结束主轴位置+结束横向脉冲位置(逻辑位置)+脉冲开关(1B)+命令识标号(4B)
/// D+0xE0+开始主轴位置(逻辑位置)+结束主轴位置(逻辑位置)+结束横向脉冲位置(逻辑位置)+脉冲开关(1B)+命令识标号(4B)
/// </summary>
/// <param name="pos2_begin"></param>
/// <param name="pos2_end"></param>
/// <param name="pos2lc_begin"></param>
/// <param name="pos2lc_end"></param>
/// <param name="pos1lc"></param>
/// <param name="hasDataGrid"></param>
/// <param name="marker"></param>
void SyncRunAtLC(int pos2_begin, int pos2_end, int pos1lc, bool hasDataGrid, Int32 marker);
void SyncRunAtLC(int pos2lc_begin, int pos2lc_end, int pos1lc, bool hasDataGrid, Int32 marker);
/// <summary>
......
......@@ -55,16 +55,15 @@ namespace FlyADBase
DateTime BeResetTime { get; }
/// <summary>
/// 用于同步, 最后一次 纵向信号 0->1 时,主轴脉冲
/// 当前在同步状态
/// </summary>
[Obsolete("偏移都由电脑计算,不需要AD盒处理")]
int LastPos2At01 { get; }
bool IsSync { get; }
/// <summary>
/// 当前在同步状态
/// 只要connect成功,获取systick被复位,都会从AD盒设备读取参数;
/// 否则, 设置参数 到 AD盒
/// </summary>
bool IsSync { get; }
bool IsReadParamFromDev { get; set; }
/// <summary>
/// 同步列表,完成后,会删除
......
......@@ -16,12 +16,6 @@ namespace FlyADBase
/// </summary>
public interface IFlyADClientAdv : IFlyADClient
{
/// <summary>
/// 通过脉冲计算速度,不使用AD盒的输出
/// </summary>
bool IsCalSpeed { get; set; }
/// <summary>
/// 机架修正
/// </summary>
......@@ -33,19 +27,15 @@ namespace FlyADBase
int GridSmooth { get; set; }
/// <summary>
/// 脉冲比例 Ratio02(编码器脉冲) / Ratio01(电机脉冲)
/// PosLen / PosOfGrid;
/// </summary>
double Speed1Scale { get; }
int GridLen { get; }
/// <summary>
/// 只要connect成功,获取systick被复位,都会从AD盒设备读取参数;
/// 否则, 设置参数 到 AD盒
/// </summary>
bool IsReadParamFromDev { get; set; }
/// <summary>
/// 保存的设备参数有效
/// 脉冲比例 Ratio02(编码器脉冲) / Ratio01(电机脉冲)
/// </summary>
bool IsDevParamValid { get; set; }
double Speed1Scale { get; }
/// <summary>
/// 机架总长
/// </summary>
......@@ -104,17 +94,32 @@ namespace FlyADBase
/// </summary>
bool IsFinish { get; }
#region 滞后处理
/// <summary>
/// ad滞后修正 单位ms
/// </summary>
int ADLag { get; set; }
//一共有1.AD数据池(由timegrid提供) 1min
//2.pos数据池(pos推送提供) 1min
//4.当接收的grid事件数据。它有 (direction, grid_start,grid_len, systick )
//systick 就是结束的时间点。 当AD数据池出现了这个时间点
//pos数据池向前找。 pos 在 grid_start*posOfGrid 范围的数据。
//找到开始的systick 后,整合3个数据池的数据。
//5.最后代替 grid 推送出去。
TimeGridAdvHelper mTimeGridAdvHelper { get; }
/// <summary>
/// 动作指令完成,准备推送 timegridadv 事件
/// </summary>
bool IsTimeToPushTimeGridAdv { get; }
/// <summary>
/// 以timegrid 为单位,推送数据
/// </summary>
event TimeGridAdv2EventHandler TimeGridAdv2Event;
#endregion
}
/// <summary>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
</Weavers>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("FlyAd2021")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FlyAd2021")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("9521a8f9-7310-49b3-a951-594efe9d3ef0")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment