Added repetitions of UOP
This commit is contained in:
@@ -414,6 +414,10 @@ namespace SCMA.AdapterPLC
|
||||
/// </summary>
|
||||
public string kRevKey { get { return string.Format("{0}_KRev", ident); } }
|
||||
/// <summary>
|
||||
/// contatore cumulato di apertura testa
|
||||
/// </summary>
|
||||
public string countKey { get { return string.Format("{0}_Count", ident); } }
|
||||
/// <summary>
|
||||
/// Classe Unita Operatrice (Mandrino) con Idx e descrizione
|
||||
/// </summary>
|
||||
/// <param name="baseElem">element base contenente parametri (da XML)</param>
|
||||
@@ -749,6 +753,8 @@ namespace SCMA.AdapterPLC
|
||||
currGateway.addItemNodeAndSet(vettUnOp[i].speedOverKey, itemType.Sample, availStatus.UNAVAILABLE.ToString().ToLower());
|
||||
currGateway.addItemNodeAndSet(vettUnOp[i].loadKey, itemType.Sample, availStatus.UNAVAILABLE.ToString().ToLower());
|
||||
currGateway.addItemNodeAndSet(vettUnOp[i].accTimeKey, itemType.Sample, availStatus.UNAVAILABLE.ToString().ToLower());
|
||||
currGateway.addItemNodeAndSet(vettUnOp[i].countKey, itemType.Sample, availStatus.UNAVAILABLE.ToString().ToLower());
|
||||
|
||||
// SOLO SE NON sono SOUR...
|
||||
if (currGateway.protocollo != gwProtocol.SOURS)
|
||||
{
|
||||
@@ -939,6 +945,10 @@ namespace SCMA.AdapterPLC
|
||||
/// Vettore ATTUALE dei contatori del numero cambi utensili x UnOp
|
||||
/// </summary>
|
||||
public uint[] currNumCambiUt;
|
||||
/// <summary>
|
||||
/// Vettore ATTUALE dei contatori del numero cambi utensili x UnOp
|
||||
/// </summary>
|
||||
public uint[] currRepetitionUnOp;
|
||||
|
||||
/// <summary>
|
||||
/// Vettore ATTUALE dei contatori GENERICI MONOTONI CRESCENTI
|
||||
@@ -983,6 +993,10 @@ namespace SCMA.AdapterPLC
|
||||
/// </summary>
|
||||
public sampleVect[] istGiriElettrom;
|
||||
/// <summary>
|
||||
/// Vettore ISTANTANEO dei contatori Apertura teste
|
||||
/// </summary>
|
||||
public sampleVect[] istRepetitionUnOp;
|
||||
/// <summary>
|
||||
/// Vettore ISTANTANEO dei contatori ORE LAVORATE elettromandrino
|
||||
/// </summary>
|
||||
public sampleVect[] istOreElettrom;
|
||||
@@ -2079,6 +2093,7 @@ namespace SCMA.AdapterPLC
|
||||
contGiriElettrom[i] = getStoredValUInt(string.Format("UnOp_{0:00}_AccTime", i + 1));
|
||||
contOreElettrom[i] = getStoredValUInt(string.Format("UnOp_{0:00}_KRev", i + 1));
|
||||
currNumCambiUt[i] = getStoredValUInt(string.Format("UnOp_{0:00}_NumCU", i + 1));
|
||||
currRepetitionUnOp[i] = getStoredValUInt(string.Format("UnOp_{0:00}_Count", i + 1));
|
||||
}
|
||||
|
||||
for (int i = 0; i < currAdpConf.nAxis; i++)
|
||||
@@ -2184,8 +2199,11 @@ namespace SCMA.AdapterPLC
|
||||
contGiriElettrom = new uint[currAdpConf.nUnOp];
|
||||
contOreElettrom = new uint[currAdpConf.nUnOp];
|
||||
istGiriElettrom = new sampleVect[currAdpConf.nUnOp];
|
||||
istRepetitionUnOp = new sampleVect[currAdpConf.nUnOp];
|
||||
istOreElettrom = new sampleVect[currAdpConf.nUnOp];
|
||||
currNumCambiUt = new uint[currAdpConf.nUnOp];
|
||||
currRepetitionUnOp = new uint[currAdpConf.nUnOp];
|
||||
|
||||
istNumCambiUt = new sampleVect[currAdpConf.nUnOp];
|
||||
for (int i = 0; i < currAdpConf.nUnOp; i++)
|
||||
{
|
||||
@@ -2195,17 +2213,21 @@ namespace SCMA.AdapterPLC
|
||||
DataRefItem<string, string> riContKRev = listaDR.Find(x => x.Key == string.Format("UnOp_{0:00}_KRev", i + 1));
|
||||
DataRefItem<string, string> riContOre = listaDR.Find(x => x.Key == string.Format("UnOp_{0:00}_AccTime", i + 1));
|
||||
DataRefItem<string, string> riContNumCU = listaDR.Find(x => x.Key == string.Format("UnOp_{0:00}_NumCU", i + 1));
|
||||
DataRefItem<string, string> riRepUO = listaDR.Find(x => x.Key == string.Format("UnOp_{0:00}_Count", i + 1));
|
||||
// recupero valore giri...
|
||||
UInt32 contTotGiri = Convert.ToUInt32(riContKRev.Value);
|
||||
// recupero valore ore...
|
||||
UInt32 contTotOre = Convert.ToUInt32(riContOre.Value);
|
||||
// recupero valore num cambi ut...
|
||||
UInt32 contNumCU = Convert.ToUInt32(riContNumCU.Value);
|
||||
UInt32 contRepUO = Convert.ToUInt32(riRepUO.Value);
|
||||
// salvo valore letto
|
||||
contGiriElettrom[i] = contTotGiri;
|
||||
contOreElettrom[i] = contTotOre;
|
||||
currNumCambiUt[i] = contNumCU;
|
||||
currRepetitionUnOp[i] = contRepUO;
|
||||
istGiriElettrom[i] = new sampleVect();
|
||||
istRepetitionUnOp[i] = new sampleVect();
|
||||
istOreElettrom[i] = new sampleVect();
|
||||
istNumCambiUt[i] = new sampleVect();
|
||||
}
|
||||
@@ -4440,6 +4462,19 @@ namespace SCMA.AdapterPLC
|
||||
istNumCambiUt[numero - 1].addValue(DateTime.Now, (int)valRead);
|
||||
}
|
||||
}
|
||||
else if (origName.EndsWith("_Count"))
|
||||
{
|
||||
try
|
||||
{
|
||||
numero = Convert.ToInt32(origName.Replace("UnOp_", "").Replace("_Count", ""));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (numero > 0 && istRepetitionUnOp.Length >= numero)
|
||||
{
|
||||
istRepetitionUnOp[numero - 1].addValue(DateTime.Now, (int)valRead);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (origName.StartsWith("VacPump_"))
|
||||
{
|
||||
@@ -4676,6 +4711,7 @@ namespace SCMA.AdapterPLC
|
||||
needSave = procPzProd(needSave);
|
||||
needSave = procGiriTotUnOp(needSave);
|
||||
needSave = procNumCU(needSave);
|
||||
needSave = procRepetitions(needSave);
|
||||
needSave = procCounters(needSave);
|
||||
needSave = procMovTotAssi(needSave);
|
||||
needSave = procAccTimeAssi(needSave);
|
||||
@@ -5702,6 +5738,53 @@ namespace SCMA.AdapterPLC
|
||||
return needSave;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Processing delle variabili sul numero di ripetizioni
|
||||
/// </summary>
|
||||
/// <param name="needSave"></param>
|
||||
/// <returns></returns>
|
||||
public bool procRepetitions(bool needSave)
|
||||
{
|
||||
uint delta = 0;
|
||||
uint valore = 0;
|
||||
string outString = string.Format("UnOp_[1-{0}]_Count: ", currAdpConf.nUnOp);
|
||||
for (int i = 0; i < currAdpConf.nUnOp; i++)
|
||||
{
|
||||
// procedo solo SE HO FINESTRA VALIDA...
|
||||
if (istRepetitionUnOp[i].vcValid)
|
||||
{
|
||||
valore = Convert.ToUInt32(istRepetitionUnOp[i].vcMedian);
|
||||
if (valore >= currRepetitionUnOp[i])
|
||||
{
|
||||
delta = valore - currRepetitionUnOp[i];
|
||||
// controllo delta < 50% max...
|
||||
if (delta < uint.MaxValue / 2)
|
||||
{
|
||||
// processo comunque sempre...
|
||||
uint contatore = updateValUIntByIncr(i, delta, "UnOp_{0:00}_Count");
|
||||
// passo valore num CU all'adapter
|
||||
currGateway.updateItemNodeValue(vettUnOp[i].countKey, contatore);
|
||||
// controllo valore riferimento...
|
||||
if (delta > 0)
|
||||
{
|
||||
// segnalo necessità salvataggio!
|
||||
needSave = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// ...aggiorno valore riferimento...
|
||||
currRepetitionUnOp[i] = valore;
|
||||
}
|
||||
outString += string.Format("{0} | ", currGateway.getItemNode(vettUnOp[i].countKey));
|
||||
}
|
||||
// salvo su maschera...
|
||||
parentForm.dataMonitor_2 += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
|
||||
return needSave;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Processing delle variabili sul totale m percorsi dagli assi
|
||||
/// </summary>
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
<!--<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="006" CmsDataOpt="BIT" />-->
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="Krev" CmsDataType="CounterList" CmsDataIndex="016" CmsDataOpt="COUNT" CmsDataScale="1000" />
|
||||
<Variable SymbolicName="SpeedRate" BrowseName="SpeedRate" DataType="ua:UInt32" ValueRank="Scalar" Units="rpm" />
|
||||
<Variable SymbolicName="SpeedOverride" BrowseName="SpeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="SpeedOverride" BrowseName="SpeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="026" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="001" CmsDataOpt="NUM" />
|
||||
<!--<Variable SymbolicName="ToolChanges" BrowseName="ToolChanges" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="024" CmsDataOpt="NUM" />-->
|
||||
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
|
||||
@@ -154,6 +154,7 @@
|
||||
<Variable SymbolicName="DrillTool" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="012" CmsDataOpt="BIT" />
|
||||
<Variable SymbolicName="RouterTool" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="013" CmsDataOpt="BIT" />
|
||||
<Variable SymbolicName="WaterJet" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="014" CmsDataOpt="BIT" />
|
||||
<Variable SymbolicName="Repetitions" BrowseName="Repetitions" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="025" CmsDataOpt="COUNT" />
|
||||
</Component>
|
||||
</Component>
|
||||
<Component Name="AuxiliaryGroups">
|
||||
|
||||
@@ -1407,7 +1407,9 @@ namespace SCMA
|
||||
fileOut.WriteLine($"A|I|{newElement.ident}_Load|{replString}:Load");
|
||||
fileOut.WriteLine($"A|I|{newElement.ident}_SpeedOverr|{replString}:SpeedOverride");
|
||||
fileOut.WriteLine($"A|I|{newElement.ident}_Status|{replString}:Status");
|
||||
numRules += 8;
|
||||
fileOut.WriteLine($"A|I|{newElement.ident}_Count|{replString}:Repetitions");
|
||||
|
||||
numRules += 9;
|
||||
}
|
||||
fileOut.WriteLine("");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user