Merge branch 'feature/S7Net' into develop

This commit is contained in:
Samuele Locatelli
2020-05-19 16:32:40 +02:00
11 changed files with 2340 additions and 487 deletions
+28 -27
View File
@@ -69,14 +69,14 @@
this.TXTPPName = new System.Windows.Forms.TextBox();
this.TXTPPLines = new System.Windows.Forms.TextBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.label12 = new System.Windows.Forms.Label();
this.labelTest1TXT = new System.Windows.Forms.TextBox();
this.labelTest = new System.Windows.Forms.Label();
this.labelTest2TXT = new System.Windows.Forms.TextBox();
this.TXTNow = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.Error = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.labelTest1TXT = new System.Windows.Forms.TextBox();
this.panel1.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
@@ -207,7 +207,8 @@
"Demo",
"Fanuc",
"Siemens",
"Osai"});
"Osai",
"S7Net"});
this.NcCombo.Location = new System.Drawing.Point(484, 3);
this.NcCombo.Name = "NcCombo";
this.NcCombo.Size = new System.Drawing.Size(150, 21);
@@ -354,7 +355,7 @@
this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.76253F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 49.23747F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 296F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 297F));
this.tableLayoutPanel1.Controls.Add(this.groupBox2, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.groupBox4, 2, 0);
@@ -375,7 +376,7 @@
this.groupBox2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.groupBox2.Location = new System.Drawing.Point(158, 3);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(145, 265);
this.groupBox2.Size = new System.Drawing.Size(144, 265);
this.groupBox2.TabIndex = 28;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Plc";
@@ -389,7 +390,7 @@
this.TXTMsg.Multiline = true;
this.TXTMsg.Name = "TXTMsg";
this.TXTMsg.ReadOnly = true;
this.TXTMsg.Size = new System.Drawing.Size(134, 238);
this.TXTMsg.Size = new System.Drawing.Size(133, 238);
this.TXTMsg.TabIndex = 18;
//
// groupBox1
@@ -424,9 +425,9 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox4.Controls.Add(this.tabControl1);
this.groupBox4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.groupBox4.Location = new System.Drawing.Point(309, 3);
this.groupBox4.Location = new System.Drawing.Point(308, 3);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(291, 265);
this.groupBox4.Size = new System.Drawing.Size(292, 265);
this.groupBox4.TabIndex = 29;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Path";
@@ -440,7 +441,7 @@
this.tabControl1.Location = new System.Drawing.Point(6, 21);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(278, 238);
this.tabControl1.Size = new System.Drawing.Size(279, 238);
this.tabControl1.TabIndex = 0;
//
// tabPage1
@@ -449,7 +450,7 @@
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(270, 212);
this.tabPage1.Size = new System.Drawing.Size(271, 212);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Path 1";
this.tabPage1.UseVisualStyleBackColor = true;
@@ -463,7 +464,7 @@
this.TXTAlm.Multiline = true;
this.TXTAlm.Name = "TXTAlm";
this.TXTAlm.ReadOnly = true;
this.TXTAlm.Size = new System.Drawing.Size(258, 203);
this.TXTAlm.Size = new System.Drawing.Size(259, 203);
this.TXTAlm.TabIndex = 18;
//
// groupBox3
@@ -590,6 +591,22 @@
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Nc Info";
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(95, 73);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(66, 13);
this.label12.TabIndex = 32;
this.label12.Text = "Label Test 1";
//
// labelTest1TXT
//
this.labelTest1TXT.Location = new System.Drawing.Point(164, 70);
this.labelTest1TXT.Name = "labelTest1TXT";
this.labelTest1TXT.Size = new System.Drawing.Size(217, 20);
this.labelTest1TXT.TabIndex = 31;
//
// labelTest
//
this.labelTest.AutoSize = true;
@@ -643,22 +660,6 @@
this.Error.Size = new System.Drawing.Size(462, 20);
this.Error.TabIndex = 27;
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(95, 73);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(66, 13);
this.label12.TabIndex = 32;
this.label12.Text = "Label Test 1";
//
// labelTest1TXT
//
this.labelTest1TXT.Location = new System.Drawing.Point(164, 70);
this.labelTest1TXT.Name = "labelTest1TXT";
this.labelTest1TXT.Size = new System.Drawing.Size(217, 20);
this.labelTest1TXT.TabIndex = 31;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+34 -8
View File
@@ -3,6 +3,7 @@ using CMS_CORE_Library.Demo;
using CMS_CORE_Library.Fanuc;
using CMS_CORE_Library.Models;
using CMS_CORE_Library.Osai;
using CMS_CORE_Library.S7Net;
using CMS_CORE_Library.Siemens;
using System;
using System.Collections.Generic;
@@ -77,6 +78,9 @@ namespace CMS_CORE_Application
CmsError cmsError = N.NC_Connect();
cmsError = N.NC_RModelName(ref ModelName);
cmsError = N.NC_RSoftwareVersion(ref SFTVersion);
cmsError = N.NC_RSerialNumber(ref MachNumber);
List<uint> val = new List<uint>();
@@ -117,16 +121,24 @@ namespace CMS_CORE_Application
OffsetModel off = new OffsetModel();
cmsError = N.TOOLS_ROffset(1, ref off);
try
// in caso di errore (es S7Net) escludo
if (cmsError.IsError())
{
off.CustomDouble[3] = 88.22;
off.CustomInt[1] = 15;
cmsError = N.TOOLS_WOffset(1, ref off);
error = true; SetError(Lines, cmsError);
}
catch (Exception ex)
else
{
labelTest1TXT.Text = ex.Message;
try
{
off.CustomDouble[3] = 88.22;
off.CustomInt[1] = 15;
cmsError = N.TOOLS_WOffset(1, ref off);
}
catch (Exception ex)
{
labelTest1TXT.Text = ex.Message;
}
}
MovementBetweenMagazinesModel mov = new MovementBetweenMagazinesModel();
@@ -138,7 +150,7 @@ namespace CMS_CORE_Application
N.PROC_RSelectedProcessData(1, ref a);
sw.Stop();
Console.WriteLine("TEMPO PER FUNZIONE " + sw.ElapsedMilliseconds);
Console.WriteLine("TEMPO PER FUNZIONE " + sw.ElapsedMilliseconds);
////////////////////////////////////////////////////////////// END TEST
if (!this.IsDisposed && this.InvokeRequired)
@@ -208,6 +220,13 @@ namespace CMS_CORE_Application
return null;
}
private NcThermo SetNcThermoByType()
{
if (NCType == "S7Net")
return new Nc_S7Net(NCIp, NCPort, 500);
return null;
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
@@ -240,6 +259,13 @@ namespace CMS_CORE_Application
TXTip.Text = "localhost";
TXTport.Text = "8080";
}
else if (NcCombo.SelectedItem.ToString().Equals("S7Net"))
{
TXTip.Enabled = true;
TXTport.Enabled = false;
TXTip.Text = "192.168.0.102";
TXTport.Text = "102";
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
+3 -1
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG;FS30D,WIN32</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -151,7 +151,9 @@
<Compile Include="Fanuc\Nc_Fanuc.cs" />
<Compile Include="Models\NcToolModel.cs" />
<Compile Include="Models\PreAndPostPowerOnModels.cs" />
<Compile Include="Models\ThermoModels.cs" />
<Compile Include="Models\SiemensToolModels.cs" />
<Compile Include="NcThermo.cs" />
<Compile Include="Nc.cs" />
<Compile Include="Osai\Nc_Osai.cs" />
<Compile Include="Osai\OSAIErrMgr.cs" />
+2 -1
View File
@@ -73,6 +73,7 @@ namespace CMS_CORE_Library.Models
OPTION_NOT_CONSISTENT = 28,
WRONG_CMS_PP = 29,
SIEMENS_TOOL_TABLE_ERROR = 30,
PLC_IP_NOT_FOUND = 31
PLC_IP_NOT_FOUND = 31,
PLC_MEM_CONF_ERROR = 32
}
}
+82 -6
View File
@@ -95,7 +95,7 @@ namespace CMS_CORE_Library.Models
REVOLVER = 3,
BOX_MAGAZINE = 5,
MAGAZINE_TOOL_BUFFER = 7,
MAGAZINE_LOADING_STATION = 9,
MAGAZINE_LOADING_STATION = 9,
INVISIBLE_MAGAZINE = 99
}
@@ -178,7 +178,7 @@ namespace CMS_CORE_Library.Models
public static CmsError INCORRECT_PARAMETERS_ERROR = new CmsError(CMS_ERROR_CODES.INCORRECT_PARAMETERS, "error_incorrect_parameters");
public static CmsError INCORRECT_LANGUAGE_ERROR = new CmsError(CMS_ERROR_CODES.NC_LANGUAGE_ERROR, "error_invalid_language");
public static CmsError SIEMENS_ENVIRONMENT_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND, "error_siemens_enviroment_not_found_error");
public static CmsError PLC_IP_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.PLC_IP_NOT_FOUND, "error_plc_ip_not_found_error");
public static CmsError PLC_IP_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.PLC_IP_NOT_FOUND, "error_plc_ip_not_found_error");
public static CmsError SIEMENS_HMI_NOT_RUNNING_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING, "error_siemens_hmi_not_running");
public static CmsError MAX_TOOL_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_TOOL_REACHED, "error_max_tool_reached");
public static CmsError MAX_EDGES_PER_TOOL_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_EDGES_PER_TOOL_REACHED, "error_max_edges_per_tool_reached");
@@ -190,7 +190,7 @@ namespace CMS_CORE_Library.Models
public static CmsError MAGAZINE_BUSY_ERROR = new CmsError(CMS_ERROR_CODES.MAGAZINE_OCCUPIED, "error_magazine_occupied");
public static CmsError TOOL_IS_MOUNTED_ERROR = new CmsError(CMS_ERROR_CODES.TOOL_IS_MOUNTED, "error_tool_mounted");
public static CmsError TOOL_AND_POSITION_NOT_MATCHING_ERROR = new CmsError(CMS_ERROR_CODES.TOOL_IS_MOUNTED, "error_tool_and_position_not_matching");
public static CmsError FILE_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.FILE_NOT_FOUND, "error_file_not_found");
public static CmsError FILE_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.FILE_NOT_FOUND, "error_file_not_found");
public static CmsError PLC_NOT_RUNNING_ERROR = new CmsError(CMS_ERROR_CODES.PLC_NOT_RUNNING, "error_plc_not_running");
public static CmsError HMI_NOT_RESPONDING_ERROR = new CmsError(CMS_ERROR_CODES.HMI_NOT_RESPONDING, "error_hmi_not_responding");
public static CmsError PROGRAM_IS_SELECTED_ERROR = new CmsError(CMS_ERROR_CODES.PROGRAM_IS_SELECTED, "error_program_is_selected");
@@ -199,6 +199,7 @@ namespace CMS_CORE_Library.Models
public static CmsError OPTION_NOT_CONSISTENT_ERROR = new CmsError(CMS_ERROR_CODES.OPTION_NOT_CONSISTENT, "error_option_not_consistent");
public static CmsError WRONG_CMS_PP_ERROR = new CmsError(CMS_ERROR_CODES.WRONG_CMS_PP, "error_wrong_custom_part_program");
public static CmsError SIEMENS_TOOL_TABLE_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_TOOL_TABLE_ERROR, "error_siemens_tool_table_error");
public static CmsError PLC_MEM_CONF_ERROR = new CmsError(CMS_ERROR_CODES.PLC_MEM_CONF_ERROR, "error_plc_mem_conf_not_found");
#endregion Cms Errors Codes
@@ -359,7 +360,7 @@ namespace CMS_CORE_Library.Models
}
public class HeadDataModel
{
{
public uint Id;
public byte Process;
public byte Override;
@@ -424,7 +425,7 @@ namespace CMS_CORE_Library.Models
{
public short Origin { get; set; }
public short ActiveOffsetId { get; set; }
public short ActiveOffsetId { get; set; }
public string ProcessMessage { get; set; }
@@ -462,7 +463,7 @@ namespace CMS_CORE_Library.Models
TRANSFER_WITHOUT_ORIG = 2,
SWITCH = 3
}
public enum MOVEMENT_RESPONSE
{
NONE = 0,
@@ -520,5 +521,80 @@ namespace CMS_CORE_Library.Models
}
#endregion Data structure models
#region Thermo models
public class RecipeParam
{
public short Id { get; set; } = 0;
public int SetpointHMI { get; set; } = 0;
public int SetpointPLC { get; set; } = 0;
public double ValMax { get; set; } = 0;
public double ValMin { get; set; } = 0;
public ushort UnitMeasure { get; set; } = 0;
public bool Visible { get; set; } = false;
public bool Enabled { get; set; } = false;
public bool HasError { get; set; } = false;
public double ValueAct { get; set; } = 0;
}
public class RecipeModule
{
public ushort Id { get; set; } = 0;
public uint EstimatedDuration { get; set; } = 0;
public uint EstimatedDelay { get; set; } = 0;
public List<ushort> PrecedingId { get; set; } = new List<ushort>();
public uint ActualDuration { get; set; } = 0;
public uint ActualDelay { get; set; } = 0;
public bool Visible { get; set; } = false;
public bool Running { get; set; } = false;
public bool HasError { get; set; } = false;
}
public class RecipeWarmerUp
{
public ushort Id { get; set; } = 0;
public byte IdRefrector { get; set; } = 0;
public double MinCurrent { get; set; } = 0;
public byte ChStatus { get; set; } = 0;
public byte PercWork { get; set; } = 0;
public byte PercAct { get; set; } = 0;
}
public class RecipeWarmerDown
{
public ushort Id { get; set; } = 0;
public byte SetpointHMI { get; set; } = 0;
}
public class RecipeProdInfo
{
public ushort NumTarget { get; set; } = 0;
public ushort NumDOne { get; set; } = 0;
public uint TimeWarm { get; set; } = 0;
public uint TimeVent { get; set; } = 0;
public uint TimeVacuum { get; set; } = 0;
public uint TimeCycleGross { get; set; } = 0;
public uint TimeCycleNet { get; set; } = 0;
public double MaterialTempEndWarm { get; set; } = 0;
public double MaterialTempEndVent { get; set; } = 0;
public double MoldTemp { get; set; } = 0;
public double VacuumReadVal { get; set; } = 0;
public double MouldEnergyOUT { get; set; } = 0;
public double MouldEnergyIN { get; set; } = 0;
}
public class RecipeProdCycle
{
public ushort Status { get; set; } = 0;
public ushort MessageId { get; set; } = 0;
public ushort Mode { get; set; } = 0;
public uint TimeAdv { get; set; } = 0;
}
#endregion
}
}
+22
View File
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CMS_CORE_Library.Models
{
public class ThermoModels
{
/// <summary>
/// Represents thermo gauge data
/// </summary>
public class GaugeModel
{
public uint TimeAdv { get; set; } = 0;
public int Power { get; set; } = 0;
public int Vacuum { get; set; } = 0;
public int Air { get; set; } = 0;
}
}
}
+1 -1
View File
@@ -1977,7 +1977,7 @@ namespace CMS_CORE_Library
///////////////////////////////////////////////////////////////////
// Demo memory type
/**<summary>Demo default memory</summary> **/
Demo = 1000
Demo = 10000
};
// NC Memory Type Name
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -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.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.1.2.0")]
[assembly: AssemblyFileVersion("1.1.2.0")]
File diff suppressed because it is too large Load Diff
+12
View File
@@ -589,6 +589,7 @@ namespace Siemens_S7_Test
string byteVal = "";
ushort shortVal = 0;
uint intVal = 0;
double realVal = 0;
string byteValA = "";
string byteValB = "";
string byteValC = "";
@@ -637,6 +638,17 @@ namespace Siemens_S7_Test
contenuto += $"---------{Environment.NewLine}";
}
break;
case "real":
for (int i = 0; i < memByteRead.Length / 4; i++)
{
byteValA = Convert.ToString(memByteRead[i * 4], 2).PadLeft(8, '0');
byteValB = Convert.ToString(memByteRead[i * 4 + 1], 2).PadLeft(8, '0');
byteValC = Convert.ToString(memByteRead[i * 4 + 2], 2).PadLeft(8, '0');
byteValD = Convert.ToString(memByteRead[i * 4 + 3], 2).PadLeft(8, '0');
realVal = S7.Net.Types.Double.FromByteArray(memByteRead.Skip(4 * i).Take(4).ToArray());
contenuto += string.Format("R{0:000}: {1} | {2}-{3}-{4}-{5}{6}", i, realVal, byteValA, byteValB, byteValC, byteValD, Environment.NewLine);
}
break;
case "byte":
default:
for (int i = 0; i < memByteRead.Length; i++)