Merge commit '12254e74e4b3f8211563cee7375bb4a5d959d10d' into feature/S7Net
This commit is contained in:
@@ -103,8 +103,8 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>libs\CndexLinkDotNet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="S7.Net, Version=0.4.0.0, Culture=neutral, PublicKeyToken=d5812d469e84c693, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\S7netplus.0.4.0\lib\net452\S7.Net.dll</HintPath>
|
||||
<Reference Include="S7.Net, Version=0.7.0.0, Culture=neutral, PublicKeyToken=d5812d469e84c693, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\cms_thermo_active\packages\S7netplus.0.7.0\lib\net452\S7.Net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Siemens.Sinumerik.Operate.Services, Version=4.7.3.2, Culture=neutral, PublicKeyToken=bdd90fa02fd1c4ee, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace CMS_CORE_Library.Demo
|
||||
private DemoEdgesConfiguration DemoEdgesConfiguration = new DemoEdgesConfiguration();
|
||||
private const string PART_PROGRAM_FOLDER = "C:/CMS/Active/DEMO/part_program/";
|
||||
private const string JOB_PROGRAM_FOLDER = PART_PROGRAM_FOLDER + "\\job\\";
|
||||
private Random rand = new Random();
|
||||
|
||||
// Magazine config parameters
|
||||
private List<SiemensMagazineConfigModel> MagazineConfig = new List<SiemensMagazineConfigModel>()
|
||||
@@ -1142,6 +1143,12 @@ namespace CMS_CORE_Library.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PROC_RFeed(ushort ProcNumber, ref float Feed)
|
||||
{
|
||||
Feed = Convert.ToSingle(rand.NextDouble() * 100);
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
private CmsError ResetStrobe(int bitId, int strobeByte, int ackByte, MEMORY_TYPE memType)
|
||||
{
|
||||
int n = 5;
|
||||
@@ -1419,6 +1426,7 @@ namespace CMS_CORE_Library.Demo
|
||||
// Populate response structure
|
||||
processData.Type = bits[3] ? "AUX" : "WORK";
|
||||
processData.CanLoadProgram = bits[6];
|
||||
processData.IsInPieceWork = rand.NextDouble() > 0.5f;
|
||||
|
||||
// Choose process status
|
||||
if (bits[4])
|
||||
|
||||
@@ -1615,6 +1615,7 @@ namespace CMS_CORE_Library.Fanuc
|
||||
// Get process part program data
|
||||
public override CmsError PROC_RStatusAndData(ushort procNumber, ref ProcessDataModel processData)
|
||||
{
|
||||
Boolean Cut = false;
|
||||
processData.Id = procNumber;
|
||||
// Read part program name
|
||||
CmsError cmsError = PROC_RSelectedPPName(procNumber, ref processData.PartProgramName);
|
||||
@@ -1627,6 +1628,15 @@ namespace CMS_CORE_Library.Fanuc
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
//Read CUT variable
|
||||
byte CutRaw = 0;
|
||||
int address = (1000 * (procNumber - 1)) + 2;
|
||||
cmsError = MEM_RWByte(R, 0, MEMORY_TYPE.Fanuc_F, address, 0, ref CutRaw);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
Cut = (CutRaw & 0x40) == 0x40;
|
||||
|
||||
byte[] bytes = BitConverter.GetBytes(readValue);
|
||||
|
||||
// Convert Byte into true/false array
|
||||
@@ -1640,6 +1650,7 @@ namespace CMS_CORE_Library.Fanuc
|
||||
processData.IsSelected = bits[2];
|
||||
processData.IsInAlarm = bits[3];
|
||||
processData.CanLoadProgram = bits[4];
|
||||
processData.IsInPieceWork = Cut;
|
||||
|
||||
// Choose process status
|
||||
if (bytes[1] == 1)
|
||||
@@ -2004,6 +2015,28 @@ namespace CMS_CORE_Library.Fanuc
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override CmsError PROC_RFeed(ushort ProcNumber, ref float Feed)
|
||||
{
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
if (ProcNumber <= 0)
|
||||
return PROC_NOT_FOUND_ERROR;
|
||||
|
||||
|
||||
ODBACT feedRaw = new ODBACT();
|
||||
short nReturn = Focas1.cnc_actf(nLibHandle[ProcNumber - 1], feedRaw);
|
||||
// Check return value
|
||||
if (nReturn != 0)
|
||||
return GetNcError(nReturn);
|
||||
|
||||
Feed = feedRaw.data / 10.0f;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#endregion PROCESS (PATH) High-level data
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -285,6 +285,7 @@ namespace CMS_CORE_Library.Models
|
||||
public bool Visible;
|
||||
public ushort Reps;
|
||||
public bool IsSelected;
|
||||
public bool IsInPieceWork;
|
||||
public bool CanLoadProgram;
|
||||
}
|
||||
|
||||
|
||||
@@ -775,6 +775,20 @@ namespace CMS_CORE_Library
|
||||
|
||||
public abstract CmsError PLC_WTerminateAssistedToolingProcedure();
|
||||
|
||||
/**
|
||||
* <summary>
|
||||
* Read the actual feed of the Process "ProcNumber"
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Process number which the data refer</param>
|
||||
* <param name="Feed">Feed of the Process in mm/min</param>
|
||||
* */
|
||||
|
||||
public abstract CmsError PROC_RFeed(ushort ProcNumber, ref float Feed);
|
||||
|
||||
#endregion PROCESS (PATH, CHANNEL) data (to override)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1954,9 +1954,18 @@ namespace CMS_CORE_Library.Osai
|
||||
cmsError = MEM_RWInteger(R, 0, PROCESS_STATUS.MemType, PROCESS_STATUS.Address + ((procNumber - 1) * 2), ref readValue);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
byte[] bytes = BitConverter.GetBytes(readValue);
|
||||
|
||||
|
||||
// Read processes status from memory
|
||||
int index = (20 * procNumber) + 2;
|
||||
ushort readWord = 0;
|
||||
bool isInPiece = false;
|
||||
cmsError = MEM_RWWord(R, 0, MEMORY_TYPE.Osai_SW, PROCESS_STATUS.Address + ((procNumber - 1) * 2), ref readWord);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
isInPiece = (readWord & 0x1) != 0x1; //Bit 1
|
||||
|
||||
// Convert Byte into true/false array
|
||||
BitArray bits = new BitArray(new byte[] { bytes[0] }); //1st byte -> 0 : Proccess type (AUX-WORK), 1: Process in alarm status, 2: Run, 3: Hold, 4: Read, 5: PartProgramVisible
|
||||
|
||||
@@ -1968,6 +1977,7 @@ namespace CMS_CORE_Library.Osai
|
||||
processData.IsSelected = bits[2];
|
||||
processData.IsInAlarm = bits[3];
|
||||
processData.CanLoadProgram = bits[4];
|
||||
processData.IsInPieceWork = isInPiece;
|
||||
|
||||
// Choose process status
|
||||
if (bytes[1] == 1)
|
||||
@@ -2095,6 +2105,17 @@ namespace CMS_CORE_Library.Osai
|
||||
|
||||
}
|
||||
|
||||
|
||||
public override CmsError PROC_RFeed(ushort ProcNumber, ref float Feed)
|
||||
{
|
||||
ushort nReturn = OpenNC.GetNcInfo1((ushort)ProcNumber, out GETINFO1DATA info, out uint errorClass, out uint errorNum);
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
|
||||
Feed = Convert.ToSingle(info.realfeed);
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#endregion PROCESS (PATH) High-level data
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -2325,6 +2325,7 @@ namespace CMS_CORE_Library.Siemens
|
||||
processData.IsSelected = bits[2];
|
||||
processData.IsInAlarm = bits[3];
|
||||
processData.CanLoadProgram = bits[4];
|
||||
processData.IsInPieceWork = false;
|
||||
|
||||
// Choose process status
|
||||
if (bytes[1] == 1)
|
||||
@@ -2514,6 +2515,28 @@ namespace CMS_CORE_Library.Siemens
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override CmsError PROC_RFeed(ushort ProcNumber, ref float Feed)
|
||||
{
|
||||
if (ProcNumber <= 0)
|
||||
return PROC_NOT_FOUND_ERROR;
|
||||
try
|
||||
{
|
||||
Item item = new Item { Path = "/Channel/State/actFeedRateIpo[u" + ProcNumber + ", 1]" };
|
||||
// Read data
|
||||
DataSvc dataSvc = new DataSvc();
|
||||
dataSvc.Read(item);
|
||||
Feed = Convert.ToSingle(item.Value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
private CmsError PROC_ReadActiveLine(uint processId, ref string line)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="S7netplus" version="0.4.0" targetFramework="net462" />
|
||||
<package id="S7netplus" version="0.7.0" targetFramework="net462" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user