LASCO!!!! OK read/write data...
This commit is contained in:
@@ -33,8 +33,8 @@ CMDREBO=/sendReboot.aspx?idxMacchina=
|
||||
[MEMORY]
|
||||
ADDR_READ=DB1001.DBB0
|
||||
ADDR_WRITE=DB1002.DBB0
|
||||
SIZE_READ=60
|
||||
SIZE_WRITE=60
|
||||
SIZE_READ=68
|
||||
SIZE_WRITE=68
|
||||
;BIT0=CONN
|
||||
;BIT1=DB60.DBB1
|
||||
;BIT2=PZCOUNT.STD.DB700.DBW22
|
||||
|
||||
+23
-54
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace IOB_WIN
|
||||
{
|
||||
@@ -149,7 +150,7 @@ namespace IOB_WIN
|
||||
bool taskOk = false;
|
||||
string taskVal = "";
|
||||
// inizio con 1 byte VUOTO
|
||||
byte[] MemBlock = new byte[62];
|
||||
byte[] MemBlock = new byte[parametri.memSizeWrite];
|
||||
|
||||
// cerco task specifici: se ho startSetup --> imposto bit DBB701.DBB0.4
|
||||
foreach (var item in task2exe)
|
||||
@@ -183,6 +184,7 @@ namespace IOB_WIN
|
||||
{
|
||||
currProdData.Add(item.Key, item.Value);
|
||||
}
|
||||
taskVal = item.Value;
|
||||
break;
|
||||
case taskType.sendWatchDogMes2Plc:
|
||||
// compogo in byte... primo bit è setup/run, ultimo è watchdog
|
||||
@@ -307,22 +309,22 @@ namespace IOB_WIN
|
||||
* DB60.DBD10: pressione linea utenze (salvataggio del MAX ogni minuto)
|
||||
* DB60.DBD14: temperatura acqua pulita (salvataggio del MAX ogni minuto)
|
||||
* */
|
||||
int RamPosition = S7.Net.Types.Int.FromByteArray(RawInput.Skip(14).Take(2).ToArray());
|
||||
int LowerEjectorPosition = S7.Net.Types.Int.FromByteArray(RawInput.Skip(16).Take(2).ToArray());
|
||||
int UpperTool = S7.Net.Types.Int.FromByteArray(RawInput.Skip(18).Take(2).ToArray());
|
||||
int TempMainMotorU = S7.Net.Types.Int.FromByteArray(RawInput.Skip(20).Take(2).ToArray());
|
||||
int TempMainMotorV = S7.Net.Types.Int.FromByteArray(RawInput.Skip(22).Take(2).ToArray());
|
||||
int TempMainMotorW = S7.Net.Types.Int.FromByteArray(RawInput.Skip(24).Take(2).ToArray());
|
||||
int TempSpindleNut = S7.Net.Types.Int.FromByteArray(RawInput.Skip(26).Take(2).ToArray());
|
||||
int TempMotoModule = S7.Net.Types.Int.FromByteArray(RawInput.Skip(28).Take(2).ToArray());
|
||||
int TempOilCirculation = S7.Net.Types.Int.FromByteArray(RawInput.Skip(30).Take(2).ToArray());
|
||||
int TempHydraulicUnit = S7.Net.Types.Int.FromByteArray(RawInput.Skip(32).Take(2).ToArray());
|
||||
int PressHydraulicPump = S7.Net.Types.Int.FromByteArray(RawInput.Skip(34).Take(2).ToArray());
|
||||
int PressHydraulicAccumulator = S7.Net.Types.Int.FromByteArray(RawInput.Skip(36).Take(2).ToArray());
|
||||
int PressCounterforceOil = S7.Net.Types.Int.FromByteArray(RawInput.Skip(38).Take(2).ToArray());
|
||||
int PressCounterforceGas = S7.Net.Types.Int.FromByteArray(RawInput.Skip(40).Take(2).ToArray());
|
||||
double ForcePressureActual = S7.Net.Types.Double.FromByteArray(RawInput.Skip(42).Take(4).ToArray());
|
||||
int ForceOnBushing = S7.Net.Types.Int.FromByteArray(RawInput.Skip(46).Take(2).ToArray());
|
||||
int RamPosition = S7.Net.Types.Int.FromByteArray(RawInput.Skip(18).Take(2).ToArray());
|
||||
int LowerEjectorPosition = S7.Net.Types.Int.FromByteArray(RawInput.Skip(20).Take(2).ToArray());
|
||||
int UpperTool = S7.Net.Types.Int.FromByteArray(RawInput.Skip(22).Take(2).ToArray());
|
||||
int TempMainMotorU = S7.Net.Types.Int.FromByteArray(RawInput.Skip(24).Take(2).ToArray());
|
||||
int TempMainMotorV = S7.Net.Types.Int.FromByteArray(RawInput.Skip(26).Take(2).ToArray());
|
||||
int TempMainMotorW = S7.Net.Types.Int.FromByteArray(RawInput.Skip(28).Take(2).ToArray());
|
||||
int TempSpindleNut = S7.Net.Types.Int.FromByteArray(RawInput.Skip(30).Take(2).ToArray());
|
||||
int TempMotoModule = S7.Net.Types.Int.FromByteArray(RawInput.Skip(32).Take(2).ToArray());
|
||||
int TempOilCirculation = S7.Net.Types.Int.FromByteArray(RawInput.Skip(34).Take(2).ToArray());
|
||||
int TempHydraulicUnit = S7.Net.Types.Int.FromByteArray(RawInput.Skip(36).Take(2).ToArray());
|
||||
int PressHydraulicPump = S7.Net.Types.Int.FromByteArray(RawInput.Skip(38).Take(2).ToArray());
|
||||
int PressHydraulicAccumulator = S7.Net.Types.Int.FromByteArray(RawInput.Skip(40).Take(2).ToArray());
|
||||
int PressCounterforceOil = S7.Net.Types.Int.FromByteArray(RawInput.Skip(42).Take(2).ToArray());
|
||||
int PressCounterforceGas = S7.Net.Types.Int.FromByteArray(RawInput.Skip(44).Take(2).ToArray());
|
||||
int ForcePressureActual = S7.Net.Types.DInt.FromByteArray(RawInput.Skip(46).Take(4).ToArray());
|
||||
int ForceOnBushing = S7.Net.Types.Int.FromByteArray(RawInput.Skip(50).Take(2).ToArray());
|
||||
|
||||
// !!!FIXME: i dati di lasco sono da dividere per 10 (CREDO) perché sono int ma hanno virgola (1 pos) --> impostare un fattore x tutte le var TSVC (default a 1, gestito da classe TSVC?)
|
||||
|
||||
@@ -364,7 +366,7 @@ namespace IOB_WIN
|
||||
PressHydraulicAccumulator = getVal_TSVC_int("PressHydraulicAccumulator", scaduti[11]);
|
||||
PressCounterforceOil = getVal_TSVC_int("PressCounterforceOil", scaduti[12]);
|
||||
PressCounterforceGas = getVal_TSVC_int("PressCounterforceGas", scaduti[13]);
|
||||
ForcePressureActual = getVal_TSVC("ForcePressureActual", scaduti[14]);
|
||||
ForcePressureActual = getVal_TSVC_int("ForcePressureActual", scaduti[14]);
|
||||
ForceOnBushing = getVal_TSVC_int("ForceOnBushing", scaduti[15]);
|
||||
outVal.Add("DYNDATA", $"RamPosition {RamPosition:N2} | TempMainMotorV {TempMainMotorV:N2} | TempOilCirculation {TempOilCirculation:N2} | PressCounterforceGas {PressCounterforceGas}");
|
||||
outVal.Add("RamPosition", $"{RamPosition:N2}");
|
||||
@@ -478,29 +480,6 @@ namespace IOB_WIN
|
||||
}
|
||||
#endif
|
||||
|
||||
#if true
|
||||
try
|
||||
{
|
||||
// recupero prodCode loro...
|
||||
// primo è num char, secondo è max lenght...
|
||||
var par1 = System.Text.Encoding.UTF8.GetString(RawInput.Skip(54).Take(1).ToArray());
|
||||
var par2 = System.Text.Encoding.UTF8.GetString(RawInput.Skip(55).Take(1).ToArray());
|
||||
|
||||
var rawProdCode52 = RawInput.Skip(54).Take(14).ToArray();
|
||||
var rawProdCode54 = RawInput.Skip(54).Take(12).ToArray();
|
||||
var rawProdCode56 = RawInput.Skip(56).Take(12).ToArray();
|
||||
var prodCode52 = S7.Net.Types.String.FromByteArray(rawProdCode52);
|
||||
var prodCode54 = S7.Net.Types.String.FromByteArray(rawProdCode54);
|
||||
var prodCode56 = S7.Net.Types.String.FromByteArray(rawProdCode56);
|
||||
var test12 = System.Text.Encoding.UTF8.GetString(rawProdCode54).ToCharArray();
|
||||
var test10 = System.Text.Encoding.UTF8.GetString(rawProdCode56).ToCharArray();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError($"Errore in decodifica product code{Environment.NewLine}{exc}");
|
||||
}
|
||||
#endif
|
||||
|
||||
// log opzionale!
|
||||
if (verboseLog)
|
||||
{
|
||||
@@ -513,19 +492,9 @@ namespace IOB_WIN
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
// recupero prodCode loro...
|
||||
// primo è num char, secondo è max lenght...
|
||||
var par1 = System.Text.Encoding.UTF8.GetString(RawInput.Skip(48).Take(1).ToArray());
|
||||
var par2 = System.Text.Encoding.UTF8.GetString(RawInput.Skip(49).Take(1).ToArray());
|
||||
|
||||
var rawProdCode12 = RawInput.Skip(48).Take(12).ToArray();
|
||||
var rawProdCode10 = RawInput.Skip(50).Take(10).ToArray();
|
||||
var prodCode = S7.Net.Types.String.FromByteArray(rawProdCode12);
|
||||
var prodCode2 = S7.Net.Types.String.FromByteArray(rawProdCode10);
|
||||
var test12 = System.Text.Encoding.UTF8.GetString(rawProdCode12).ToCharArray();
|
||||
var test10 = System.Text.Encoding.UTF8.GetString(rawProdCode10).ToCharArray();
|
||||
|
||||
answ = prodCode;
|
||||
string rawProdCode = S7.Net.Types.String.FromByteArray(RawInput.Skip(54).Take(12).ToArray());
|
||||
// primi due char sono \f e \n avanzamento carta e nuova linea...
|
||||
answ = Regex.Replace(rawProdCode, @"\t|\n|\r|\f", "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user