riorganizzate letture memoria e rallentata letture mtz/var analogiche
This commit is contained in:
@@ -2049,10 +2049,6 @@ namespace MTC_Adapter
|
||||
}
|
||||
parentForm.dataMonitor_2 = sb2.ToString();
|
||||
|
||||
// gestisco lettura dati manutenzione da PLC...
|
||||
getMtzDataFromPlc();
|
||||
// gestisco lettura dati analogici da PLC...
|
||||
getAnalogDataFromPlc();
|
||||
// gestisco lettura dati status da PLC...
|
||||
getStatusDataFromPlc();
|
||||
}
|
||||
@@ -3166,6 +3162,11 @@ namespace MTC_Adapter
|
||||
{
|
||||
// dati da PC
|
||||
mClock.Value = string.Format("{0:yyyy-MM-dd} {0:HH:mm:ss}", DateTime.Now);
|
||||
|
||||
// gestisco lettura dati manutenzione da PLC...
|
||||
getMtzDataFromPlc();
|
||||
// gestisco lettura dati analogici da PLC...
|
||||
getAnalogDataFromPlc();
|
||||
|
||||
// reload dati da file...
|
||||
reloadDataFromFile();
|
||||
|
||||
@@ -14,6 +14,10 @@ namespace MTC_Adapter
|
||||
/// Oggetto MAIN x connessione SIEMENS
|
||||
/// </summary>
|
||||
protected SIEMENS SIEMENS_ref;
|
||||
/// <summary>
|
||||
/// Area di memoria "Top" che contiene le informazioni principali x adpter (da scompattare), dato overhead lettura la leggiamo sempre tutta poi alla bisogna processamento...
|
||||
/// </summary>
|
||||
public byte[] MemBlockTop = new byte[284];
|
||||
|
||||
/// <summary>
|
||||
/// Area di memoria base x MTConnect con SIEMENS (DB1499)
|
||||
@@ -264,17 +268,31 @@ namespace MTC_Adapter
|
||||
base.getStrobeAndAckStatus();
|
||||
if (connectionOk)
|
||||
{
|
||||
// leggo TUTTO ack e strobe,
|
||||
byte[] MemBlock = new byte[Strobes.Length + Acknowl.Length];
|
||||
int memIndex = 0;
|
||||
if (utils.CRB("readAllTop"))
|
||||
{
|
||||
// leggo TUTTI i primi 284 byte...
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Byte(R, baseMemDb, memIndex, ref MemBlockTop);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-STROBES", MemBlockTop.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Byte(R, baseMemDb, memIndex, ref MemBlock);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-STROBES", MemBlock.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
// suddivido! (...la prima parte ack/strobe...)
|
||||
Buffer.BlockCopy(MemBlockTop, 0, Acknowl, 0, Acknowl.Length);
|
||||
Buffer.BlockCopy(MemBlockTop, Acknowl.Length, Strobes, 0, Strobes.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
// leggo TUTTO ack e strobe,
|
||||
byte[] MemBlock = new byte[Strobes.Length + Acknowl.Length];
|
||||
|
||||
// suddivido!
|
||||
Buffer.BlockCopy(MemBlock, 0, Acknowl, 0, Acknowl.Length);
|
||||
Buffer.BlockCopy(MemBlock, Acknowl.Length, Strobes, 0, Strobes.Length);
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Byte(R, baseMemDb, memIndex, ref MemBlock);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-STROBES", MemBlock.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
|
||||
// suddivido! (...la prima parte ack/strobe...)
|
||||
Buffer.BlockCopy(MemBlock, 0, Acknowl, 0, Acknowl.Length);
|
||||
Buffer.BlockCopy(MemBlock, Acknowl.Length, Strobes, 0, Strobes.Length);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -355,10 +373,18 @@ namespace MTC_Adapter
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
// leggo tutto!!!
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Word(R, baseMemDb, memIndexMST, ref MemBlock_W);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-STRB_DW1-P{1:00}", MemBlock_W.Length, idxPath), DateTime.Now.Subtract(inizio).Ticks);
|
||||
if (utils.CRB("readAllTop"))
|
||||
{
|
||||
// copio la memoria allarmi dalla memoria top...
|
||||
Buffer.BlockCopy(MemBlockTop, memIndexMST, MemBlock_W, 0, MemBlock_W.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
// leggo tutto!!!
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Word(R, baseMemDb, memIndexMST, ref MemBlock_W);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-STRB_DW1-P{1:00}", MemBlock_W.Length, idxPath), DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -388,7 +414,7 @@ namespace MTC_Adapter
|
||||
try
|
||||
{
|
||||
// leggo tutto!!!
|
||||
int memIndex = 256;
|
||||
int memIndex = 284;
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_DWord(R, baseMemDb, memIndex, ref MemBlockTestData);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TEST_DATA", MemBlockTestData.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
@@ -420,9 +446,19 @@ namespace MTC_Adapter
|
||||
/// <returns></returns>
|
||||
public override bool readAllAlarms(ref uint[] MemBlock)
|
||||
{
|
||||
// DB1499.DBW36
|
||||
int memIndex = 36;
|
||||
return SIEMENSMemRW_DWord(R, baseMemDb, memIndex, ref MemBlock);
|
||||
bool fatto = false;
|
||||
if (utils.CRB("readAllTop"))
|
||||
{
|
||||
// copio la memoria allarmi dalla memoria top...
|
||||
Buffer.BlockCopy(MemBlockTop, 36, MemBlock, 0, MemBlock.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
// DB1499.DBW36
|
||||
int memIndex = 36;
|
||||
fatto = SIEMENSMemRW_DWord(R, baseMemDb, memIndex, ref MemBlock);
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
/// Legge vettore di TUTTE memorie tipo DWord dato indice di partenza e vettore memorie
|
||||
@@ -468,15 +504,22 @@ namespace MTC_Adapter
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
|
||||
// area path1/2: 7 WORD x ogni path...
|
||||
int memIndex = 508;
|
||||
ushort[] PathData_mem = new ushort[14];
|
||||
parentForm.commPlcActive = true;
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Word(R, baseMemDb, memIndex, ref PathData_mem);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-PathData", PathData_mem.Length * 2), DateTime.Now.Subtract(inizio).Ticks);
|
||||
parentForm.commPlcActive = false;
|
||||
if (utils.CRB("readAllTop"))
|
||||
{
|
||||
// copio la memoria allarmi dalla memoria top...
|
||||
Buffer.BlockCopy(MemBlockTop, 256, PathData_mem, 0, PathData_mem.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
// area path1/2: 7 WORD x ogni path...
|
||||
int memIndex = 256;
|
||||
parentForm.commPlcActive = true;
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Word(R, baseMemDb, memIndex, ref PathData_mem);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-PathData", PathData_mem.Length * 2), DateTime.Now.Subtract(inizio).Ticks);
|
||||
parentForm.commPlcActive = false;
|
||||
}
|
||||
|
||||
// inizio indicando feed...
|
||||
sb1.AppendLine(string.Format("FeedRate: {0} mm/min", FeedRate));
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<!-- For more information on using app.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<appSettings>
|
||||
<add key="timerIntMs" value="10" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="waitEndCycle" value="20" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="timerIntMs" value="20" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="waitEndCycle" value="0" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="loglevel" value="5" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="mode" value="prod" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="autoLoadConf" value="true" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
@@ -13,6 +13,6 @@
|
||||
<add key="windowCanMax" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="trayClose" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="recTime" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="ipPLC" value="192.168.111.1" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="ipPLC" value="192.168.214.1" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
@@ -9,12 +9,12 @@
|
||||
<add key="appName" value="MTConnect Adapter"/>
|
||||
<!--gestione TIMERS e periodi multipli x thread lenti-->
|
||||
<add key="startTimerMs" value="250"/>
|
||||
<add key="timerIntMs" value="20"/><!--invio da adapter ad agent: 5ms-->
|
||||
<add key="timerIntMs" value="20"/><!--invio da adapter ad agent: 10ms-->
|
||||
<add key="fastCount" value="10"/><!--100ms-->
|
||||
<add key="normCount" value="25"/><!--250ms-->
|
||||
<add key="slowCount" value="250"/><!--2.5 sec-->
|
||||
<add key="normCount" value="50"/><!--500ms-->
|
||||
<add key="slowCount" value="500"/><!--5 sec-->
|
||||
<add key="alarmSyncCount" value="6000"/><!--30 sec-->
|
||||
<add key="waitEndCycle" value="10"/><!--20ms attesa dopo ogni ciclo lettura...-->
|
||||
<add key="waitEndCycle" value="0"/><!--ms attesa dopo ogni ciclo lettura...-->
|
||||
<!--30 sec-->
|
||||
|
||||
<!--parametri gestione watchdog-->
|
||||
@@ -87,6 +87,7 @@
|
||||
<add key="eStopCode" value="152"/>
|
||||
<!--gestione watchdog CMS-->
|
||||
<add key="sendWatchDog" value="true"/>
|
||||
<add key="readAllTop" value="true"/>
|
||||
<add key="fastCopy" value="true"/>
|
||||
<add key="ClientSettingsProvider.ServiceUri" value=""/>
|
||||
</appSettings>
|
||||
|
||||
Reference in New Issue
Block a user