Sistemato FIXME x TIPO ASSI!!!
This commit is contained in:
Vendored
+1
-1
@@ -15,7 +15,7 @@ pipeline {
|
||||
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=411']) {
|
||||
withEnv(['NEXT_BUILD_NUMBER=417']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '2.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '2.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.APP_NAME = 'SCMA'
|
||||
|
||||
@@ -599,7 +599,7 @@ namespace SCMA
|
||||
}
|
||||
// salvo!
|
||||
ouStatus = MemBlock[0];
|
||||
|
||||
|
||||
// recupero valore PUNTUALE status da apposita area memoria... se ha valore >=0...
|
||||
if (ouStatusByPlc && ouStatus >= 0)
|
||||
{
|
||||
@@ -644,7 +644,7 @@ namespace SCMA
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 14000;
|
||||
byte[] tabDatiMtzByte = new byte[4 * maintData.Length];
|
||||
uint[] tabDatiMtz = new uint[maintData.Length];
|
||||
uint[] tabDatiMtz = new uint[maintDataMaxNum];
|
||||
inizio = DateTime.Now;
|
||||
FanucMemRW(R, FANUC.MemType.R, memIndex, ref tabDatiMtzByte);
|
||||
if (utils.CRB("recTime"))
|
||||
@@ -674,8 +674,8 @@ namespace SCMA
|
||||
{
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 15000;
|
||||
byte[] tabDatiAnalogByte = new byte[4 * analogData.Length];
|
||||
uint[] tabDatiAnalog = new uint[analogData.Length];
|
||||
byte[] tabDatiAnalogByte = new byte[4 * analogDataMaxNum];
|
||||
uint[] tabDatiAnalog = new uint[analogDataMaxNum];
|
||||
inizio = DateTime.Now;
|
||||
FanucMemRW(R, FANUC.MemType.R, memIndex, ref tabDatiAnalogByte);
|
||||
if (utils.CRB("recTime"))
|
||||
@@ -702,11 +702,11 @@ namespace SCMA
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
if (statusData.Length > 0)
|
||||
if (statusDataMaxNum > 0)
|
||||
{
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 14512;
|
||||
int numByte = 1 + (statusData.Length / 8);
|
||||
int numByte = 1 + (statusDataMaxNum / 8);
|
||||
byte[] tabDatiStatus = new byte[numByte];
|
||||
inizio = DateTime.Now;
|
||||
FanucMemRW(R, FANUC.MemType.R, memIndex, ref tabDatiStatus);
|
||||
@@ -1177,7 +1177,6 @@ namespace SCMA
|
||||
double newPos = 0;
|
||||
double distPerc = 0;
|
||||
int newDir = 0;
|
||||
string tipoAsse = "";
|
||||
string direzione = "";
|
||||
|
||||
for (int i = 0; i < currAdpConf.nAxis; i++)
|
||||
@@ -1342,18 +1341,9 @@ namespace SCMA
|
||||
{
|
||||
newDir = prevDirAxis[i];
|
||||
}
|
||||
|
||||
// verifico tipo direzione da tipo asse...
|
||||
tipoAsse = currGateway.getItemNode(vettAxis[i].typeKey).ToString();
|
||||
if (tipoAsse == "LINEAR")
|
||||
{
|
||||
// ?: conditional operator.
|
||||
direzione = (newDir > 0) ? "POSITIVE" : "NEGATIVE";
|
||||
}
|
||||
else if (tipoAsse == "ROTARY")
|
||||
{
|
||||
direzione = (newDir > 0) ? "CLOCKWISE" : "COUNTER_CLOCKWISE";
|
||||
}
|
||||
// calcolo direzione
|
||||
direzione = calculateDirection(newDir, i);
|
||||
// imposto direzione
|
||||
currGateway.updateItemNodeValue(vettAxis[i].directionKey, direzione);
|
||||
|
||||
if (utils.CRB("verbose"))
|
||||
|
||||
@@ -2431,7 +2431,58 @@ namespace SCMA
|
||||
eh_refreshed(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua verifica direzione asse
|
||||
/// </summary>
|
||||
/// <param name="newDir"></param>
|
||||
/// <param name="i"></param>
|
||||
protected string calculateDirection(int newDir, int i)
|
||||
{
|
||||
string tipoAsse = "";
|
||||
string direzione = "";
|
||||
// controllo se tipo MTC/SOUR
|
||||
if (currGateway.protocollo != gwProtocol.SOURS)
|
||||
{
|
||||
tipoAsse = currGateway.getItemNode(vettAxis[i].typeKey).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
// recupero info TIPO ASSE
|
||||
List<DataRefItem<string, string>> drl = vettAxis[i].dataRefList;
|
||||
foreach (var item in drl)
|
||||
{
|
||||
if (item.Key == vettAxis[i].typeKey)
|
||||
{
|
||||
tipoAsse = item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
// verifico tipo direzione da tipo asse...
|
||||
if (tipoAsse == "LINEAR")
|
||||
{
|
||||
if (currGateway.protocollo == gwProtocol.SOURS)
|
||||
{
|
||||
direzione = (newDir > 0) ? "POS" : "NEG";
|
||||
}
|
||||
else
|
||||
{
|
||||
// ?: conditional operator.
|
||||
direzione = (newDir > 0) ? "POSITIVE" : "NEGATIVE";
|
||||
}
|
||||
}
|
||||
else if (tipoAsse == "ROTARY")
|
||||
{
|
||||
if (currGateway.protocollo == gwProtocol.SOURS)
|
||||
{
|
||||
direzione = (newDir > 0) ? "CW" : "CCW";
|
||||
}
|
||||
else
|
||||
{
|
||||
direzione = (newDir > 0) ? "CLOCKWISE" : "COUNTER_CLOCKWISE";
|
||||
}
|
||||
}
|
||||
return direzione;
|
||||
}
|
||||
/// <summary>
|
||||
/// Area per effettuazione test (tipicamente variabili scambiate da MTC --> generali...
|
||||
/// </summary>
|
||||
@@ -4187,6 +4238,31 @@ namespace SCMA
|
||||
// return!
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Numero massimo (indice) valori maintData (privato)
|
||||
/// </summary>
|
||||
protected int _maintDataMaxNum = 0;
|
||||
/// <summary>
|
||||
/// Numero massimo (indice) valori maintData (calcolato)
|
||||
/// </summary>
|
||||
public int maintDataMaxNum
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_maintDataMaxNum == 0)
|
||||
{
|
||||
// prima stima
|
||||
int idx = maintData.Length;
|
||||
// ora ciclo...
|
||||
foreach (var item in maintData)
|
||||
{
|
||||
int.TryParse(item.codNum, out idx);
|
||||
_maintDataMaxNum = idx > _maintDataMaxNum ? idx : _maintDataMaxNum;
|
||||
}
|
||||
}
|
||||
return _maintDataMaxNum;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processa la tabella di memoria dei dati di manutenzione
|
||||
@@ -4326,7 +4402,7 @@ namespace SCMA
|
||||
catch (Exception exc)
|
||||
{
|
||||
valRead = 0;
|
||||
lg.Error(string.Format("Errore in recupero num inversioni:{0}parametro: {1}{0}i: {2}{0}Exc: {3}", Environment.NewLine, maintData[i].varName, i, exc));
|
||||
lg.Error(string.Format("Errore in recupero num AccTime:{0}parametro: {1}{0}i: {2}{0}Exc: {3}", Environment.NewLine, maintData[i].varName, i, exc));
|
||||
}
|
||||
istAccTimeAssi[numero - 1].addValue(DateTime.Now, Convert.ToInt32(valRead));
|
||||
}
|
||||
@@ -4469,7 +4545,31 @@ namespace SCMA
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Numero massimo (indice) valori analogData (privato)
|
||||
/// </summary>
|
||||
protected int _analogDataMaxNum = 0;
|
||||
/// <summary>
|
||||
/// Numero massimo (indice) valori analogData (calcolato)
|
||||
/// </summary>
|
||||
public int analogDataMaxNum
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_analogDataMaxNum == 0)
|
||||
{
|
||||
// prima stima
|
||||
int idx = analogData.Length;
|
||||
// ora ciclo...
|
||||
foreach (var item in analogData)
|
||||
{
|
||||
int.TryParse(item.codNum, out idx);
|
||||
_analogDataMaxNum = idx > _analogDataMaxNum ? idx : _analogDataMaxNum;
|
||||
}
|
||||
}
|
||||
return _analogDataMaxNum;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Processa la tabella di memoria dei dati analogici
|
||||
/// </summary>
|
||||
@@ -4551,6 +4651,31 @@ namespace SCMA
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Numero massimo (indice) valori analogData (privato)
|
||||
/// </summary>
|
||||
protected int _statusDataMaxNum = 0;
|
||||
/// <summary>
|
||||
/// Numero massimo (indice) valori analogData (calcolato)
|
||||
/// </summary>
|
||||
public int statusDataMaxNum
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_statusDataMaxNum == 0)
|
||||
{
|
||||
// prima stima
|
||||
int idx = statusData.Length;
|
||||
// ora ciclo...
|
||||
foreach (var item in statusData)
|
||||
{
|
||||
int.TryParse(item.codNum, out idx);
|
||||
_statusDataMaxNum = idx > _statusDataMaxNum ? idx : _statusDataMaxNum;
|
||||
}
|
||||
}
|
||||
return _statusDataMaxNum;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Processa la tabella di memoria degli status di manutenzione
|
||||
/// </summary>
|
||||
|
||||
@@ -680,7 +680,8 @@ namespace SCMA
|
||||
{
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 1000;
|
||||
uint[] tabDatiMtz = new uint[maintData.Length];
|
||||
// calcolo indice max scorrendo...
|
||||
uint[] tabDatiMtz = new uint[maintDataMaxNum];
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW_DWord(R, OSAI.MemTypeWord.GW_CODE, memIndex, ref tabDatiMtz);
|
||||
if (utils.CRB("recTime"))
|
||||
@@ -710,7 +711,7 @@ namespace SCMA
|
||||
{
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 19434;
|
||||
uint[] tabDatiAnalog = new uint[analogData.Length];
|
||||
uint[] tabDatiAnalog = new uint[analogDataMaxNum];
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW_DWord(R, OSAI.MemTypeWord.MW_CODE, memIndex, ref tabDatiAnalog);
|
||||
if (utils.CRB("recTime"))
|
||||
@@ -736,11 +737,11 @@ namespace SCMA
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
if (statusData.Length > 0)
|
||||
if (statusDataMaxNum > 0)
|
||||
{
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 19426;
|
||||
int numByte = 1 + (statusData.Length / 8);
|
||||
int numByte = 1 + (statusDataMaxNum / 8);
|
||||
byte[] tabDatiStatus = new byte[numByte];
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW_Byte(R, OSAI.MemTypeWord.MW_CODE, memIndex, 0, ref tabDatiStatus);
|
||||
@@ -1017,9 +1018,9 @@ namespace SCMA
|
||||
// 2017.01.16 da rivedere
|
||||
currGateway.updateItemNodeValue(vettPath[i].currProgRowNumKey, "");
|
||||
currGateway.updateItemNodeValue(vettPath[i].activeAxesKey, "");
|
||||
sb_2.AppendLine(string.Format("Path {0}, PROG: {1}", i + 1, currGateway.getItemNode(vettPath[i].currProgKey)));
|
||||
}
|
||||
|
||||
sb_2.AppendLine(string.Format("Path {0}, PROG: {1}", i + 1, currGateway.getItemNode(vettPath[i].currProgKey)));
|
||||
sb_3.AppendLine(string.Format("Path {0}, GCodes: {1}", i + 1, GCodAttivi));
|
||||
|
||||
parentForm.dataMonitor_2 += sb_2.ToString();
|
||||
@@ -1139,7 +1140,6 @@ namespace SCMA
|
||||
double newPosTgt = 0;
|
||||
double distPerc = 0;
|
||||
int newDir = 0;
|
||||
string tipoAsse = "";
|
||||
string direzione = "";
|
||||
// ORA ho tutto in posizione corretta, PROCESSO!!!
|
||||
for (int i = 0; i < currAdpConf.nAxis; i++)
|
||||
@@ -1185,20 +1185,9 @@ namespace SCMA
|
||||
{
|
||||
newDir = prevDirAxis[i];
|
||||
}
|
||||
|
||||
// controllo se tipo MTC/SOUR
|
||||
// verifico tipo direzione da tipo asse...
|
||||
tipoAsse = currGateway.getItemNode(vettAxis[i].typeKey).ToString();
|
||||
if (tipoAsse == "LINEAR")
|
||||
{
|
||||
// ?: conditional operator.
|
||||
direzione = (newDir > 0) ? "POSITIVE" : "NEGATIVE";
|
||||
}
|
||||
else if (tipoAsse == "ROTARY")
|
||||
{
|
||||
direzione = (newDir > 0) ? "CLOCKWISE" : "COUNTER_CLOCKWISE";
|
||||
}
|
||||
|
||||
// calcolo direzione
|
||||
direzione = calculateDirection(newDir, i);
|
||||
// imposto direzione
|
||||
currGateway.updateItemNodeValue(vettAxis[i].directionKey, direzione);
|
||||
|
||||
if (utils.CRB("verbose"))
|
||||
@@ -1226,5 +1215,6 @@ namespace SCMA
|
||||
parentForm.commPlcActive = false;
|
||||
parentForm.dataMonitor_3 += sb.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using MTC;
|
||||
using SCMA.AdapterCom;
|
||||
using Siemens.Sinumerik.Operate.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SCMA
|
||||
@@ -676,7 +677,7 @@ namespace SCMA
|
||||
{
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 536;
|
||||
uint[] tabDatiMtz = new uint[maintData.Length];
|
||||
uint[] tabDatiMtz = new uint[maintDataMaxNum];
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_DWord(R, baseMemDb, memIndex, ref tabDatiMtz);
|
||||
if (utils.CRB("recTime"))
|
||||
@@ -700,11 +701,11 @@ namespace SCMA
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
if (statusData.Length > 0)
|
||||
if (statusDataMaxNum > 0)
|
||||
{
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 1048;
|
||||
int numByte = 1 + (statusData.Length / 8);
|
||||
int numByte = 1 + (statusDataMaxNum / 8);
|
||||
byte[] tabDatiStatus = new byte[numByte];
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Byte(R, baseMemDb, memIndex, ref tabDatiStatus);
|
||||
@@ -733,7 +734,7 @@ namespace SCMA
|
||||
{
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 1064;
|
||||
uint[] tabDatiAnalog = new uint[analogData.Length];
|
||||
uint[] tabDatiAnalog = new uint[analogDataMaxNum];
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_DWord(R, baseMemDb, memIndex, ref tabDatiAnalog);
|
||||
if (utils.CRB("recTime"))
|
||||
@@ -986,7 +987,6 @@ namespace SCMA
|
||||
double newPos = 0;
|
||||
double distPerc = 0;
|
||||
int newDir = 0;
|
||||
string tipoAsse = "";
|
||||
string direzione = "";
|
||||
|
||||
// recupero in blocco dati assi...
|
||||
@@ -1023,39 +1023,8 @@ namespace SCMA
|
||||
{
|
||||
newDir = prevDirAxis[i];
|
||||
}
|
||||
|
||||
// FIXME!!! CONTROLLARE TIPO ASSI
|
||||
// verifico tipo direzione da tipo asse...
|
||||
tipoAsse = "LINEAR";
|
||||
try
|
||||
{
|
||||
currGateway.getItemNode(vettAxis[i].typeKey).ToString();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (tipoAsse == "LINEAR")
|
||||
{
|
||||
if (currGateway.protocollo == gwProtocol.SOURS)
|
||||
{
|
||||
direzione = (newDir > 0) ? "POS" : "NEG";
|
||||
}
|
||||
else
|
||||
{
|
||||
// ?: conditional operator.
|
||||
direzione = (newDir > 0) ? "POSITIVE" : "NEGATIVE";
|
||||
}
|
||||
}
|
||||
else if (tipoAsse == "ROTARY")
|
||||
{
|
||||
if (currGateway.protocollo == gwProtocol.SOURS)
|
||||
{
|
||||
direzione = (newDir > 0) ? "CW" : "CCW";
|
||||
}
|
||||
else
|
||||
{
|
||||
direzione = (newDir > 0) ? "CLOCKWISE" : "COUNTER_CLOCKWISE";
|
||||
}
|
||||
}
|
||||
// calcolo direzione
|
||||
direzione = calculateDirection(newDir, i);
|
||||
// imposto direzione
|
||||
currGateway.updateItemNodeValue(vettAxis[i].directionKey, direzione);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user