aggiunta lettura file conf analogData (da testare!!!)
This commit is contained in:
@@ -791,10 +791,14 @@ namespace MTC_Adapter
|
||||
/// </summary>
|
||||
public Dictionary<string, string> generalStatus;
|
||||
/// <summary>
|
||||
/// Contenuto valori maintenance data da PLC
|
||||
/// Contenuto valori contatori manutenzione da PLC
|
||||
/// </summary>
|
||||
public otherData[] maintData;
|
||||
/// <summary>
|
||||
/// Contenuto valori variabili analogiche da PLC
|
||||
/// </summary>
|
||||
public otherData[] analogData;
|
||||
/// <summary>
|
||||
/// Contenuto valori status data da PLC
|
||||
/// </summary>
|
||||
public otherData[] statusData;
|
||||
@@ -1375,7 +1379,6 @@ namespace MTC_Adapter
|
||||
// SE non è un commento...
|
||||
if (linea.Substring(0, 1) != "#")
|
||||
{
|
||||
//elencoAllarmi[rumRiga] = decodeAlarmLine(linea, ':');
|
||||
maintData[numRiga] = decodeOtherData(linea, utils.CRC("testCharSep"), memPre, baseAddr, memSize);
|
||||
numRiga++;
|
||||
}
|
||||
@@ -1388,6 +1391,42 @@ namespace MTC_Adapter
|
||||
if (utils.CRB("verbose")) lg.Info(string.Format("Fine caricamento vettore di {0} variabili manutenzione gestite", numRiga));
|
||||
}
|
||||
/// <summary>
|
||||
/// Lettura file gestione dati analogici da PLC
|
||||
/// </summary>
|
||||
/// <param name="memPre"></param>
|
||||
/// <param name="baseAddr"></param>
|
||||
/// <param name="memSize"></param>
|
||||
public void loadAnalogData(string memPre, int baseAddr, int memSize)
|
||||
{
|
||||
// carico dati x Maintenance
|
||||
if (utils.CRB("verbose")) lg.Info("Inizio caricamento vettore variabili analogiche gestite");
|
||||
int totRighe = 0;
|
||||
string fileName = string.Format(@"{0}\{1}", utils.confDir, utils.CRS("AnalogDataFilePath"));
|
||||
string linea;
|
||||
totRighe = File.ReadLines(fileName).Count();
|
||||
// creo un vettore della dimensione corretta... conta anche commenti tanto poi riduco...
|
||||
analogData = new otherData[File.ReadLines(fileName).Count()];
|
||||
// carica da file...
|
||||
StreamReader file = new StreamReader(fileName);
|
||||
// leggo 1 linea alla volta...
|
||||
int numRiga = 0;
|
||||
while ((linea = file.ReadLine()) != null)
|
||||
{
|
||||
// SE non è un commento...
|
||||
if (linea.Substring(0, 1) != "#")
|
||||
{
|
||||
analogData[numRiga] = decodeOtherData(linea, utils.CRC("testCharSep"), memPre, baseAddr, memSize);
|
||||
numRiga++;
|
||||
}
|
||||
}
|
||||
// chiudo file
|
||||
file.Close();
|
||||
// ora trimmo vettore al solo numero VERO dei valori caricati...
|
||||
Array.Resize<otherData>(ref maintData, numRiga);
|
||||
|
||||
if (utils.CRB("verbose")) lg.Info(string.Format("Fine caricamento vettore di {0} variabili analogiche gestite", numRiga));
|
||||
}
|
||||
/// <summary>
|
||||
/// Lettura file gestione dati status da PLC
|
||||
/// </summary>
|
||||
/// <param name="memPre"></param>
|
||||
|
||||
@@ -1258,7 +1258,10 @@ namespace MTC_Adapter
|
||||
{
|
||||
base.loadOtherFile();
|
||||
loadMaintData("MW", 19166, 2);
|
||||
loadStatusData("ML", 19426, 2);
|
||||
//loadStatusData("ML", 19426, 2);
|
||||
loadStatusData("GL", 500, 1);
|
||||
//loadAnalogData("ML", 19434, 2);
|
||||
loadAnalogData("ML", 9717, 1);
|
||||
}
|
||||
/// <summary>
|
||||
/// Processing allarmi CNC
|
||||
|
||||
Reference in New Issue
Block a user