Bug Fixed & Terminated Siemens Nc
This commit is contained in:
Generated
+101
-28
@@ -49,6 +49,12 @@
|
||||
this.TXTTime = new System.Windows.Forms.TextBox();
|
||||
this.TXTAlm = new System.Windows.Forms.TextBox();
|
||||
this.TXTMsg = new System.Windows.Forms.TextBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.TXTAlmNc = new System.Windows.Forms.TextBox();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.TXTSft = new System.Windows.Forms.TextBox();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -58,7 +64,7 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Connect.Location = new System.Drawing.Point(14, 98);
|
||||
this.Connect.Name = "Connect";
|
||||
this.Connect.Size = new System.Drawing.Size(234, 23);
|
||||
this.Connect.Size = new System.Drawing.Size(341, 23);
|
||||
this.Connect.TabIndex = 0;
|
||||
this.Connect.Text = "Connect";
|
||||
this.Connect.UseVisualStyleBackColor = true;
|
||||
@@ -79,14 +85,14 @@
|
||||
this.panel1.Controls.Add(this.Connect);
|
||||
this.panel1.Location = new System.Drawing.Point(-3, -2);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(264, 128);
|
||||
this.panel1.Size = new System.Drawing.Size(371, 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(63, 59);
|
||||
this.label3.Location = new System.Drawing.Point(170, 59);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(29, 13);
|
||||
this.label3.TabIndex = 5;
|
||||
@@ -96,7 +102,7 @@
|
||||
//
|
||||
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(48, 33);
|
||||
this.label2.Location = new System.Drawing.Point(155, 33);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(44, 13);
|
||||
this.label2.TabIndex = 4;
|
||||
@@ -106,7 +112,7 @@
|
||||
//
|
||||
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(41, 6);
|
||||
this.label1.Location = new System.Drawing.Point(148, 6);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(51, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
@@ -115,7 +121,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(98, 56);
|
||||
this.TXTport.Location = new System.Drawing.Point(205, 56);
|
||||
this.TXTport.Name = "TXTport";
|
||||
this.TXTport.Size = new System.Drawing.Size(150, 20);
|
||||
this.TXTport.TabIndex = 3;
|
||||
@@ -124,7 +130,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(98, 30);
|
||||
this.TXTip.Location = new System.Drawing.Point(205, 30);
|
||||
this.TXTip.Name = "TXTip";
|
||||
this.TXTip.Size = new System.Drawing.Size(150, 20);
|
||||
this.TXTip.TabIndex = 2;
|
||||
@@ -140,7 +146,7 @@
|
||||
"Fanuc",
|
||||
"Siemens",
|
||||
"Osai"});
|
||||
this.NcCombo.Location = new System.Drawing.Point(98, 3);
|
||||
this.NcCombo.Location = new System.Drawing.Point(205, 3);
|
||||
this.NcCombo.Name = "NcCombo";
|
||||
this.NcCombo.Size = new System.Drawing.Size(150, 21);
|
||||
this.NcCombo.TabIndex = 2;
|
||||
@@ -149,7 +155,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(179, 229);
|
||||
this.TXTPath1.Location = new System.Drawing.Point(286, 229);
|
||||
this.TXTPath1.Name = "TXTPath1";
|
||||
this.TXTPath1.ReadOnly = true;
|
||||
this.TXTPath1.Size = new System.Drawing.Size(65, 20);
|
||||
@@ -159,7 +165,7 @@
|
||||
//
|
||||
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(105, 232);
|
||||
this.label4.Location = new System.Drawing.Point(212, 232);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(68, 13);
|
||||
this.label4.TabIndex = 6;
|
||||
@@ -168,7 +174,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(179, 255);
|
||||
this.TXTStat1.Location = new System.Drawing.Point(286, 255);
|
||||
this.TXTStat1.Name = "TXTStat1";
|
||||
this.TXTStat1.ReadOnly = true;
|
||||
this.TXTStat1.Size = new System.Drawing.Size(65, 20);
|
||||
@@ -178,7 +184,7 @@
|
||||
//
|
||||
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(102, 258);
|
||||
this.label5.Location = new System.Drawing.Point(209, 258);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(71, 13);
|
||||
this.label5.TabIndex = 8;
|
||||
@@ -187,7 +193,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(94, 151);
|
||||
this.TXTName.Location = new System.Drawing.Point(69, 148);
|
||||
this.TXTName.Name = "TXTName";
|
||||
this.TXTName.ReadOnly = true;
|
||||
this.TXTName.Size = new System.Drawing.Size(150, 20);
|
||||
@@ -197,7 +203,7 @@
|
||||
//
|
||||
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, 154);
|
||||
this.label6.Location = new System.Drawing.Point(11, 151);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(55, 13);
|
||||
this.label6.TabIndex = 10;
|
||||
@@ -206,7 +212,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(179, 203);
|
||||
this.TXTNProcess.Location = new System.Drawing.Point(286, 203);
|
||||
this.TXTNProcess.Name = "TXTNProcess";
|
||||
this.TXTNProcess.ReadOnly = true;
|
||||
this.TXTNProcess.Size = new System.Drawing.Size(65, 20);
|
||||
@@ -215,7 +221,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(179, 177);
|
||||
this.TXTMachNum.Location = new System.Drawing.Point(286, 177);
|
||||
this.TXTMachNum.Name = "TXTMachNum";
|
||||
this.TXTMachNum.ReadOnly = true;
|
||||
this.TXTMachNum.Size = new System.Drawing.Size(65, 20);
|
||||
@@ -225,7 +231,7 @@
|
||||
//
|
||||
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(67, 180);
|
||||
this.LabelBoh.Location = new System.Drawing.Point(174, 180);
|
||||
this.LabelBoh.Name = "LabelBoh";
|
||||
this.LabelBoh.Size = new System.Drawing.Size(106, 13);
|
||||
this.LabelBoh.TabIndex = 14;
|
||||
@@ -235,7 +241,7 @@
|
||||
//
|
||||
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(127, 206);
|
||||
this.label8.Location = new System.Drawing.Point(234, 206);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(46, 13);
|
||||
this.label8.TabIndex = 15;
|
||||
@@ -244,7 +250,7 @@
|
||||
// TXTTime
|
||||
//
|
||||
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.Location = new System.Drawing.Point(290, 623);
|
||||
this.TXTTime.Name = "TXTTime";
|
||||
this.TXTTime.ReadOnly = true;
|
||||
this.TXTTime.Size = new System.Drawing.Size(65, 20);
|
||||
@@ -252,33 +258,94 @@
|
||||
//
|
||||
// TXTAlm
|
||||
//
|
||||
this.TXTAlm.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
this.TXTAlm.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTAlm.Location = new System.Drawing.Point(7, 288);
|
||||
this.TXTAlm.Location = new System.Drawing.Point(7, 408);
|
||||
this.TXTAlm.Multiline = true;
|
||||
this.TXTAlm.Name = "TXTAlm";
|
||||
this.TXTAlm.ReadOnly = true;
|
||||
this.TXTAlm.Size = new System.Drawing.Size(236, 81);
|
||||
this.TXTAlm.Size = new System.Drawing.Size(343, 88);
|
||||
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)
|
||||
this.TXTMsg.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTMsg.Location = new System.Drawing.Point(7, 375);
|
||||
this.TXTMsg.Location = new System.Drawing.Point(7, 516);
|
||||
this.TXTMsg.Multiline = true;
|
||||
this.TXTMsg.Name = "TXTMsg";
|
||||
this.TXTMsg.ReadOnly = true;
|
||||
this.TXTMsg.Size = new System.Drawing.Size(236, 89);
|
||||
this.TXTMsg.Size = new System.Drawing.Size(343, 95);
|
||||
this.TXTMsg.TabIndex = 18;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(12, 281);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(24, 13);
|
||||
this.label7.TabIndex = 19;
|
||||
this.label7.Text = "Nc:";
|
||||
//
|
||||
// TXTAlmNc
|
||||
//
|
||||
this.TXTAlmNc.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTAlmNc.Location = new System.Drawing.Point(7, 297);
|
||||
this.TXTAlmNc.Multiline = true;
|
||||
this.TXTAlmNc.Name = "TXTAlmNc";
|
||||
this.TXTAlmNc.ReadOnly = true;
|
||||
this.TXTAlmNc.Size = new System.Drawing.Size(343, 88);
|
||||
this.TXTAlmNc.TabIndex = 20;
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(10, 392);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(40, 13);
|
||||
this.label9.TabIndex = 21;
|
||||
this.label9.Text = "path 1:";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(8, 500);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(25, 13);
|
||||
this.label10.TabIndex = 22;
|
||||
this.label10.Text = "Plc:";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(225, 151);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(61, 13);
|
||||
this.label11.TabIndex = 24;
|
||||
this.label11.Text = "Sft Version:";
|
||||
//
|
||||
// TXTSft
|
||||
//
|
||||
this.TXTSft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TXTSft.Location = new System.Drawing.Point(286, 148);
|
||||
this.TXTSft.Name = "TXTSft";
|
||||
this.TXTSft.ReadOnly = true;
|
||||
this.TXTSft.Size = new System.Drawing.Size(64, 20);
|
||||
this.TXTSft.TabIndex = 23;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(255, 521);
|
||||
this.ClientSize = new System.Drawing.Size(362, 655);
|
||||
this.Controls.Add(this.label11);
|
||||
this.Controls.Add(this.TXTSft);
|
||||
this.Controls.Add(this.label10);
|
||||
this.Controls.Add(this.label9);
|
||||
this.Controls.Add(this.TXTAlmNc);
|
||||
this.Controls.Add(this.label7);
|
||||
this.Controls.Add(this.TXTMsg);
|
||||
this.Controls.Add(this.TXTAlm);
|
||||
this.Controls.Add(this.TXTTime);
|
||||
@@ -327,6 +394,12 @@
|
||||
private System.Windows.Forms.TextBox TXTTime;
|
||||
private System.Windows.Forms.TextBox TXTAlm;
|
||||
private System.Windows.Forms.TextBox TXTMsg;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox TXTAlmNc;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.Label label11;
|
||||
private System.Windows.Forms.TextBox TXTSft;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace CMS_CORE_Application
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
static Nc N;
|
||||
static Nc N2;
|
||||
static String NCType;
|
||||
static String NCIp;
|
||||
static ushort NCPort;
|
||||
@@ -66,10 +65,12 @@ namespace CMS_CORE_Application
|
||||
ushort procnum = 0;
|
||||
String MachNumber = "";
|
||||
String ModelName = "";
|
||||
String SFTVersion = "";
|
||||
Dictionary<String, double> Axes = new Dictionary<String,double>();
|
||||
Stopwatch sw = new Stopwatch();
|
||||
List<String> Alm = new List<string>();
|
||||
List<String> Msg = new List<string>();
|
||||
List<String> Alm2 = new List<string>();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -93,7 +94,9 @@ namespace CMS_CORE_Application
|
||||
N.PROC_RMode(1,ref mode);
|
||||
N.PROC_RStatus(1, ref status);
|
||||
N.PROC_RActiveAlarms(1,ref Alm);
|
||||
N.PLC_RActiveAlarms(ref Msg);
|
||||
N.NC_RActiveAlarms(ref Alm2);
|
||||
N.PLC_RActiveMessages(ref Msg);
|
||||
N.NC_RSoftwareVersion(ref SFTVersion);
|
||||
sw.Stop();
|
||||
|
||||
|
||||
@@ -107,8 +110,10 @@ namespace CMS_CORE_Application
|
||||
TXTNProcess.Text = procnum.ToString();
|
||||
TXTName.Text = ModelName;
|
||||
TXTMachNum.Text = MachNumber;
|
||||
TXTSft.Text = SFTVersion;
|
||||
TXTTime.Text = sw.ElapsedMilliseconds.ToString()+" mS";
|
||||
TXTAlm.Text = String.Join(Environment.NewLine, Alm);
|
||||
TXTAlmNc.Text = String.Join(Environment.NewLine, Alm2);
|
||||
TXTMsg.Text = String.Join(Environment.NewLine, Msg);
|
||||
panel1.Enabled = false;
|
||||
});
|
||||
|
||||
@@ -846,6 +846,21 @@
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\OPENControl\OPENcontrol.wsdl" />
|
||||
<None Include="Language\ERR_english.INI">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Language\ERR_French.INI">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Language\ERR_German.INI">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Language\ERR_Italian.INI">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Language\ERR_Spanish.INI">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadataStorage Include="Connected Services\OPENControl\" />
|
||||
|
||||
@@ -151,6 +151,7 @@ namespace CMS_CORE.Demo
|
||||
ThrowNCException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public override void NC_RLanguage(ref CultureInfo Language)
|
||||
{
|
||||
//Check if the NC Demo is Connected
|
||||
@@ -169,12 +170,17 @@ namespace CMS_CORE.Demo
|
||||
ThrowNCException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public override void NC_RActiveAlarms(ref List<string> Alarms)
|
||||
{
|
||||
Alarms.Clear();
|
||||
}
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#region PLC High-level data
|
||||
|
||||
public override void PLC_RActiveAlarms(ref List<String> Alarms)
|
||||
public override void PLC_RActiveMessages(ref List<String> Alarms)
|
||||
{
|
||||
// Check if the NC Demo is Connected
|
||||
CheckConnection();
|
||||
@@ -881,7 +887,7 @@ namespace CMS_CORE.Demo
|
||||
if (bitnum < 0 || bitnum > 7)
|
||||
throw new Nc_Exception(getError(BIT_NOT_IN_RANGE_ERROR));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -273,11 +273,11 @@ namespace CMS_CORE.Fanuc
|
||||
|
||||
Mode = ConverToSTEPMode(StatInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Get the process message
|
||||
public override void PROC_RActiveAlarms(ushort ProcNumber, ref List<string> Alarms)
|
||||
//Get the NC Alarms
|
||||
public override void NC_RActiveAlarms(ref List<string> Alarms)
|
||||
{
|
||||
Focas1.ODBALMMSG2 Messg = new Focas1.ODBALMMSG2();
|
||||
short nReturn = 0;
|
||||
@@ -287,12 +287,12 @@ namespace CMS_CORE.Fanuc
|
||||
CheckConnection();
|
||||
|
||||
//Execute the method
|
||||
nReturn = Focas1.cnc_rdalmmsg2(nLibHandle[GetHandleIndexFromPath(ProcNumber)],-1, ref count, Messg);
|
||||
nReturn = Focas1.cnc_rdalmmsg2(nLibHandle[GetHandleIndexFromPath(1)], -1, ref count, Messg);
|
||||
|
||||
//Throw Exception if there's an error
|
||||
if (nReturn != 0)
|
||||
ThrowNCException(NC_PROD_ERROR, nReturn);
|
||||
|
||||
|
||||
//Add Alarm in List
|
||||
Alarms.Clear();
|
||||
if (count >= 1)
|
||||
@@ -315,13 +315,20 @@ namespace CMS_CORE.Fanuc
|
||||
Alarms.Add(Messg.msg9.alm_no + " " + Messg.msg9.alm_msg.Substring(0, Messg.msg9.msg_len));
|
||||
if (count >= 10)
|
||||
Alarms.Add(Messg.msg10.alm_no + " " + Messg.msg10.alm_msg.Substring(0, Messg.msg10.msg_len));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Get the process Alarms
|
||||
public override void PROC_RActiveAlarms(ushort ProcNumber, ref List<string> Alarms)
|
||||
{
|
||||
Alarms.Clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Get the PMC Messages
|
||||
public override void PLC_RActiveAlarms(ref List<String> Alarms)
|
||||
public override void PLC_RActiveMessages(ref List<String> Alarms)
|
||||
{
|
||||
Focas1.OPMSG3 Messg = new Focas1.OPMSG3();
|
||||
short nReturn = 0;
|
||||
@@ -339,15 +346,15 @@ namespace CMS_CORE.Fanuc
|
||||
|
||||
//Add Alarm in List
|
||||
Alarms.Clear();
|
||||
if (count >= 1)
|
||||
if (count >= 1 && Messg.msg1.datano >= 0)
|
||||
Alarms.Add(Messg.msg1.datano + " " + Messg.msg1.data);
|
||||
if (count >= 2)
|
||||
if (count >= 2 && Messg.msg2.datano >= 0)
|
||||
Alarms.Add(Messg.msg2.datano + " " + Messg.msg2.data);
|
||||
if (count >= 3)
|
||||
if (count >= 3 && Messg.msg3.datano >= 0)
|
||||
Alarms.Add(Messg.msg3.datano + " " + Messg.msg3.data);
|
||||
if (count >= 4)
|
||||
if (count >= 4 && Messg.msg4.datano >= 0)
|
||||
Alarms.Add(Messg.msg4.datano + " " + Messg.msg4.data);
|
||||
if (count >= 5)
|
||||
if (count >= 5 && Messg.msg5.datano >= 0)
|
||||
Alarms.Add(Messg.msg5.datano + " " + Messg.msg5.data);
|
||||
}
|
||||
|
||||
@@ -1246,7 +1253,7 @@ namespace CMS_CORE.Fanuc
|
||||
string partProgramContent = "";
|
||||
|
||||
// Read NC part program content
|
||||
R_NCReadPartProgram(partProgramPath, ref partProgramContent);
|
||||
ReadPartProgramContent(partProgramPath, ref partProgramContent);
|
||||
try
|
||||
{
|
||||
// Write content into local file
|
||||
@@ -1258,59 +1265,7 @@ namespace CMS_CORE.Fanuc
|
||||
}
|
||||
}
|
||||
|
||||
private void R_NCReadPartProgram(string partProgramPath, ref string partProgramContent)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CheckConnection();
|
||||
|
||||
bool fileEnded = false;
|
||||
short nReturn;
|
||||
int lenght = 256;
|
||||
|
||||
// Start read process
|
||||
nReturn = Focas1.cnc_upstart4(nLibHandle[0], 0, partProgramPath);
|
||||
|
||||
//Throw Exception if there's an error
|
||||
ErrorHandler(NC_PROD_ERROR, nReturn);
|
||||
|
||||
do
|
||||
{
|
||||
// Local buffer
|
||||
char[] tmpContentBuffer = new char[256]; // TODO find function to read size file
|
||||
|
||||
// Read file
|
||||
nReturn = Focas1.cnc_upload4(nLibHandle[0], ref lenght, tmpContentBuffer);
|
||||
|
||||
// If File ended
|
||||
switch(nReturn)
|
||||
{
|
||||
case (short)Focas1.focas_ret.EW_RESET:
|
||||
{
|
||||
fileEnded = true;
|
||||
}break;
|
||||
case (short)Focas1.EW_OK:
|
||||
{
|
||||
// Add the characters into string with all the content
|
||||
partProgramContent += new string(tmpContentBuffer);
|
||||
}break;
|
||||
case (short)Focas1.focas_ret.EW_BUFFER:
|
||||
{
|
||||
continue;
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
ThrowNCException(NC_PROD_ERROR, nReturn);
|
||||
}break;
|
||||
}
|
||||
} while ((nReturn == (short)Focas1.focas_ret.EW_OK || nReturn == (short)Focas1.focas_ret.EW_BUFFER) && !fileEnded);
|
||||
|
||||
// End read
|
||||
nReturn = Focas1.cnc_upend4(nLibHandle[0]);
|
||||
|
||||
ErrorHandler(NC_PROD_ERROR, nReturn);
|
||||
|
||||
partProgramContent = partProgramContent.Replace("\0", String.Empty);
|
||||
}
|
||||
|
||||
|
||||
public override void FILES_WProgramFromFile(string partProgramPath, FileStream localFile)
|
||||
{
|
||||
@@ -1326,36 +1281,9 @@ namespace CMS_CORE.Fanuc
|
||||
ThrowNCException(INTERNAL_ERROR, 0);
|
||||
}
|
||||
|
||||
W_NCWritePartProgram(partProgramPath, partProgramContent);
|
||||
}
|
||||
WritePartProgramContent(partProgramPath, partProgramContent);
|
||||
}
|
||||
|
||||
private void W_NCWritePartProgram(string partProgramPath, string partProgramContent)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CheckConnection();
|
||||
|
||||
short nReturn;
|
||||
|
||||
// Start write
|
||||
nReturn = Focas1.cnc_dwnstart4(nLibHandle[0], 0, partProgramPath);
|
||||
|
||||
//Throw Exception if there's an error
|
||||
ErrorHandler(NC_PROD_ERROR, nReturn);
|
||||
|
||||
//int lenghtMax = fileData.Length;
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
int lenght = partProgramContent.Length;
|
||||
// Write program
|
||||
nReturn = Focas1.cnc_download4(nLibHandle[0], ref lenght, partProgramContent);
|
||||
|
||||
//Throw Exception if there's an error
|
||||
ErrorHandler(NC_PROD_ERROR, nReturn);
|
||||
|
||||
nReturn = Focas1.cnc_dwnend4(nLibHandle[0]);
|
||||
|
||||
//Throw Exception if there's an error
|
||||
ErrorHandler(NC_PROD_ERROR, nReturn);
|
||||
}
|
||||
|
||||
public override void FILES_CopyProgram(string partProgramPath, string newPartProgramPath, bool failIfExist)
|
||||
{
|
||||
@@ -1646,8 +1574,100 @@ namespace CMS_CORE.Fanuc
|
||||
name += " " + new string(Mt_Type);
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Write Part program content
|
||||
private void WritePartProgramContent(string partProgramPath, string partProgramContent)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CheckConnection();
|
||||
|
||||
short nReturn;
|
||||
|
||||
// Start write
|
||||
nReturn = Focas1.cnc_dwnstart4(nLibHandle[0], 0, partProgramPath);
|
||||
|
||||
//Throw Exception if there's an error
|
||||
ErrorHandler(NC_PROD_ERROR, nReturn);
|
||||
|
||||
//int lenghtMax = fileData.Length;
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
int lenght = partProgramContent.Length;
|
||||
// Write program
|
||||
nReturn = Focas1.cnc_download4(nLibHandle[0], ref lenght, partProgramContent);
|
||||
|
||||
//Throw Exception if there's an error
|
||||
ErrorHandler(NC_PROD_ERROR, nReturn);
|
||||
|
||||
nReturn = Focas1.cnc_dwnend4(nLibHandle[0]);
|
||||
|
||||
//Throw Exception if there's an error
|
||||
ErrorHandler(NC_PROD_ERROR, nReturn);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Read Part program content
|
||||
private void ReadPartProgramContent(string partProgramPath, ref string partProgramContent)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CheckConnection();
|
||||
|
||||
bool fileEnded = false;
|
||||
short nReturn;
|
||||
int lenght = 256;
|
||||
|
||||
// Start read process
|
||||
nReturn = Focas1.cnc_upstart4(nLibHandle[0], 0, partProgramPath);
|
||||
|
||||
//Throw Exception if there's an error
|
||||
ErrorHandler(NC_PROD_ERROR, nReturn);
|
||||
|
||||
do
|
||||
{
|
||||
// Local buffer
|
||||
char[] tmpContentBuffer = new char[256]; // TODO find function to read size file
|
||||
|
||||
// Read file
|
||||
nReturn = Focas1.cnc_upload4(nLibHandle[0], ref lenght, tmpContentBuffer);
|
||||
|
||||
// If File ended
|
||||
switch (nReturn)
|
||||
{
|
||||
case (short)Focas1.focas_ret.EW_RESET:
|
||||
{
|
||||
fileEnded = true;
|
||||
}
|
||||
break;
|
||||
case (short)Focas1.EW_OK:
|
||||
{
|
||||
// Add the characters into string with all the content
|
||||
partProgramContent += new string(tmpContentBuffer);
|
||||
}
|
||||
break;
|
||||
case (short)Focas1.focas_ret.EW_BUFFER:
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
ThrowNCException(NC_PROD_ERROR, nReturn);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} while ((nReturn == (short)Focas1.focas_ret.EW_OK || nReturn == (short)Focas1.focas_ret.EW_BUFFER) && !fileEnded);
|
||||
|
||||
// End read
|
||||
nReturn = Focas1.cnc_upend4(nLibHandle[0]);
|
||||
|
||||
ErrorHandler(NC_PROD_ERROR, nReturn);
|
||||
|
||||
partProgramContent = partProgramContent.Replace("\0", String.Empty);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Convert the internal error in a readable-String error
|
||||
private String getError(uint CMSError, short Value)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+52
-27
@@ -1,9 +1,11 @@
|
||||
using CMS_CORE_Library;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -16,6 +18,7 @@ namespace CMS_CORE
|
||||
internal String Ip;
|
||||
internal ushort Port;
|
||||
internal Boolean UseProxy;
|
||||
internal String LibName = "CMS_CORE_Library.dll";
|
||||
|
||||
//Osai Variable
|
||||
internal string OSAI_PlcMessagesPath = @"C:\CMS\OSAI\";
|
||||
@@ -28,9 +31,8 @@ namespace CMS_CORE
|
||||
* <summary>
|
||||
* Get the NC IP-Address
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* </summary>
|
||||
* */
|
||||
public String LIB_GetIpAddress() { return Ip; }
|
||||
@@ -42,7 +44,6 @@ namespace CMS_CORE
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* </summary>
|
||||
* */
|
||||
public void LIB_SetIpAddress(String ip) { Ip = ip; }
|
||||
@@ -54,7 +55,6 @@ namespace CMS_CORE
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* </summary>
|
||||
* */
|
||||
public ushort LIB_GetPort() { return Port; }
|
||||
@@ -66,12 +66,23 @@ namespace CMS_CORE
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* </summary>
|
||||
* */
|
||||
public void LIB_SetPort(ushort port) { Port = port; }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <summary>
|
||||
* Get Library Version
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* */
|
||||
public String LIB_GetLibraryVersion() { return FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion.ToString(); }
|
||||
|
||||
#endregion
|
||||
|
||||
#region LIB Methods (OSAI)
|
||||
|
||||
/**
|
||||
@@ -155,7 +166,7 @@ namespace CMS_CORE
|
||||
* <summary>
|
||||
* Connect the NC
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* </summary>
|
||||
@@ -167,7 +178,7 @@ namespace CMS_CORE
|
||||
* <summary>
|
||||
* Disconnect the NC
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* </summary>
|
||||
@@ -179,7 +190,7 @@ namespace CMS_CORE
|
||||
* <summary>
|
||||
* Read Nc Status
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
@@ -191,7 +202,7 @@ namespace CMS_CORE
|
||||
* <summary>
|
||||
* Read actual time of the NC-Software (sometimes it can be different from NC-Operative-System)
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
@@ -204,7 +215,7 @@ namespace CMS_CORE
|
||||
* <summary>
|
||||
* Read Vendor NC Serial number
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
@@ -216,7 +227,7 @@ namespace CMS_CORE
|
||||
* <summary>
|
||||
* Read Model name of the NC
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
@@ -228,7 +239,7 @@ namespace CMS_CORE
|
||||
* <summary>
|
||||
* Read Software Version of the Nc
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
@@ -240,7 +251,7 @@ namespace CMS_CORE
|
||||
* <summary>
|
||||
* Read CMS Serial number of the Machine
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
@@ -252,7 +263,7 @@ namespace CMS_CORE
|
||||
* <summary>
|
||||
* Read number of configured Processes/Paths
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
@@ -264,7 +275,7 @@ namespace CMS_CORE
|
||||
* <summary>
|
||||
* Read the configured language of the NC
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
@@ -272,6 +283,20 @@ namespace CMS_CORE
|
||||
* */
|
||||
public abstract void NC_RLanguage(ref CultureInfo Language);
|
||||
|
||||
|
||||
/**
|
||||
* <summary>
|
||||
* Read active alarms of the NC (Nc-Process indipendent). For OSAI Nc the list can contain only one Message
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <param name="Alarms">Reference of a List of String Variables where data will be saved</param>
|
||||
* */
|
||||
public abstract void NC_RActiveAlarms(ref List<String> Alarms);
|
||||
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -345,27 +370,27 @@ namespace CMS_CORE
|
||||
|
||||
/**
|
||||
* <summary>
|
||||
* Read PMC active Alarms
|
||||
* Read PMC active Messages
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <param name="Alarms">Reference of a List of String Variables where data will be saved</param>
|
||||
* */
|
||||
public abstract void PLC_RActiveAlarms(ref List<String> Alarms);
|
||||
public abstract void PLC_RActiveMessages(ref List<String> Alarms);
|
||||
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#region PROCESS (PATH) data (to override)
|
||||
#region PROCESS (PATH, CHANNEL) data (to override)
|
||||
|
||||
/**
|
||||
* <summary>
|
||||
* Read the actual status of the Process "ProcNumber"
|
||||
* <para>See <see cref="Nc.PROC_Status"/> for information about the PROC_Status type</para>
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
@@ -379,7 +404,7 @@ namespace CMS_CORE
|
||||
* Read the selected Mode Process "ProcNumber"
|
||||
* <para>See <see cref="Nc.PROC_Mode"/> for information about the PROC_Status type</para>
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
@@ -393,7 +418,7 @@ namespace CMS_CORE
|
||||
* <summary>
|
||||
* Read active alarms of the process "ProcNumber". For OSAI Nc the list can contain only one Message
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
@@ -876,7 +901,7 @@ namespace CMS_CORE
|
||||
/**
|
||||
* <summary>Read a Part Program by path and name
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
@@ -889,7 +914,7 @@ namespace CMS_CORE
|
||||
/**
|
||||
* <summary>Write/Overwrite a Part Program by path and name
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
@@ -901,7 +926,7 @@ namespace CMS_CORE
|
||||
/**
|
||||
* <summary>Copy a Part Program into another path
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
@@ -914,7 +939,7 @@ namespace CMS_CORE
|
||||
/**
|
||||
* <summary>Delete a Nc Part Program
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
|
||||
@@ -229,7 +229,7 @@ namespace CMS_CORE.Osai
|
||||
|
||||
|
||||
//Get the PLC Active Alarms
|
||||
public override void PLC_RActiveAlarms(ref List<String> Alarms)
|
||||
public override void PLC_RActiveMessages(ref List<String> Alarms)
|
||||
{
|
||||
List<ushort> lista = new List<ushort>();
|
||||
BitArray Bits;
|
||||
@@ -309,6 +309,50 @@ namespace CMS_CORE.Osai
|
||||
|
||||
|
||||
|
||||
//Get the Nc Alarm
|
||||
public override void NC_RActiveAlarms(ref List<string> Alarms)
|
||||
{
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
MSGEMERGENCY errEmgy;
|
||||
|
||||
//Check if the NC is Connected
|
||||
CheckConnection();
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
//Clear the OLD Message
|
||||
Alarms.Clear();
|
||||
|
||||
//Execute the method
|
||||
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
|
||||
Alarms.Add(OsaiToStepMessage(MessageEmgy));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ThrowNCException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Get the process status
|
||||
public override void PROC_RStatus(ushort Number, ref PROC_Status Status)
|
||||
{
|
||||
@@ -369,14 +413,12 @@ namespace CMS_CORE.Osai
|
||||
|
||||
|
||||
|
||||
//Get the process Messages
|
||||
//Get the process Alarm
|
||||
public override void PROC_RActiveAlarms(ushort Number, ref List<String> Alarms)
|
||||
{
|
||||
String ActMSG = "";
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
MSGERROR err;
|
||||
MSGEMERGENCY errEmgy;
|
||||
|
||||
//Check if the NC is Connected
|
||||
CheckConnection();
|
||||
@@ -384,39 +426,9 @@ namespace CMS_CORE.Osai
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
//Execute the method
|
||||
nReturn = OpenNC.ReadCurrentEmergMsg(0, out errEmgy, out errorClass, out errorNum);
|
||||
//Clear the OLD Message
|
||||
Alarms.Clear();
|
||||
|
||||
//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);
|
||||
|
||||
@@ -435,17 +447,9 @@ namespace CMS_CORE.Osai
|
||||
OSAIErrorManagerLibrary.TranslateErrorMsg(ref CndexError, ref Message);
|
||||
|
||||
//Build the new String Message
|
||||
ActMSG = Message.Line1.Trim();
|
||||
if (!String.IsNullOrWhiteSpace(Message.Line2))
|
||||
ActMSG += "\n" + Message.Line2.Trim();
|
||||
if (!String.IsNullOrWhiteSpace(Message.Line3))
|
||||
ActMSG += "\n" + Message.Line3.Trim();
|
||||
if (!String.IsNullOrWhiteSpace(Message.Line4))
|
||||
ActMSG += "\n" + Message.Line4.Trim();
|
||||
Alarms.Add(OsaiToStepMessage(Message));
|
||||
|
||||
}
|
||||
Alarms.Clear();
|
||||
Alarms.Add(ActMSG);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -1398,6 +1402,22 @@ namespace CMS_CORE.Osai
|
||||
|
||||
|
||||
|
||||
//Convert OSAI MESSAGE to STEP Message
|
||||
private String OsaiToStepMessage(MESSAGE_TEXT Message)
|
||||
{
|
||||
String ActMSG = Message.Line1.Trim();
|
||||
if (!String.IsNullOrWhiteSpace(Message.Line2))
|
||||
ActMSG += "\n" + Message.Line2.Trim();
|
||||
if (!String.IsNullOrWhiteSpace(Message.Line3))
|
||||
ActMSG += "\n" + Message.Line3.Trim();
|
||||
if (!String.IsNullOrWhiteSpace(Message.Line4))
|
||||
ActMSG += "\n" + Message.Line4.Trim();
|
||||
|
||||
return ActMSG;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Read Language Configuration
|
||||
private void LanguageConfig()
|
||||
{
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
|
||||
// usando l'asterisco '*' come illustrato di seguito:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
|
||||
@@ -9,6 +9,8 @@ using System.IO;
|
||||
using Siemens.Sinumerik.Operate.Services;
|
||||
using CMS_CORE.Exceptions;
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
using CMS_CORE.Utils;
|
||||
|
||||
namespace CMS_CORE.Siemens
|
||||
{
|
||||
@@ -50,7 +52,6 @@ namespace CMS_CORE.Siemens
|
||||
private uint ConfChannelNo;
|
||||
private uint MaxChannelNo;
|
||||
private uint SiemensLanguage;
|
||||
private List<ushort> AxisInPath;
|
||||
|
||||
// STatic variables
|
||||
private static AlarmSvc SiemensAlmSvc;
|
||||
@@ -271,20 +272,26 @@ namespace CMS_CORE.Siemens
|
||||
|
||||
|
||||
|
||||
//Get the PLC Active Alarms
|
||||
public override void PLC_RActiveAlarms(ref List<string> Alarms)
|
||||
//Get the Nc Active Alarms
|
||||
public override void NC_RActiveAlarms(ref List<string> Alarms)
|
||||
{
|
||||
AlarmSource s = new AlarmSource(10,"");
|
||||
Alarms = SiemensAlarms.Where(x => (x.Id < IDMinPLCMessage || x.Id > IDMaxPLCMessage) && (x.Id < IDMinChannel || x.Id > IDMaxChannel)).Select(x => x.Message).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Get the PLC Active Messages
|
||||
public override void PLC_RActiveMessages(ref List<string> Alarms)
|
||||
{
|
||||
Alarms = SiemensAlarms.Where(x => x.Id >= IDMinPLCMessage && x.Id <= IDMaxPLCMessage).Select(x => x.Message).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Get the process Messages
|
||||
//Get the process Active Alarms
|
||||
public override void PROC_RActiveAlarms(ushort ProcNumber, ref List<string> Alarms)
|
||||
{
|
||||
Alarms = SiemensAlarms.Where(x => x.Id < IDMinPLCMessage || x.Id > IDMaxPLCMessage).Select(x => x.Message).ToList();
|
||||
Alarms = SiemensAlarms.Where(x => x.Id >= IDMinChannel && x.Id <= IDMaxChannel && x.Parameters[0].Equals(ProcNumber.ToString())).Select(x => x.Message).ToList();
|
||||
}
|
||||
|
||||
|
||||
@@ -761,33 +768,96 @@ namespace CMS_CORE.Siemens
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#region File Management
|
||||
|
||||
public override void FILES_CopyProgram(string partProgramPath, string newPartProgramPath, bool failIfExist)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
FileSvc FileData = new FileSvc();
|
||||
|
||||
Node sourceNode = new Node(partProgramPath);
|
||||
Node destNode = new Node(newPartProgramPath);
|
||||
|
||||
try
|
||||
{
|
||||
//Execute Function
|
||||
FileData.Copy(sourceNode, destNode, failIfExist);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ThrowNCException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void FILES_DeleteProgram(string partProgramPath, string partProgramName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
FileSvc FileData = new FileSvc();
|
||||
|
||||
Node sourceNode = new Node(partProgramPath);
|
||||
|
||||
try
|
||||
{
|
||||
//Execute Function
|
||||
FileData.Delete(sourceNode);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ThrowNCException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void FILES_RProgramToFile(string partProgramPath, FileStream localFile)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
String TempFile = Path.GetTempFileName();
|
||||
FileSvc FileData = new FileSvc();
|
||||
Node sourceNode = new Node(partProgramPath);
|
||||
Node destNode = new Node(TempFile);
|
||||
|
||||
try
|
||||
{
|
||||
//Execute Function
|
||||
FileData.Copy(sourceNode, destNode, true);
|
||||
|
||||
//Write to local file
|
||||
Nc_Utils.WriteLocalFile(Nc_Utils.ReadLocalFile(new FileStream(TempFile,FileMode.Open)), ref localFile);
|
||||
|
||||
//Delete temporary file
|
||||
File.Delete(TempFile);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ThrowNCException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void FILES_WProgramFromFile(string partProgramPath, FileStream localFile)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
FileSvc FileData = new FileSvc();
|
||||
Node sourceNode = new Node(localFile.Name);
|
||||
Node destNode = new Node(partProgramPath);
|
||||
|
||||
try
|
||||
{
|
||||
//Execute Function
|
||||
FileData.Copy(sourceNode, destNode, true);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ThrowNCException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#region Subordinate Private Functions
|
||||
|
||||
|
||||
|
||||
|
||||
//Manage the Alarms - Called automatically on changes
|
||||
private void AlarmsChanged(Guid guid, Alarm[] alarms)
|
||||
{
|
||||
@@ -936,8 +1006,9 @@ namespace CMS_CORE.Siemens
|
||||
|
||||
//Setup variables
|
||||
Cnc_name = getName((uint)ItemNcType.Value);
|
||||
Cnc_SftVersion = ((double)ItemNcVersion.Value).ToString();
|
||||
Cnc_SeriesNum = (String)ItemSerialNumber.Value;
|
||||
Cnc_SftVersion = Regex.Replace(((double)ItemNcVersion.Value).ToString(), ".{2}", "$0.").TrimEnd('.'); ;
|
||||
Cnc_SeriesNum = ((String)ItemSerialNumber.Value);
|
||||
|
||||
MaxChannelNo = (uint)ItemMaxChannelNo.Value;
|
||||
ConfChannelNo = (uint)ItemConfChannelNo.Value;
|
||||
SiemensLanguage = (uint)ItemLanguage.Value;
|
||||
@@ -1018,6 +1089,6 @@ namespace CMS_CORE.Siemens
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ namespace CMS_CORE.Utils
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 2 WORD -> UINT
|
||||
public static void WordTOUint(out uint UintVal, ushort LowWord, ushort HighWord)
|
||||
{
|
||||
@@ -107,6 +108,7 @@ namespace CMS_CORE.Utils
|
||||
}
|
||||
|
||||
|
||||
|
||||
// UINT -> 2 WORD (LIST)
|
||||
public static List<ushort> UIntTOWordList(List<uint> UintVal)
|
||||
{
|
||||
@@ -127,6 +129,7 @@ namespace CMS_CORE.Utils
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 2 WORD -> UINT (LIST)
|
||||
public static List<uint> WordTOUintList(List<ushort> UintVal)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user