diff --git a/IOB-WIN/DATA/CONF/INTERCL_02.ini b/IOB-WIN/DATA/CONF/INTERCL_02.ini
index 41b7d3c7..cff1785e 100644
--- a/IOB-WIN/DATA/CONF/INTERCL_02.ini
+++ b/IOB-WIN/DATA/CONF/INTERCL_02.ini
@@ -10,6 +10,7 @@ MODEL=MiscelazioneOssidiFerro
[CNC]
IP=192.168.250.1
+PORT=9600
OM_MOD=CP1EM60DRA
[SERVER]
@@ -51,26 +52,12 @@ BLINK_FILT=0
[OPTPAR]
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
; attenzione memoria sempre base BYTE (1604 DW --> 6416...)
-PZCOUNT_MODE=STD.DB1275.DBDW4
+PZCOUNT_MODE=STD.DM1275.DBDW4
DISABLE_PZCOUNT=TRUE
ENABLE_DYN_DATA=TRUE
FORCE_DYN_DATA=TRUE
-TSVC_Power_01=MAX:5
-TSVC_Power_02=MAX:5
-TSVC_Power_03=MAX:5
-TSVC_Power_04=MAX:5
-TSVC_TempPirom_01=MAX:5
-TSVC_TempPirom_02=MAX:5
-TSVC_TempPirom_03=MAX:5
-TSVC_TempPirom_04=MAX:5
-TSVC_TempCool_01=MAX:5
-TSVC_TempCool_02=MAX:5
-TSVC_TempCool_03=MAX:5
-TSVC_TempCool_04=MAX:5
-TSVC_PartStatus_01=MAX:5
-TSVC_PartStatus_02=MAX:5
-TSVC_PartStatus_03=MAX:5
-TSVC_PartStatus_04=MAX:5
+; conf parametri memoria READ/WRITE
+PARAM_CONF=INTERCL_02.json
[BRANCH]
NAME=master
\ No newline at end of file
diff --git a/IOB-WIN/DATA/CONF/INTERCL_02.json b/IOB-WIN/DATA/CONF/INTERCL_02.json
new file mode 100644
index 00000000..0254c249
--- /dev/null
+++ b/IOB-WIN/DATA/CONF/INTERCL_02.json
@@ -0,0 +1,154 @@
+{
+ "mMapWrite": {
+ "kgParz": {
+ "name": "kgParz",
+ "tipoMem": "Int",
+ "index": 66,
+ "size": 2,
+ "value": "0"
+ },
+ "set_th": {
+ "name": "set_th",
+ "tipoMem": "Int",
+ "index": 72,
+ "size": 2,
+ "value": "0"
+ },
+ "set_c": {
+ "name": "set_c",
+ "tipoMem": "Real",
+ "index": 74,
+ "size": 4,
+ "value": "0"
+ },
+ "aria_1": {
+ "name": "aria_1",
+ "tipoMem": "Int",
+ "index": 78,
+ "size": 2,
+ "value": "0"
+ },
+ "aria_2": {
+ "name": "aria_2",
+ "tipoMem": "Int",
+ "index": 80,
+ "size": 2,
+ "value": "0"
+ },
+ "setMmH20": {
+ "name": "setMmH20",
+ "tipoMem": "Real",
+ "index": 82,
+ "size": 4,
+ "value": "0"
+ },
+ "rpmci": {
+ "name": "rpmci",
+ "tipoMem": "Int",
+ "index": 86,
+ "size": 2,
+ "value": "0"
+ }
+ },
+ "mMapRead": {
+ "T_Attuale_Cil": {
+ "name": "T_Attuale_Cil",
+ "tipoMem": "Real",
+ "index": 16,
+ "size": 4,
+ "func": "MAX",
+ "period": 5,
+ "value": "0"
+ },
+ "Bruc_0_100": {
+ "name": "Bruc_0_100",
+ "tipoMem": "Int",
+ "index": 28,
+ "size": 2,
+ "func": "MAX",
+ "period": 5,
+ "value": "0"
+ },
+ "Dep_Cil_mmH2O": {
+ "name": "Dep_Cil_mmH2O",
+ "tipoMem": "Int",
+ "index": 30,
+ "size": 2,
+ "func": "MAX",
+ "period": 5,
+ "value": "0"
+ },
+ "Asp_0_100": {
+ "name": "Asp_0_100",
+ "tipoMem": "Int",
+ "index": 32,
+ "size": 2,
+ "func": "MAX",
+ "period": 5,
+ "value": "0"
+ },
+ "Ampere_Asp": {
+ "name": "Ampere_Asp",
+ "tipoMem": "Int",
+ "index": 34,
+ "size": 2,
+ "func": "MAX",
+ "period": 5,
+ "value": "0"
+ },
+ "Temp_Filtro": {
+ "name": "Temp_Filtro",
+ "tipoMem": "Int",
+ "index": 36,
+ "size": 2,
+ "func": "MAX",
+ "period": 5,
+ "value": "0"
+ },
+ "Ampere_Cil": {
+ "name": "Ampere_Cil",
+ "tipoMem": "Int",
+ "index": 38,
+ "size": 2,
+ "func": "MAX",
+ "period": 5,
+ "value": "0"
+ },
+ "Flowrate": {
+ "name": "Flowrate",
+ "tipoMem": "Int",
+ "index": 40,
+ "size": 2,
+ "func": "MAX",
+ "period": 5,
+ "value": "0"
+ },
+ "Ampere_Dosat": {
+ "name": "Ampere_Dosat",
+ "tipoMem": "Int",
+ "index": 42,
+ "size": 2,
+ "func": "MAX",
+ "period": 5,
+ "value": "0"
+ },
+ "Tot_Parz_Dosatore": {
+ "name": "Tot_Parz_Dosatore",
+ "tipoMem": "DInt",
+ "index": 48,
+ "size": 4,
+ "func": "MAX",
+ "period": 5,
+ "value": "0"
+ },
+ "Tot_Dosatore": {
+ "name": "Tot_Dosatore",
+ "tipoMem": "DInt",
+ "index": 52,
+ "size": 4,
+ "func": "MAX",
+ "period": 5,
+ "value": "0"
+ }
+ }
+}
\ No newline at end of file
diff --git a/IOB-WIN/IOB-WIN.csproj b/IOB-WIN/IOB-WIN.csproj
index ac358569..597a1055 100644
--- a/IOB-WIN/IOB-WIN.csproj
+++ b/IOB-WIN/IOB-WIN.csproj
@@ -234,6 +234,9 @@
Always
+
+ Always
+
Always
diff --git a/IOB-WIN/IobOmron.cs b/IOB-WIN/IobOmron.cs
index a957aa20..b6898ce2 100644
--- a/IOB-WIN/IobOmron.cs
+++ b/IOB-WIN/IobOmron.cs
@@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.Net.NetworkInformation;
-using OmronFinsTCP;
namespace IOB_WIN
{
@@ -57,18 +56,6 @@ namespace IOB_WIN
///
protected System.Collections.ArrayList resDataArray;
///
- /// Comando inviato al robot
- ///
- protected string comando;
- ///
- /// Variabile verifica thread comunicazione
- ///
- protected bool threadOk = false;
- ///
- /// Nome e seriale macchina
- ///
- protected string macName = "";
- ///
/// Variabile STATUS corrente (8bit INT)
///
protected string cStatus;
@@ -84,10 +71,6 @@ namespace IOB_WIN
/// Ultimo TC registrato da robot
///
protected decimal lastRecTC;
- ///
- /// Ultima missione svolta da robot
- ///
- protected string lastMissRobot;
///
/// estende l'init della classe base...
@@ -101,6 +84,7 @@ namespace IOB_WIN
lastPzCountSend = DateTime.Now;
lastWarnODL = DateTime.Now;
+#if false
OMRON_ref = new OmronFinsTCP.Net.EtherNetPLC();
OMRON_ref.Link("192.168.250.1", 9600, 500);
short[] response;
@@ -125,7 +109,8 @@ namespace IOB_WIN
valoriWord[i] = (short)i;
}
- OMRON_ref.WriteWords(OmronFinsTCP.Net.PlcMemory.WR, 0, 10, valoriWord);
+ OMRON_ref.WriteWords(OmronFinsTCP.Net.PlcMemory.WR, 0, 10, valoriWord);
+#endif
// init connessione
setConnection();
@@ -315,7 +300,6 @@ namespace IOB_WIN
// fix enable prgName
enablePrgName = fIni.ReadBoolean("CNC", "GETPRGNAME", false);
-#if false
// SE รจ necessario refresh...
if (needRefresh)
{
@@ -325,19 +309,8 @@ namespace IOB_WIN
{
try
{
- string connPar = string.Format("TCP {0}", cIobConf.cncIpAddr);
- OMRON_ref = new KRcc.Commu(connPar);
- //OMRON_ref = new KRcc.Commu("TCP 192.168.0.92");
- // disconnetto e connetto...
- if (utils.CRB("verbose"))
- {
- lgInfo("OMRON: tryDisconnect");
- }
-
- //tryDisconnect();
- //lgInfo("OMRON: tryConnect");
- //tryConnect();
- lgInfo("End init Adapter OMRON");
+ short esitoLink = doConnect();
+ lgInfo($"End init Adapter OMRON, esitoLink: {esitoLink}");
if (utils.CRB("verbose"))
{
lgInfo("OMRON CONNESSIONE AVVENUTA");
@@ -351,6 +324,7 @@ namespace IOB_WIN
}
parentForm.commPlcActive = false;
// gestione pzCounter
+#if false
if (utils.CRB("enableContapezzi"))
{
lgInfo("OMRON: inizio gestione contapezzi");
@@ -383,22 +357,35 @@ namespace IOB_WIN
{
lgError(exc, "Errore in contapezzi OMRON");
}
- }
- }
+ }
#endif
+ }
}
+ ///
+ /// Vera connessione ad OMRON
+ ///
+ ///
+ private short doConnect()
+ {
+ // avvio un oggetto di comunicazione OMRON
+ OMRON_ref = new OmronFinsTCP.Net.EtherNetPLC();
+ short port = 9600;
+ short.TryParse(cIobConf.cncPort, out port);
+ short esitoLink = OMRON_ref.Link(cIobConf.cncIpAddr, port, 500);
+ return esitoLink;
+ }
+
///
/// Override disconnessione
///
public override void tryDisconnect()
{
-#if false
if (connectionOk)
{
string szStatusConnection = "";
try
{
- OMRON_ref.disconnect();
+ OMRON_ref.Close();
connectionOk = false;
lgInfo(szStatusConnection);
lgInfo("Effettuata disconnessione adapter OMRON!");
@@ -411,15 +398,13 @@ namespace IOB_WIN
else
{
lgError("IMPOSSIBILE effettuare disconnessione OMRON: Connessione non disponibile...");
- }
-#endif
+ }
}
///
/// Override connessione
///
public override void tryConnect()
{
-#if false
if (!connectionOk)
{
// controllo che il ping sia stato tentato almeno pingTestSec fa...
@@ -439,10 +424,9 @@ namespace IOB_WIN
{
// ora provo connessione...
parentForm.commPlcActive = true;
- string connPar = string.Format("TCP {0}", cIobConf.cncIpAddr);
- OMRON_ref.connect(connPar);
+ short esitoLink = doConnect();
+ lgInfo($"szStatusConnection OMRON, esitoLink: {esitoLink}");
parentForm.commPlcActive = false;
- lgInfo("szStatusConnection: " + OMRON_ref.IsConnected);
connectionOk = true;
// refresh stato allarmi!!!
if (connectionOk)
@@ -466,9 +450,9 @@ namespace IOB_WIN
}
catch (Exception exc)
{
- lgFatal(string.Format("Errore nella connessione all'adapter OMRON: {0}{1}{2}", szStatusConnection, Environment.NewLine, exc));
+ lgFatal($"Errore nella connessione all'adapter OMRON: {szStatusConnection}{Environment.NewLine}{exc}");
connectionOk = false;
- lgInfo(string.Format("Eccezione in TryConnect, Adapter OMRON NON running, pausa di {0} msec prima di ulteriori tentativi di riconnessione", utils.CRI("waitRecMSec")));
+ lgInfo($"Eccezione in TryConnect, Adapter OMRON NON running, pausa di {utils.CRI("waitRecMSec")} msec prima di ulteriori tentativi di riconnessione");
}
}
else
@@ -477,7 +461,7 @@ namespace IOB_WIN
connectionOk = false;
if (verboseLog || periodicLog)
{
- lgInfo(string.Format("Attenzione: OMRON controllo PING fallito per IP {0}", cIobConf.cncIpAddr));
+ lgInfo($"Attenzione: OMRON controllo PING fallito per IP {cIobConf.cncIpAddr}");
}
}
}
@@ -487,8 +471,7 @@ namespace IOB_WIN
{
// processo semafori ed invio...
processMemoryDiscon();
- }
-#endif
+ }
}
///
@@ -505,24 +488,6 @@ namespace IOB_WIN
resDataArray = OMRON_ref.command("TYPE i_prelevati", 3000); // num pz prelevati --> "0\r\n"
int.TryParse(resDataArray[1].ToString().Replace("\n", "").Replace("\r", ""), out answ);
}
-#endif
- return answ;
- }
- }
- ///
- /// Oggetto per lettura ULTIMO TC rilevato
- ///
- protected decimal lastTC
- {
- get
- {
- decimal answ = 0;
-#if false
- if (OMRON_ref.IsConnected)
- {
- resDataArray = OMRON_ref.command("TYPE r_tempo", 3000); // ultimo TCiclo rilevato --> " 349.19\r\n"
- decimal.TryParse(resDataArray[1].ToString().Replace("\n", "").Replace("\r", "").Replace(".", ","), out answ);
- }
#endif
return answ;
}
@@ -557,62 +522,6 @@ namespace IOB_WIN
}
}
///
- /// Verifica se il thread 4 di comm sia attivo
- ///
- protected bool commThreadOk
- {
- get
- {
- bool answ = false;
-#if false
- if (OMRON_ref.IsConnected)
- {
- int retVal = 0;
- resDataArray = OMRON_ref.command("TYPE TASK (1004)", 3000); // thread 4 ok --> " 1\r\n"
- int.TryParse(resDataArray[1].ToString().Replace("\n", "").Replace("\r", ""), out retVal);
- answ = (retVal == 1);
- }
-#endif
- return answ;
- }
- }
- ///
- /// Recupera nome e seriale macchina
- ///
- protected string machineName
- {
- get
- {
- string answ = "";
-#if false
- if (OMRON_ref.IsConnected)
- {
- resDataArray = OMRON_ref.command("TYPE $id_true", 3000); // id macchina --> "BX100N-B001 Sn. 2366\r\n"
- answ = resDataArray[1].ToString().Replace("\n", "").Replace("\r", "");
- }
-#endif
- return answ;
- }
- }
- ///
- /// Recupera ultima missione svolta
- ///
- protected string lastMission
- {
- get
- {
- string answ = "";
-#if false
- if (OMRON_ref.IsConnected)
- {
- resDataArray = OMRON_ref.command("TYPE $exe", 3000); // missione --> "\r\n" (vuoto, no missione)
- answ = resDataArray[1].ToString().Replace("\n", "").Replace("\r", "");
- }
-#endif
- return answ;
- }
- }
- ///
/// Restituisce stato macchina nel formato (da sx a dx):
/// B0: POWER_ON
/// B1: AUTO
@@ -712,13 +621,11 @@ namespace IOB_WIN
parentForm.sIN = Semaforo.SV;
// effettuo TUTTE le letture
- threadOk = commThreadOk;
cStatus = currBitmapStatus;
cSignals = currBitmapSignals;
lastCountCNC = pzCounter;
// decodifica e gestione
decodeToBaseBitmap();
- decodeOtherData();
}
///
@@ -852,37 +759,6 @@ namespace IOB_WIN
#endif
}
- ///
- /// Decodifica il resto dell'area x i dati accessori (allarmi, ...)
- ///
- private void decodeOtherData()
- {
- if (verboseLog)
- {
-
- }
- }
-
- ///
- /// Recupero programma in lavorazione
- ///
- ///
- public override string getPrgName()
- {
- // valore non presente in vers default... se gestito fare override
- string prgName = "";
- return prgName;
- }
- ///
- /// Recupero info sistema generiche
- ///
- public override Dictionary getSysInfo()
- {
- // valore non presente in vers default... se gestito fare override
- Dictionary outVal = new Dictionary();
- outVal.Add("MACHINE", machineName);
- return outVal;
- }
///
/// Recupero dati dinamici...
///
@@ -890,8 +766,6 @@ namespace IOB_WIN
{
// valore non presente in vers default... se gestito fare override
Dictionary outVal = new Dictionary();
- outVal.Add("LAST_MISS", lastMissRobot);
- outVal.Add("LAST_TC", lastTC.ToString());
outVal.Add("NUM_PZ_PREL", pzPrelevati.ToString());
outVal.Add("NUM_PZ_LAV", pzCounter.ToString());
outVal.Add("CURR_SIGNALS", currBitmapSignals.ToString());