This commit is contained in:
Generated
+65
-24
@@ -47,6 +47,8 @@
|
||||
this.LabelBoh = new System.Windows.Forms.Label();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.TXTTime = new System.Windows.Forms.TextBox();
|
||||
this.TXTAlm = new System.Windows.Forms.TextBox();
|
||||
this.TXTMsg = new System.Windows.Forms.TextBox();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -54,9 +56,9 @@
|
||||
//
|
||||
this.Connect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Connect.Location = new System.Drawing.Point(3, 86);
|
||||
this.Connect.Location = new System.Drawing.Point(14, 98);
|
||||
this.Connect.Name = "Connect";
|
||||
this.Connect.Size = new System.Drawing.Size(229, 23);
|
||||
this.Connect.Size = new System.Drawing.Size(234, 23);
|
||||
this.Connect.TabIndex = 0;
|
||||
this.Connect.Text = "Connect";
|
||||
this.Connect.UseVisualStyleBackColor = true;
|
||||
@@ -64,7 +66,10 @@
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panel1.BackColor = System.Drawing.Color.White;
|
||||
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.panel1.Controls.Add(this.label3);
|
||||
this.panel1.Controls.Add(this.label2);
|
||||
this.panel1.Controls.Add(this.label1);
|
||||
@@ -72,15 +77,16 @@
|
||||
this.panel1.Controls.Add(this.TXTip);
|
||||
this.panel1.Controls.Add(this.NcCombo);
|
||||
this.panel1.Controls.Add(this.Connect);
|
||||
this.panel1.Location = new System.Drawing.Point(12, 12);
|
||||
this.panel1.Location = new System.Drawing.Point(-3, -2);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(237, 114);
|
||||
this.panel1.Size = new System.Drawing.Size(264, 128);
|
||||
this.panel1.TabIndex = 1;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(49, 59);
|
||||
this.label3.Location = new System.Drawing.Point(63, 59);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(29, 13);
|
||||
this.label3.TabIndex = 5;
|
||||
@@ -88,8 +94,9 @@
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(34, 33);
|
||||
this.label2.Location = new System.Drawing.Point(48, 33);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(44, 13);
|
||||
this.label2.TabIndex = 4;
|
||||
@@ -97,8 +104,9 @@
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(27, 6);
|
||||
this.label1.Location = new System.Drawing.Point(41, 6);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(51, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
@@ -107,7 +115,7 @@
|
||||
// TXTport
|
||||
//
|
||||
this.TXTport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTport.Location = new System.Drawing.Point(82, 56);
|
||||
this.TXTport.Location = new System.Drawing.Point(98, 56);
|
||||
this.TXTport.Name = "TXTport";
|
||||
this.TXTport.Size = new System.Drawing.Size(150, 20);
|
||||
this.TXTport.TabIndex = 3;
|
||||
@@ -116,7 +124,7 @@
|
||||
// TXTip
|
||||
//
|
||||
this.TXTip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTip.Location = new System.Drawing.Point(82, 30);
|
||||
this.TXTip.Location = new System.Drawing.Point(98, 30);
|
||||
this.TXTip.Name = "TXTip";
|
||||
this.TXTip.Size = new System.Drawing.Size(150, 20);
|
||||
this.TXTip.TabIndex = 2;
|
||||
@@ -132,7 +140,7 @@
|
||||
"Fanuc",
|
||||
"Siemens",
|
||||
"Osai"});
|
||||
this.NcCombo.Location = new System.Drawing.Point(82, 3);
|
||||
this.NcCombo.Location = new System.Drawing.Point(98, 3);
|
||||
this.NcCombo.Name = "NcCombo";
|
||||
this.NcCombo.Size = new System.Drawing.Size(150, 21);
|
||||
this.NcCombo.TabIndex = 2;
|
||||
@@ -141,7 +149,7 @@
|
||||
// TXTPath1
|
||||
//
|
||||
this.TXTPath1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTPath1.Location = new System.Drawing.Point(184, 210);
|
||||
this.TXTPath1.Location = new System.Drawing.Point(179, 229);
|
||||
this.TXTPath1.Name = "TXTPath1";
|
||||
this.TXTPath1.ReadOnly = true;
|
||||
this.TXTPath1.Size = new System.Drawing.Size(65, 20);
|
||||
@@ -149,8 +157,9 @@
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(110, 213);
|
||||
this.label4.Location = new System.Drawing.Point(105, 232);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(68, 13);
|
||||
this.label4.TabIndex = 6;
|
||||
@@ -159,7 +168,7 @@
|
||||
// TXTStat1
|
||||
//
|
||||
this.TXTStat1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTStat1.Location = new System.Drawing.Point(184, 236);
|
||||
this.TXTStat1.Location = new System.Drawing.Point(179, 255);
|
||||
this.TXTStat1.Name = "TXTStat1";
|
||||
this.TXTStat1.ReadOnly = true;
|
||||
this.TXTStat1.Size = new System.Drawing.Size(65, 20);
|
||||
@@ -167,8 +176,9 @@
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(107, 239);
|
||||
this.label5.Location = new System.Drawing.Point(102, 258);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(71, 13);
|
||||
this.label5.TabIndex = 8;
|
||||
@@ -177,7 +187,7 @@
|
||||
// TXTName
|
||||
//
|
||||
this.TXTName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTName.Location = new System.Drawing.Point(99, 132);
|
||||
this.TXTName.Location = new System.Drawing.Point(94, 151);
|
||||
this.TXTName.Name = "TXTName";
|
||||
this.TXTName.ReadOnly = true;
|
||||
this.TXTName.Size = new System.Drawing.Size(150, 20);
|
||||
@@ -185,8 +195,9 @@
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(34, 135);
|
||||
this.label6.Location = new System.Drawing.Point(34, 154);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(55, 13);
|
||||
this.label6.TabIndex = 10;
|
||||
@@ -195,7 +206,7 @@
|
||||
// TXTNProcess
|
||||
//
|
||||
this.TXTNProcess.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTNProcess.Location = new System.Drawing.Point(184, 184);
|
||||
this.TXTNProcess.Location = new System.Drawing.Point(179, 203);
|
||||
this.TXTNProcess.Name = "TXTNProcess";
|
||||
this.TXTNProcess.ReadOnly = true;
|
||||
this.TXTNProcess.Size = new System.Drawing.Size(65, 20);
|
||||
@@ -204,7 +215,7 @@
|
||||
// TXTMachNum
|
||||
//
|
||||
this.TXTMachNum.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTMachNum.Location = new System.Drawing.Point(184, 158);
|
||||
this.TXTMachNum.Location = new System.Drawing.Point(179, 177);
|
||||
this.TXTMachNum.Name = "TXTMachNum";
|
||||
this.TXTMachNum.ReadOnly = true;
|
||||
this.TXTMachNum.Size = new System.Drawing.Size(65, 20);
|
||||
@@ -212,8 +223,9 @@
|
||||
//
|
||||
// LabelBoh
|
||||
//
|
||||
this.LabelBoh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.LabelBoh.AutoSize = true;
|
||||
this.LabelBoh.Location = new System.Drawing.Point(72, 161);
|
||||
this.LabelBoh.Location = new System.Drawing.Point(67, 180);
|
||||
this.LabelBoh.Name = "LabelBoh";
|
||||
this.LabelBoh.Size = new System.Drawing.Size(106, 13);
|
||||
this.LabelBoh.TabIndex = 14;
|
||||
@@ -221,8 +233,9 @@
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(132, 187);
|
||||
this.label8.Location = new System.Drawing.Point(127, 206);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(46, 13);
|
||||
this.label8.TabIndex = 15;
|
||||
@@ -230,18 +243,44 @@
|
||||
//
|
||||
// TXTTime
|
||||
//
|
||||
this.TXTTime.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTTime.Location = new System.Drawing.Point(84, 336);
|
||||
this.TXTTime.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTTime.Location = new System.Drawing.Point(183, 489);
|
||||
this.TXTTime.Name = "TXTTime";
|
||||
this.TXTTime.ReadOnly = true;
|
||||
this.TXTTime.Size = new System.Drawing.Size(65, 20);
|
||||
this.TXTTime.TabIndex = 16;
|
||||
//
|
||||
// TXTAlm
|
||||
//
|
||||
this.TXTAlm.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTAlm.Location = new System.Drawing.Point(7, 288);
|
||||
this.TXTAlm.Multiline = true;
|
||||
this.TXTAlm.Name = "TXTAlm";
|
||||
this.TXTAlm.ReadOnly = true;
|
||||
this.TXTAlm.Size = new System.Drawing.Size(236, 81);
|
||||
this.TXTAlm.TabIndex = 17;
|
||||
//
|
||||
// TXTMsg
|
||||
//
|
||||
this.TXTMsg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTMsg.Location = new System.Drawing.Point(7, 375);
|
||||
this.TXTMsg.Multiline = true;
|
||||
this.TXTMsg.Name = "TXTMsg";
|
||||
this.TXTMsg.ReadOnly = true;
|
||||
this.TXTMsg.Size = new System.Drawing.Size(236, 89);
|
||||
this.TXTMsg.TabIndex = 18;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(255, 479);
|
||||
this.ClientSize = new System.Drawing.Size(255, 521);
|
||||
this.Controls.Add(this.TXTMsg);
|
||||
this.Controls.Add(this.TXTAlm);
|
||||
this.Controls.Add(this.TXTTime);
|
||||
this.Controls.Add(this.label8);
|
||||
this.Controls.Add(this.LabelBoh);
|
||||
@@ -286,6 +325,8 @@
|
||||
private System.Windows.Forms.Label LabelBoh;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.TextBox TXTTime;
|
||||
private System.Windows.Forms.TextBox TXTAlm;
|
||||
private System.Windows.Forms.TextBox TXTMsg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace CMS_CORE_Application
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
static Nc N;
|
||||
static Nc N2;
|
||||
static String NCType;
|
||||
static String NCIp;
|
||||
static ushort NCPort;
|
||||
@@ -67,6 +68,8 @@ namespace CMS_CORE_Application
|
||||
String ModelName = "";
|
||||
Dictionary<String, double> Axes = new Dictionary<String,double>();
|
||||
Stopwatch sw = new Stopwatch();
|
||||
List<String> Alm = new List<string>();
|
||||
List<String> Msg = new List<string>();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -78,7 +81,7 @@ namespace CMS_CORE_Application
|
||||
N = new Nc_Osai(NCIp, NCPort,500);
|
||||
if (NCType == "Fanuc")
|
||||
N = new Nc_Fanuc(NCIp, NCPort, 500);
|
||||
|
||||
|
||||
N.NC_Connect();
|
||||
N.NC_RModelName(ref ModelName);
|
||||
N.NC_RProcessesNum(ref procnum);
|
||||
@@ -87,9 +90,10 @@ namespace CMS_CORE_Application
|
||||
while (true)
|
||||
{
|
||||
sw.Restart();
|
||||
N.AXES_RInterpPosition(1, ref Axes);
|
||||
N.PROC_RMode(1,ref mode);
|
||||
N.PROC_RStatus(1, ref status);
|
||||
N.PROC_RActiveAlarms(1,ref Alm);
|
||||
N.PLC_RActiveAlarms(ref Msg);
|
||||
sw.Stop();
|
||||
|
||||
|
||||
@@ -104,6 +108,8 @@ namespace CMS_CORE_Application
|
||||
TXTName.Text = ModelName;
|
||||
TXTMachNum.Text = MachNumber;
|
||||
TXTTime.Text = sw.ElapsedMilliseconds.ToString()+" mS";
|
||||
TXTAlm.Text = String.Join(Environment.NewLine, Alm);
|
||||
TXTMsg.Text = String.Join(Environment.NewLine, Msg);
|
||||
panel1.Enabled = false;
|
||||
});
|
||||
|
||||
|
||||
@@ -881,6 +881,12 @@
|
||||
<Content Include="fwlibe64.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="OsaiTool.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="OSAI_ErrorMgr.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Binary file not shown.
@@ -28,12 +28,12 @@ namespace CMS_CORE.Osai
|
||||
private String Cnc_SftVersion;
|
||||
private String Cnc_SeriesNum;
|
||||
private String Cnc_name;
|
||||
private String[] PlcMessages;
|
||||
private DateTime Last_Static_Read;
|
||||
private String OsaiLanguages;
|
||||
private ushort timeOutConn;
|
||||
private EndpointAddress endPointAddress;
|
||||
private BasicHttpBinding HttpBinding;
|
||||
private static String[] PlcMessages;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -61,8 +61,12 @@ namespace CMS_CORE.Osai
|
||||
//ReadLanguageConfig
|
||||
LanguageConfig();
|
||||
|
||||
//ReadPlcMessages
|
||||
ReadPlcMessages();
|
||||
//Read Plc Messages
|
||||
if(PlcMessages == null)
|
||||
{
|
||||
PlcMessages = new string[] { };
|
||||
ReadPlcMessages();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -372,6 +376,7 @@ namespace CMS_CORE.Osai
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
MSGERROR err;
|
||||
MSGEMERGENCY errEmgy;
|
||||
|
||||
//Check if the NC is Connected
|
||||
CheckConnection();
|
||||
@@ -380,12 +385,45 @@ namespace CMS_CORE.Osai
|
||||
try
|
||||
{
|
||||
//Execute the method
|
||||
nReturn = OpenNC.ReadCurrentErrorMsg(Number, out err, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.ReadCurrentEmergMsg(0, out errEmgy, out errorClass, out errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
throw new Nc_Exception(getError(NC_PROD_ERROR, errorClass, errorNum));
|
||||
|
||||
//If there's an error
|
||||
if (errEmgy.CodeErr != 0)
|
||||
{
|
||||
MESSAGE_TEXT MessageEmgy = new MESSAGE_TEXT();
|
||||
Cndex.MSG_EMERGENCY CndexErrorEmgy = ConverToCndexMessage(errEmgy);
|
||||
|
||||
//Translate using OSAI .DLL (a new one!)
|
||||
OSAIErrorManagerLibrary.TranslateEmergMsg(ref CndexErrorEmgy, ref MessageEmgy);
|
||||
|
||||
//Build the new String Message
|
||||
ActMSG = MessageEmgy.Line1.Trim();
|
||||
if (!String.IsNullOrWhiteSpace(MessageEmgy.Line2))
|
||||
ActMSG += "\n" + MessageEmgy.Line2.Trim();
|
||||
if (!String.IsNullOrWhiteSpace(MessageEmgy.Line3))
|
||||
ActMSG += "\n" + MessageEmgy.Line3.Trim();
|
||||
if (!String.IsNullOrWhiteSpace(MessageEmgy.Line4))
|
||||
ActMSG += "\n" + MessageEmgy.Line4.Trim();
|
||||
|
||||
Alarms.Clear();
|
||||
Alarms.Add(ActMSG);
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
//Second Part: Read the Global Alarms
|
||||
|
||||
//Execute the method
|
||||
nReturn = OpenNC.ReadCurrentErrorMsg(Number, out err, out errorClass, out errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
throw new Nc_Exception(getError(NC_PROD_ERROR, errorClass, errorNum));
|
||||
|
||||
//If there's an error
|
||||
if (err.CodeErr != 0)
|
||||
{
|
||||
@@ -1493,6 +1531,7 @@ namespace CMS_CORE.Osai
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Convert error from Open To Cndex
|
||||
private Cndex.MSG_ERROR ConverToCndexMessage(MSGERROR OpenError)
|
||||
{
|
||||
@@ -1511,6 +1550,21 @@ namespace CMS_CORE.Osai
|
||||
|
||||
|
||||
|
||||
//Convert error from Open To Cndex
|
||||
private Cndex.MSG_EMERGENCY ConverToCndexMessage(MSGEMERGENCY OpenError)
|
||||
{
|
||||
Cndex.MSG_EMERGENCY OsaiSerie10Err = new Cndex.MSG_EMERGENCY();
|
||||
|
||||
OsaiSerie10Err.BootID = (int)OpenError.BootID;
|
||||
OsaiSerie10Err.UnIdSeq = (int)OpenError.UnIdSeq;
|
||||
OsaiSerie10Err.Code_Err = (int)OpenError.CodeErr;
|
||||
OsaiSerie10Err.FormatTxt = OpenError.FormatTxt;
|
||||
OsaiSerie10Err.Process = OpenError.Process;
|
||||
|
||||
return OsaiSerie10Err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Convert the internal error in a readable-String error
|
||||
private String getError(uint CMSError, uint Class, uint Num)
|
||||
@@ -1701,7 +1755,7 @@ namespace CMS_CORE.Osai
|
||||
}
|
||||
return ErrororOwner + szErrorClassDesc + ": " + szErrorDesc + " (" + Class + "-" + Num + ")";
|
||||
|
||||
default: return ErrororOwner + " Generic Osai Error - Class:" + Class + " Num:" + Num + ")";
|
||||
default: return ErrororOwner + " Generic Osai Error - Class: " + Class + " Num: " + Num;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace CMS_CORE.Osai
|
||||
/// pText: MESSAGE_TEXT*
|
||||
/// </summary>
|
||||
[DllImport("OSAI_ErrorMgr.dll", EntryPoint = "TranslateEmergMsg", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void TranslateEmergMsg(ref MSGEMERGENCY pMsgLog, ref MESSAGE_TEXT pText);
|
||||
public static extern void TranslateEmergMsg(ref Cndex.MSG_EMERGENCY pMsgLog, ref MESSAGE_TEXT pText);
|
||||
|
||||
/// <summary>
|
||||
/// Return Type: void
|
||||
|
||||
Binary file not shown.
@@ -20,6 +20,10 @@ namespace CMS_CORE.Siemens
|
||||
const string NcNotFound2 = "networking error";
|
||||
const string NcNotFound3 = "Nc not Connected";
|
||||
const string SinumerikEnvPath = @"MotionControl\siemens\sinumerik";
|
||||
const int IDMinPLCMessage = 700000;
|
||||
const int IDMaxPLCMessage = 799999;
|
||||
const int IDMinChannel = 10000;
|
||||
const int IDMaxChannel = 19999;
|
||||
|
||||
// Siemens Path Constants
|
||||
const string PathMaxChannelNo = "/Nck/Configuration/maxnumChannels";
|
||||
@@ -48,6 +52,10 @@ namespace CMS_CORE.Siemens
|
||||
private uint SiemensLanguage;
|
||||
private List<ushort> AxisInPath;
|
||||
|
||||
// STatic variables
|
||||
private static AlarmSvc SiemensAlmSvc;
|
||||
private static Alarm[] SiemensAlarms;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#region Contructor & global methods
|
||||
|
||||
@@ -86,6 +94,14 @@ namespace CMS_CORE.Siemens
|
||||
//Read static Data
|
||||
ReadStaticNCData();
|
||||
|
||||
//Setup the alarms (Only managed in this way (Siemens Thread)
|
||||
if(SiemensAlmSvc == null)
|
||||
{
|
||||
SiemensAlarms = new Alarm[]{ };
|
||||
SiemensAlmSvc = new AlarmSvc(ConvertToSTEPLanguage(SiemensLanguage).ThreeLetterISOLanguageName);
|
||||
SiemensAlmSvc.Subscribe(AlarmsChanged);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -200,7 +216,7 @@ namespace CMS_CORE.Siemens
|
||||
//Setup variables
|
||||
DataSvc Data = new DataSvc();
|
||||
Data.Timeout = TimeoutConn;
|
||||
Data.PriorityFlag = SlPriority.highPriority;
|
||||
Data.PriorityFlag = SlPriority.highPriority;
|
||||
Item ReadItem = new Item(PathGenericNcMode + "[u"+ ProcNumber + "]");
|
||||
Item ReadItemIncr = new Item(PathIncrJog + "[u" + ProcNumber + "]");
|
||||
Item ReadItemAdv = new Item(PathAdvancedJog + "[u" + ProcNumber + "]");
|
||||
@@ -258,7 +274,9 @@ namespace CMS_CORE.Siemens
|
||||
//Get the PLC Active Alarms
|
||||
public override void PLC_RActiveAlarms(ref List<string> Alarms)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
AlarmSource s = new AlarmSource(10,"");
|
||||
|
||||
Alarms = SiemensAlarms.Where(x => x.Id >= IDMinPLCMessage && x.Id <= IDMaxPLCMessage).Select(x => x.Message).ToList();
|
||||
}
|
||||
|
||||
|
||||
@@ -266,7 +284,7 @@ namespace CMS_CORE.Siemens
|
||||
//Get the process Messages
|
||||
public override void PROC_RActiveAlarms(ushort ProcNumber, ref List<string> Alarms)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
Alarms = SiemensAlarms.Where(x => x.Id < IDMinPLCMessage || x.Id > IDMaxPLCMessage).Select(x => x.Message).ToList();
|
||||
}
|
||||
|
||||
|
||||
@@ -274,29 +292,7 @@ namespace CMS_CORE.Siemens
|
||||
//Get a dictionary with the Actual position of the axes in Process
|
||||
public override void AXES_RInterpPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CheckConnection();
|
||||
|
||||
//Setup variables
|
||||
DataSvc Data = new DataSvc();
|
||||
Data.Timeout = TimeoutConn;
|
||||
Data.PriorityFlag = SlPriority.highPriority;
|
||||
Item ReadItem = new Item(PathRelatPosition + "[u" + ProcNumber + ",1,16]");
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
//Read Data
|
||||
Data.Read(ReadItem);
|
||||
|
||||
//Save Data
|
||||
//Status = ConvertToSTEPStatus((uint)ReadItem.Value);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ThrowNCException(ex);
|
||||
}
|
||||
throw new Nc_Exception("CMS-Core-Error: Function not allowed for this type of NC");
|
||||
}
|
||||
|
||||
|
||||
@@ -304,7 +300,7 @@ namespace CMS_CORE.Siemens
|
||||
//Get a dictionary with the Machine position of the axes in Process
|
||||
public override void AXES_RMachinePosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
throw new Nc_Exception("CMS-Core-Error: Function not allowed for this type of NC");
|
||||
}
|
||||
|
||||
|
||||
@@ -312,7 +308,7 @@ namespace CMS_CORE.Siemens
|
||||
//Get a dictionary with the Programmed position of the axes in Process
|
||||
public override void AXES_RProgrPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
throw new Nc_Exception("CMS-Core-Error: Function not allowed for this type of NC");
|
||||
}
|
||||
|
||||
|
||||
@@ -320,7 +316,7 @@ namespace CMS_CORE.Siemens
|
||||
//Get a dictionary with the Following Error of the axes in Process
|
||||
public override void AXES_RFollowingError(ushort ProcNumber, ref Dictionary<string, double> Axes)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
throw new Nc_Exception("CMS-Core-Error: Function not allowed for this type of NC");
|
||||
}
|
||||
|
||||
|
||||
@@ -328,7 +324,7 @@ namespace CMS_CORE.Siemens
|
||||
//Get a dictionary with the Distance To Go of the axes in Process
|
||||
public override void AXES_RDistanceToGo(ushort ProcNumber, ref Dictionary<string, double> Axes)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
throw new Nc_Exception("CMS-Core-Error: Function not allowed for this type of NC");
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -790,6 +786,16 @@ namespace CMS_CORE.Siemens
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#region Subordinate Private Functions
|
||||
|
||||
|
||||
|
||||
//Manage the Alarms - Called automatically on changes
|
||||
private void AlarmsChanged(Guid guid, Alarm[] alarms)
|
||||
{
|
||||
SiemensAlarms = alarms;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Manage the Mode
|
||||
private PROC_Mode ConvertToSTEPMode(uint mode, uint JogMode, uint AdvMode)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user