diff --git a/MTC_Sim/MTC_Sim/AdapterESA.cs b/MTC_Sim/MTC_Sim/AdapterESA.cs
index ad86393..367944a 100644
--- a/MTC_Sim/MTC_Sim/AdapterESA.cs
+++ b/MTC_Sim/MTC_Sim/AdapterESA.cs
@@ -53,7 +53,6 @@ namespace MTC_Adapter
if (utils.CRB("verbose")) lg.Info("End init Adapter ESA");
}
-
public override void tryDisconnect()
{
base.tryDisconnect();
@@ -92,8 +91,6 @@ namespace MTC_Adapter
}
}
-
-
///
/// Effettuo lettura memorie strobe/status
///
@@ -129,7 +126,7 @@ namespace MTC_Adapter
// leggo TUTTO il blocco di memoria
inizio = DateTime.Now;
ncDevice.ReadBuffer();
- if (utils.CRB("recTime")) TimingData.addResult(string.Format("R-PLC_MemoryRead", ncDevice.PLC_MemoryRead.Length), DateTime.Now.Subtract(inizio).Ticks);
+ if (utils.CRB("recTime")) TimingData.addResult(string.Format("R-PLC_FullMemoryRead", ncDevice.PLC_MemoryRead.Length), DateTime.Now.Subtract(inizio).Ticks);
}
else
{
@@ -137,6 +134,26 @@ namespace MTC_Adapter
}
+ Byte v82 = ncDevice.PLC_MemoryAreaV[14]; // FeedOver: 120 = 100% = 213
+ Byte v83 = ncDevice.PLC_MemoryAreaV[15]; // SpeedOver: 50% = 128
+
+ byte[] tmpByte = new byte[2];
+ Buffer.BlockCopy(ncDevice.PLC_MemoryAreaV, 16, tmpByte, 0, 2);
+ short v84 = BitConverter.ToInt16(tmpByte, 0); // Speed S5000 OK!!!
+
+ Byte v86 = ncDevice.PLC_MemoryAreaV[18]; // last alarm PLC
+ Byte v87 = ncDevice.PLC_MemoryAreaV[19]; // Allarme CN (almeno 1?!?)
+
+ // recupero feed
+ FeedRateOver = Convert.ToInt16((decimal)(v82 * 100) / 213);// BitConverter.ToInt16(v82, 0);
+ sb.AppendLine(string.Format("FeedRateOver: {0} %", FeedRateOver));
+
+ SpeedRateOver = Convert.ToInt16((decimal)(v83 * 100) / 255);// BitConverter.ToInt16(v83, 0);
+ sb.AppendLine(string.Format("SpeedRateOver: {0} %", SpeedRateOver));
+
+
+ // check allarmi?!?
+
parentForm.dataMonitor = sb.ToString();
}
@@ -150,6 +167,17 @@ namespace MTC_Adapter
// HARD CODE: forzo path 1 (indice 0...)
int idxPath = 0;
+ // verifica macchina accesa...
+ Byte V73 = ncDevice.PLC_MemoryAreaV[5];
+ if (((StFlag8)V73).HasFlag(StFlag8.B2))
+ {
+ mPower.Value = "ON";
+ }
+ else
+ {
+ mPower.Value = "OFF";
+ }
+
// switch su run mode...
/*
* MODO_X V[74].W --> byte (6)
@@ -162,8 +190,8 @@ namespace MTC_Adapter
* 6 = Modo RAP
* 7 = Modo TES
* */
- uint Modo_X = ncDevice.PLC_MemoryAreaV_bytes[6];
- switch (Modo_X)
+ uint V74 = ncDevice.PLC_MemoryAreaV[6];
+ switch (V74)
{
case 1:
vettPath[idxPath].mPathRunMode.Value = "EDIT";
diff --git a/MTC_Sim/MTC_Sim/AdapterGeneric.cs b/MTC_Sim/MTC_Sim/AdapterGeneric.cs
index ad0d28d..a4df99a 100644
--- a/MTC_Sim/MTC_Sim/AdapterGeneric.cs
+++ b/MTC_Sim/MTC_Sim/AdapterGeneric.cs
@@ -1399,44 +1399,15 @@ namespace MTC_Adapter
///
public int SpeedRate { get; set; }
- //protected int _feedrate = 0;
+ ///
+ /// OVERRIDE FeedRate globale
+ ///
+ public int FeedRateOver { get; set; }
+ ///
+ /// OVERRIDE SpeedRate mandrino globale
+ ///
+ public int SpeedRateOver { get; set; }
- /////
- ///// recupera FeedRate (fare override!)
- /////
- //public virtual int FeedRate
- //{
- // get
- // {
- // return _feedrate;
- // }
- // set
- // {
- // _feedrate = value;
- // }
- //}
- ///
- /// recupera FeedRateOver (fare override!)
- ///
- public virtual int FeedRateOver
- {
- get
- {
- int answ = 0;
- return answ;
- }
- }
- ///
- /// recupera SpeedRateOver (fare override!)
- ///
- public virtual int SpeedRateOver
- {
- get
- {
- int answ = 0;
- return answ;
- }
- }
///
/// recupera Vettore completo PosAct (fare override!)
diff --git a/MTC_Sim/MTC_Sim/Resources/SCM/.~lock.KvaraDb.doc# b/MTC_Sim/MTC_Sim/Resources/SCM/.~lock.KvaraDb.doc#
new file mode 100644
index 0000000..96ea991
--- /dev/null
+++ b/MTC_Sim/MTC_Sim/Resources/SCM/.~lock.KvaraDb.doc#
@@ -0,0 +1 @@
+,steamw/samuele,W10-DEV-SCM.steamware.local.net,01.06.2016 12:09,file:///C:/Users/samuele/AppData/Roaming/LibreOffice/4;
\ No newline at end of file
diff --git a/MTC_Sim/SCMCncLib/thdNcEsaGvKvara.cs b/MTC_Sim/SCMCncLib/thdNcEsaGvKvara.cs
index b37c973..60ed6bc 100644
--- a/MTC_Sim/SCMCncLib/thdNcEsaGvKvara.cs
+++ b/MTC_Sim/SCMCncLib/thdNcEsaGvKvara.cs
@@ -50,6 +50,10 @@ namespace SCMCncLib
private string VAreaAddressName;
private TS_REG VAreaAddress;
+
+
+ private string ETKAreaAddressName;
+ private TS_REG ETKAreaAddress;
///
/// Memorie a 4 byte (32 bit)
///
@@ -59,13 +63,13 @@ namespace SCMCncLib
///
/// memorie a 4 byte (32 bit)
///
- public UInt32[] PLC_MemoryAreaV;
- public UInt32[] PLC_MemoryAreaETK;
+ public UInt32[] PLC_MemAreaV_tmp;
+ public UInt32[] PLC_MemAreaETK_tmp;
///
/// memorie a 1 byte (8 bit)
///
- public Byte[] PLC_MemoryAreaV_bytes;
- public Byte[] PLC_MemoryAreaETK_bytes;
+ public Byte[] PLC_MemoryAreaV;
+ public Byte[] PLC_MemoryAreaETK;
// esa constants
#region ESA_PLC_CONSTANTS
@@ -129,13 +133,7 @@ namespace SCMCncLib
DeviceType = NC_DEVICE_TYPE.ESAGV_KVARA;
StringBuilder tempS = new StringBuilder(Convert.ToInt32(MAX_PATH));
-
- //string buffer = " ";
- //byte[] byteS = new UTF8Encoding().GetBytes(buffer);
- //GCHandle bufferH = GCHandle.Alloc(byteS, GCHandleType.Pinned);
- //IntPtr tempS = Marshal.UnsafeAddrOfPinnedArrayElement(byteS, 0);
- //byte[] tempS = new byte[MAX_PATH];
-
+
// set executable path
SetDllDirectory(fIni.ReadString("NC", "SysExe", "C:\\KVARA\\EXE"));
@@ -155,7 +153,7 @@ namespace SCMCncLib
// !!! 2016.05.25 inutile forse? riguarda l'engine 3d...
- //hack: metto fisso... OCCHIO son 4 byte...
+ //hack: metto fisso... OCCHIO son 4 byte x area SIM...
ReadNumber = 265;
WriteNumber = 265;
VAreaNumber = 8;
@@ -179,12 +177,12 @@ namespace SCMCncLib
PLC_MemoryWrite = new UInt32[WriteNumber];
// create VArea buffer
- PLC_MemoryAreaV = new UInt32[VAreaNumber];
+ PLC_MemAreaV_tmp = new UInt32[VAreaNumber];
// create ETKArea buffer
- PLC_MemoryAreaETK = new UInt32[ETKAreaNumber];
+ PLC_MemAreaETK_tmp = new UInt32[ETKAreaNumber];
// creo array duali in bytes...
- PLC_MemoryAreaV_bytes = new Byte[4 * VAreaNumber];
- PLC_MemoryAreaETK_bytes = new Byte[4 * ETKAreaNumber];
+ PLC_MemoryAreaV = new Byte[4 * VAreaNumber];
+ PLC_MemoryAreaETK = new Byte[4 * ETKAreaNumber];
if (!Connect())
@@ -325,13 +323,14 @@ namespace SCMCncLib
iError = read_regbuffer(ref StatusAddress, 0, ReadNumber, PLC_MemoryRead);
// devo definire posizione memorie Vcome TS_REG
- iError = read_regbuffer(ref VAreaAddress, 68, 32, PLC_MemoryAreaV);
+ iError = read_regbuffer(ref VAreaAddress, 68, 32, PLC_MemAreaV_tmp);
- // !!!FARE!!! leggere ETK
+ //// !!!FARE!!! leggere ETK
+ //iError = read_regbuffer(ref ETKAreaAddress, 68, 32, PLC_MemAreaETK_tmp);
// copio in array a byte...
- Buffer.BlockCopy(PLC_MemoryAreaV, 0, PLC_MemoryAreaV_bytes, 0, 4 * VAreaNumber);
- Buffer.BlockCopy(PLC_MemoryAreaETK, 0, PLC_MemoryAreaETK_bytes, 0, 4 * ETKAreaNumber);
+ Buffer.BlockCopy(PLC_MemAreaV_tmp, 0, PLC_MemoryAreaV, 0, 4 * VAreaNumber);
+ Buffer.BlockCopy(PLC_MemAreaETK_tmp, 0, PLC_MemoryAreaETK, 0, 4 * ETKAreaNumber);
#if false