首次上传

This commit is contained in:
hanqiangqiang
2026-06-15 10:56:30 +08:00
commit b0213b94d6
4160 changed files with 736101 additions and 0 deletions
@@ -0,0 +1,244 @@
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using MECF.Framework.Simulator.Core.Driver;
namespace MECF.Framework.Simulator.Core.Aligners.HPA48
{
public class HPA48Simulator : SerialPortDeviceSimulator
{
#region Variables
private CancellationTokenSource _cancellationTokenSource;
private readonly object _lock = new object();
private bool _isBusy = false;
#endregion
#region Constructors
public HPA48Simulator(string portName)
: base(portName, -1, "", ' ')
{
}
#endregion
#region Properties
public bool IsAlarm { get; set; }
public bool IsVacuumOn { get; set; }
public bool IsGenerateBALError { get; set; }
#endregion
#region Methods
protected override void ProcessUnsplitMessage(string message)
{
if (message.StartsWith("ERS"))
ERS(message);
else if (message.StartsWith("BAL"))
BAL(message);
else if (message.StartsWith("HOM"))
HOM(message);
else if (message.StartsWith("CVN"))
CVN(message);
else if (message.StartsWith("CVF"))
CVF(message);
else if (message.StartsWith("CVD"))
CVD(message);
else if (message.StartsWith("MTM"))
MTM(message);
else if (message.StartsWith("DOC"))
DOC(message);
else if (message.StartsWith("STP"))
STP(message);
else if (message.StartsWith("PER"))
PER(message);
}
protected override void ProcessWriteMessage(string msg)
{
var msgReformatted = $"{msg}\r\n";
base.ProcessWriteMessage(msgReformatted);
}
private void SendResponse(string cmd, Action<string> handleCmd, Action customizeEcho = null)
{
lock (_lock)
{
if(_isBusy)
OnWriteMessage("BUSY");
else
{
if (_cancellationTokenSource == null)
{
_cancellationTokenSource = new CancellationTokenSource();
_isBusy = true;
Task.Run(() => { handleCmd?.Invoke(cmd); }, _cancellationTokenSource.Token).ContinueWith(t =>
{
lock (_lock)
{
_isBusy = false;
if(customizeEcho != null)
{
try
{
customizeEcho?.Invoke();
}
catch (Exception ex)
{
Trace.WriteLine(ex.Message);
Debugger.Break();
}
}
else
OnWriteMessage("END");
_cancellationTokenSource = null;
}
});
}
}
}
}
/// <summary>
/// 开始寻边。
/// </summary>
/// <param name="cmd"></param>
private void BAL(string cmd)
{
SendResponse(cmd, s =>
{
Thread.Sleep(3000);
}, () =>
{
if(IsGenerateBALError)
OnWriteMessage("ERR 0411");
else
OnWriteMessage("END");
});
}
/// <summary>
/// 回机械零点。
/// </summary>
/// <param name="cmd"></param>
private void HOM(string cmd)
{
SendResponse(cmd, s =>
{
Thread.Sleep(3000);
});
}
/// <summary>
/// 读取真空值
/// </summary>
/// <param name="cmd"></param>
private void CVD(string cmd)
{
SendResponse(cmd, s =>
{
Thread.Sleep(500);
OnWriteMessage("-65");
});
}
/// <summary>
/// 打开真空。
/// </summary>
/// <param name="cmd"></param>
private void CVN(string cmd)
{
SendResponse(cmd, s =>
{
Thread.Sleep(500);
IsVacuumOn = true;
});
}
/// <summary>
/// 关闭真空。
/// </summary>
/// <param name="cmd"></param>
private void CVF(string cmd)
{
SendResponse(cmd, s =>
{
Thread.Sleep(500);
IsVacuumOn = false;
});
}
/// <summary>
/// 清除所有报警。
/// </summary>
/// <param name="cmd"></param>
private void ERS(string cmd)
{
SendResponse(cmd, s =>
{
Thread.Sleep(100);
IsAlarm = false;
});
}
/// <summary>
/// 读取上一次报警
/// </summary>
/// <param name="cmd"></param>
private void PER(string cmd)
{
SendResponse(cmd, s =>
{
Thread.Sleep(500);
OnWriteMessage("ERR 444");
});
}
/// <summary>
/// 移动至测量中心点。
/// </summary>
/// <param name="cmd"></param>
private void MTM(string cmd)
{
SendResponse(cmd, s =>
{
Thread.Sleep(1000);
});
}
/// <summary>
///检测是否有Wafer。
/// </summary>
/// <param name="cmd"></param>
private void DOC(string cmd)
{
SendResponse(cmd, s =>
{
Thread.Sleep(1000);
OnWriteMessage("1");
});
}
/// <summary>
/// 停止运动。
/// </summary>
/// <param name="cmd"></param>
private void STP(string cmd)
{
_cancellationTokenSource?.Cancel();
}
#endregion
}
}
@@ -0,0 +1,75 @@
<UserControl x:Class="MECF.Framework.Simulator.Core.LoadPorts.HPA48View"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MECF.Framework.Simulator.Core.LoadPorts"
xmlns:deviceControl="clr-namespace:MECF.Framework.UI.Core.DeviceControl;assembly=MECF.Framework.UI.Core"
xmlns:commons="clr-namespace:MECF.Framework.Simulator.Core.Commons"
Height="900" Width="900">
<UserControl.Resources>
<DataTemplate x:Key="DataTemplate1">
<StackPanel Orientation="Horizontal" Width="200" Height="15">
<TextBox Text="{Binding Index}"></TextBox>
<TextBox Text="{Binding State}"></TextBox>
<Button Content="{Binding State}" Margin="0" Width="100" Height="15" Background="LightBlue" VerticalAlignment="Center"></Button>
<TextBox Text="{Binding Index}"></TextBox>
</StackPanel>
</DataTemplate>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="50"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<commons:SerialPortTitleView Grid.Row="0"/>
<StackPanel Grid.Row="2" Orientation="Horizontal" Width="900">
<Button Content="Clear Log" Width="100" Height="35" Command="{Binding ClearLogCommand}"></Button>
<CheckBox
Content="Gen BAL Error"
VerticalAlignment="Center"
Margin="10 0 0 0"
IsChecked="{Binding IsGenBALError, Mode=OneWayToSource}"/>
</StackPanel>
<DataGrid Grid.Row="3" FontSize="16" AutoGenerateColumns="False" CanUserAddRows="False" CanUserResizeRows="False" CanUserSortColumns="False" ItemsSource="{Binding TransactionLogItems}"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Width="900" Height="380" VerticalAlignment="Top">
<DataGrid.Columns>
<DataGridTextColumn Header="Time" Width="160" IsReadOnly="True" Binding="{Binding OccurTime, UpdateSourceTrigger=PropertyChanged}"/>
<DataGridTextColumn Header="Incoming" Width="350" IsReadOnly="True" Binding="{Binding Incoming, UpdateSourceTrigger=PropertyChanged}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Height" Value="auto"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Outgoing" Width="350" IsReadOnly="True" Binding="{Binding Outgoing, UpdateSourceTrigger=PropertyChanged}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Height" Value="auto"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>
@@ -0,0 +1,95 @@
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Aitex.Core.UI.MVVM;
using Aitex.Core.Utilities;
using MECF.Framework.Simulator.Core.Aligners.HPA48;
using MECF.Framework.Simulator.Core.Commons;
namespace MECF.Framework.Simulator.Core.LoadPorts
{
//public class WaferItem
//{
// public int index { get; set; }
// public string Display { get; set; }
// public int State { get; set; }
//}
/// <summary>
/// TazmoAligner.xaml 的交互逻辑
/// </summary>
public partial class HPA48View : UserControl
{
public static readonly DependencyProperty PortNameProperty = DependencyProperty.Register(
"PortName", typeof(string), typeof(TazmoAlignerView),
new FrameworkPropertyMetadata("COM10", FrameworkPropertyMetadataOptions.AffectsRender));
public string PortName
{
get => (string)this.GetValue(PortNameProperty);
set => this.SetValue(PortNameProperty, value);
}
public static readonly DependencyProperty PortNumberProperty = DependencyProperty.Register(
"PortNumber", typeof(int), typeof(TazmoAlignerView),
new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.AffectsRender));
public int PortNumber
{
get => (int)this.GetValue(PortNumberProperty);
set => this.SetValue(PortNumberProperty, value);
}
public HPA48View()
{
InitializeComponent();
this.Loaded += OnViewLoaded;
}
private void OnViewLoaded(object sender, RoutedEventArgs e)
{
if (DataContext == null)
{
DataContext = new HPA48ViewModel(PortName, PortNumber);
(DataContext as TimerViewModelBase).Start();
}
}
}
class HPA48ViewModel : SerialPortDeviceViewModel
{
public string Title => "HiWin HPA48 Aligner Simulator";
public bool IsGenBALError
{
set
{
_sim.IsGenerateBALError = value;
}
}
public ObservableCollection<WaferItem> WaferList { get; set; }
private HPA48Simulator _sim;
public HPA48ViewModel(string port, int index) : base("HPA48ViewModel")
{
_sim = new HPA48Simulator(port);
Init(_sim);
WaferList = new ObservableCollection<WaferItem>()
{
new WaferItem {Display = "1", Index = 2, State = 3}
};
}
}
}
@@ -0,0 +1,584 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Aitex.Core.RT.Log;
using MECF.Framework.Simulator.Core.Driver;
namespace MECF.Framework.Simulator.Core.LoadPorts
{
//public enum StateIndex : int
//{
// EquipmentStatus,
// Mode,
// InitialPosition,
// OperationStatus,
// ErrorCodeUpper,
// ErrorCodeLower,
// Present,
// ClampClosed,
// LatchClosed,
// VacuumOn,
// DoorClosed,
// WaferProtrusion,
//}
public class TazmoAlignerSimulator : SerialPortDeviceSimulator
{
public string SlotMap
{
get { return string.Join("", _slotMap); }
}
//public event Action<string> WriteDeviceEvent;
private string[] _slotMap = new string[25];
private string[] _state = new string[20];
private string[] _led = new string[13];
public string InforPadState { get; set; } = "0";
//private bool _isPlaced;
//private bool _isPresent;
//private int _moveTime = 5000; //
public TazmoAlignerSimulator(string portName)
: base(portName, -1, "", ' ')
{
for (int i = 0; i < _slotMap.Length; i++)
_slotMap[i] = "0";
for (int i = 0; i < _state.Length; i++)
_state[i] = "0";
for (int i = 0; i < _led.Length; i++)
_led[i] = "0";
//00110 01?10 10001 01100
//A000A 41010 10001 01000
_state[0] = "0"; //Equipment status 0 = Normal A = Recoverable error E = Fatal error
_state[1] = "0"; //Mode 0 = Online 1 = Teaching
_state[2] = "0"; //Initial position 0 = Unexecuted 1 = Executed
_state[3] = "0"; //Operation status 0 = Stopped 1 = Operating
_state[4] = "0"; //Error code Error code (upper)
_state[5] = "0"; // Error code Error code (lower)
_state[6] = "0"; //Cassette presence 0 = None 1 = Normal position 2 = Error load
_state[7] = "0"; //FOUP clamp status 0 = Open 1 = Close ? = Not defined
_state[8] = "0"; //Latch key status 0 = Open 1 = Close ? = Not defined
_state[9] = "0"; //Vacuum 0 = OFF 1 = ON
_state[10] = "1"; //Door position 0 = Open position 1 = Close position ? = Not defined
_state[11] = "0"; //Wafer protrusion sensor 0 = Blocked. 1 = Unblocked.
_state[12] = "0";
_state[13] = "0";
_state[14] = "0";
_state[15] = "0";
_state[16] = "0";
_state[17] = "0";
_state[18] = "0";
_state[19] = InforPadState;
//A000A 41010 10001 01000
_led[0] = "0"; //LOAD
_led[1] = "0"; //UNLOAD
_led[2] = "0"; //OP.ACCESS
_led[3] = "0"; //PRESENCE
_led[4] = "0"; //PLACEMENT
_led[5] = "0"; // ALARM
_led[6] = "0"; //STATUS1
_led[7] = "0"; //STATUS2
_led[8] = "0"; //
_led[9] = "0"; //
_led[10] = "0"; //
_led[11] = "0"; //
_led[12] = "0";
}
//public void ChangeSlotMap(SlotMapChangedEventArgs obj)
//{
// string slotMap = obj.SlotMap.Replace("'", "");
// for (int i = 0; i < slotMap.Length; i++)
// _slotMap[i] = slotMap.Substring(i, 1);
//}
protected override void ProcessUnsplitMessage(string message)
{
string cmd = message.Replace("s00", "").Replace("\r", "").Replace("\u0006","");
//message = message.Replace("s00", "").Replace(";", "");
//string[] msg = message.Split(':');
//if (msg.Length < 2)
// return;
//string type = msg[0];
//string cmd = msg[1];
if (cmd.Contains("ALG"))
{
_liftUP = false;
//_waferON = true;
stsfeedback = "102";
ReceiveTwinCommand(cmd, 4);
return;
}
if (cmd.Contains("PRR"))
{
_liftUP = true;
ReceiveTwinCommand(cmd, 4);
return;
}
if (cmd.Contains("VVN"))
{
ReceiveTwinCommand(cmd, 2);
return;
}
if (cmd.Contains("VVF"))
{
stsfeedback = "102";
ReceiveTwinCommand(cmd, 2);
return;
}
//if (cmd.Contains("VVF")) ReceiveTwinCommand(cmd, 2);
if (cmd.Contains("NYG"))
{
stsfeedback = "100";
ReceiveTwinCommand(cmd, 2);
return;
}
if (cmd.Contains("PRP"))
{
_liftUP = true;
ReceiveTwinCommand(cmd, 2);
return;
}
if (cmd.Contains("STS"))
{
ReceiveQueryCommand(cmd);
return;
}
if (cmd.Contains("STU"))
{
ReceiveQueryCommand(cmd);
return;
}
if (cmd.Contains("DWL"))
{
ReceiveSignleCommand(cmd);
return;
}
switch (cmd)
{
case "RST":
ReceiveTwinCommand(cmd,3);
break;
case "ERF":
ReceiveSignleCommand(cmd);
break;
case "HOM":
//_waferON = false;
_liftUP = false;
ReceiveTwinCommand(cmd, 5);
break;
case "FIN":
ReceiveFinCommand(cmd);
break;
case "MOV":
ReceiveMovCommand(cmd);
break;
case "EVT":
ReceiveEvtCommand(cmd);
break;
case "TCH":
ReceiveTchCommand(cmd);
break;
default:
ReceiveUnknownCommand(message);
break;
}
string C41Feedback = ASCIIEncoding.Default.GetString(new byte[] { 0x50, 0x43, 0x74, 0x6F, 0x50, 0x41, 0x3A, 0x43, 0x34, 0x31, 0x0D, 0x0A, 0x31, 0x0D, 0x0A, 0x4D, 0x34, 0x31, 0x0A });
if (message == "C01") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M00" });
if (message == "C02") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M01" });
if (message == "C03") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M03" });
if (message == "C04") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M05" });
if (message == "C05") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M07" });
if (message == "C06") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M09" });
if (message == "C07") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M09" });
if (message == "C08") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M10" });
if (message == "C09") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M10" });
if (message == "C10") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M11" });
if (message == "C11") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M12" });
if (message == "C12") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M12" });
if (message == "C13") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M13" });
if (message == "C14") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M13" });
if (message == "C15") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M11" });
if (message == "C16") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M31" });
if (message == "C17") SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M32" });
if (message == "C40") SendHonghuPAResponse(new string[] { "M40" });
if (message == "C41") SendHonghuPAResponse(new string[] { "M41" });
if (message.Contains("A")) SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M14" });
if (message.Contains("B")) SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M15" });
if (message.Contains("T")) SendHonghuPAResponse(new string[] { $"PCtoPA:{message}", "M16" });
}
private void ReceiveSignleCommand(string cmd)
{
SendAck(cmd);
}
private string stsfeedback = "100";
private void ReceiveQueryCommand(string cmd)
{
string data = string.Empty;
if (cmd == "STS")
data = cmd + "," + stsfeedback + "\r";
if(cmd == "STU")
data = cmd + ",00" +(_liftUP? "0":"1") +"1001011" + "\r";
OnWriteMessage(data);
}
//private bool _waferON = false;
private bool _liftUP;
private void ReceiveTwinCommand(string cmd,int delaytime)
{
SendAck(cmd);
Thread.Sleep(1000* delaytime);
SendResponse(cmd);
}
private void SendResponse(string cmd)
{
string data = cmd + "\r";
OnWriteMessage(data);
}
private void ReceiveMovCommand(string cmd)
{
bool needINF = true;
switch (cmd)
{
case "ORGSH": //back to initial
_state[(int)StateIndex.ClampClosed] = "0";
_state[(int)StateIndex.DoorClosed] = "1";
break;
case "ABORG": //Force back to initial
_state[(int)StateIndex.ClampClosed] = "0";
_state[(int)StateIndex.DoorClosed] = "1";
break;
case "PODCL": //FOUP clamp: Close
_state[(int)StateIndex.ClampClosed] = "1";
//needINF = false;
break;
case "PODOP": //FOUP clamp: open
_state[(int)StateIndex.ClampClosed] = "0";
break;
case "CLDDK": //FOUP dock:
_state[(int)StateIndex.ClampClosed] = "1";
break;
case "CUDCL": //FOUP undock
_state[(int)StateIndex.ClampClosed] = "0";
break;
case "CULFC": //FOUP undock
_state[(int)StateIndex.DoorClosed] = "1";
break;
case "CULDK": //Door Close
_state[(int)StateIndex.DoorClosed] = "1";
break;
case "CLMPO": //Door open
_state[(int)StateIndex.DoorClosed] = "0";
break;
case "CLDMP": //Maps and loads the FOUP.
_state[(int)StateIndex.DoorClosed] = "0";
_state[(int)StateIndex.ClampClosed] = "1";
break;
case "CLOAD": //loads the FOUP.
_state[(int)StateIndex.DoorClosed] = "0";
_state[(int)StateIndex.ClampClosed] = "1";
break;
case "CULOD": //Unloads the FOUP (at the ejection position).
_state[(int)StateIndex.ClampClosed] = "0";
_state[(int)StateIndex.DoorClosed] = "1";
break;
case "YDOOR": //move to dock pos in fosb mode
break;
case "YWAIT": //move to undock pos in fosb mode
break;
case "DORBK": //move to door open pos in fosb mode
_state[(int) StateIndex.DoorClosed] = "0";
break;
case "DORFW": //move to door close pos in fosb mode
_state[(int) StateIndex.DoorClosed] = "1";
break;
case "ZDRDW": //move to door down pos in fosb mode
break;
case "ZDRUP": //move to door up pos in fosb mode
break;
case "STOP_":
break;
}
SendAck(cmd);
Thread.Sleep(2000);
if(needINF) SendInf(cmd);
}
private void ReceiveSetCommand(string cmd)
{
SendAck(cmd);
if (cmd.Contains("FSB")) return;
SendInf(cmd);
}
private void ReceiveModCommand(string cmd)
{
SendAck(cmd);
}
#region GET Command
private void ReceiveGetCommand(string cmdGet)
{
_state[19] = InforPadState;
switch (cmdGet)
{
case "STATE":
FeedbackGetStatus(cmdGet);
break;
case "VERSN":
FeedbackGetVersion();
break;
case "LEDST":
FeedbackGetIndicator(cmdGet);
break;
case "MAPDT":
FeedbackGetWaferMapDescendingOrder(cmdGet);
break;
case "MAPRD":
FeedbackGetWaferMapAscendingOrder(cmdGet);
break;
case "WFCNT":
FeedbackGetWaferCount();
break;
case "FSBxx":
FeedbackGetFOSBMode(cmdGet);
break;
}
}
private void FeedbackGetStatus(string cmd)
{
string message = string.Format("s00ACK:{0}/{1};\r", cmd, string.Join("", _state));
OnWriteMessage(message);
}
private void FeedbackGetVersion()
{
}
private void FeedbackGetIndicator(string cmd)
{
string message = string.Format("s00ACK:{0}/{1};\r", cmd, string.Join("", _led));
OnWriteMessage(message);
}
//25 - 1
private void FeedbackGetWaferMapDescendingOrder(string cmd)
{
var sm = _slotMap.Reverse();
string message = string.Format("s00ACK:{0}/{1};\r", cmd, string.Join("", sm));
OnWriteMessage(message);
}
//1-25
private void FeedbackGetWaferMapAscendingOrder(string cmd)
{
string message = string.Format("s00ACK:{0}/{1};\r", cmd, string.Join("", _slotMap));
OnWriteMessage(message);
}
private void FeedbackGetWaferCount()
{
}
private void FeedbackGetFOSBMode(string cmd)
{
string message = string.Format("s00ACK:{0}/{1};\r", cmd, string.Join("", _state));
OnWriteMessage(message);
}
#endregion
private void ReceiveFinCommand(string cmd)
{
SendAck(cmd);
}
private void ReceiveEvtCommand(string cmd)
{
SendAck(cmd);
}
private void ReceiveTchCommand(string cmd)
{
SendAck(cmd);
}
private void ReceiveUnknownCommand(string message)
{
//LOG.Write("LoadPort" + _loadPortNumber + " Receive Unknown message," + message);
}
private void SendInf(string cmd)
{
Thread.Sleep(1000);
//string msg = _isPlaced ? "s00INF:PODON;\r" : "s00INF:PODOF;\r";
string message = string.Format("{0};\r", cmd);
OnWriteMessage(message);
}
private void SendAck(string cmd)
{
string ack = Encoding.Default.GetString(new byte[] { 0x6});
OnWriteMessage(ack);
}
private void SendHonghuPAResponse(string[] cmds)
{
foreach (string cmd in cmds)
{
Thread.Sleep(2000);
OnWriteMessage(cmd + "\n");
}
}
public void PlaceCarrier()
{
//SimManager.Instance.PlaceFoup(_loadPortNumber);
//_isPlaced = _isPresent = true;
_state[6] = "1";
//_led[(int) Indicator.PLACEMENT] = _isPlaced ? "1" : "0";
//_led[(int) Indicator.PRESENCE] = _isPresent ? "1" : "0";
string msg = "s00INF:PODON;\r";
OnWriteMessage(msg);
}
public void RemoveCarrier()
{
//SimManager.Instance.RemoveFoup(_loadPortNumber);
//_isPlaced = _isPresent = false;
_state[6] = "0";
//_led[(int) Indicator.PLACEMENT] = "0";
//_led[(int) Indicator.PRESENCE] = "0";
string msg = "s00INF:PODOF;\r";
OnWriteMessage(msg);
}
public void ClearWafer()
{
for (int i = 0; i < _slotMap.Length; i++)
{
_slotMap[i] = "0";
}
}
public void SetAllWafer()
{
for (int i = 0; i < _slotMap.Length; i++)
{
_slotMap[i] = "1";
}
}
public void SetUpWafer()
{
for (int i = 0; i < _slotMap.Length; i++)
{
_slotMap[i] = i>15 ? "1" : "0";
}
}
public void SetLowWafer()
{
for (int i = 0; i < _slotMap.Length; i++)
{
_slotMap[i] = i <10 ? "1" : "0";
}
}
public void RandomWafer()
{
Random _rd = new Random();
for (int i = 0; i < _slotMap.Length; i++)
{
_slotMap[i] = _rd.Next(0,10) < 6 ? "0" : "1";
}
}
}
}
@@ -0,0 +1,94 @@
<UserControl x:Class="MECF.Framework.Simulator.Core.LoadPorts.TazmoAlignerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MECF.Framework.Simulator.Core.LoadPorts"
xmlns:deviceControl="clr-namespace:MECF.Framework.UI.Core.DeviceControl;assembly=MECF.Framework.UI.Core"
xmlns:commons="clr-namespace:MECF.Framework.Simulator.Core.Commons"
Height="900" Width="900">
<UserControl.Resources>
<DataTemplate x:Key="DataTemplate1">
<StackPanel Orientation="Horizontal" Width="200" Height="15">
<TextBox Text="{Binding Index}"></TextBox>
<TextBox Text="{Binding State}"></TextBox>
<Button Content="{Binding State}" Margin="0" Width="100" Height="15" Background="LightBlue" VerticalAlignment="Center"></Button>
<TextBox Text="{Binding Index}"></TextBox>
</StackPanel>
</DataTemplate>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"></RowDefinition>
<RowDefinition Height="350"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="400"></RowDefinition>
</Grid.RowDefinitions>
<commons:SerialPortTitleView Grid.Row="0"></commons:SerialPortTitleView>
<Canvas Grid.Row="1" Height="350" Width="900">
<Label Content="{Binding WaferMap}" Width="300" Height="30" HorizontalContentAlignment="Center" Background="LightBlue" BorderThickness="2" Canvas.Left="32" Canvas.Top="50"></Label>
<Label Content="InfoPad Status" Width="161" Height="30" HorizontalContentAlignment="Center" Background="Transparent" BorderThickness="2" Canvas.Left="32" Canvas.Top="197"></Label>
<Label Content="{Binding InfoPadStatus}" Width="82" Height="41" HorizontalContentAlignment="Center" Background="LightBlue" BorderThickness="2" Canvas.Left="198" Canvas.Top="194"></Label>
<TextBox Text="{Binding InfoPadSet}" IsReadOnly ="False" Width="69" Height="38" Margin="0" RenderTransformOrigin="0.471,-0.188" Canvas.Left="285" Canvas.Top="198"></TextBox>
<Button Content="SetInfoPad" Width="138" Height="42" Command="{Binding SetInfoPadCommand}"
Canvas.Left="400" Margin="0" Canvas.Top="194" ></Button>
<Button Content="Place" Width="100" Height="35" Command="{Binding PlaceCommand}" Canvas.Left="10" Margin="0" Canvas.Top="136"></Button>
<Button Content="Remove" Width="100" Height="35" Command="{Binding RemoveCommand}" Canvas.Left="141" Margin="0" Canvas.Top="136"></Button>
<ItemsControl Width="300" Height="300" Background="LightGray" Canvas.Left="576" ItemsSource="{Binding WaferList}" ItemTemplate="{DynamicResource DataTemplate1}" >
</ItemsControl>
<Button Content="SetAll" Width="100" Height="35" Command="{Binding SetAllCommand}" Canvas.Left="513" Margin="0" Canvas.Top="305"></Button>
<Button Content="Random" Width="100" Height="35" Command="{Binding RandomCommand}" Canvas.Left="646" Margin="0" Canvas.Top="305"></Button>
<Button Content="Clear" Width="100" Height="35" Command="{Binding ClearCommand}" Canvas.Left="766" Margin="0" Canvas.Top="305"></Button>
</Canvas>
<StackPanel Grid.Row="2" Orientation="Horizontal" Width="900">
<Button Content="Clear Log" Width="100" Height="35" Command="{Binding ClearLogCommand}"></Button>
</StackPanel>
<DataGrid Grid.Row="3" FontSize="16" AutoGenerateColumns="False" CanUserAddRows="False" CanUserResizeRows="False" CanUserSortColumns="False" ItemsSource="{Binding TransactionLogItems}"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Width="900" Height="380" VerticalAlignment="Top">
<DataGrid.Columns>
<DataGridTextColumn Header="Time" Width="160" IsReadOnly="True" Binding="{Binding OccurTime, UpdateSourceTrigger=PropertyChanged}"/>
<DataGridTextColumn Header="Incoming" Width="350" IsReadOnly="True" Binding="{Binding Incoming, UpdateSourceTrigger=PropertyChanged}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Height" Value="auto"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Outgoing" Width="350" IsReadOnly="True" Binding="{Binding Outgoing, UpdateSourceTrigger=PropertyChanged}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Height" Value="auto"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>
@@ -0,0 +1,181 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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.Navigation;
using System.Windows.Shapes;
using Aitex.Core.UI.MVVM;
using Aitex.Core.Utilities;
using MECF.Framework.Simulator.Core.Commons;
using MECF.Framework.Simulator.Core.Driver;
using MECF.Framework.Simulator.Core.Robots;
namespace MECF.Framework.Simulator.Core.LoadPorts
{
//public class WaferItem
//{
// public int index { get; set; }
// public string Display { get; set; }
// public int State { get; set; }
//}
/// <summary>
/// TazmoAligner.xaml 的交互逻辑
/// </summary>
public partial class TazmoAlignerView : UserControl
{
public static readonly DependencyProperty PortNameProperty = DependencyProperty.Register(
"PortName", typeof(string), typeof(TazmoAlignerView),
new FrameworkPropertyMetadata("COM10", FrameworkPropertyMetadataOptions.AffectsRender));
public string PortName
{
get
{
return (string)this.GetValue(PortNameProperty);
}
set
{
this.SetValue(PortNameProperty, value);
}
}
public static readonly DependencyProperty PortNumberProperty = DependencyProperty.Register(
"PortNumber", typeof(int), typeof(TazmoAlignerView),
new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.AffectsRender));
public int PortNumber
{
get
{
return (int)this.GetValue(PortNumberProperty);
}
set
{
this.SetValue(PortNumberProperty, value);
}
}
public TazmoAlignerView()
{
InitializeComponent();
this.Loaded += OnViewLoaded;
}
private void OnViewLoaded(object sender, RoutedEventArgs e)
{
if (DataContext == null)
{
DataContext = new TazmoAlignerViewModel(PortName, PortNumber);
(DataContext as TimerViewModelBase).Start();
}
}
}
class TazmoAlignerViewModel : SerialPortDeviceViewModel
{
public string Title
{
get { return "Tazmo Aligner Simulator"; }
}
public string WaferMap
{
get { return _sim.SlotMap; }
}
public string InfoPadStatus
{
get { return _sim.InforPadState; }
}
[IgnorePropertyChange]
public string InfoPadSet { get; set; }
public ObservableCollection<WaferItem> WaferList { get; set; }
public ICommand PlaceCommand { get; set; }
public ICommand RemoveCommand { get; set; }
public ICommand ClearCommand { get; set; }
public ICommand SetAllCommand { get; set; }
public ICommand RandomCommand { get; set; }
public ICommand SetInfoPadCommand { get; set; }
private TazmoAlignerSimulator _sim;
public TazmoAlignerViewModel(string port, int index) : base("TazmoAlignerViewModel")
{
PlaceCommand = new DelegateCommand<string>(Place);
RemoveCommand = new DelegateCommand<string>(Remove);
ClearCommand = new DelegateCommand<string>(Clear);
SetAllCommand = new DelegateCommand<string>(SetAll);
RandomCommand = new DelegateCommand<string>(RandomGenerateWafer);
SetInfoPadCommand = new DelegateCommand<string>(SetInfoPadStatus);
_sim = new TazmoAlignerSimulator(port);
Init(_sim);
WaferList = new ObservableCollection<WaferItem>()
{
new WaferItem {Display = "1", Index = 2, State = 3}
};
if (index == 1)
_sim.SetUpWafer();
else
{
_sim.SetLowWafer();
}
}
private void SetInfoPadStatus(string obj)
{
_sim.InforPadState = InfoPadSet;
}
private void RandomGenerateWafer(string obj)
{
_sim.RandomWafer();
}
private void SetAll(string obj)
{
_sim.SetAllWafer();
}
private void Clear(string obj)
{
_sim.ClearWafer();
}
private void Remove(string obj)
{
_sim.RemoveCarrier();
}
private void Place(string obj)
{
_sim.PlaceCarrier();
}
}
}
@@ -0,0 +1,27 @@
using System;
using System.Threading;
using MECF.Framework.Simulator.Core.Driver;
using MECF.Framework.Simulator.Core.Robots;
namespace MECF.Framework.Simulator.Core.Aligners
{
public class YaskawaAlignerSimulator : YaskawaSR100ControllerSimulator
{
public YaskawaAlignerSimulator()
:base(10111)
{
}
}
public class YaskawaNXAlignerSimulator : YaskawaNX100ControllerSimulator
{
public YaskawaNXAlignerSimulator()
: base(10111)
{
}
}
}
@@ -0,0 +1,67 @@
<UserControl x:Class="MECF.Framework.Simulator.Core.Aligners.YaskawaAlignerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MECF.Framework.Simulator.Core.Aligners"
xmlns:deviceControl="clr-namespace:MECF.Framework.UI.Core.DeviceControl;assembly=MECF.Framework.UI.Core"
xmlns:commons="clr-namespace:MECF.Framework.Simulator.Core.Commons"
Height="900" Width="900">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"></RowDefinition>
<RowDefinition Height="350"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="400"></RowDefinition>
</Grid.RowDefinitions>
<commons:SocketTitleView Grid.Row="0"></commons:SocketTitleView>
<Grid Grid.Row="1" Height="350" Width="900">
<Grid.RowDefinitions>
<RowDefinition Height="300"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions>
</Grid>
<StackPanel Grid.Row="2" Orientation="Horizontal" Width="900">
<Button Content="Clear Log" Width="100" Height="35" Command="{Binding ClearLogCommand}"></Button>
</StackPanel>
<DataGrid Grid.Row="3" FontSize="16" AutoGenerateColumns="False" CanUserAddRows="False" CanUserResizeRows="False" CanUserSortColumns="False" ItemsSource="{Binding TransactionLogItems}"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Width="900" Height="380" VerticalAlignment="Top">
<DataGrid.Columns>
<DataGridTextColumn Header="Time" Width="160" IsReadOnly="True" Binding="{Binding OccurTime, UpdateSourceTrigger=PropertyChanged}"/>
<DataGridTextColumn Header="Incoming" Width="350" IsReadOnly="True" Binding="{Binding Incoming, UpdateSourceTrigger=PropertyChanged}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Height" Value="auto"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Outgoing" Width="350" IsReadOnly="True" Binding="{Binding Outgoing, UpdateSourceTrigger=PropertyChanged}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Height" Value="auto"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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.Navigation;
using System.Windows.Shapes;
using Aitex.Core.UI.MVVM;
using MECF.Framework.Simulator.Core.Commons;
using MECF.Framework.Simulator.Core.Driver;
using MECF.Framework.Simulator.Core.Robots;
namespace MECF.Framework.Simulator.Core.Aligners
{
/// <summary>
/// YaskawaAlignerView.xaml 的交互逻辑
/// </summary>
public partial class YaskawaAlignerView : UserControl
{
public YaskawaAlignerView()
{
InitializeComponent();
this.DataContext = new YaskawaAlignerViewModel();
this.Loaded += OnViewLoaded;
}
private void OnViewLoaded(object sender, RoutedEventArgs e)
{
(DataContext as TimerViewModelBase).Start();
}
}
class YaskawaAlignerViewModel : SocketDeviceViewModel
{
public string Title
{
get { return "Yaskawa Aligner Simulator"; }
}
public YaskawaAlignerViewModel() : base("YaskawaAlignerViewModel")
{
Init(new YaskawaAlignerSimulator());
}
}
}
@@ -0,0 +1,67 @@
<UserControl x:Class="MECF.Framework.Simulator.Core.Aligners.YaskawaNXAlignerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MECF.Framework.Simulator.Core.Aligners"
xmlns:deviceControl="clr-namespace:MECF.Framework.UI.Core.DeviceControl;assembly=MECF.Framework.UI.Core"
xmlns:commons="clr-namespace:MECF.Framework.Simulator.Core.Commons"
Height="900" Width="900">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"></RowDefinition>
<RowDefinition Height="350"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="400"></RowDefinition>
</Grid.RowDefinitions>
<commons:SocketTitleView Grid.Row="0"></commons:SocketTitleView>
<Grid Grid.Row="1" Height="350" Width="900">
<Grid.RowDefinitions>
<RowDefinition Height="300"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions>
</Grid>
<StackPanel Grid.Row="2" Orientation="Horizontal" Width="900">
<Button Content="Clear Log" Width="100" Height="35" Command="{Binding ClearLogCommand}"></Button>
</StackPanel>
<DataGrid Grid.Row="3" FontSize="16" AutoGenerateColumns="False" CanUserAddRows="False" CanUserResizeRows="False" CanUserSortColumns="False" ItemsSource="{Binding TransactionLogItems}"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Width="900" Height="380" VerticalAlignment="Top">
<DataGrid.Columns>
<DataGridTextColumn Header="Time" Width="160" IsReadOnly="True" Binding="{Binding OccurTime, UpdateSourceTrigger=PropertyChanged}"/>
<DataGridTextColumn Header="Incoming" Width="350" IsReadOnly="True" Binding="{Binding Incoming, UpdateSourceTrigger=PropertyChanged}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Height" Value="auto"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Outgoing" Width="350" IsReadOnly="True" Binding="{Binding Outgoing, UpdateSourceTrigger=PropertyChanged}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Height" Value="auto"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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.Navigation;
using System.Windows.Shapes;
using Aitex.Core.UI.MVVM;
using MECF.Framework.Simulator.Core.Commons;
using MECF.Framework.Simulator.Core.Driver;
using MECF.Framework.Simulator.Core.Robots;
namespace MECF.Framework.Simulator.Core.Aligners
{
/// <summary>
/// YaskawaAlignerView.xaml 的交互逻辑
/// </summary>
public partial class YaskawaNXAlignerView : UserControl
{
public YaskawaNXAlignerView()
{
InitializeComponent();
this.DataContext = new YaskawaNXAlignerViewModel();
this.Loaded += OnViewLoaded;
}
private void OnViewLoaded(object sender, RoutedEventArgs e)
{
(DataContext as TimerViewModelBase).Start();
}
}
class YaskawaNXAlignerViewModel : SocketDeviceViewModel
{
public string Title
{
get { return "Yaskawa Aligner Simulator"; }
}
public YaskawaNXAlignerViewModel() : base("YaskawaNXAlignerViewModel")
{
Init(new YaskawaNXAlignerSimulator());
}
}
}