Update x gestione task 2 exe x SIEMENS TORRI (setup start/stop...
This commit is contained in:
Binary file not shown.
@@ -3,17 +3,18 @@
|
||||
NAME=master
|
||||
|
||||
[SERVER]
|
||||
;MPIP=192.168.1.7
|
||||
MPIP=10.74.82.218
|
||||
MPIP=192.168.1.7
|
||||
;MPIP=10.74.82.218
|
||||
MPURL=/MP/IO
|
||||
CMDREBO=/IOB/sendRebootGateway?GWIP=
|
||||
CMDIOB2CALL=/IOB/getIob2call?GWIP=
|
||||
|
||||
[IOB]
|
||||
;--- TEST SIMULAZIONE
|
||||
;STARTLIST=3011
|
||||
STARTLIST=3010
|
||||
;STARTLIST=SIMUL_01
|
||||
|
||||
;STARTLIST=3015
|
||||
STARTLIST=SIMUL_01
|
||||
;STARTLIST=SIMUL_05,SIMUL_06,SIMUL_07,SIMUL_08,SIM_DP_01,SIM_DP_02
|
||||
;STARTLIST=SIMUL_01,SIMUL_02,SIMUL_03,SIMUL_04,SIMUL_05,SIMUL_06,SIMUL_07,SIMUL_08,SIM_DP_01 ,SIM_DP_02
|
||||
|
||||
|
||||
@@ -78,6 +78,9 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>ExtLib\krcc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.5.11\lib\net40-client\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
+52
-9
@@ -481,7 +481,7 @@ namespace IOB_WIN
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Invia al server IO i valori dei parametri opzionali (es counters)
|
||||
/// Chiede elenco dei task da eseguire
|
||||
/// </summary>
|
||||
protected string getTask2exe()
|
||||
{
|
||||
@@ -494,6 +494,20 @@ namespace IOB_WIN
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Cancella dal server i task eseguiti
|
||||
/// </summary>
|
||||
protected string remTask2exe(string taskName)
|
||||
{
|
||||
string answ = "";
|
||||
if (checkServerAlive)
|
||||
{
|
||||
string url2call = $"{urlRemTask2Exe}{taskName}";
|
||||
lgInfo("chiamata URL " + url2call);
|
||||
answ = utils.callUrl(url2call);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invia al server IO i valori dei parametri opzionali (es counters)
|
||||
@@ -701,10 +715,10 @@ namespace IOB_WIN
|
||||
{
|
||||
processAllMemory();
|
||||
processMode();
|
||||
processServerRequests();
|
||||
}
|
||||
else if (ciclo == gatherCycle.MF)
|
||||
{
|
||||
processServerRequests();
|
||||
processOverride();
|
||||
processContapezzi();
|
||||
processCncAlarms();
|
||||
@@ -793,19 +807,29 @@ namespace IOB_WIN
|
||||
public void processServerRequests()
|
||||
{
|
||||
Dictionary<string, string> task2exe = new Dictionary<string, string>();
|
||||
Dictionary<string, string> taskDone = new Dictionary<string, string>();
|
||||
// recupero elenco delle cose da fare
|
||||
string resp = getTask2exe();
|
||||
task2exe = JsonConvert.DeserializeObject<Dictionary<string, string>>(resp);
|
||||
// chiamo procedura esecutiva (diversa x ogni IOB)
|
||||
executeTasks(task2exe);
|
||||
// se ho da fare chiamo esecuzione..
|
||||
if (task2exe.Count > 0)
|
||||
{
|
||||
// chiamo procedura esecutiva (diversa x ogni IOB)
|
||||
taskDone = executeTasks(task2exe);
|
||||
}
|
||||
// ora chiamo la cancellazione dei task eseguiti...
|
||||
foreach (var item in taskDone)
|
||||
{
|
||||
remTask2exe(item.Key);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Esecuzione dei task richiesti e pulizia coda richieste 1:1
|
||||
/// Esecuzione dei task richiesti e pulizia coda richieste eseguite
|
||||
/// </summary>
|
||||
/// <param name="task2exe"></param>
|
||||
public virtual void executeTasks(Dictionary<string, string> task2exe)
|
||||
public virtual Dictionary<string, string> executeTasks(Dictionary<string, string> task2exe)
|
||||
{
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1360,11 +1384,30 @@ namespace IOB_WIN
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = string.Format(@"http://{0}{1}{2}/getTask2Exe/{3}?", cIobConf.serverData.MPIP, cIobConf.serverData.MPURL, cIobConf.serverData.CMDALIVE, cIobConf.codIOB);
|
||||
answ = string.Format(@"http://{0}{1}{2}/getTask2Exe/{3}", cIobConf.serverData.MPIP, cIobConf.serverData.MPURL, cIobConf.serverData.CMDALIVE, cIobConf.codIOB);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Errore in composizione urlSetOptVal");
|
||||
lgError(exc, "Errore in composizione urlGetTask2Exe");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// URL per richiamo task da eseguire...
|
||||
/// </summary>
|
||||
public string urlRemTask2Exe
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = string.Format(@"http://{0}{1}{2}/remTask2Exe/{3}?taskName=", cIobConf.serverData.MPIP, cIobConf.serverData.MPURL, cIobConf.serverData.CMDALIVE, cIobConf.codIOB);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Errore in composizione urlRemTask2Exe");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
+17
-18
@@ -120,29 +120,28 @@ namespace IOB_WIN
|
||||
public bool S7WriteBB(ref byte[] Value)
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
#if false
|
||||
sw.Restart();
|
||||
if (testCncConn())
|
||||
{
|
||||
// decodifico memoria...
|
||||
memAddress memoria = new memAddress(txtMemArea.Text);
|
||||
int numByte = 1;
|
||||
int.TryParse(txtMemSize.Text, out numByte);
|
||||
Byte[] memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
|
||||
titolo = string.Format("READ BLOCK MEM BYTE: {0} --> {1} byte", txtMemArea.Text, numByte);
|
||||
contenuto = "";
|
||||
string byteVal = "";
|
||||
for (int i = 0; i < memByteRead.Length; i++)
|
||||
{
|
||||
byteVal = Convert.ToString(memByteRead[i], 2).PadLeft(8, '0');
|
||||
contenuto += string.Format("B{0:000}: {1} | {2}{3}", i, byteVal, memByteRead[i], Environment.NewLine);
|
||||
}
|
||||
showOut(titolo, contenuto);
|
||||
// decodifico memoria...
|
||||
memAreaSiemens memoria = new memAreaSiemens(parametri.memAddrWrite);
|
||||
int numByte = Value.Length;
|
||||
var errorCode = currPLC.WriteBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, Value);
|
||||
|
||||
answ = true;
|
||||
//titolo = string.Format("READ BLOCK MEM BYTE: {0} --> {1} byte", txtMemArea.Text, numByte);
|
||||
//contenuto = "";
|
||||
//string byteVal = "";
|
||||
//for (int i = 0; i < memByteRead.Length; i++)
|
||||
//{
|
||||
// byteVal = Convert.ToString(memByteRead[i], 2).PadLeft(8, '0');
|
||||
// contenuto += string.Format("B{0:000}: {1} | {2}{3}", i, byteVal, memByteRead[i], Environment.NewLine);
|
||||
//}
|
||||
//showOut(titolo, contenuto);
|
||||
}
|
||||
sw.Stop();
|
||||
tslRTime.Text = string.Format("{0}", sw.Elapsed);
|
||||
#endif
|
||||
//tslRTime.Text = string.Format("{0}", sw.Elapsed);
|
||||
|
||||
|
||||
|
||||
#if false
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace IOB_WIN
|
||||
* mod: 2019.01.19: aggiunta gestione segnale test/accensione/spegnimento (DB700.B1.4) --> mod StateMachine!
|
||||
* mod: 2019.04.06: aggiunta indicazione (IOB--> PLC) di stato setup su DB701.B0.4
|
||||
* -------------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// estende l'init della classe base con i metodi x Siemens specifici x Torri
|
||||
@@ -27,9 +27,46 @@ namespace IOB_WIN
|
||||
// dovebbe fare init della classe base, VERIFICARE...
|
||||
lgInfo("NEW IOB SIEMENS versione TORRI");
|
||||
}
|
||||
/// <summary>
|
||||
/// Processo i task richeisti e li elimino dalla coda 1:1
|
||||
/// </summary>
|
||||
/// <param name="task2exe"></param>
|
||||
public override Dictionary<string, string> executeTasks(Dictionary<string, string> task2exe)
|
||||
{
|
||||
// Verificare il protocollo: dovrebeb togliere SOLO i task eseguiti...
|
||||
Dictionary<string, string> answ = new Dictionary<string, string>();
|
||||
// inizio con 1 byte VUOTO
|
||||
byte[] MemBlock = new byte[1];
|
||||
|
||||
// cerco task specifici: se ho startSetup --> imposto bit DBB701.DBB0.4
|
||||
foreach (var item in task2exe)
|
||||
{
|
||||
switch (item.Value)
|
||||
{
|
||||
case "startSetup":
|
||||
MemBlock[0] += (1 << 4);
|
||||
answ.Add(item.Key, item.Value);
|
||||
break;
|
||||
case "stopSetup":
|
||||
answ.Add(item.Key, item.Value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//if (item.Value == "startSetup")
|
||||
//{
|
||||
// MemBlock[0] += (1 << 4);
|
||||
// answ.(item);
|
||||
//}
|
||||
}
|
||||
// scrivo comunque!
|
||||
bool fatto = S7WriteBB(ref MemBlock);
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
#region da verificare
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Recupero dati override in formato dictionary
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user