continuata pulizia x memorie read/write inutilizzate

This commit is contained in:
Samuele E. Locatelli
2017-03-17 10:04:44 +01:00
parent 182e244508
commit 4f671b5776
2 changed files with 3 additions and 78 deletions
-43
View File
@@ -820,50 +820,7 @@ namespace MTC_Adapter
public override void getGlobalData()
{
base.getGlobalData();
// accodo dati path in DataMonitor......
StringBuilder sb = new StringBuilder();
if (connectionOk)
{
// leggo TUTTO il blocco di memoria
inizio = DateTime.Now;
ncDevice.ReadBuffer();
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R-PLC_FullMemoryRead", ncDevice.PLC_MemoryRead.Length), DateTime.Now.Subtract(inizio).Ticks);
}
else
{
lg.Error("Errore connessione mancante in getGlobalData");
}
// -------------------------------------------
bool needSave = false;
// per ESA calcolo a mano se ci sia stato impiego assi... salvo le istantanee mov precedenti...
double precVal = 0;
DateTime adesso = DateTime.Now;
TimeSpan accumTime = adesso.Subtract(lastChekAccumTimeAxis);
// salvo valore lastChekAccumTimeAxis
lastChekAccumTimeAxis = adesso;
needSave = procMovTotAssi(needSave);
needSave = procAccTimeAssi(needSave);
needSave = procProgrName(needSave);
needSave = procPartId(needSave);
needSave = procPzProd(needSave);
needSave = procNumInvAssi(needSave);
needSave = procVacPump(needSave);
needSave = procVacAct(needSave);
needSave = procLubro(needSave);
// salvo se necessario!
if (needSave) parentForm.persistData();
// -------------------------------------------
parentForm.dataMonitor = sb.ToString();
}
/// <summary>
/// Path percorso file prod
+3 -35
View File
@@ -30,8 +30,6 @@ namespace SCMCncLib
/// </summary>
public class thdNcEsaGvKvara : thdNcBase
{
private UInt16 ReadNumber;
private UInt16 WriteNumber;
private UInt16 IOT_ByteAreaByteSize;
private UInt16 IOT_WordAreaByteSize;
@@ -43,10 +41,7 @@ namespace SCMCncLib
private string DefCn = "";
private int iChannel;
private int iError;
private string CommandsAddressName;
private TS_REG CommandsAddress;
private string IOT_ByteAreaAddressName;
private TS_REG IOT_ByteAreaAddress;
@@ -64,15 +59,7 @@ namespace SCMCncLib
private TS_REG IOT_StringC_AreaAddress;
private string IOT_StringD_AreaAddressName;
private TS_REG IOT_StringD_AreaAddress;
/// <summary>
/// Memorie a 4 byte (32 bit)
/// </summary>
public UInt32[] PLC_MemoryRead;
public UInt32[] PLC_MemoryWrite;
#region memorie IOT NUOVE
/// <summary>
/// Area IOT_Byte: memoria temp di UINT di 4 byte (32 bit)
/// </summary>
@@ -106,8 +93,6 @@ namespace SCMCncLib
/// </summary>
public Byte[,] PLC_MemoryAreaIOT_String;
#endregion
// esa constants
#region ESA_PLC_CONSTANTS
private const UInt32 MAX_PATH = 256;
@@ -183,19 +168,13 @@ namespace SCMCncLib
defValue = fIni.ReadString("NC", "SysDefCn", "C:\\KVARA\\DISCOI");
ENVGetProfileString("SYS", "DEFCN", defValue, tempS, MAX_PATH);
DefCn = tempS.ToString() + "\\defcn";
//StrCat(DefCn, "\\defcn");
ReadNumber = 265;
WriteNumber = 265;
// nuove aree: da init mi passa le dimensioni delle memorie
IOT_ByteAreaByteSize = Convert.ToUInt16(IAS_Byte);
IOT_WordAreaByteSize = Convert.ToUInt16(IAS_Word);
IOT_DWordAreaByteSize = Convert.ToUInt16(IAS_DWord);
IOT_String_AreaByteSize = Convert.ToUInt16(IAS_String);
CommandsAddressName = fIni.ReadString("NC", "CommandsAddress", "SIMREAD[0]");
// indirizzo area IOT...
IOT_ByteAreaAddressName = fIni.ReadString("NC", "IOT_AreaAddressByte", "IOT.BYTE");
IOT_WordAreaAddressName = fIni.ReadString("NC", "IOT_AreaAddressWord", "IOT.WORD");
@@ -208,14 +187,6 @@ namespace SCMCncLib
/**************************************************
* Creazione buffers letture memoria
**************************************************/
// create read buffer 32bit
PLC_MemoryRead = new UInt32[ReadNumber];
// create write buffer 32bit
PLC_MemoryWrite = new UInt32[WriteNumber];
// creazione buffers a 32bit
// creo array x aree memoria IOT...
PLC_MemoryAreaIOT_Byte_tmp = new UInt32[(int)Math.Ceiling((decimal)IOT_ByteAreaByteSize / 4)];
PLC_MemoryAreaIOT_Byte = new Byte[IOT_ByteAreaByteSize];
@@ -369,10 +340,7 @@ namespace SCMCncLib
// inizializzazione comunicazione
iError = init_board(DefCn, iChannel);
// inizializzo i registri di lettura e scrittura
if (iError == 0)
iError = get_reg_by_name(CommandsAddressName, ref CommandsAddress);
// effetto le vere letture!
if (iError == 0)
iError = get_reg_by_name(IOT_ByteAreaAddressName, ref IOT_ByteAreaAddress);
if (iError == 0)