Inserito contapezzi TORRI assoluto (x ghiringhelli)
This commit is contained in:
@@ -30,14 +30,6 @@ namespace IOB_WIN
|
||||
/// </summary>
|
||||
protected byte[] MemBlockY = new byte[2];
|
||||
/// <summary>
|
||||
/// Ultimo invio contapezzi (x invio delayed)
|
||||
/// </summary>
|
||||
protected DateTime lastPzCountSend;
|
||||
/// <summary>
|
||||
/// Ritardo minimo x invio contapezzi
|
||||
/// </summary>
|
||||
protected int pzCountDelay;
|
||||
/// <summary>
|
||||
/// LookUpTable di decodifica da CNC a segnali tipo bitmap MAPO
|
||||
/// </summary>
|
||||
Dictionary<string, string> signLUT = new Dictionary<string, string>();
|
||||
|
||||
@@ -27,6 +27,14 @@ namespace IOB_WIN
|
||||
/// </summary>
|
||||
protected Int32 lastCountCNC;
|
||||
/// <summary>
|
||||
/// Ultimo invio contapezzi (x invio delayed)
|
||||
/// </summary>
|
||||
protected DateTime lastPzCountSend;
|
||||
/// <summary>
|
||||
/// Ritardo minimo x invio contapezzi
|
||||
/// </summary>
|
||||
protected int pzCountDelay;
|
||||
/// <summary>
|
||||
/// Abilitazione lettura PrgName
|
||||
/// </summary>
|
||||
public bool enablePrgName = true;
|
||||
|
||||
+39
-26
@@ -159,6 +159,10 @@ namespace IOB_WIN
|
||||
/// <param name="adpConf"></param>
|
||||
public IobSiemensTorri(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
|
||||
{
|
||||
// gestione invio ritardato contapezzi
|
||||
pzCountDelay = utils.CRI("pzCountDelay");
|
||||
lastPzCountSend = DateTime.Now;
|
||||
// init conf
|
||||
_IOBConf = IOBConf;
|
||||
// inizializzo parametri...
|
||||
parametri = new connParamS7Torri()
|
||||
@@ -547,20 +551,42 @@ namespace IOB_WIN
|
||||
{
|
||||
// init a zero...
|
||||
B_input = 0;
|
||||
|
||||
// temporaneamente decodifico HARD CODED... poi implementerò da MemMap...
|
||||
|
||||
// leggo i byte interessati...
|
||||
// TORRI: leggo i primi 8 bit hard coded...
|
||||
int byteSem = RawInput[0];
|
||||
|
||||
// azzero i bit NON gestiti (2-5-6-7)
|
||||
byteSem &= ~(1 << 2);
|
||||
byteSem &= ~(1 << 5);
|
||||
byteSem &= ~(1 << 6);
|
||||
byteSem &= ~(1 << 7);
|
||||
// salvo infine variabile bit x invio
|
||||
B_input = byteSem;
|
||||
|
||||
// log opzionale!
|
||||
if (verboseLog) lgInfo(string.Format("Trasformazione B_input: {0}", B_input));
|
||||
// ora processo il contapezzi...
|
||||
// controllo se è passato intervallo minimo tra 2 controlli/elaborazioni x distanziare invio e ridurre letture
|
||||
if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
{
|
||||
// verifico se variato contapezzi in area STD PAR6711... e se passato ritardo minimo...
|
||||
if (lastCountCNC > contapezzi)
|
||||
{
|
||||
// salvo nuovo contapezzi (incremento di 1...)
|
||||
contapezzi++;
|
||||
// salvo in semaforo!
|
||||
B_input += 1 << 2;
|
||||
// registro contapezzi
|
||||
lgInfo(string.Format("Contapezzi FANUC: {0} | Contapezzi interno {1}", lastCountCNC, contapezzi));
|
||||
}
|
||||
else if (contapezzi > lastCountCNC) // in questo caso resetto
|
||||
{
|
||||
contapezzi = lastCountCNC;
|
||||
}
|
||||
// invio a server contapezzi (aggiornato)
|
||||
utils.callUrl(urlSetPzCount + contapezzi.ToString());
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
|
||||
#if false
|
||||
// SE SI E' CONNESSO al FANUC allora è 1=powerON...
|
||||
if (FANUC_ref.Connected)
|
||||
// SE SI E' CONNESSO al PLC allora è 1=powerON...
|
||||
if (connectionOk)
|
||||
{
|
||||
B_input += 1 << 0;
|
||||
}
|
||||
@@ -664,29 +690,16 @@ namespace IOB_WIN
|
||||
B_input += 1 << i;
|
||||
}
|
||||
}
|
||||
|
||||
#if false
|
||||
// da rivedere x gestione contapezzi a bit...
|
||||
// verifico se si tratta di un segnale contapezzo... nel qual caso conteggio ed invio...
|
||||
if (currIobConf.optPar["PZCOUNT_MODE"].StartsWith("BIT"))
|
||||
{
|
||||
// salvo nuovo contapezzi (incremento di 1...)
|
||||
contapezzi++;
|
||||
// invio a server contapezzi (aggiornato)
|
||||
utils.callUrl(urlSetPzCount + contapezzi.ToString());
|
||||
lgInfo("Aggiornato contapezzi: {0}", contapezzi);
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// log opzionale!
|
||||
if (verboseLog) lgInfo(string.Format("Trasformazione B_input: {0}", B_input));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// log opzionale!
|
||||
if (verboseLog) lgInfo(string.Format("Trasformazione B_input: {0}", B_input));
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupero programma in lavorazione
|
||||
|
||||
Reference in New Issue
Block a user