77 Commits

Author SHA1 Message Date
Samuele E. Locatelli a6dff6dc0b Merge remote-tracking branch 'origin/develop' into RemoteDebug 2022-09-07 11:12:51 +02:00
Samuele Locatelli 6d06c601a8 Merge branch 'Feature/FanucDoppioPallet' into develop 2022-09-07 11:12:16 +02:00
Samuele Locatelli 7c84d739fb Fix conf fanuc DP Colcom L018 2022-09-07 11:12:02 +02:00
Samuele Locatelli 49312dd181 Eliminazione fanuc DP (NON serve) 2022-09-07 11:09:59 +02:00
Samuele Locatelli 7e66ebb79a Colcom L018:
- aggiunti bit x doppio pallet e cambiate machcine ingresso
2022-09-06 19:23:03 +02:00
Samuele Locatelli 8ee2f3b9c4 Conf originale L18 colcom (NO DP signals) 2022-09-06 19:22:36 +02:00
Samuele Locatelli 9d320ae451 Inizio setup classe fanuc DP x gestione DOppioPallet 2022-09-06 19:09:35 +02:00
Samuele Locatelli d388c420ed Merge tag 'OpcUaOmp' into develop
Aggiunta gestione debug remoto x OMP
2022-09-06 17:56:42 +02:00
Samuele Locatelli d2aa632a89 Merge branch 'release/OpcUaOmp' 2022-09-06 17:56:25 +02:00
Samuele Locatelli 0199669847 COpe typo fix 2022-09-06 17:43:57 +02:00
Samuele Locatelli f85c47fe24 Reord classe ToMapo 2022-09-06 17:40:30 +02:00
Samuele Locatelli 3620822e83 Merge branch 'RemoteDebug' into develop 2022-09-06 17:29:37 +02:00
Samuele E. Locatelli 14740640fb COmpletata aggiunta metodi x OMP (da testare) 2022-09-06 17:27:55 +02:00
Samuele E. Locatelli 3b5e76d72a Continuo fix OMP 2022-09-06 17:22:45 +02:00
Samuele E. Locatelli eb8cb3cfb5 update bat scripts 2022-09-06 15:05:49 +02:00
Samuele E. Locatelli 821a2c3fcf update conf x valore contapezzi/pz req 2022-09-06 12:46:53 +02:00
Samuele E. Locatelli aded6e2020 timeout a 60 min x client OPC-UA 2022-09-06 12:40:54 +02:00
Samuele E. Locatelli 5029049835 Modifica conf x OMP FInassi 2022-09-06 12:40:31 +02:00
Samuele E. Locatelli 51227605f2 Update conf finassi x test remoto 2022-09-05 17:08:14 +02:00
Samuele E. Locatelli 7cfa69e889 Update x gestione debug remoto da conf progetto 2022-09-05 16:40:36 +02:00
Samuele E. Locatelli f40044ff31 Fix configurazione finazzi/OMP 2022-09-05 16:40:24 +02:00
Samuele Locatelli e2c905d113 Merge branch 'develop' of https://gitlab.steamware.net/steamware/Mapo-IOB-WIN into develop 2022-09-05 14:53:51 +02:00
Samuele E. Locatelli a399761674 Merge branch 'master' into develop 2022-09-05 12:41:00 +02:00
Samuele E. Locatelli c336f7504d Aggiunta preliminare OMP 2022-09-05 12:40:31 +02:00
Samuele Locatelli c3c9addbef Merge branch 'develop' of https://gitlab.steamware.net/steamware/Mapo-IOB-WIN into develop 2022-07-29 17:53:16 +02:00
Samuele E. Locatelli b7fb86f94f Merge branch 'develop' 2022-07-29 16:51:26 +02:00
Samuele E. Locatelli b861daaf12 Helpi
- ok scrittura string
- ok scrittura NUM
2022-07-29 16:50:55 +02:00
Samuele E. Locatelli 937fffb2c4 update x test scrittura string 2022-07-29 16:07:26 +02:00
Samuele E. Locatelli 503d2ecfa3 Merge branch 'develop' 2022-07-29 13:33:25 +02:00
Samuele E. Locatelli a200f1455e Update SDK Mapo, valori reversed LH x Helpi 2022-07-29 13:30:31 +02:00
Samuele E. Locatelli 9822f43894 Merge branch 'master' into develop 2022-07-29 11:10:00 +02:00
Samuele E. Locatelli eae1d51337 Update x gestione lettura string 2022-07-29 11:08:38 +02:00
Samuele E. Locatelli 9f8944876d update ModBus x lettura string 2022-07-28 19:15:24 +02:00
Samuele E. Locatelli 4941dc3fdc deploy remoto x FINASSI (test) 2022-07-28 19:15:14 +02:00
Samuele E. Locatelli 852bbcb29a update conf finassi x debug remoto 2022-07-28 19:15:02 +02:00
Samuele E. Locatelli 0f6f32a5a0 Aggiunta util x conversione dato EPOCH 2022-07-28 19:14:49 +02:00
Samuele Locatelli 06d25078e6 Merge tag 'ModbusHelpiDebug01' into develop
update log x helpi + modbus
2022-07-27 19:01:06 +02:00
Samuele Locatelli ace3ef79c1 Merge branch 'release/ModbusHelpiDebug01' 2022-07-27 19:00:56 +02:00
Samuele Locatelli e162c2a8af update x migliorare log helpi... 2022-07-27 18:59:09 +02:00
Samuele Locatelli 9baae29627 Merge tag 'ModbusLogReadDetailed' into develop
Log errori read modbus + dettagliato
2022-07-27 12:42:56 +02:00
Samuele Locatelli 845c32d56f Merge branch 'release/ModbusLogReadDetailed' 2022-07-27 12:42:43 +02:00
Samuele Locatelli 04734ddf46 Update x test lettura helpi che cade in lettura 2022-07-27 12:42:18 +02:00
Samuele Locatelli 3f995027b5 Inizio obj OpcUaSiemens OMP (FARE!!!) 2022-07-27 12:39:12 +02:00
Samuele Locatelli 46b50fac5b Update parametri simula (minDeltaSec) 2022-07-27 12:38:52 +02:00
Samuele Locatelli 657c90061f Update conf finassi/Helpi 2022-07-27 12:38:31 +02:00
Samuele Locatelli fffb0c712e update conf aprametri Fanuc aux x Jetco 2022-07-27 12:38:19 +02:00
Samuele Locatelli e8f5044972 Merge tag 'MinDeltaSecParametrico' into develop
Update: gestione delta sec parametrico + fix watchdog (ogni tentativo
--> update lastPLC)
2022-07-14 16:31:15 +02:00
Samuele Locatelli b5d214b437 Merge branch 'release/MinDeltaSecParametrico' 2022-07-14 16:30:47 +02:00
Samuele Locatelli cde83c36b0 Sistemato PING/watchdog x aggiornare lastPLC sempre 2022-07-14 16:30:18 +02:00
Samuele Locatelli 7c83c314ea Gestione delta secondi parametrico 2022-07-14 16:29:32 +02:00
Samuele Locatelli 42c50cad0c Aggiunta parametro x minimo delta sec 2022-07-14 16:29:24 +02:00
Samuele Locatelli 77de6722f3 Refresh conf x errore typo 2022-07-14 16:29:13 +02:00
Samuele Locatelli 6bfb159f19 Merge tag 'TestRefreshIobManWin' into develop
Cambio condizioni calcolo aggiornamento
2022-07-14 16:00:07 +02:00
Samuele Locatelli cbc6de2cca Merge branch 'release/TestRefreshIobManWin' 2022-07-14 16:00:00 +02:00
Samuele Locatelli 335a877d4d Update condizioni ultimo valore aggiornato 2022-07-14 15:59:24 +02:00
Samuele Locatelli 766fc5eade Merge tag 'UpdateLastPlcSignal' into develop
Update frequenza refresh lastPLC
2022-07-14 15:30:26 +02:00
Samuele Locatelli 1e7b2cd24e Merge branch 'release/UpdateLastPlcSignal' 2022-07-14 15:30:17 +02:00
Samuele Locatelli f009dbef37 IOB-WIN-NEXT:
- Refresh frequenza update lastPLC
- refreh MAN
2022-07-14 15:29:57 +02:00
Samuele Locatelli 81233d0bc4 Merge tag 'FixPlcOkModbus' into develop
Update modalità calcolo lastPlcIn x avere PLCOK prima in modbus
2022-07-14 15:17:13 +02:00
Samuele Locatelli a70d4af729 Merge branch 'release/FixPlcOkModbus' 2022-07-14 15:17:00 +02:00
Samuele Locatelli bbae83a669 UPdate modbus x inviare plcOk prima 2022-07-14 15:16:40 +02:00
Samuele Locatelli 121eacfb6a Merge tag 'UpdateSimDP_ErrorRawJson' into develop
Update classi x fix sim DP
2022-07-14 11:20:12 +02:00
Samuele Locatelli 0928ebe6ec Merge branch 'release/UpdateSimDP_ErrorRawJson' 2022-07-14 11:20:01 +02:00
Samuele Locatelli b4a0333085 fix x accodamento dari RAW:
- errore init IOB
- scambio URL di default
- inviava il dato watchdog sul "canale sbagliato"
2022-07-14 11:19:23 +02:00
Samuele Locatelli e0098e4194 Merge tag 'UpdateCenterfrigoWrite' into develop
Update centerfrigo x scrittura, pronto x test lettura con swap byte +
base addr cambiato
2022-07-13 19:22:36 +02:00
Samuele Locatelli 5a35a2e926 Merge branch 'release/UpdateCenterfrigoWrite' 2022-07-13 19:22:17 +02:00
Samuele Locatelli 8efa8fc1d1 Update vari:
- JObject x invio raw
- gestione RealHL e RealLH in lettura ModBus (test centerfrigo)
2022-07-13 19:21:49 +02:00
Samuele Locatelli fd45ab8180 update SDK x configurazione memorie Centerfrigo
- FLoat BaDc --> RealLH
2022-07-13 19:02:00 +02:00
Samuele Locatelli dbf5a88a4e Merge remote-tracking branch 'origin/Feature/Giacovelli' into develop 2022-07-13 18:31:47 +02:00
S.E.Locatelli c691a677d2 centerfrigo:
- update conf e scrittura real
- è LowHigh (NON HighLow)
- da aggiornare SDK
2022-07-13 18:10:05 +02:00
S.E.Locatelli b55cb314f2 Merge remote-tracking branch 'origin/HEAD' into Feature/Giacovelli 2022-07-13 17:49:30 +02:00
Samuele Locatelli bbe04ea0cb Merge tag 'FixDisplayCOntapezziFanuc' into develop
Fix log contapezzi FANUC
2022-07-12 11:43:24 +02:00
Samuele Locatelli 3a2749d947 Merge branch 'release/FixDisplayCOntapezziFanuc' 2022-07-12 11:43:04 +02:00
Samuele Locatelli 8b34765ad5 Update display contapezzi x FANUC (dopo lettura valori da MACRO) 2022-07-12 11:42:43 +02:00
Samuele Locatelli ebc7afc455 Merge tag 'UpdateAuxMacro' into develop
Update x gestione nuova delle p-code
2022-07-12 11:07:06 +02:00
Samuele Locatelli 3bd9da0949 Merge branch 'release/UpdateAuxMacro' 2022-07-12 11:06:50 +02:00
Samuele Locatelli 11fd84276c Update con nuova libreria FANUC 2022-07-12 11:06:18 +02:00
92 changed files with 2168 additions and 1013 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
<add key="appNameExt" value="IOB-WIN-NEXT" />
<add key="uiPeriod" value="100" />
<add key="checkPeriod" value="3000" />
<add key="forceCheckPeriodMult" value="15" />
<add key="forceCheckPeriodMult" value="20" />
<add key="autoRestartTimeoutMin" value="15" />
<add key="autoStartProc" value="true" />
<add key="closeOnChildUpdate" value="true" />
+237 -238
View File
@@ -1,20 +1,17 @@
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Serializers.NewtonsoftJson;
using SteamWare.Scheduler;
using SteamWare.IO;
using SteamWare.Logger;
using SteamWare.Scheduler;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
@@ -24,28 +21,53 @@ namespace IOB_MAN
{
public partial class IOBManPanel : Form
{
#region Private Fields
private const int SW_SHOWMAXIMIZED = 3;
private const int SW_SHOWMINIMIZED = 2;
private const int SW_SHOWNORMAL = 1;
#region Public Fields
/// <summary>
/// Context x sync thread
/// Elenco ARGS (uno per child da avviare)
/// </summary>
private readonly SynchronizationContext synchronizationContext;
public List<string> ArgsList = new List<string>();
#endregion Public Fields
#region Public Constructors
/// <summary>
/// Oggetto semaforico di lock
/// Init classe
/// </summary>
private SemaphoreSlim _sync = new SemaphoreSlim(1);
public IOBManPanel()
{
InitializeComponent();
synchronizationContext = SynchronizationContext.Current;
preInit();
loadConfig();
// fix log...
cbLogLevelMin.SelectedValue = "Info";
setLogLevel("Info");
initTimers();
initControls();
updateStatus();
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Binding source degli elementi gestiti..
/// Cerca nell'elenco il processo corrente
/// </summary>
private BindingSource ElencoIOB = new BindingSource();
/// <param name="processlist"></param>
/// <param name="id"></param>
/// <returns></returns>
public static Process myGetProcByID(Process[] processlist, int id)
{
return processlist.FirstOrDefault(pr => pr.Id == id);
}
#endregion Private Fields
#endregion Public Methods
#region Protected Fields
@@ -54,6 +76,11 @@ namespace IOB_MAN
/// </summary>
protected static List<iobAdapt> item2rem = new List<iobAdapt>();
/// <summary>
/// URL di base x l'API di gestione licenze/file upload
/// </summary>
protected string ApiUrl = "";
/// <summary>
/// Ramo applicazione (x update)
/// </summary>
@@ -114,26 +141,21 @@ namespace IOB_MAN
/// </summary>
protected string TargetExe = "";
/// <summary>
/// File target x conf NLog
/// </summary>
protected string TargetNLogConf = "";
/// <summary>
/// Directory log generale x IOB-WIN (dentro ci sono x singoli IOB)
/// </summary>
protected string TargetLogDir = "";
/// <summary>
/// URL di base x l'API di gestione licenze/file upload
/// </summary>
protected string ApiUrl = "";
/// <summary>
/// Name dell'exe da chiamare
/// </summary>
protected string TargetName = "";
/// <summary>
/// File target x conf NLog
/// </summary>
protected string TargetNLogConf = "";
/// <summary>
/// Dataora prossima scadenza riavvio automatico
/// </summary>
@@ -151,39 +173,6 @@ namespace IOB_MAN
#endregion Protected Fields
#region Public Fields
/// <summary>
/// Elenco ARGS (uno per child da avviare)
/// </summary>
public List<string> ArgsList = new List<string>();
#endregion Public Fields
#region Public Constructors
/// <summary>
/// Init classe
/// </summary>
public IOBManPanel()
{
InitializeComponent();
synchronizationContext = SynchronizationContext.Current;
preInit();
loadConfig();
// fix log...
cbLogLevelMin.SelectedValue = "Info";
setLogLevel("Info");
initTimers();
initControls();
updateStatus();
}
#endregion Public Constructors
#region Protected Properties
/// <summary>
@@ -199,6 +188,29 @@ namespace IOB_MAN
#endregion Protected Properties
#region Private Fields
private const int SW_SHOWMAXIMIZED = 3;
private const int SW_SHOWMINIMIZED = 2;
private const int SW_SHOWNORMAL = 1;
/// <summary>
/// Context x sync thread
/// </summary>
private readonly SynchronizationContext synchronizationContext;
/// <summary>
/// Oggetto semaforico di lock
/// </summary>
private SemaphoreSlim _sync = new SemaphoreSlim(1);
/// <summary>
/// Binding source degli elementi gestiti..
/// </summary>
private BindingSource ElencoIOB = new BindingSource();
#endregion Private Fields
#region Private Methods
[DllImport("user32.dll")]
@@ -375,12 +387,155 @@ namespace IOB_MAN
updateStatus();
}
private async void btnSendLog_Click(object sender, EventArgs e)
{
// salvo valori button normali
var stdColor = btnSendLog.BackColor;
var stdText = btnSendLog.Text;
// mostro che sto inviando dati...
btnSendLog.Enabled = false;
btnSendLog.BackColor = Color.OrangeRed;
btnSendLog.Text = "fix directory";
btnSendLog.Refresh();
// svuoto area temp...
string fileName = "LogFiles.zip";
string tempDir = Path.Combine(Application.StartupPath, "temp", "logs");
string zipPath = Path.Combine(Application.StartupPath, "temp", fileName);
if (Directory.Exists(tempDir))
{
Directory.Delete(tempDir, true);
}
// ricreo directory...
Directory.CreateDirectory(tempDir);
// definisco limite temporale alle 21 di 2 gg prima...
DateTime minDate = DateTime.Today.AddHours(-27);
// SOLO SE selezionato in dgv...
string logDir = TargetLogDir;
if (dgvManagedItems.SelectedRows.Count > 0)
{
btnSendLog.Text = "zip start";
btnSendLog.Refresh();
// ciclo su row selezionate
foreach (DataGridViewRow riga in dgvManagedItems.SelectedRows)
{
// verifico che sia già chiuso...
var iobData = (iobAdapt)ElencoIOB[riga.Index];
// calcolo folder
logDir = Path.Combine(TargetLogDir, iobData.CodIOB);
// recupero file odierno
DirectoryInfo dI = new DirectoryInfo(logDir);
var files = dI.GetFiles().Where(i => i.CreationTime >= minDate);
// copio in area temp...
foreach (var file in files)
{
Directory.CreateDirectory(Path.Combine(tempDir, iobData.CodIOB));
file.CopyTo(Path.Combine(tempDir, iobData.CodIOB, file.Name));
}
}
// creo unico ZIP
if (File.Exists(zipPath))
{
File.Delete(zipPath);
}
ZipFile.CreateFromDirectory(tempDir, zipPath);
btnSendLog.Text = "zip end";
btnSendLog.Refresh();
// ciclo di creazione ticket e upload file
try
{
// client chiamate rest
var client = new RestClient(ApiUrl);
client.UseNewtonsoftJson();
SupportRequest newSuppReq = new SupportRequest();
string licensePath = Path.Combine(Application.StartupPath, "CONF", "license.json");
string rawData = "";
if (File.Exists(licensePath))
{
rawData = File.ReadAllText(licensePath);
}
if (!string.IsNullOrEmpty(rawData))
{
// fare: composizione richiesta da parametri chiave
newSuppReq = JsonConvert.DeserializeObject<SupportRequest>(rawData);
}
else
{
string hostName = utils.machineName;
string listIP = string.Join(", ", utils.machineIp);
// genero il ticket
newSuppReq = new SupportRequest()
{
CodApp = "MAPO-IOB-WIN-NEXT",
CodImp = "",
CodInst = "SteamWare",
ContactEmail = "info@steamware.net",
ContactName = "Default Config",
ContactPhone = "035-460560",
MasterKey = "a3BRQz/1B34uvvcDoE/D38ssH/c/KSsjpn39wZsxOVsck9rGnBkF3xfUnj3edYIl",
ReqBody = $"File Upload - MISSING license file | machine: {utils.machineName} | IP: {listIP}",
Tipo = TipologiaTicket.FileUpload,
idxSubLic = 0
};
}
btnSendLog.Text = "LogSend start";
btnSendLog.BackColor = Color.DarkOrange;
btnSendLog.Refresh();
var ticketReq = new RestRequest("/api/ticket/sendReq", DataFormat.Json).AddJsonBody(newSuppReq);
var ticketResp = await client.PostAsync<TicketDTO>(ticketReq);
// preparo richiesta x upload file
var fileUploadReq = new RestRequest("/api/filesave/single");
fileUploadReq.AddParameter("ticketId", ticketResp.idxTicket);
fileUploadReq.AddFile("file", zipPath);
// ... infine INVIA file zip che li contiene...
//var fileUploadResp = client.Post(fileUploadReq);
var fileUploadResp = await client.PostAsync<UploadResult>(fileUploadReq);
btnSendLog.Text = "LogSend end";
btnSendLog.BackColor = Color.DarkOliveGreen;
btnSendLog.Refresh();
// elimino folder temporanea
if (Directory.Exists(tempDir))
{
Directory.Delete(tempDir, true);
}
// elimino il file temporaneo...
if (File.Exists(zipPath))
{
File.Delete(zipPath);
}
}
catch (Exception exc)
{
Logging.LogError($"Eccezione in fase gestione REST services{Environment.NewLine}{exc}");
}
}
btnSendLog.BackColor = stdColor;
btnSendLog.Text = stdText;
btnSendLog.Enabled = true;
}
private void btnStartSel_Click(object sender, EventArgs e)
{
// riapro child (SOLO SE non era già aperto...)
apriChildSel();
}
private void cbLogLevelMin_SelectedIndexChanged(object sender, EventArgs e)
{
// aggiornato livelo di log --> chiamo procedura x riscrivere il file conf di NLog
setLogLevel($"{cbLogLevelMin.SelectedItem}");
}
/// <summary>
/// verifica buttons attivi data selezione su gridview...
/// </summary>
@@ -476,7 +631,8 @@ namespace IOB_MAN
IList<iobAdapt> allItems = (IList<iobAdapt>)ElencoIOB.List;
bool needRem = false;
// 2020.02.01 passato chiamata specifica x leggere in 1 sola volta TUTTO elenco processi (x nome)...
// 2020.02.01 passato chiamata specifica x leggere in 1 sola volta TUTTO elenco processi
// (x nome)...
Process[] processList = Process.GetProcessesByName(TargetName);
// ciclo
@@ -729,6 +885,12 @@ namespace IOB_MAN
}
}
private void dgvManagedItems_SelectionChanged(object sender, EventArgs e)
{
checkButtons();
}
private void ElencoIOB_AddingNew(object sender, System.ComponentModel.AddingNewEventArgs e)
{
}
@@ -1093,6 +1255,21 @@ namespace IOB_MAN
updateStatus();
}
private void setLogLevel(string selectedValue)
{
// leggo il file loglevel in resources
string rawData = File.ReadAllText($@"{Application.StartupPath}\Resources\NLog.template.config");
// sostituzione livello minimo da selezione
rawData = rawData.Replace("{{minLevel}}", selectedValue);
// scrivo conf x programma IOB-MAN
File.WriteAllText($@"{Application.StartupPath}\NLog.config", rawData);
// scrivo conf x IOB-WIN gestiti
File.WriteAllText(TargetNLogConf, rawData);
}
/// <summary>
/// Avvio di un child process da parametro ARG
/// </summary>
@@ -1239,183 +1416,5 @@ namespace IOB_MAN
#endregion Private Methods
#region Public Methods
/// <summary>
/// Cerca nell'elenco il processo corrente
/// </summary>
/// <param name="processlist"></param>
/// <param name="id"></param>
/// <returns></returns>
public static Process myGetProcByID(Process[] processlist, int id)
{
return processlist.FirstOrDefault(pr => pr.Id == id);
}
#endregion Public Methods
private void cbLogLevelMin_SelectedIndexChanged(object sender, EventArgs e)
{
// aggiornato livelo di log --> chiamo procedura x riscrivere il file conf di NLog
setLogLevel($"{cbLogLevelMin.SelectedItem}");
}
private void setLogLevel(string selectedValue)
{
// leggo il file loglevel in resources
string rawData = File.ReadAllText($@"{Application.StartupPath}\Resources\NLog.template.config");
// sostituzione livello minimo da selezione
rawData = rawData.Replace("{{minLevel}}", selectedValue);
// scrivo conf x programma IOB-MAN
File.WriteAllText($@"{Application.StartupPath}\NLog.config", rawData);
// scrivo conf x IOB-WIN gestiti
File.WriteAllText(TargetNLogConf, rawData);
}
private void dgvManagedItems_SelectionChanged(object sender, EventArgs e)
{
checkButtons();
}
private async void btnSendLog_Click(object sender, EventArgs e)
{
// salvo valori button normali
var stdColor = btnSendLog.BackColor;
var stdText = btnSendLog.Text;
// mostro che sto inviando dati...
btnSendLog.Enabled = false;
btnSendLog.BackColor = Color.OrangeRed;
btnSendLog.Text = "fix directory";
btnSendLog.Refresh();
// svuoto area temp...
string fileName = "LogFiles.zip";
string tempDir = Path.Combine(Application.StartupPath, "temp", "logs");
string zipPath = Path.Combine(Application.StartupPath, "temp", fileName);
if (Directory.Exists(tempDir))
{
Directory.Delete(tempDir, true);
}
// ricreo directory...
Directory.CreateDirectory(tempDir);
// definisco limite temporale alle 21 di 2 gg prima...
DateTime minDate = DateTime.Today.AddHours(-27);
// SOLO SE selezionato in dgv...
string logDir = TargetLogDir;
if (dgvManagedItems.SelectedRows.Count > 0)
{
btnSendLog.Text = "zip start";
btnSendLog.Refresh();
// ciclo su row selezionate
foreach (DataGridViewRow riga in dgvManagedItems.SelectedRows)
{
// verifico che sia già chiuso...
var iobData = (iobAdapt)ElencoIOB[riga.Index];
// calcolo folder
logDir = Path.Combine(TargetLogDir, iobData.CodIOB);
// recupero file odierno
DirectoryInfo dI = new DirectoryInfo(logDir);
var files = dI.GetFiles().Where(i => i.CreationTime >= minDate);
// copio in area temp...
foreach (var file in files)
{
Directory.CreateDirectory(Path.Combine(tempDir, iobData.CodIOB));
file.CopyTo(Path.Combine(tempDir, iobData.CodIOB, file.Name));
}
}
// creo unico ZIP
if (File.Exists(zipPath))
{
File.Delete(zipPath);
}
ZipFile.CreateFromDirectory(tempDir, zipPath);
btnSendLog.Text = "zip end";
btnSendLog.Refresh();
// ciclo di creazione ticket e upload file
try
{
// client chiamate rest
var client = new RestClient(ApiUrl);
client.UseNewtonsoftJson();
SupportRequest newSuppReq = new SupportRequest();
string licensePath = Path.Combine(Application.StartupPath, "CONF", "license.json");
string rawData = "";
if (File.Exists(licensePath))
{
rawData = File.ReadAllText(licensePath);
}
if (!string.IsNullOrEmpty(rawData))
{
// fare: composizione richiesta da parametri chiave
newSuppReq = JsonConvert.DeserializeObject<SupportRequest>(rawData);
}
else
{
string hostName = utils.machineName;
string listIP = string.Join(", ", utils.machineIp);
// genero il ticket
newSuppReq = new SupportRequest()
{
CodApp = "MAPO-IOB-WIN-NEXT",
CodImp = "",
CodInst = "SteamWare",
ContactEmail = "info@steamware.net",
ContactName = "Default Config",
ContactPhone = "035-460560",
MasterKey = "a3BRQz/1B34uvvcDoE/D38ssH/c/KSsjpn39wZsxOVsck9rGnBkF3xfUnj3edYIl",
ReqBody = $"File Upload - MISSING license file | machine: {utils.machineName} | IP: {listIP}",
Tipo = TipologiaTicket.FileUpload,
idxSubLic = 0
};
}
btnSendLog.Text = "LogSend start";
btnSendLog.BackColor = Color.DarkOrange;
btnSendLog.Refresh();
var ticketReq = new RestRequest("/api/ticket/sendReq", DataFormat.Json).AddJsonBody(newSuppReq);
var ticketResp = await client.PostAsync<TicketDTO>(ticketReq);
// preparo richiesta x upload file
var fileUploadReq = new RestRequest("/api/filesave/single");
fileUploadReq.AddParameter("ticketId", ticketResp.idxTicket);
fileUploadReq.AddFile("file", zipPath);
// ... infine INVIA file zip che li contiene...
//var fileUploadResp = client.Post(fileUploadReq);
var fileUploadResp = await client.PostAsync<UploadResult>(fileUploadReq);
btnSendLog.Text = "LogSend end";
btnSendLog.BackColor = Color.DarkOliveGreen;
btnSendLog.Refresh();
// elimino folder temporanea
if (Directory.Exists(tempDir))
{
Directory.Delete(tempDir, true);
}
// elimino il file temporaneo...
if (File.Exists(zipPath))
{
File.Delete(zipPath);
}
}
catch (Exception exc)
{
Logging.LogError($"Eccezione in fase gestione REST services{Environment.NewLine}{exc}");
}
}
btnSendLog.BackColor = stdColor;
btnSendLog.Text = stdText;
btnSendLog.Enabled = true;
}
}
}
+19 -7
View File
@@ -174,8 +174,9 @@ namespace IOB_UT_NEXT
public enum MachineSetupMode
{
ND = 0,
// Modalità Mecolpress (3 parametri IN, se variati --> porto a 1 la variabile di controllo)
/// <summary>
/// Modalità Mecolpress (3 parametri IN, se variati --> porto a 1 la variabile di controllo)
/// </summary>
MECOLPRESS = 1
}
@@ -342,11 +343,6 @@ namespace IOB_UT_NEXT
/// </summary>
OpcUaCMS,
/// <summary>
/// Adapter OPC-UA SCM
/// </summary>
OpcUaSCM,
/// <summary>
/// Adapter OPC-UA per Ewon
/// </summary>
@@ -377,6 +373,21 @@ namespace IOB_UT_NEXT
/// </summary>
OpcUaOmronIcoel,
/// <summary>
/// Adapter OPC-UA SCM
/// </summary>
OpcUaSCM,
/// <summary>
/// Adapter OPC-UA Siemens generico
/// </summary>
OpcUaSiemens,
/// <summary>
/// Adapter OPC-UA Siemens OMP
/// </summary>
OpcUaSiemensOMP,
/// <summary>
/// Adapter OSAI CNDEX (Cndex)
/// </summary>
@@ -503,4 +514,5 @@ namespace IOB_UT_NEXT
/// </summary>
ULog
}
}
+22 -2
View File
@@ -55,12 +55,31 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote_DEBUG|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Remote_DEBUG\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote_DEBUG|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Remote_DEBUG\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.3.1.9, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.3.1\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="MapoSDK, Version=6.14.2205.2808, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MapoSDK.6.14.2205.2808\lib\MapoSDK.dll</HintPath>
<Reference Include="MapoSDK, Version=6.14.2207.2913, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MapoSDK.6.14.2207.2913\lib\MapoSDK.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
@@ -125,6 +144,7 @@
<Compile Include="Eurom63.cs" />
<Compile Include="IobWinStatus.cs" />
<Compile Include="TCMan.cs" />
<Compile Include="TimeUtils.cs" />
<Compile Include="ToMapo.cs" />
<Compile Include="baseUtils.cs" />
<Compile Include="BinaryFormatter.cs" />
+16 -5
View File
@@ -105,6 +105,11 @@ namespace IOB_UT_NEXT
/// </summary>
public Dictionary<string, string> setupParams { get; set; } = new Dictionary<string, string>();
/// <summary>
/// Valore minimo da considerare come delta secondi x indicare variazione sui dati temporali
/// </summary>
public int minDeltaSec { get; set; } = 5;
#endregion Public Properties
#region Public Methods
@@ -121,16 +126,22 @@ namespace IOB_UT_NEXT
if (online != item.online)
return false;
// controllo se sia ALMENO 1 sec...
if (lastDataIn != item.lastDataIn)
// controllo se sia ALMENO 10 sec...
if (lastUpdate != item.lastUpdate)
{
if (lastDataIn.Subtract(item.lastDataIn).TotalSeconds > 1)
if (lastUpdate.Subtract(item.lastUpdate).TotalSeconds > minDeltaSec)
return false;
}
// controllo se sia ALMENO 1 sec...
// controllo se sia ALMENO 3 sec...
if (lastDataIn != item.lastDataIn)
{
if (lastDataIn.Subtract(item.lastDataIn).TotalSeconds > minDeltaSec)
return false;
}
// controllo se sia ALMENO 5 sec...
if (lastDataOut != item.lastDataOut)
{
if (lastDataOut.Subtract(item.lastDataOut).TotalSeconds > 1)
if (lastDataOut.Subtract(item.lastDataOut).TotalSeconds > minDeltaSec)
return false;
}
if (semIn != item.semIn)
+56 -9
View File
@@ -59,6 +59,56 @@ namespace IOB_UT_NEXT
#endregion Public Methods
}
#if false
/// <summary>
/// Classe di base per trasferimento informazioni di tipo RawTransfer
/// </summary>
public class BaseRawTransf
{
#region Public Properties
/// <summary>
/// Data-Ora riferimento (x ordinamento fifo)
/// </summary>
public DateTime dataRif { get; set; } = DateTime.Now;
/// <summary>
/// Messaggio in modalità raw/stringa
/// </summary>
public object mesContent { get; set; } = new object();
/// <summary>
/// Tipo di messaggio trasmesso
/// </summary>
public rawTransfType mesType { get; set; } = rawTransfType.ND;
/// <summary>
/// Costruttore senza parametri
/// </summary>
public BaseRawTransf()
{
this.dataRif = DateTime.Now;
this.mesContent = new object();
this.mesType = rawTransfType.ND;
}
/// <summary>
/// Costruttore oggetto
/// </summary>
/// <param name="dataRif"></param>
/// <param name="mesContent"></param>
/// <param name="mesType"></param>
public BaseRawTransf(DateTime dataRif, object mesContent, rawTransfType mesType)
{
this.dataRif = dataRif;
this.mesContent = mesContent;
this.mesType = mesType;
}
#endregion Public Properties
}
#endif
/// <summary>
/// Gestione dati di timing
/// </summary>
@@ -211,8 +261,6 @@ namespace IOB_UT_NEXT
/// </summary>
public class IobWinStatus
{
#region Public Properties
/// <summary>
/// ID univoco
/// </summary>
@@ -278,10 +326,6 @@ namespace IOB_UT_NEXT
/// </summary>
public int queueUlLen { get; set; } = 0;
#endregion Public Properties
#region Public Methods
/// <summary>
/// Override metodo di equality
/// </summary>
@@ -320,9 +364,7 @@ namespace IOB_UT_NEXT
{
return base.GetHashCode();
}
#endregion Public Methods
}
}
#endif
/// <summary>
@@ -770,6 +812,11 @@ namespace IOB_UT_NEXT
/// </summary>
public int Period { get; set; } = 60;
/// <summary>
/// UM parametro, impiegato anche x conversione (es epoch --> datetime)
/// </summary>
public string UM { get; set; } = "";
#endregion Public Properties
}
}
+7 -5
View File
@@ -23,9 +23,11 @@ namespace IOB_UT_NEXT
/// <summary>
/// init classe gestione dati IOB su Redis
/// </summary>
/// <param name="codServer"></param>
/// <param name="codIob"></param>
public RedisIobCache(string codServer, string codIob, string tipoIob)
/// <param name="codServer">IP/nome server</param>
/// <param name="codIob">Cod IOB</param>
/// <param name="tipoIob">Tipo di IOB</param>
/// <param name="minDeltaS">Minima differenza in secondi x considerare variazione dati DataOra</param>
public RedisIobCache(string codServer, string codIob, string tipoIob, int minDeltaS)
{
// init dati di base...
currCodIob = codIob;
@@ -42,7 +44,8 @@ namespace IOB_UT_NEXT
{
CodIob = currCodIob,
IobType = currIobType,
online = false
online = false,
minDeltaSec = minDeltaS
};
// salvo in area REDIS
servStatus = newSrvStatus;
@@ -169,7 +172,6 @@ namespace IOB_UT_NEXT
{
string rawData = JsonConvert.SerializeObject(value);
saveAndSendMessage(redIobKey, redIobChannel, rawData);
//setRSV(redIobKey, rawData);
}
}
+18
View File
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IOB_UT_NEXT
{
public class TimeUtils
{
public static DateTime epochConvert(double epoch)
{
DateTime date = new DateTime(1970, 1, 1, 0, 0, 0, 0); //from start epoch time
date = date.AddSeconds(epoch);
return date;
}
}
}
+18
View File
@@ -424,6 +424,24 @@ namespace IOB_UT_NEXT
{
#region Public Properties
/// <summary>
/// Elenco Variabili (e valori da impostare) x indicare di resettare contatore lotto e
/// quindi riavviare produzione (es: impostando valore a 1...)
/// </summary>
public Dictionary<string, string> actResetCounter { get; set; } = new Dictionary<string, string>();
/// <summary>
/// Elenco Variabili (e valori da impostare) x indicare di effettuare impostazione nuovo
/// programma/ricetta (es: impostando valore a 1...)
/// </summary>
public Dictionary<string, string> actSetRecipe { get; set; } = new Dictionary<string, string>();
/// <summary>
/// Elenco Variabili (e valori da impostare) x indicare di fermare la produzione (es:
/// impostando valore a 1...)
/// </summary>
public Dictionary<string, string> actStopProd { get; set; } = new Dictionary<string, string>();
/// <summary>
/// Identificativo nodo iniziale
/// </summary>
+3 -1
View File
@@ -41,10 +41,12 @@ namespace IOB_UT_NEXT
/// </summary>
public static bool MPIO_Online = false;
#if false
/// <summary>
/// Oggetto connessione REDIS
/// </summary>
public static RedisIobCache redisMan = new RedisIobCache();
public static RedisIobCache redisMan = new RedisIobCache();
#endif
#endregion Public Fields
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MapoSDK" version="6.14.2205.2808" targetFramework="net462" />
<package id="MapoSDK" version="6.14.2207.2913" targetFramework="net462" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="6.0.0" targetFramework="net462" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net462" />
<package id="NLog" version="4.7.13" targetFramework="net462" />
+14 -14
View File
@@ -18,10 +18,10 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
FANUC|Any CPU = FANUC|Any CPU
FANUC|x86 = FANUC|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
Remote_DEBUG|Any CPU = Remote_DEBUG|Any CPU
Remote_DEBUG|x86 = Remote_DEBUG|x86
SIEMENS|Any CPU = SIEMENS|Any CPU
SIEMENS|x86 = SIEMENS|x86
EndGlobalSection
@@ -30,14 +30,14 @@ Global
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.Debug|x86.ActiveCfg = Debug|Any CPU
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.Debug|x86.Build.0 = Debug|Any CPU
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.FANUC|Any CPU.ActiveCfg = Release|Any CPU
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.FANUC|Any CPU.Build.0 = Release|Any CPU
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.FANUC|x86.ActiveCfg = Debug|Any CPU
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.FANUC|x86.Build.0 = Debug|Any CPU
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.Release|Any CPU.ActiveCfg = Release|Any CPU
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.Release|Any CPU.Build.0 = Release|Any CPU
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.Release|x86.ActiveCfg = Release|x86
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.Release|x86.Build.0 = Release|x86
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.Remote_DEBUG|Any CPU.ActiveCfg = Debug|Any CPU
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.Remote_DEBUG|Any CPU.Build.0 = Debug|Any CPU
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.Remote_DEBUG|x86.ActiveCfg = Remote_DEBUG|x86
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.Remote_DEBUG|x86.Build.0 = Remote_DEBUG|x86
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.SIEMENS|Any CPU.ActiveCfg = Release|Any CPU
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.SIEMENS|Any CPU.Build.0 = Release|Any CPU
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.SIEMENS|x86.ActiveCfg = Debug|Any CPU
@@ -46,14 +46,14 @@ Global
{90512E12-29FC-460D-94CC-648C2A072DBD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90512E12-29FC-460D-94CC-648C2A072DBD}.Debug|x86.ActiveCfg = Debug|x86
{90512E12-29FC-460D-94CC-648C2A072DBD}.Debug|x86.Build.0 = Debug|x86
{90512E12-29FC-460D-94CC-648C2A072DBD}.FANUC|Any CPU.ActiveCfg = Release|Any CPU
{90512E12-29FC-460D-94CC-648C2A072DBD}.FANUC|Any CPU.Build.0 = Release|Any CPU
{90512E12-29FC-460D-94CC-648C2A072DBD}.FANUC|x86.ActiveCfg = Debug|x86
{90512E12-29FC-460D-94CC-648C2A072DBD}.FANUC|x86.Build.0 = Debug|x86
{90512E12-29FC-460D-94CC-648C2A072DBD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90512E12-29FC-460D-94CC-648C2A072DBD}.Release|Any CPU.Build.0 = Release|Any CPU
{90512E12-29FC-460D-94CC-648C2A072DBD}.Release|x86.ActiveCfg = Release|x86
{90512E12-29FC-460D-94CC-648C2A072DBD}.Release|x86.Build.0 = Release|x86
{90512E12-29FC-460D-94CC-648C2A072DBD}.Remote_DEBUG|Any CPU.ActiveCfg = Debug|Any CPU
{90512E12-29FC-460D-94CC-648C2A072DBD}.Remote_DEBUG|Any CPU.Build.0 = Debug|Any CPU
{90512E12-29FC-460D-94CC-648C2A072DBD}.Remote_DEBUG|x86.ActiveCfg = Remote_DEBUG|x86
{90512E12-29FC-460D-94CC-648C2A072DBD}.Remote_DEBUG|x86.Build.0 = Remote_DEBUG|x86
{90512E12-29FC-460D-94CC-648C2A072DBD}.SIEMENS|Any CPU.ActiveCfg = Release|Any CPU
{90512E12-29FC-460D-94CC-648C2A072DBD}.SIEMENS|Any CPU.Build.0 = Release|Any CPU
{90512E12-29FC-460D-94CC-648C2A072DBD}.SIEMENS|x86.ActiveCfg = Debug|x86
@@ -62,14 +62,14 @@ Global
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Debug|x86.ActiveCfg = Debug|x86
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Debug|x86.Build.0 = Debug|x86
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.FANUC|Any CPU.ActiveCfg = Release|Any CPU
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.FANUC|Any CPU.Build.0 = Release|Any CPU
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.FANUC|x86.ActiveCfg = Debug|x86
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.FANUC|x86.Build.0 = Debug|x86
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Release|Any CPU.Build.0 = Release|Any CPU
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Release|x86.ActiveCfg = Release|x86
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Release|x86.Build.0 = Release|x86
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Remote_DEBUG|Any CPU.ActiveCfg = Remote_DEBUG|Any CPU
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Remote_DEBUG|Any CPU.Build.0 = Remote_DEBUG|Any CPU
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Remote_DEBUG|x86.ActiveCfg = Remote_DEBUG|x86
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Remote_DEBUG|x86.Build.0 = Remote_DEBUG|x86
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.SIEMENS|Any CPU.ActiveCfg = Release|Any CPU
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.SIEMENS|Any CPU.Build.0 = Release|Any CPU
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.SIEMENS|x86.ActiveCfg = Debug|x86
+17 -5
View File
@@ -32,7 +32,7 @@ namespace IOB_WIN_NEXT
/// <summary>
/// Oggetto ultimo inviato stato IOB x REDIS
/// </summary>
protected IobWinStatus lastIobStatus = new IobWinStatus();
protected IobWinStatus lastIobStatus = new IobWinStatus() { lastUpdate = DateTime.Now.AddHours(-1), lastDataOut = DateTime.Now.AddHours(-1) };
/// <summary>
/// Oggetto ultimo inviato stato MP-IO x REDIS
@@ -1129,7 +1129,8 @@ namespace IOB_WIN_NEXT
}
catch (Exception exc)
{
lgError($"Eccezione in conversione tipo adapter: richiesto un tipo non codificato...{Environment.NewLine}{exc}");
string rawVal = fIni.ReadString("IOB", "CNCTYPE", "DEMO");
lgError($"Eccezione in conversione tipo adapter: richiesto {rawVal} | tipo non codificato...{Environment.NewLine}{exc}");
tipoScelto = tipoAdapter.ND;
}
// carivo vettore parametri opzionai
@@ -1162,13 +1163,14 @@ namespace IOB_WIN_NEXT
optPar = optParRead,
versIOB = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(),
codIOB = fIni.ReadString("IOB", "IOB_NAME", CurrIOB),
minDeltaSec = fIni.ReadInteger("IOB", "MinDeltaSec", 6),
cncIpAddr = fIni.ReadString("CNC", "IP", "::1"),
cncPort = fIni.ReadString("CNC", "PORT", "0"),
iniFileName = iniConfFile,
cpuType = fIni.ReadString("CNC", "CPUTYPE", ""),
rack = (short)fIni.ReadInteger("CNC", "RACK", 0),
slot = (short)fIni.ReadInteger("CNC", "SLOT", 0),
serverData = new serverMapo(fIni.ReadString("SERVER", "MPIP", "::1"), fIni.ReadString("SERVER", "MPURL", "/MP/IO"), fIni.ReadString("SERVER", "CMDBASE", "/IOB/input/"), fIni.ReadString("SERVER", "CMDFLOG", "/IOB/flog/"), fIni.ReadString("SERVER", "CMDULOG", "/IOB/ulog/"), fIni.ReadString("SERVER", "CMDALIVE", "/"), fIni.ReadString("SERVER", "CMDENABLED", "/"), fIni.ReadString("SERVER", "CMDREBO", "/"), fIni.ReadString("SERVER", "CMD_ODL_STARTED", "/IOB/getCurrOdlStart/"), fIni.ReadString("SERVER", "CLI_INST", "SW_CLI"), fIni.ReadString("SERVER", "CMD_FORCLE_SPLIT_ODL", "/IOB/forceSplitOdlFull/"), fIni.ReadString("SERVER", "CMDRAWTRANSF", "/IOB/rawTransfJson/")),
serverData = new serverMapo(fIni.ReadString("SERVER", "MPIP", "::1"), fIni.ReadString("SERVER", "MPURL", "/MP/IO"), fIni.ReadString("SERVER", "CMDBASE", "/IOB/input/"), fIni.ReadString("SERVER", "CMDFLOG", "/IOB/flog/"), fIni.ReadString("SERVER", "CMDULOG", "/IOB/ulog/"), fIni.ReadString("SERVER", "CMDALIVE", "/"), fIni.ReadString("SERVER", "CMDENABLED", "/"), fIni.ReadString("SERVER", "CMDREBO", "/"), fIni.ReadString("SERVER", "CMD_ODL_STARTED", "/IOB/getCurrOdlStart/"), fIni.ReadString("SERVER", "CLI_INST", "SW_CLI"), fIni.ReadString("SERVER", "CMD_FORCLE_SPLIT_ODL", "/IOB/forceSplitOdlFull/"), fIni.ReadString("SERVER", "CMD_IDLE_TIME", "/IOB/getIdlePeriod/"), fIni.ReadString("SERVER", "CMDRAWTRANSF", "/IOB/rawTransfJson/")),
MAX_COUNTER_BLINK = Convert.ToInt32(fIni.ReadString("BLINK", "MAX_COUNTER_BLINK", "1")),
BLINK_FILT = Convert.ToInt32(fIni.ReadString("BLINK", "BLINK_FILT", "0")),
TCMaxDelayFactor = Convert.ToDouble(fIni.ReadString("OPTPAR", "TC_MAX_TC_FACTOR", "1.2").Replace(".", ",")),
@@ -1325,6 +1327,16 @@ namespace IOB_WIN_NEXT
start.Enabled = true;
break;
case tipoAdapter.OpcUaSiemens:
iobObj = new IobOpcUaSiemens(this, IOBConf);
start.Enabled = true;
break;
case tipoAdapter.OpcUaSiemensOMP:
iobObj = new IobOpcUaSiemensOMP(this, IOBConf);
start.Enabled = true;
break;
case tipoAdapter.PingWatchdog:
iobObj = new IobPing(this, IOBConf);
start.Enabled = true;
@@ -1520,7 +1532,7 @@ namespace IOB_WIN_NEXT
queueUlLen = ulQueueLen,
counterIOB = iobObj.contapezziIOB,
counterMAC = iobObj.contapezziPLC,
lastUpdate = lastIobStatus.lastUpdate,
lastUpdate = lastIobStatus.lastUpdate > iobObj.lastWatchDog ? lastIobStatus.lastUpdate : iobObj.lastWatchDog,
online = utils.IOB_Online,
lastDataIn = iobObj.lastReadPLC,
lastDataOut = iobObj.lastIobOnline,
@@ -1528,7 +1540,7 @@ namespace IOB_WIN_NEXT
freeNotes = note
};
// se diverso SALVO!
if (!lastIobStatus.Equals(currIobStatus))
if (!currIobStatus.Equals(lastIobStatus))
{
// aggiorno data
currIobStatus.lastUpdate = DateTime.Now;
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_COSMAP
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=COSMAP
MODEL=02
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_ROBOTSERVICE
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=RobotService
MODEL=SMER12
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_ROBOTSERVICE
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=RobotService
MODEL=SCAT06
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_ROBOTSERVICE
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=RobotService
MODEL=SCAT05
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_APROCHIM
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=Aprochim
MODEL=Micro4000
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=WPS
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=Atlas Copco
MODEL=GA18VP_13
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=WPS
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=Atlas Copco
MODEL=GA18VP_12
+1 -1
View File
@@ -26,7 +26,7 @@ CMDREBO=/sendReboot.aspx?idxMacchina=
; Red: Y31.4 | Yellow: Y31.5 | Green Y31.6 | riscaldamento Y7.4 ???
;BIT0=CONN
BIT1=Y31.6
BIT2=STD.MACRO.10100
BIT2=PZCOUNT.MACRO.10100
BIT3=Y31.4
BIT4=Y31.5
BIT5=Y7.4
+3 -3
View File
@@ -4,15 +4,15 @@
CNCTYPE=FILE_EUROM63
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=PlasticMetal
MODEL=MPW280SP
[CNC]
IP=10.74.82.253
IP=10.74.82.253
;IP=192.168.1.151
[SERVER]
[SERVER]
MPIP=http://10.74.82.218
;MPIP=http://192.168.1.150
MPURL=/MP/IO
+15 -11
View File
@@ -1,35 +1,36 @@
;Configurazione IOB-WIN
[IOB]
[IOB]
;Impianto Helpi x impacchettatrice - Finassi
CNCTYPE=MODBUS_TCP_HELPI
PING_MS_TIMEOUT=1000
MinDeltaSec=5
[MACHINE]
[MACHINE]
VENDOR=HELPI
MODEL=HELPI
[CNC]
IP=10.74.82.65
IP=10.150.0.20
PORT=502
[SERVER]
MPIP=https://iis01.egalware.com
;MPIP=https://gwms.egalware.com
MPIP=http://10.150.0.1
MPURL=/MP/IO
CMDBASE=/IOB/input/
CMDFLOG=/IOB/flog/
CMDALIVE=/IOB
CMDENABLED=/IOB/enabled/
CMDADV1=?valore=
CMDREBO=/IOB/sendReboot?idxMacchina=
;CMDREBO=/sendReboot.aspx?idxMacchina=
CMDREBO=/sendReboot.aspx?idxMacchina=
[MEMORY]
ADDR_READ=41060
ADDR_READ=41050
ADDR_WRITE=41060
SIZE_READ=0
SIZE_WRITE=0
HR_BASE_ADDR=40000
SIZE_READ=60
SIZE_WRITE=50
HR_BASE_ADDR=0
;HR_BASE_ADDR=40000
DELTA_BASE=0
[BLINK]
@@ -71,5 +72,8 @@ MEM_BLOCK=FINASSI_HELPI_01_MBlock.json
; conf aree allarme
ALARM_CONF=FINASSI_HELPI_01_alarm.json
; rimozione check limiti min/max dynData
disDynDataRangeCheck=true
[BRANCH]
NAME=master
+18 -18
View File
@@ -44,7 +44,7 @@
"name": "NumPacchi",
"description": "Numero Pacchi Richiesti",
"memAddr": "41098",
"tipoMem": "INT",
"tipoMem": "IntLH",
"index": 1098,
"size": 2,
"unit": "#"
@@ -61,7 +61,7 @@
"minVal": 0,
"maxVal": 32767,
"unit": "#",
"func": "MEDIAN",
"func": "POINT",
"period": 90,
"factor": 1
},
@@ -75,7 +75,7 @@
"minVal": 0,
"maxVal": 1,
"unit": "#",
"func": "MEDIAN",
"func": "POINT",
"period": 90,
"factor": 1
},
@@ -87,7 +87,7 @@
"index": 1062,
"size": 16,
"unit": "#",
"func": "LAST",
"func": "POINT",
"period": 90
},
"LOTTO": {
@@ -98,18 +98,18 @@
"index": 1078,
"size": 16,
"unit": "#",
"func": "LAST",
"func": "POINT",
"period": 90
},
"NumPacchi": {
"name": "NumPacchi",
"description": "Numero Pacchi Richiesti",
"memAddr": "41098",
"tipoMem": "INT",
"tipoMem": "IntLH",
"index": 1098,
"size": 2,
"unit": "#",
"func": "MEDIAN",
"func": "POINT",
"period": 90,
"factor": 1
},
@@ -117,11 +117,11 @@
"name": "NumPacchiFatti",
"description": "Numero Pacchi Fatti",
"memAddr": "41100",
"tipoMem": "INT",
"tipoMem": "IntLH",
"index": 1100,
"size": 2,
"unit": "#",
"func": "MEDIAN",
"func": "POINT",
"period": 90,
"factor": 1
},
@@ -129,11 +129,11 @@
"name": "EpochStart",
"description": "DateTime inizio lavorazione formato EPOCH",
"memAddr": "41102",
"tipoMem": "INT",
"tipoMem": "IntLH",
"index": 1102,
"size": 2,
"unit": "#",
"func": "LAST",
"unit": "EPOCH",
"func": "POINT",
"period": 90,
"factor": 1
},
@@ -141,23 +141,23 @@
"name": "EpochStop",
"description": "DateTime fine lavorazione formato EPOCH",
"memAddr": "41104",
"tipoMem": "INT",
"tipoMem": "IntLH",
"index": 1104,
"size": 2,
"unit": "#",
"func": "LAST",
"unit": "EPOCH",
"func": "POINT",
"period": 90,
"factor": 1
},
"PPM": {
"name": "PPM",
"description": "Velocit espressa come Pacchi Per Minuto",
"description": "Velocita espressa come Pacchi Per Minuto",
"memAddr": "41106",
"tipoMem": "Real",
"tipoMem": "RealLH",
"index": 1106,
"size": 2,
"unit": "#",
"func": "LAST",
"func": "POINT",
"period": 90,
"factor": 1
}
@@ -4,7 +4,7 @@
"tipoMem": "DInt",
"memAddr": "41094",
"index": 1094,
"size": 2,
"size": 4,
"messages": [
"AUSILIARI NON INSERITI",
"TERMICA SBOBINATORI",
@@ -37,8 +37,7 @@
"BYPASS SPORTELLI INSERITO",
"BARRA SALDANTE NON IN POSIZIONE, EFFETTUARE SALDATURA MANUALE",
"GESTIONALE: MACCHINA IN CICLO",
"GESTIONALE: RICETTA NON TROVATA",
"PROBLEMA FC BYPASS EMERGENZA BARRA"
"GESTIONALE: RICETTA NON TROVATA"
]
},
{
@@ -46,8 +45,9 @@
"tipoMem": "DInt",
"memAddr": "41096",
"index": 1096,
"size": 2,
"size": 4,
"messages": [
"PROBLEMA FC BYPASS EMERGENZA BARRA",
"PROBLEMA FC EMERGENZA BARRA",
"##",
"##",
@@ -78,7 +78,6 @@
"##",
"##",
"##",
"##",
"##"
]
}
+66
View File
@@ -0,0 +1,66 @@
;Configurazione IOB-WIN
[IOB]
;Centro di lavoro OMP (https://omp.it/) con controllo siemens S7-1200 + OpcUa
CNCTYPE=OpcUaSiemensOMP
PING_MS_TIMEOUT=500
[MACHINE]
VENDOR=OMP
MODEL=Infilatrice
[CNC]
IP=10.150.0.41
PORT=4840
GETPRGNAME=true
[SERVER]
MPIP=http://10.150.0.1
MPURL=/MP/IO
CMDBASE=/IOB/input/
CMDFLOG=/IOB/flog/
CMDALIVE=/IOB
CMDENABLED=/IOB/enabled/
CMDADV1=?valore=
CMDREBO=/sendReboot.aspx?idxMacchina=
[MEMORY]
ADDR_READ=DB9999.DBB0
ADDR_WRITE=DB9999.DBB0
SIZE_READ=0
SIZE_WRITE=0
[BLINK]
;MAX_COUNTER_BLINK = 30
MAX_COUNTER_BLINK = 15
;bit0 = 0
;bit1 = 0
;bit2 = 1
;bit3 = 1
;bit4 = 1
;bit5 = 0
;bit6 = 0
;bit7 = 0
BLINK_FILT=0
;BLINK_FILT=28
[OPTPAR]
AUTO_CHANGE_ODL=false
CHANGE_ODL_MODE=TIME
CHANGE_ODL_HOURS=24
CHANGE_ODL_IDLE_MIN=5
PZCOUNT_MODE=OPC
DISABLE_PZCOUNT=FALSE
ENABLE_SEND_PZC_BLOCK=TRUE
MIN_SEND_PZC_BLOCK=0
MAX_SEND_PZC_BLOCK=100
ENABLE_DYN_DATA=FALSE
FORCE_DYN_DATA=TRUE
ENABLE_DATA_FILTER=TRUE
ENABLE_CLI_RESTART=TRUE
; conf parametri memoria READ/WRITE
OPC_PARAM_CONF=FINASSI_OMP_01.json
[BRANCH]
NAME=master
+131
View File
@@ -0,0 +1,131 @@
{
"BrowseFullVal": "ns=3;s=ServerInterfaces",
"BrowseNSIndex": 4,
"BrowseValue": 1,
"keyPartCount": "Conteggio",
"keyPartReq": "Set Quantità Lotto",
"keyPartId": "Generale: Nome Ricetta",
"keyProgName": "Generale: Nome Ricetta",
"keyRunMode": "",
"pingAsPowerOn": true,
"condWork": [
{
"keyName": "Selettore in Automatico",
"targetValue": "True"
},
{
"keyName": "Memoria Ciclo Automatico",
"targetValue": "True"
}
],
"condPowerOn": {
"checkMode": "AND",
"checkList": []
},
"condReady": {
"checkMode": "AND",
"checkList": []
},
"condManual": {
"checkMode": "AND",
"checkList": [
{
"keyName": "Selettore in Manuale",
"targetValue": "True"
}
]
},
"condEStop": {
"checkMode": "AND",
"checkList": []
},
"condError": {
"checkMode": "AND",
"checkList": [
{
"keyName": "Memoria Allarme Attivo",
"targetValue": "True"
}
]
},
"condCountEnabled": {
"checkMode": "AND",
"checkList": []
},
"condWarmUpCoolDown": {
"checkMode": "OR",
"checkList": []
},
"condWarning": {
"checkMode": "AND",
"checkList": []
},
"condSetup": {
"checkMode": "AND",
"checkList": [
{
"keyName": "Fine Lotto (1=Stop Ciclo)",
"targetValue": "1"
}
]
},
"fluxLogVeto": [
""
],
"itemTranslation": {
"fdovrd": "PATH FEED OVERRIDE",
"rovrd": "PATH RAPID OVERRIDE"
},
"paramsEndThresh": {
"InvDDone": 50
},
"mMapWrite": {
"setPzComm": {
"name": "setPzComm",
"description": "Qty",
"tipoMem": "Int",
"memAddr": "ns=4;i=11",
"index": 0,
"size": 4
},
"setProg": {
"name": "setProg",
"description": "Programma",
"tipoMem": "String",
"memAddr": "ns=4;i=9",
"index": 0,
"size": 30
}
},
"subscribedItems": [
"ns=4;i=1",
"ns=4;i=2",
"ns=4;i=3",
"ns=4;i=4",
"ns=4;i=5",
"ns=4;i=6",
"ns=4;i=7",
"ns=4;i=8",
"ns=4;i=9",
"ns=4;i=10",
"ns=4;i=11",
"ns=4;i=12",
"ns=4;i=13",
"ns=4;i=14"
],
"WatchDog": {
"IsEnabled": false,
"MemConfRead": "ns=4;s=tomes_1_Watchdog",
"MemConfWrite": "ns=4;s=tomach_1_watchdog",
"MaxVal": 9999
},
"actStopProd": {
"ns=4;i=14": "1"
},
"actSetRecipe": {
"ns=4;i=10": "1"
},
"actResetCounter": {
"ns=4;i=13": "1"
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ CNCTYPE=OpcUaCMS
;CNCTYPE=OpcUa
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=CMS
MODEL=Eidos
+2 -1
View File
@@ -3,8 +3,9 @@
;Impianto Cedax di Turi (test) - Giacovelli
CNCTYPE=MODBUS_TCP_CEDAX
PING_MS_TIMEOUT=1000
MinDeltaSec=5
[MACHINE]
[MACHINE]
VENDOR=CEDAX
MODEL=CEDAX Hydrocooler
+2 -1
View File
@@ -3,8 +3,9 @@
;Impianto Cedax di Turi (test) - Giacovelli
CNCTYPE=MODBUS_TCP_CEDAX
PING_MS_TIMEOUT=1000
MinDeltaSec=5
[MACHINE]
[MACHINE]
VENDOR=CEDAX
MODEL=CEDAX Scarico
+2 -1
View File
@@ -3,8 +3,9 @@
;Impianto Cedax di Turi (test) - Giacovelli
CNCTYPE=MODBUS_TCP_CEDAX
PING_MS_TIMEOUT=1000
MinDeltaSec=5
[MACHINE]
[MACHINE]
VENDOR=CEDAX
MODEL=CEDAX Lavorazione
+2 -1
View File
@@ -3,8 +3,9 @@
;Impianto Cedax di Turi (test) - Giacovelli
CNCTYPE=MODBUS_TCP_CENTERFRIGO
PING_MS_TIMEOUT=1000
MinDeltaSec=5
[MACHINE]
[MACHINE]
VENDOR=Centerfrigo
MODEL=Impianto Turi
+52 -20
View File
@@ -1,31 +1,63 @@
{
"mMapWrite": {
"TestWrite": {
"name": "TestWrite",
"description": "Test Scrittura",
"memAddr": "41621",
"tipoMem": "Real",
"index": 1621,
"SetPoint_Tunnel_Req": {
"name": "SetPoint_Tunnel_Req",
"description": "Setpoint Tunnel",
"memAddr": "44010",
"tipoMem": "RealLH",
"index": 4010,
"size": 2,
"func": "MEDIAN",
"period": 60,
"factor": 1,
"minVal": -100,
"maxVal": 100,
"minVal": -5,
"maxVal": 15,
"unit": "°C"
},
"SetPoint_Tunnel": {
"name": "SetPoint_Tunnel",
"description": "Setpoint Tunnel",
"memAddr": "41560",
"tipoMem": "Real",
"index": 1560,
"SetPoint_Cella_01_Req": {
"name": "SetPoint_Cella_01_Req",
"description": "Setpoint Cella 01",
"memAddr": "44012",
"tipoMem": "RealLH",
"index": 4012,
"size": 2,
"func": "MEDIAN",
"period": 60,
"factor": 1,
"minVal": -100,
"maxVal": 100,
"minVal": -5,
"maxVal": 15,
"unit": "°C"
},
"SetPoint_Cella_02_Req": {
"name": "SetPoint_Cella_02_Req",
"description": "Setpoint Cella 02",
"memAddr": "44014",
"tipoMem": "RealLH",
"index": 4014,
"size": 2,
"factor": 1,
"minVal": -5,
"maxVal": 15,
"unit": "°C"
},
"SetPoint_Cella_03_Req": {
"name": "SetPoint_Cella_03_Req",
"description": "Setpoint Cella 03",
"memAddr": "44016",
"tipoMem": "RealLH",
"index": 4016,
"size": 2,
"factor": 1,
"minVal": -5,
"maxVal": 15,
"unit": "°C"
},
"SetPoint_Cella_04_Req": {
"name": "SetPoint_Cella_04_Req",
"description": "Setpoint Cella 04",
"memAddr": "44018",
"tipoMem": "RealLH",
"index": 4018,
"size": 2,
"factor": 1,
"minVal": -5,
"maxVal": 15,
"unit": "°C"
}
},
@@ -3,6 +3,7 @@
;Centro di lavoro OpcUa
CNCTYPE=OpcUaOmronIcoel
PING_MS_TIMEOUT=500
MinDeltaSec=5
[MACHINE]
VENDOR=ICOEL
@@ -3,6 +3,7 @@
;WebService SOAP x sizer
CNCTYPE=IcoelSoap
PING_MS_TIMEOUT=500
MinDeltaSec=5
;IOB_NAME=GIACO_ICOEL
[MACHINE]
@@ -3,6 +3,7 @@
;Accesso gestione sync DB x sync ICOEL --> MoonPro_ISF --> MoonPro_IS
CNCTYPE=IcoelDb
PING_MS_TIMEOUT=500
MinDeltaSec=5
;IOB_NAME=GIACO_ICOEL
[MACHINE]
+2 -1
View File
@@ -3,8 +3,9 @@
;Macchina pulitrice RobotService x Donati
CNCTYPE=SIEMENS_NWSE
PING_MS_TIMEOUT=500
MinDeltaSec=5
[MACHINE]
[MACHINE]
VENDOR=NWS
MODEL=Impianto Turi
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=MTConnect
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=Mitsubishi
MODEL=PowerCenterPro1000
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=MTConnect
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=Okuma
MODEL=Lathe 2SP-35HG
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=MTConnect
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=HAAS
MODEL=UMC-500
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=MTConnect
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=HAAS
MODEL=UMC-750
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=MTConnect
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=CMS
MODEL=WaterJet
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_AT2001
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=SAET
MODEL=Preriscaldo_105B08
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=OMRON
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=EDF
MODEL=MiscelazioneOssidiFerro
+75
View File
@@ -0,0 +1,75 @@
;Configurazione IOB-WIN
[IOB]
CNCTYPE=FANUC
[MACHINE]
VENDOR=COLCOM
MODEL=DMG-MORI
[CNC]
; TEST FANUC!
IP=192.168.100.78
PORT=8193
GETPRGNAME=true
[SERVER]
MPIP=192.168.111.104
MPURL=/MP/IO
CMDBASE=/IOB/input/
CMDFLOG=/IOB/flog/
CMDALIVE=/IOB
CMDENABLED=/IOB/enabled/
CMDADV1=?valore=
CMDREBO=/sendReboot.aspx?idxMacchina=
[MEMORY]
; Red: Y12.4 | Yellow: Y51.1 (porta chiusa, da NEGARE) | Green Y12.6 | Alarm Y 51.4 | Blu Y12.7
;BIT0=CONN
BIT1=Y12.6
BIT2=PZCOUNT.PAR.6711
BIT3=Y12.4
BIT4=Y12.7
;BIT5=Y11.2
BIT5=X18.3
BIT6=X11.3
AREAD_START=0
AREAD_SIZE=9999
AREAG_SIZE=48
AREAR_START=0
AREAR_SIZE=64
AREAX_START=0
AREAX_SIZE=64
AREAY_START=0
AREAY_SIZE=64
PAR_START=6711
PAR_SIZE=3
[BLINK]
;MAX_COUNTER_BLINK = 30
MAX_COUNTER_BLINK = 15
;bit0 = 0
;bit1 = 0
;bit2 = 1
;bit3 = 1
;bit4 = 1
;bit5 = 0
;bit6 = 0
;bit7 = 0
BLINK_FILT=0
;BLINK_FILT=28
[OPTPAR]
;PZCOUNT_MODE=STD|BIT
PZCOUNT_MODE=STD.PAR.6711
PZGTOT_MODE=STD.PAR.6712
;PZREQ_MODE=STD.PAR.6713
ENABLE_PZ_RESET=TRUE
ENABLE_PZ_RESET_stopSetup=TRUE
;gestione invio pezzi in blocco
ENABLE_SEND_PZC_BLOCK=TRUE
MIN_SEND_PZC_BLOCK=0
MAX_SEND_PZC_BLOCK=100
[BRANCH]
NAME=master
+3 -1
View File
@@ -38,6 +38,8 @@ CLI_INST=SteamWareSim
;STARTLIST=GIACO_ICOEL_002
;STARTLIST=GIACO_CENTERFRIGO
;STARTLIST=GIACO_NWSE
STARTLIST=SIMUL_01
;STARTLIST=SIM_DP_01
;STARTLIST=FINASSI_HELPI_01
STARTLIST=FINASSI_OMP_01
MAXCNC=10
+1 -1
View File
@@ -5,7 +5,7 @@ CNCTYPE=OpcUaEwon
;CNCTYPE=OpcUa
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=OpcUa
MODEL=Std
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_COMECA
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=COMECA
MODEL=01
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=MODBUS_TCP_HAM
PING_MS_TIMEOUT=1000
[MACHINE]
[MACHINE]
VENDOR=HAM
MODEL=HAM
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=MODBUS_TCP_HAM
PING_MS_TIMEOUT=1000
[MACHINE]
[MACHINE]
VENDOR=HAM
MODEL=HAM
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_COMECA
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=COMECA
MODEL=01
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=MODBUS_TCP_HAM
PING_MS_TIMEOUT=1000
[MACHINE]
[MACHINE]
VENDOR=HAM
MODEL=HAM
+2 -1
View File
@@ -1,7 +1,8 @@
;Configurazione IOB-WIN
[IOB]
CNCTYPE=SIMULA
CNCTYPE=SIMULA
PING_MS_TIMEOUT=500
MinDeltaSec=5
[MACHINE]
VENDOR=STEAMWARE
+2 -1
View File
@@ -1,7 +1,8 @@
;Configurazione IOB-WIN
[IOB]
CNCTYPE=SIMULA
CNCTYPE=SIMULA
PING_MS_TIMEOUT=500
MinDeltaSec=5
[MACHINE]
VENDOR=STEAMWARE
+2 -1
View File
@@ -1,7 +1,8 @@
;Configurazione IOB-WIN
[IOB]
CNCTYPE=SIMULA
CNCTYPE=SIMULA
PING_MS_TIMEOUT=500
MinDeltaSec=5
[MACHINE]
VENDOR=STEAMWARE
+2 -1
View File
@@ -1,7 +1,8 @@
;Configurazione IOB-WIN
[IOB]
CNCTYPE=SIMULA
CNCTYPE=SIMULA
PING_MS_TIMEOUT=500
MinDeltaSec=5
[MACHINE]
VENDOR=STEAMWARE
+2 -1
View File
@@ -1,7 +1,8 @@
;Configurazione IOB-WIN
[IOB]
CNCTYPE=SIMULA
CNCTYPE=SIMULA
PING_MS_TIMEOUT=500
MinDeltaSec=5
[MACHINE]
VENDOR=STEAMWARE
+2 -1
View File
@@ -1,7 +1,8 @@
;Configurazione IOB-WIN
[IOB]
CNCTYPE=SIMULA
CNCTYPE=SIMULA
PING_MS_TIMEOUT=500
MinDeltaSec=5
[MACHINE]
VENDOR=STEAMWARE
+2 -1
View File
@@ -1,7 +1,8 @@
;Configurazione IOB-WIN
[IOB]
CNCTYPE=SIMULA
CNCTYPE=SIMULA
PING_MS_TIMEOUT=500
MinDeltaSec=5
[MACHINE]
VENDOR=STEAMWARE
+2 -1
View File
@@ -1,7 +1,8 @@
;Configurazione IOB-WIN
[IOB]
CNCTYPE=SIMULA
CNCTYPE=SIMULA
PING_MS_TIMEOUT=500
MinDeltaSec=5
[MACHINE]
VENDOR=STEAMWARE
+3 -2
View File
@@ -1,7 +1,8 @@
;Configurazione IOB-WIN
[IOB]
CNCTYPE=SIMULA
CNCTYPE=SIMULA
PING_MS_TIMEOUT=500
MinDeltaSec=5
[MACHINE]
VENDOR=STEAMWARE
@@ -50,7 +51,7 @@ SIM_PZCNT=10|3
SIM_ALARM=1000|20
SIM_MANU=50|6
; 1 = indica che la macchina è multi --> allo scadere del contapezzo gestisce ANCHE il giro tavola sui bit relativi
SIM_MULTI=1
IS_MULTI=1
; indica gestione e simulazione bit 5 --> slow/emergenza
SIM_SLOW=3500|20
; indica gestione e simulazione bit 6 --> warmup/cooldown
+4 -3
View File
@@ -1,7 +1,8 @@
;Configurazione IOB-WIN
[IOB]
CNCTYPE=SIMULA
CNCTYPE=SIMULA
PING_MS_TIMEOUT=500
MinDeltaSec=5
[MACHINE]
VENDOR=STEAMWARE
@@ -24,7 +25,7 @@ CMD_ODL_STARTED=/IOB/getCurrOdlStart/
CMD_FORCLE_SPLIT_ODL=/IOB/forceSplitOdlFull/
CMD_IDLE_TIME=/IOB/getIdlePeriod/
[MEMORY]
[MEMORY]
[BLINK]
MAX_COUNTER_BLINK = 15
@@ -50,7 +51,7 @@ SIM_PZCNT=10|2
SIM_ALARM=1000|20
SIM_MANU=50|6
; 1 = indica che la macchina è multi --> allo scadere del contapezzo gestisce ANCHE il giro tavola sui bit relativi
SIM_MULTI=1
IS_MULTI=1
; indica gestione e simulazione bit 5 --> slow/emergenza
SIM_SLOW=6500|20
; indica gestione e simulazione bit 6 --> warmup/cooldown
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=MTConnect
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=CMS
MODEL=WaterJet
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=OpcUaEwonMonti
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=Monti
MODEL=Std
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_SAET
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=SAET
MODEL=Preriscaldo_105B08
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_SAET
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=SAET
MODEL=FornoTemprainduzione_105B08
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_COMUR
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=COMUR
MODEL=DENTATRICE_PE125H
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_LASCO
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=LASCP
MODEL=PRESSA_3150
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_PRESSOIL_CEI
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=PRESSOIL_CEI
MODEL=PRESSA_IDRAULICA
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_SAET
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=SAET
MODEL=Preriscaldo_105B08
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_INGENIA
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=INGENIA
MODEL=RobotAutomPressaValvital
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=SIEMENS_SIMEC
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=SIMEC
MODEL=180
+1 -1
View File
@@ -4,7 +4,7 @@
CNCTYPE=WPS
PING_MS_TIMEOUT=500
[MACHINE]
[MACHINE]
VENDOR=Atlas Copco
MODEL=GA18VP_13
+34 -7
View File
@@ -74,6 +74,25 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote_DEBUG|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Remote_DEBUG\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote_DEBUG|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Remote_DEBUG\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoUpdater.NET, Version=1.7.0.0, Culture=neutral, PublicKeyToken=501435c91b35f4bc, processorArchitecture=MSIL">
<HintPath>..\packages\Autoupdater.NET.Official.1.7.0\lib\net45\AutoUpdater.NET.dll</HintPath>
@@ -94,7 +113,7 @@
<HintPath>..\packages\EgwProxy.Icoel.3.6.2206.2811\lib\EgwProxy.Icoel.DataLayer.dll</HintPath>
</Reference>
<Reference Include="EgwProxy.MultiCncLib, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EgwProxy.MultiCncLib.3.6.2207.1116\lib\EgwProxy.MultiCncLib.dll</HintPath>
<HintPath>..\packages\EgwProxy.MultiCncLib.3.6.2207.1211\lib\EgwProxy.MultiCncLib.dll</HintPath>
</Reference>
<Reference Include="EgwProxy.OsaiCncLib, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EgwProxy.OsaiCncLib.3.6.2205.2015\lib\EgwProxy.OsaiCncLib.dll</HintPath>
@@ -112,8 +131,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>ExtLib\krcc.dll</HintPath>
</Reference>
<Reference Include="MapoSDK, Version=6.14.2206.2718, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MapoSDK.6.14.2206.2718\lib\MapoSDK.dll</HintPath>
<Reference Include="MapoSDK, Version=6.14.2207.2913, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MapoSDK.6.14.2207.2913\lib\MapoSDK.dll</HintPath>
</Reference>
<Reference Include="MathNet.Numerics, Version=4.15.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MathNet.Numerics.4.15.0\lib\net461\MathNet.Numerics.dll</HintPath>
@@ -210,6 +229,8 @@
<Compile Include="IobModbusTCPCenterfrigo.cs" />
<Compile Include="IobModbusTCPHelpi.cs" />
<Compile Include="IobModbusTCPCedax.cs" />
<Compile Include="IobOpcUaSiemensOMP.cs" />
<Compile Include="IobOpcUaSiemens.cs" />
<Compile Include="IobOpcUaOmronIcoel.cs" />
<Compile Include="IobOpcUaOmron.cs" />
<Compile Include="IobOpcUaEwonBLM.cs" />
@@ -360,16 +381,16 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\FINASSI_HELPI_01.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\FINASSI_HELPI_01.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\FINASSI_HELPI_01_alarm.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\FINASSI_HELPI_01_MBlock.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\GIACO_ICOEL_002.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -602,6 +623,12 @@
<None Include="DATA\CONF\MECART_80.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\FINASSI_OMP_01.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\FINASSI_OMP_01.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\STEL_200.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+9 -1
View File
@@ -86,7 +86,7 @@ namespace IOB_WIN_NEXT
/// <summary>
/// Dati di conf del server MoonPro cui comunicare
/// </summary>
public serverMapo serverData { get; set; } = new serverMapo("127.0.0.1", "/", "/IOB/input/", "/IOB/flog/", "/IOB", "/IOB/enabled/", "/sendReboot.aspx?idxMacchina=", "/IOB/getCurrOdlStart/");
public serverMapo serverData { get; set; } = new serverMapo("127.0.0.1", "/", "/IOB/input/", "/IOB/flog/", "/IOB/ulog/", "/IOB", "/IOB/enabled/", "/sendReboot.aspx?idxMacchina=", "/IOB/getCurrOdlStart/","SteamWare","/IOB/forceSplitOdlFull", "/IOB/getIdlePeriod", "/IOB/rawTransfJson");
/// <summary>
/// Slot (Siemens S7)
@@ -123,6 +123,11 @@ namespace IOB_WIN_NEXT
/// </summary>
public string versIOB { get; set; } = "0";
/// <summary>
/// Minimo delta in sec x considerare variazioni info
/// </summary>
public int minDeltaSec { get; set; } = 2;
#endregion Public Properties
}
@@ -146,7 +151,10 @@ namespace IOB_WIN_NEXT
/// <param name="CMDENABLED_">Comando x check abilitato</param>
/// <param name="CMDREBO_">Comando x reboot</param>
/// <param name="CMD_ODL_STARTED_">Comando x check data avvio ODL</param>
/// <param name="CLI_INST_">Installazione</param>
/// <param name="CMD_FORCLE_SPLIT_ODL_">Comando x forzare split ODL</param>
/// <param name="CMD_IDLE_TIME_">URL calcolo idle time</param>
/// <param name="CMDRAWTRANSFJSON_">Url invio raw transf</param>
public serverMapo(string MPIP_, string MPURL_ = "/MP/IO", string CMDBASE_ = "/IOB/input/", string CMDFLOG_ = "/IOB/flog/", string CMDULOG_ = "/IOB/ulog/", string CMDALIVE_ = "IOB", string CMDENABLED_ = "/IOB/enabled/", string CMDREBO_ = "/sendReboot.aspx?idxMacchina=", string CMD_ODL_STARTED_ = "/IOB/getCurrOdlStart/", string CLI_INST_ = "SteamWare", string CMD_FORCLE_SPLIT_ODL_ = "/IOB/forceSplitOdlFull/", string CMD_IDLE_TIME_ = "/IOB/getIdlePeriod/", string CMDRAWTRANSFJSON_ = "/IOB/rawTransfJson/")
{
if (!string.IsNullOrEmpty(MPIP_))
+5 -5
View File
@@ -15,7 +15,7 @@ namespace IOB_WIN_NEXT
/// <summary>
/// LookUpTable di decodifica da CNC a segnali tipo bitmap MAPO
/// </summary>
private Dictionary<string, string> signLUT = new Dictionary<string, string>();
internal Dictionary<string, string> signLUT = new Dictionary<string, string>();
#endregion Private Fields
@@ -1112,10 +1112,10 @@ namespace IOB_WIN_NEXT
int newVal = -1;
Int32.TryParse(outputVal.ToString(), out newVal);
contapezziPLC = newVal > -1 ? newVal : contapezziPLC;
if (isVerboseLog)
{
lgInfo("[3] contapezziPLC contapezzi: {0}", contapezziPLC);
}
//if (isVerboseLog)
//{
lgInfo("[3] contapezziPLC contapezzi: {0}", contapezziPLC);
//}
}
stopwatch.Stop();
}
+5 -4
View File
@@ -125,7 +125,7 @@ namespace IOB_WIN_NEXT
public DateTime lastDisconnCheck;
/// <summary>
/// Data/ora ultima volta che IOB è stato dichairato online
/// Data/ora ultima volta che IOB è stato dichiarato online
/// </summary>
public DateTime lastIobOnline = DateTime.Now.AddHours(-1);
@@ -280,7 +280,7 @@ namespace IOB_WIN_NEXT
if (IOBConf != null)
{
// init oggetto redis...
redisMan = new RedisIobCache(IOBConf.serverData.MPIP, IOBConf.codIOB, IOBConf.tipoIob.ToString());
redisMan = new RedisIobCache(IOBConf.serverData.MPIP, IOBConf.codIOB, IOBConf.tipoIob.ToString(), IOBConf.minDeltaSec);
// initi oggetto TCMan
tcMan = new TCMan(IOBConf.TCLambda, IOBConf.TCMaxDelayFactor, IOBConf.TCMaxIncrPz);
@@ -1367,7 +1367,7 @@ namespace IOB_WIN_NEXT
* */
// serializzo il valore...
BaseRawTransf newVal = new BaseRawTransf(DateTime.Now, mesContent, mesType);
BaseRawTransf newVal = new BaseRawTransf(DateTime.Now, (Newtonsoft.Json.Linq.JObject)mesContent, mesType);
string encodedVal = JsonConvert.SerializeObject(newVal);
// --> accodo (valore già formattato)!
QueueRawTransf.Enqueue(encodedVal);
@@ -3155,7 +3155,7 @@ namespace IOB_WIN_NEXT
}
else
{
lgError($"Errore in invio richiesta registrazione allarme: URL: {lastUrl}{Environment.NewLine}Payload:{Environment.NewLine}{rawData}");
lgError($"Errore in invio richiesta registrazione allarme | resp: {resp} | URL: {lastUrl}{Environment.NewLine}Payload:{Environment.NewLine}{rawData}");
}
}
return fatto;
@@ -4902,6 +4902,7 @@ namespace IOB_WIN_NEXT
{
Funzione = funz,
Period = periodo,
UM = item.Value.unit,
DTStart = DateTime.Now.AddHours(-1),
dataArray = new List<double>()
};
+2
View File
@@ -211,6 +211,7 @@ namespace IOB_WIN_NEXT
if (adpRunning)
{
lgInfo("Connessione OK");
lastReadPLC = DateTime.Now;
}
}
else
@@ -269,6 +270,7 @@ namespace IOB_WIN_NEXT
sw.Start();
elencoSyncState = dbProxy.DataController.SyncStateDoImportAll();
sw.Stop();
lastReadPLC = DateTime.Now;
lgInfo($"DB: esecuzione task dbProxy.DataController.SyncStateGetAll() in {sw.ElapsedMilliseconds} ms");
if (elencoSyncState != null)
+137 -32
View File
@@ -238,7 +238,7 @@ namespace IOB_WIN_NEXT
}
catch (Exception exc)
{
lgError(exc, "Errore in getDynData x ModBus TCP PLC --> ciclo disconnect/reconnect | LUT: {useLUT}");
lgError(exc, $"Errore in getDynData x ModBus TCP PLC --> ciclo disconnect/reconnect | LUT: {useLUT}{Environment.NewLine}{exc}");
tryDisconnect();
outVal = new Dictionary<string, string>();
tryConnect();
@@ -540,15 +540,16 @@ namespace IOB_WIN_NEXT
/// </summary>
/// <param name="startAddr"></param>
/// <param name="currRegVal">Valore in formato INT da registri</param>
/// <param name="baseAddr">Indirizzo di base dei registri</param>
/// <returns></returns>
public bool writeInputReg(int startAddr, int[] currRegVal)
public bool writeInputReg(int startAddr, int[] currRegVal, int baseAddr)
{
bool answ = false;
if (currPLC.Connected)
{
try
{
currPLC.WriteMultipleRegisters(startAddr + deltaBase, currRegVal);
currPLC.WriteMultipleRegisters(startAddr + deltaBase + (40000 - baseAddr), currRegVal);
answ = true;
}
catch
@@ -797,13 +798,36 @@ namespace IOB_WIN_NEXT
CurrVal = ModbusClient.ConvertIntToRegisters(valInt);
}
fatto = writeInputReg(currMem.index, CurrVal);
fatto = writeInputReg(currMem.index, CurrVal, parametri.holdRegBaseAddr);
break;
case plcDataType.IntLH:
valInt = getScaledInt(currMem, true);
if (byteSize == 1)
{
CurrVal[1] = valInt;
}
else
{
CurrVal = ModbusClient.ConvertIntToRegisters(valInt);
Array.Reverse(CurrVal);
}
fatto = writeInputReg(currMem.index, CurrVal, parametri.holdRegBaseAddr);
break;
case plcDataType.DInt:
valUInt = getScaledUInt(currMem, true);
CurrVal = ModbusClient.ConvertLongToRegisters(valInt);
fatto = writeInputReg(currMem.index, CurrVal);
fatto = writeInputReg(currMem.index, CurrVal, parametri.holdRegBaseAddr);
break;
case plcDataType.DIntLH:
valUInt = getScaledUInt(currMem, true);
CurrVal = ModbusClient.ConvertLongToRegisters(valInt);
Array.Reverse(CurrVal);
fatto = writeInputReg(currMem.index, CurrVal, parametri.holdRegBaseAddr);
break;
//case plcDataType.Word:
@@ -817,19 +841,27 @@ namespace IOB_WIN_NEXT
// break;
case plcDataType.Real:
case plcDataType.RealHL:
valDouble = getScaledDouble(currMem);
CurrVal = ModbusClient.ConvertFloatToRegisters((float)valDouble, ModbusClient.RegisterOrder.HighLow);
fatto = writeInputReg(currMem.index, CurrVal);
fatto = writeInputReg(currMem.index, CurrVal, parametri.holdRegBaseAddr);
break;
//case plcDataType.String:
// // se ho writePre --> "allungo" di 2 la dimensione della stringa x MemBlock...
// if (writePre)
// {
// MemBlock = new byte[byteSize + 2];
// }
// saveStringOnMemBlock(ref MemBlock, 0, currMem.size, currMem.value);
// break;
case plcDataType.FloatBADC:
case plcDataType.RealLH:
valDouble = getScaledDouble(currMem);
CurrVal = ModbusClient.ConvertFloatToRegisters((float)valDouble, ModbusClient.RegisterOrder.LowHigh);
fatto = writeInputReg(currMem.index, CurrVal, parametri.holdRegBaseAddr);
break;
case plcDataType.String:
CurrVal = ModbusClient.ConvertStringToRegisters(currMem.value.PadRight(currMem.size * 2));
var regLen = ModbusClient.ConvertIntToRegisters(currMem.size * 2 - 2);
Array.Copy(regLen, 0, CurrVal, CurrVal.Length - regLen.Length, regLen.Length);
//CurrVal[CurrVal.Length - 2] = regLen[1];
//CurrVal[CurrVal.Length - 1] = regLen[0];
fatto = writeInputReg(currMem.index, CurrVal, parametri.holdRegBaseAddr);
break;
default:
break;
@@ -876,7 +908,7 @@ namespace IOB_WIN_NEXT
// SE è necessario refresh...
if (needRefresh)
{
lgInfoStartup("Refreshing connection...");
lgInfo("Refreshing connection...");
if (parametri != null)
{
try
@@ -1123,6 +1155,8 @@ namespace IOB_WIN_NEXT
#region Private Methods
/// <summary>
/// converte valore in tipo desiderato
/// </summary>
@@ -1137,6 +1171,7 @@ namespace IOB_WIN_NEXT
switch (tipoMem)
{
case plcDataType.Real:
case plcDataType.RealHL:
case plcDataType.FloatABCD:
if (size == 4)
{
@@ -1148,16 +1183,17 @@ namespace IOB_WIN_NEXT
}
break;
case plcDataType.RealLH:
case plcDataType.FloatCDAB:
if (size == 4)
{
// invero array...
// inverto array...
Array.Reverse(listInt);
valore = ModbusClient.ConvertRegistersToDouble(listInt);
}
else if (size == 2)
{
// non serve cambaire nulla...
// inverto array...
Array.Reverse(listInt);
valore = ModbusClient.ConvertRegistersToFloat(listInt);
}
@@ -1191,6 +1227,21 @@ namespace IOB_WIN_NEXT
valore = listInt[0];
}
break;
case plcDataType.IntLH:
case plcDataType.DIntLH:
if (size == 4)
{
Array.Reverse(listInt);
valore = ModbusClient.ConvertRegistersToLong(listInt);
}
else if (size == 2)
{
Array.Reverse(listInt);
valore = ModbusClient.ConvertRegistersToInt(listInt);
}
break;
}
return valore;
}
@@ -1233,6 +1284,10 @@ namespace IOB_WIN_NEXT
valInt = (int)(temp * 10 * currMem.factor) / 10;
}
}
else
{
valInt = (int)temp;
}
return valInt;
}
@@ -1292,11 +1347,13 @@ namespace IOB_WIN_NEXT
// procedo x ogni valore configurato...
foreach (var item in memItemList)
{
listInt = new int[item.Value.size];
// attesa 50 ms prima di procedere x evitare burst dati
if (!useLUT)
{
Thread.Sleep(50);
}
string valString = "";
double valore = 0;
double valoreScal = 0;
bool dataOk = false;
@@ -1318,7 +1375,16 @@ namespace IOB_WIN_NEXT
case modBusAddrType.InputRegister:
listInt = readInputReg(item.Value.index, item.Value.size);
valore = convertFromReg(listInt, item.Value.size, item.Value.tipoMem);
if (item.Value.tipoMem == plcDataType.String)
{
// valore string...
valString = ModbusClient.ConvertRegistersToString(listInt, 0, item.Value.size);
}
else
{
// valori numerici...
valore = convertFromReg(listInt, item.Value.size, item.Value.tipoMem);
}
break;
@@ -1346,7 +1412,18 @@ namespace IOB_WIN_NEXT
{
try
{
listInt = HoldingRegisterLUT[lutAddress];
if (listInt.Length == 2)
{
listInt = HoldingRegisterLUT[lutAddress];
}
else
{
// faccio ciclo x copiare 2 alla volta...
for (int i = 0; i < listInt.Length; i += 2)
{
Array.Copy(HoldingRegisterLUT[lutAddress + i], 0, listInt, i, 2);
}
}
}
catch (Exception exc)
{
@@ -1359,26 +1436,53 @@ namespace IOB_WIN_NEXT
{
listInt = readHoldReg(item.Value.index - 1, item.Value.size);
}
valore = convertFromReg(listInt, item.Value.size, item.Value.tipoMem);
if (item.Value.tipoMem == plcDataType.String)
{
// valore string...
valString = ModbusClient.ConvertRegistersToString(listInt, 0, item.Value.size);
valString = valString.Replace("\n", "").Replace("\r", "").Replace("\0", string.Empty).Trim();
}
else
{
valore = convertFromReg(listInt, item.Value.size, item.Value.tipoMem);
}
break;
default:
break;
}
// verifica limite... con delta da impianto
dataOk = (valore > (item.Value.minVal + deltaVal) && valore < (item.Value.maxVal - deltaVal));
if (dataOk || disDynDataRangeCheck)
if (item.Value.tipoMem == plcDataType.String)
{
// moltiplico x fattore conversione...
valoreScal = valore * item.Value.factor;
saveValue(ref outVal, valoreScal, item.Key);
lgDebug($"getDataDictionary: valore ricevuto | {item.Key} | val: {valore} | valoreScal: {valoreScal}");
saveValueString(ref outVal, valString, item.Key);
lgDebug($"getDataDictionary: valore ricevuto | {item.Key} | val: {valString}");
}
else
{
lgError($"getDataDictionary: valore scartato x limiti min/max | {item.Key} | val: {valore} | valoreScal: {valoreScal} | min-max: {item.Value.minVal}-{item.Value.maxVal} | deltaVal: {deltaVal}");
readErrorList.Add(item.Key, item.Value);
lgDebug($"--> rimesso in coda lettura | parametro: {item.Key} | index: {item.Value.index} | size: {item.Value.size}");
// verifica limite... con delta da impianto
dataOk = (valore > (item.Value.minVal + deltaVal) && valore < (item.Value.maxVal - deltaVal));
if (dataOk || disDynDataRangeCheck)
{
// verifica valori EPOCH x convertirli in datetime...
if (item.Value.unit == "EPOCH")
{
valString = TimeUtils.epochConvert(valore).ToString("yyyy-MM-dd HH:mm:ss");
saveValueString(ref outVal, valString, item.Key);
lgDebug($"getDataDictionary: valore EPOCH ricevuto | {item.Key} | val: {valore} | valString: {valString}");
}
else
{
// moltiplico x fattore conversione...
valoreScal = valore * item.Value.factor;
saveValue(ref outVal, valoreScal, item.Key);
lgDebug($"getDataDictionary: valore ricevuto | {item.Key} | val: {valore} | valoreScal: {valoreScal}");
}
}
else
{
lgError($"getDataDictionary: valore scartato x limiti min/max | {item.Key} | val: {valore} | valoreScal: {valoreScal} | min-max: {item.Value.minVal}-{item.Value.maxVal} | deltaVal: {deltaVal}");
readErrorList.Add(item.Key, item.Value);
lgDebug($"--> rimesso in coda lettura | parametro: {item.Key} | index: {item.Value.index} | size: {item.Value.size}");
}
}
}
@@ -1419,7 +1523,7 @@ namespace IOB_WIN_NEXT
/// Effettua lettura blocco memoria indicato e lo salva in copia locale HoldingRegisterLUT
/// </summary>
/// <param name="startAddr">Indirizzo di partenza</param>
/// <param name="numReg">NUm registri da leggere (max 120)</param>
/// <param name="numReg">Num registri da leggere (max 120)</param>
private void readBlockHoldingReg(int startAddr, int numReg, int baseAddr)
{
bool allOk = false;
@@ -1441,6 +1545,7 @@ namespace IOB_WIN_NEXT
rawData = currPLC.ReadHoldingRegisters(startAddr - baseAddr, numReg);
stopwatch.Stop();
lgTrace($"Lettura in blocco HoldingRegisters| startAddr: {startAddr} | numReg {numReg} | rawData.lenght: {rawData.Length} | {stopwatch.ElapsedMilliseconds}ms");
lastReadPLC = DateTime.Now;
// salvo in LUT la versione ESPLOSA 2 byte alla volta...
if (rawData.Length > 0)
{
@@ -1474,7 +1579,7 @@ namespace IOB_WIN_NEXT
{
currReadErrors++;
allOk = false;
lgError($"Eccezione in readBlockHoldingReg | currReadErrors: {currReadErrors}{Environment.NewLine}{exc}");
lgError($"Eccezione in readBlockHoldingReg | startAddr: {startAddr} | baseAddr: {baseAddr} | numReg: {numReg} | currReadErrors: {currReadErrors} |{Environment.NewLine}{exc}");
}
}
else
+1
View File
@@ -222,5 +222,6 @@ namespace IOB_WIN_NEXT
}
#endregion Protected Methods
}
}
+3 -1
View File
@@ -1114,7 +1114,9 @@ namespace IOB_WIN_NEXT
await application.CheckApplicationInstanceCertificate(silent: false, minimumKeySize: 0).ConfigureAwait(false);
lgInfo($"Chiamata UAClient con configurazione standard: {application.ApplicationConfiguration.ApplicationName}");
UA_ref = new UAClient(application.ApplicationConfiguration, cIobConf.codIOB, opcUaParams.Identity.UserName, opcUaParams.Identity.Passwd, isVerboseLog, ClientBase.ValidateResponse);
string userName = opcUaParams == null || opcUaParams.Identity == null ? "" : opcUaParams.Identity.UserName;
string passwd = opcUaParams == null || opcUaParams.Identity == null ? "" : opcUaParams.Identity.Passwd;
UA_ref = new UAClient(application.ApplicationConfiguration, cIobConf.codIOB, userName, passwd, isVerboseLog, ClientBase.ValidateResponse);
lgInfo($"Chiamata apertura OpcUa Client: {cIobConf.cncIpAddr}:{port}");
UA_ref.ServerUrl = $"opc.tcp://{cIobConf.cncIpAddr}:{port}";
+4 -3
View File
@@ -44,7 +44,7 @@ namespace IOB_WIN_NEXT
protected override void plcWriteParams(ref List<objItem> updatedPar)
{
base.plcWriteParams(ref updatedPar);
#if false
// se DEVO gestire setup Mecolpress...
if (opcUaParams.SetupConf.SetupMode == IOB_UT_NEXT.MachineSetupMode.MECOLPRESS)
{
@@ -86,7 +86,7 @@ namespace IOB_WIN_NEXT
// accodo x scrittura
nodes2Write.Add(commWriteVal);
lgInfo($"richiesta scrittura valore | nodeId: {commWriteVal.NodeId } | targetPar: {item.TargetParam} | val {commWriteVal.Value.Value}");
lgInfo($"richiesta scrittura valore | nodeId: {commWriteVal.NodeId} | targetPar: {item.TargetParam} | val {commWriteVal.Value.Value}");
}
// x ora NON eseguo
@@ -98,7 +98,8 @@ namespace IOB_WIN_NEXT
UA_ref.WriteNodes(nodes2Write);
}
}
}
}
#endif
}
#endregion Public Constructors
+369
View File
@@ -0,0 +1,369 @@
using MapoSDK;
using Newtonsoft.Json;
using Opc.Ua;
using System;
using System.Collections.Generic;
using System.Net.NetworkInformation;
namespace IOB_WIN_NEXT
{
public class IobOpcUaSiemens : IobOpcUa
{
#region Public Constructors
/// <summary>
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la
/// gestione specifica per Siemens OPC-UA (es OPC, Cereria Finassi) https://github.com/OPCFoundation/UA-.NETStandard
/// </summary>
/// <param name="caller"></param>
/// <param name="IOBConf"></param>
public IobOpcUaSiemens(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
{
lgInfo("Init OpcUa Siemens");
// inizializzo classe base...
if (!string.IsNullOrEmpty(getOptPar("CHANGE_ODL_MODE")))
{
CHANGE_ODL_MODE = getOptPar("CHANGE_ODL_MODE");
}
sendKeyRichiesta = true;
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Processo i task richiesti e li elimino dalla coda 1:1
/// </summary>
/// <param name="task2exe"></param>
public override Dictionary<string, string> executeTasks(Dictionary<string, string> task2exe)
{
// uso metodo base x ora
return base.executeTasks(task2exe);
}
/// <summary>
/// Effettua vero processing contapezzi
/// </summary>
public override void processContapezzi()
{
if (utils.CRB("enableContapezzi"))
{
// check condizione validazione
if (checkMultiCondition(opcUaParams.condCountEnabled) || opcUaParams.condCountEnabled.checkList.Count == 0)
{
// cerco parametro contapezzi...
string currPzCount = getDataItemValue(opcUaParams.keyPartCount);
// se ho un contapezzi... processo...
if (!string.IsNullOrEmpty(currPzCount))
{
int newVal = -1;
bool fatto = Int32.TryParse(currPzCount, out newVal);
if (fatto)
{
// gestione decremento contapezzi: viene "messo via" solo SE c'è un
// effettivo decremento contapezzi...
if (newVal < contapezziPLC)
{
pzCountResetted = true;
// incremento contatore richiesta
countKeyRichiesta = countKeyRichiesta + 1;
// log
lgInfo("Contapezzi resettato (PLC) --> pzCountResetted = true");
}
// salvo nuovo valore contapezziPLC
contapezziPLC = newVal > -1 ? newVal : contapezziPLC;
}
else
{
lgError($"Errore in decodifica valore contapezzi, valore rilevato: {currPzCount}");
}
}
else
{
lgError("Errore in decodifica valore contapezzi, valore vuoto!");
}
}
if (CHANGE_ODL_MODE == "PZCOUNT_RESET")
{
// controllo comunque, se è ZERO il contapezzi, e sul server è maggiore il
// valore x ODL e NON abilitato il trigger reset --> abilito trigger...
if (!pzCountResetted && contapezziPLC == 0 && contapezziIOB > 0)
{
pzCountResetted = true;
// incremento contatore richiesta
countKeyRichiesta = countKeyRichiesta + 1;
// log
lgInfo("Contapezzi resettato (PLC==0 e IOB>PLC) --> pzCountResetted = true");
}
}
}
}
/// <summary>
/// Effettua reset del contapezzi, NON POSSIBILE in questa versione
/// </summary>
/// <returns></returns>
public override bool resetcontapezziPLC()
{
bool answ = false;
return answ;
}
/// <summary>
/// Effettua IMPOSTAZIONE FORZATA del contapezzi, NON POSSIBILE in questa versione
/// </summary>
/// <returns></returns>
public override bool setcontapezziPLC(int newPzCount)
{
bool answ = false;
return answ;
}
#endregion Public Methods
#region Protected Fields
/// <summary>
/// Modalità cambio ODL
/// </summary>
protected string CHANGE_ODL_MODE = "";
protected bool testDone = false;
#endregion Protected Fields
#region Protected Methods
/// <summary>
/// Effettua decodifica aree memoria alla bitmap usata x MAPO
/// </summary>
protected override void decodeToBaseBitmap()
{
DateTime adesso = DateTime.Now;
// init a zero...
B_input = 0;
/* -----------------------------------------------------
* STATE MACHINE 60 STD / SIMULA
*------------------------------------------------------
* bitmap MAPO
* B0: POWER_ON
* B1: RUN
* B2: pzCount
* B3: allarme
* B4: manuale
* B5: SlowTC (NON gestito qui)
* B6: warm-up / cool-down / setup
* B7: emergenza ARMATA (1=ok, 0 = premuta)
---------------------------------------------------- */
// se valido il check ping lo eseguo... altrimenti lo do x buono
bool checkPing = !opcUaParams.pingAsPowerOn;
string currRun = "N.A.";
if (!checkPing)
{
checkPing = (testPingMachine == IPStatus.Success);
}
// bit 0 (poweron) imposto a 1 SE pingo + PowerOn=="ON"...
bool powerOnOk = checkPing && hasPowerOn;
// procedo SOLO SE mi da ping OK...
if (checkPing)
{
B_input = powerOnOk ? 1 : 0;
// variabili RUN...
if (!string.IsNullOrEmpty(opcUaParams.keyRunMode))
{
currRun = getDataItemValue(opcUaParams.keyRunMode);
}
// salvo running come = working...
isRunning = isWorking;
// se ho emergenza premuta --> emergenza!
if (hasEStopArmed)
{
B_input += (1 << 7);
}
// se ho emergenza premuta --> emergenza!
if (isWarmUpCoolDown)
{
B_input += (1 << 6);
}
// se ho almeno 1 allarme E NON SONO IN AUTO --> ALARM!
if (hasError)
{
B_input += (1 << 3);
}
if (isWorking)
{
// RUN = LAVORA!
B_input += (1 << 1);
}
else if (powerOnOk && (!isReady || isManual))
{
// se NON ready --> manual
B_input += (1 << 4);
}
}
// se abilitato watchdog...
if (opcUaParams.WatchDog.IsEnabled)
{
if (adesso.Subtract(lastWatchDogPLC).TotalSeconds > 2)
{
lastWatchDogPLC = adesso;
WatchDog++;
WatchDog = WatchDog > opcUaParams.WatchDog.MaxVal ? 0 : WatchDog;
lgTrace($"WatchDog val: {WatchDog}");
try
{
WriteValue commWriteVal = new WriteValue();
commWriteVal.NodeId = new NodeId(opcUaParams.WatchDog.MemConfWrite);
commWriteVal.AttributeId = Attributes.Value;
commWriteVal.Value = new DataValue();
commWriteVal.Value.Value = WatchDog;
List<WriteValue> nodes2Write = new List<WriteValue>();
nodes2Write.Add(commWriteVal);
UA_ref.WriteNodes(nodes2Write);
}
catch (Exception exc)
{
lgError($"Eccezione in gestione WatchDog, valore attuale {WatchDog}{Environment.NewLine}{exc}");
}
}
}
else
{
lgTrace("WatchDog disabilitato");
}
// controllo se sono poweroff e se non ho dati buoni da > 2 minuti --> disconnetto
if (!powerOnOk && adesso.Subtract(lastCurrent).TotalMinutes > 2)
{
tryDisconnect();
}
// solo se non ho veto check
int vFactor = 2;
if (vetoCheckStatus < adesso)
{
lgDebug($"Stato variabili checkPing: {testPingMachine}");
// imposto veto per vetoSeconds...
vetoCheckStatus = adesso.AddSeconds(vetoSeconds * vFactor);
}
// log opzionale!
if (verboseLog)
{
lgDebug($"Trasformazione checkPing: {checkPing} | hasPowerOn: {hasPowerOn} | B_input: {B_input} | currRun = {currRun}");
}
}
/// <summary>
/// Effettua vera scrittura parametri
/// </summary>
/// <param name="updatedPar"></param>
protected override void plcWriteParams(ref List<objItem> updatedPar)
{
dataConf currMem = null;
int byteSize = 0;
string memAddrWrite = "";
string serObj = "";
if (updatedPar != null)
{
List<WriteValue> nodes2Write = new List<WriteValue>();
// controllo i parametri... ne gestisco 4...
foreach (var item in updatedPar)
{
try
{
memAddrWrite = "";
int valInt = 0;
double valReal = 0;
// cerco in area memMapWrite...
if (memMap.mMapWrite.ContainsKey(item.uid))
{
// recupero!
currMem = memMap.mMapWrite[item.uid];
byteSize = currMem.size;
memAddrWrite = currMem.memAddr;
WriteValue commWriteVal = new WriteValue();
commWriteVal.NodeId = new NodeId(currMem.memAddr);
commWriteVal.AttributeId = Attributes.Value;
commWriteVal.Value = new DataValue();
commWriteVal.Value.Value = item.reqValue;
// faccio preliminarmente upsertKey...
upsertKey(currMem.name, currMem.value);
serObj = JsonConvert.SerializeObject(item);
lgInfo($"Inizio processing plcWriteParams per {currMem.name} | valore richiesto {currMem.value}");
lgInfo($"---------------{Environment.NewLine}UPDATED PARAM:{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
serObj = JsonConvert.SerializeObject(currMem);
lgInfo($"---------------{Environment.NewLine}MEMORY CONTENT:{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
switch (currMem.tipoMem)
{
case plcDataType.Boolean:
break;
case plcDataType.Int:
case plcDataType.DInt:
case plcDataType.Word:
case plcDataType.DWord:
int.TryParse(item.reqValue, out valInt);
commWriteVal.Value.Value = valInt;
break;
case plcDataType.Real:
double.TryParse(item.reqValue, out valReal);
commWriteVal.Value.Value = valReal;
break;
case plcDataType.String:
commWriteVal.Value.Value = item.reqValue;
break;
default:
break;
}
lgInfo($"---------------{Environment.NewLine}OPC-UA data:{Environment.NewLine}NodeId: {commWriteVal.NodeId}{Environment.NewLine}Value: {commWriteVal.Value.Value}{Environment.NewLine}---------------");
if (!string.IsNullOrEmpty(memAddrWrite))
{
nodes2Write.Add(commWriteVal);
}
else
{
lgInfo($"Errore: memAddrWrite vuoto!");
}
}
else
{
lgInfo($"Errore uid non trovato in area write memory: {item.uid}, ci sono {memMap.mMapWrite.Count} in area write");
}
}
catch (Exception exc)
{
lgError($"Eccezione in fase di plcWriteParams per item {item.uid} con valore {item.value}{Environment.NewLine}{exc}");
}
}
if (nodes2Write.Count > 0)
{
UA_ref.WriteNodes(nodes2Write);
}
}
}
#endregion Protected Methods
}
}
+203
View File
@@ -0,0 +1,203 @@
using MapoSDK;
using Opc.Ua;
using System;
using System.Collections.Generic;
namespace IOB_WIN_NEXT
{
public class IobOpcUaSiemensOMP : IobOpcUaSiemens
{
#region Public Constructors
/// <summary>
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la
/// gestione specifica per EWON (es Monti, Tenditalia) https://github.com/OPCFoundation/UA-.NETStandard
/// </summary>
/// <param name="caller"></param>
/// <param name="IOBConf"></param>
public IobOpcUaSiemensOMP(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
{
lgInfo("Init OpcUa Siemens versione OMP (Cereria Finassi)");
// inizializzo classe base...
if (!string.IsNullOrEmpty(getOptPar("CHANGE_ODL_MODE")))
{
CHANGE_ODL_MODE = getOptPar("CHANGE_ODL_MODE");
}
sendKeyRichiesta = true;
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Processo i task richiesti e li elimino dalla coda 1:1
/// </summary>
/// <param name="task2exe"></param>
public override Dictionary<string, string> executeTasks(Dictionary<string, string> task2exe)
{
// uso metodo base x salvare esito scrittura
var writeResult = base.executeTasks(task2exe);
// aggiungo comportamento custom: se ho impostato nome ricetta (programma) --> imposto
// richiesta caricamento se ho richiesto reset o fine lavoro --> imposto azzeramento
// esco restituendo risutlato scrittura iniziali
if (task2exe != null)
{
// controllo se memMap != null...
if (memMap != null)
{
bool taskOk = false;
string taskVal = "";
// cerco task specifici x OMP
foreach (var item in task2exe)
{
taskOk = false;
taskVal = "";
// converto richiesta in enum...
taskType tName = taskType.nihil;
Enum.TryParse(item.Key, out tName);
// controllo sulla KEY...
switch (tName)
{
case taskType.setProg:
// recupero dati da memMap...
if (memMap != null && memMap.mMapWrite != null)
{
if (memMap.mMapWrite.ContainsKey(item.Key))
{
dataConf currMem = memMap.mMapWrite[item.Key];
string addr = currMem.memAddr;
taskVal = $"SET task: {item.Key} --> {item.Value} | mem: {currMem.memAddr} - {currMem.size} byte";
// salvo il nuovo valore nella memoria... così prox invio lo trasmetterà
memMap.mMapWrite[item.Key].value = item.Value;
}
else
{
taskVal = $"NO DATA MEM, SET task: {item.Key} --> {item.Value}";
}
}
else
{
taskVal = $"NO MemMap found, SET task: {item.Key} --> {item.Value}";
}
// salvo in currProd..
saveProdData(new KeyValuePair<string, string>(item.Key, item.Value));
break;
case taskType.startSetup:
setFineLotto();
break;
case taskType.stopSetup:
setInizioProd();
break;
default:
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
lgInfo($"Chiamata senza processing: taskOk: {taskOk} | taskVal: {taskVal}");
break;
}
}
}
else
{
lgError($"Attenzione! memMap è nullo, non posso eseguire task2exe!");
}
}
return writeResult;
}
public override bool resetcontapezziPLC()
{
bool answ = false;
try
{
List<WriteValue> nodes2Write = new List<WriteValue>();
foreach (var item in opcUaParams.actResetCounter)
{
WriteValue commWriteVal = new WriteValue();
commWriteVal.NodeId = new NodeId(item.Key);
commWriteVal.AttributeId = Attributes.Value;
commWriteVal.Value = new DataValue();
commWriteVal.Value.Value = item.Value;
nodes2Write.Add(commWriteVal);
}
// vera scrittura
UA_ref.WriteNodes(nodes2Write);
answ = true;
}
catch
{ }
return answ;
}
#endregion Public Methods
#region Private Methods
/// <summary>
/// Azioni specifiche x indicare fine lotto di produzione
/// </summary>
/// <returns></returns>
private bool setFineLotto()
{
bool answ = false;
try
{
List<WriteValue> nodes2Write = new List<WriteValue>();
foreach (var item in opcUaParams.actStopProd)
{
WriteValue commWriteVal = new WriteValue();
commWriteVal.NodeId = new NodeId(item.Key);
commWriteVal.AttributeId = Attributes.Value;
commWriteVal.Value = new DataValue();
commWriteVal.Value.Value = item.Value;
nodes2Write.Add(commWriteVal);
}
// vera scrittura
UA_ref.WriteNodes(nodes2Write);
answ = true;
}
catch
{ }
return answ;
}
/// <summary>
/// Azioni specifiche x iniziare produzione (impostazione ricetta)
/// </summary>
/// <returns></returns>
private bool setInizioProd()
{
bool answ = false;
try
{
List<WriteValue> nodes2Write = new List<WriteValue>();
foreach (var item in opcUaParams.actSetRecipe)
{
WriteValue commWriteVal = new WriteValue();
commWriteVal.NodeId = new NodeId(item.Key);
commWriteVal.AttributeId = Attributes.Value;
commWriteVal.Value = new DataValue();
commWriteVal.Value.Value = item.Value;
nodes2Write.Add(commWriteVal);
}
// vera scrittura
UA_ref.WriteNodes(nodes2Write);
answ = true;
}
catch
{ }
return answ;
}
#endregion Private Methods
}
}
+2 -2
View File
@@ -80,12 +80,12 @@ namespace IOB_WIN_NEXT
try
{
currDispData.semIn = Semaforo.SV;
// in primis salvo data ping comunque...
lastPING = DateTime.Now;
// se passa il ping faccio il resto...
if (testPingMachine == IPStatus.Success)
{
// in primis salvo data ping...
lastPING = DateTime.Now;
connectionOk = true;
}
else
+470 -458
View File
@@ -8,112 +8,6 @@ namespace IOB_WIN_NEXT
{
public class IobSimula : IobGeneric
{
#region Protected Fields
/// <summary>
/// Parametri simulazione oscillazione bit 2
/// </summary>
protected simPar bit2;
/// <summary>
/// Parametri simulazione oscillazione bit 3
/// </summary>
protected simPar bit3;
/// <summary>
/// Parametri simulazione oscillazione bit 4
/// </summary>
protected simPar bit4;
/// <summary>
/// Parametri simulazione oscillazione bit 5
/// </summary>
protected simPar bit5;
/// <summary>
/// Parametri simulazione oscillazione bit 6
/// </summary>
protected simPar bit6;
/// <summary>
/// Parametri simulazione oscillazione bit 7
/// </summary>
protected simPar bit7;
/// <summary>
/// pallet corrente
/// </summary>
protected int cP = 1;
protected bool disableSimStatus = false;
/// <summary>
/// ultimo controllo decremento eventi
/// </summary>
protected DateTime lastEvCheck;
/// <summary>
/// Ultimo istante in cui sono stati generati dati di simulazione
/// </summary>
protected DateTime lastSimData;
/// <summary>
/// Ultimo istante in cui sono stati ridotti dati simulazione duration
/// </summary>
protected DateTime lastRedDuration;
/// <summary>
/// Matricola OPR simulato
/// </summary>
protected int matrOpr = 1;
/// <summary>
/// Durata minima ODL x reset quando pezzi iob > pezzi macchina...
/// </summary>
protected int minDurataODL = 480;
/// <summary>
/// pallet successivo (next)
/// </summary>
protected int nP = 1;
/// <summary>
/// periodo base del simulatore (in millisecondi)
/// </summary>
protected int periodoMSec = 1000;
/// <summary>
/// variabile di appoggio x stato segnale contapezzo
/// </summary>
protected bool sigPzCount = false;
/// <summary>
/// Simulazione registrazione dichiarazioni utente
/// </summary>
protected simPar simDich;
/// <summary>
/// BOOL: indica se simulare powerOn/Off (bit 0 e 1) compresi WarmUp e CoolDown
/// </summary>
protected bool simPowerOnOff;
/// <summary>
/// Simulazione effettuazione controlli utente
/// </summary>
protected simPar simRC;
/// <summary>
/// Simulazione registro scarti utente
/// </summary>
protected simPar simRS;
/// <summary>
/// Tempo di MINIMO attesa x simulazione parametri
/// </summary>
protected int waitSimPar = utils.CRI("waitSimPar");
#endregion Protected Fields
#region Public Fields
/// <summary>
@@ -200,18 +94,454 @@ namespace IOB_WIN_NEXT
#endregion Public Constructors
#region Private Methods
#region Public Methods
/// <summary>
/// Decodifica il resto dell'area x i dati accessori (allarmi, ...)
/// Processo i task richiesti e li elimino dalla coda 1:1 (in realtà SOLO forceSetPzCount x ora)
/// </summary>
private void decodeOtherData()
/// <param name="task2exe"></param>
public override Dictionary<string, string> executeTasks(Dictionary<string, string> task2exe)
{
// Verificare il protocollo: dovrebeb togliere SOLO i task eseguiti...
Dictionary<string, string> taskDone = new Dictionary<string, string>();
// controlo SE sia disabilitata simulazione principale
if (!disableSimStatus)
{
string taskVal = "";
// verifico non sia null
if (task2exe != null)
{
// cerco task specifici
foreach (var item in task2exe)
{
taskVal = "";
// converto richiesta in enum...
taskType tName = taskType.nihil;
Enum.TryParse(item.Key, out tName);
// controllo sulla KEY
switch (tName)
{
case taskType.setArt:
case taskType.setComm:
case taskType.setProg:
case taskType.setPzComm:
memMap.mMapWrite[item.Key].value = item.Value;
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | UPDATED memMap.mMapWrite";
break;
case taskType.setParameter:
// richiedo da URL i parametri WRITE da popolare
lgInfo("Chiamata processMemWriteRequests");
taskVal = processMemWriteRequests();
// se restituiscce "" faccio altra prova...
if (string.IsNullOrEmpty(taskVal))
{
// i parametri me li aspetto come stringa composta paramName|paramvalue
if (item.Value.Contains("|"))
{
string[] paramsJob = item.Value.Split('|');
taskVal = $"REQUEST SET PARAMETERS: {paramsJob[0]} --> {paramsJob[1]}";
}
else
{
taskVal = $"WRONG REQUEST FOR SET PARAMETERS: {item.Value} doesnt contain pipe for splitting key/value";
}
}
break;
case taskType.nihil:
case taskType.fixStopSetup:
case taskType.forceResetPzCount:
case taskType.sendWatchDogMes2Plc:
case taskType.startSetup:
case taskType.stopSetup:
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
break;
case taskType.forceSetPzCount:
// forzo sul SIM il valore pzCount dell'IOB...
int newPzCount = contapezziPLC;
bool fatto = int.TryParse(item.Value, out newPzCount);
if (fatto)
{
// verifico SE sia ammesso il cambio ...
int deltaPzCount = newPzCount - contapezziPLC;
double maxDelta = DateTime.Now.Subtract(plcLastPzRead).TotalMinutes / (plcAvgTc / 60);
// se incremento superiore del doppio atteso --> segnalo errore
// e NON accetto
if (deltaPzCount > (maxDelta * maxPzDeltaPerc) / 100)
{
lgError($"[DELTA CHECK]: intremento contapezziPLC troppo elevato: lettura {newPzCount} | contapezzi attuale: {contapezziPLC} | ultima lettura PLC: {plcLastPzRead} | TCiclo medio: {plcAvgTc}s | incremento accettato ");
}
else
{
contapezziPLC = newPzCount;
taskVal = $"Set new contapezziPLC: {contapezziPLC}";
}
}
break;
default:
taskVal = "SKIPPED | NO EXEC";
break;
}
// aggiungo task!
taskDone.Add(item.Key, taskVal);
}
}
}
return taskDone;
}
/// <summary>
/// Recupera e processa allarmi CNC...
/// </summary>
public override Dictionary<string, string> getCncAlarms()
{
Dictionary<string, string> outVal = new Dictionary<string, string>();
return outVal;
}
/// <summary>
/// Recupero dati dinamici...
/// </summary>
public override Dictionary<string, string> getDynData()
{
// valore non presente in vers default... se gestito fare override
Dictionary<string, string> outVal = new Dictionary<string, string>();
// verificare periodo SIM parametri... se passato li invio altrimenti NO... FIX a 20 sec
if (lastSimData.AddSeconds(waitSimPar) < DateTime.Now)
{
Random rnd = new Random();
// controllo conf memorie json (se ci sono...)
try
{
if (memMap.mMapWrite.Count > 0)
{
foreach (var item in memMap.mMapWrite)
{
outVal.Add(item.Key, item.Value.value);
}
}
if (memMap.mMapRead.Count > 0)
{
foreach (var item in memMap.mMapRead)
{
// se il TIPO di valore è livello --> simulo variazione da MAX --> min,
// con un delta in CALO pari a factor * (80-120)%
if (item.Value.name == "SIM_LEVEL")
{
// verifico last value
float lastVal = 0;
float.TryParse(item.Value.value, out lastVal);
if (lastVal == 0)
{
lastVal = item.Value.maxVal - (float)item.Value.factor;
}
// decremento casuale...
float newVal = lastVal - ((float)item.Value.factor * rnd.Next(40, 120) / 100);
// se inferiore a minimo --> massimo!
if (newVal < item.Value.minVal)
{
newVal = item.Value.maxVal;
}
// salvo il suo VALUE...
item.Value.value = $"{newVal}";
outVal.Add(item.Key, $"{newVal}");
}
// altrimenti siulazione random walk...
else
{
if (item.Value.factor == 1)
{
// uso factor come valore MAX ammesso
int randVal = rnd.Next(item.Value.minVal, item.Value.maxVal);
outVal.Add(item.Key, randVal.ToString());
}
else
{
// uso factor come fattore di divisione x simulare decimali
float randVal = ((float)rnd.Next(item.Value.minVal, item.Value.maxVal)) / (float)item.Value.factor;
outVal.Add(item.Key, randVal.ToString());
}
}
}
}
}
catch
{ }
lastSimData = DateTime.Now;
}
return outVal;
}
/// <summary>
/// Recupero programma in lavorazione
/// </summary>
/// <returns></returns>
public override string getPrgName()
{
// NOME DEL SIM!
string prgName = $"PROG_{cIobConf.codIOB}";
return prgName;
}
/// <summary> Recupero info sistema generiche <returns></returns>
public override Dictionary<string, string> getSysInfo()
{
// valore non presente in vers default... se gestito fare override
Dictionary<string, string> outVal = new Dictionary<string, string>();
outVal.Add("MACHINE", "IOB_SIM");
return outVal;
}
/// <summary>
/// Effettua vero processing contapezzi
/// </summary>
public override void processContapezzi()
{
}
private Random rnd = new Random();
private int currSimAlarmCode = 0;
private List<string> alarmMessages = new List<string>();
/// <summary>
/// Processo contatori eventi...
/// </summary>
public override void processVHF()
{
if (lastEvCheck.AddMilliseconds(periodoMSec) < DateTime.Now)
{
// decremento contatore ultimo evento
try
{
if (bit2 != null)
bit2.wait--;
if (bit3 != null)
bit3.wait--;
if (bit4 != null)
bit4.wait--;
if (bit5 != null)
bit5.wait--;
if (simDich != null)
simDich.wait--;
if (simRC != null)
simRC.wait--;
if (simRS != null)
simRS.wait--;
}
catch
{ }
lastEvCheck = DateTime.Now;
}
}
/// <summary>
/// Effettua lettura semafori principale <paramref name="currDispData">Parametri da
/// aggiornare x display in form</paramref>
/// </summary>
public override void readSemafori(ref newDisplayData currDispData)
{
base.readSemafori(ref currDispData);
// controlo SE sia disabilitata simulazione principale
if (!disableSimStatus)
{
// decodifica e gestione
decodeToBaseBitmap();
decodeOtherData();
reportRawInput(ref currDispData);
}
}
/// <summary>
/// Effettua reset del contapezzi
/// </summary>
/// <returns></returns>
public override bool resetcontapezziPLC()
{
bool answ = false;
// ...SE abilitato da conf IOB
if (cIobConf.optPar.Count > 0 && getOptPar("ENABLE_PZ_RESET") == "TRUE")
{
// fingo di aver fatto...
answ = true;
}
return answ;
}
public override void tryConnect()
{
base.tryConnect();
connectionOk = true;
}
public override void tryDisconnect()
{
base.tryDisconnect();
connectionOk = false;
}
#endregion Public Methods
#region Protected Fields
/// <summary>
/// Parametri simulazione oscillazione bit 2
/// </summary>
protected simPar bit2;
/// <summary>
/// Parametri simulazione oscillazione bit 3
/// </summary>
protected simPar bit3;
/// <summary>
/// Parametri simulazione oscillazione bit 4
/// </summary>
protected simPar bit4;
/// <summary>
/// Parametri simulazione oscillazione bit 5
/// </summary>
protected simPar bit5;
/// <summary>
/// Parametri simulazione oscillazione bit 6
/// </summary>
protected simPar bit6;
/// <summary>
/// Parametri simulazione oscillazione bit 7
/// </summary>
protected simPar bit7;
/// <summary>
/// pallet corrente
/// </summary>
protected int cP = 1;
protected bool disableSimStatus = false;
/// <summary>
/// ultimo controllo decremento eventi
/// </summary>
protected DateTime lastEvCheck;
/// <summary>
/// Ultimo istante in cui sono stati ridotti dati simulazione duration
/// </summary>
protected DateTime lastRedDuration;
/// <summary>
/// Ultimo istante in cui sono stati generati dati di simulazione
/// </summary>
protected DateTime lastSimData;
/// <summary>
/// Matricola OPR simulato
/// </summary>
protected int matrOpr = 1;
/// <summary>
/// Durata minima ODL x reset quando pezzi iob &gt; pezzi macchina...
/// </summary>
protected int minDurataODL = 480;
/// <summary>
/// pallet successivo (next)
/// </summary>
protected int nP = 1;
/// <summary>
/// periodo base del simulatore (in millisecondi)
/// </summary>
protected int periodoMSec = 1000;
/// <summary>
/// variabile di appoggio x stato segnale contapezzo
/// </summary>
protected bool sigPzCount = false;
/// <summary>
/// Simulazione registrazione dichiarazioni utente
/// </summary>
protected simPar simDich;
/// <summary>
/// BOOL: indica se simulare powerOn/Off (bit 0 e 1) compresi WarmUp e CoolDown
/// </summary>
protected bool simPowerOnOff;
/// <summary>
/// Simulazione effettuazione controlli utente
/// </summary>
protected simPar simRC;
/// <summary>
/// Simulazione registro scarti utente
/// </summary>
protected simPar simRS;
/// <summary>
/// Tempo di MINIMO attesa x simulazione parametri
/// </summary>
protected int waitSimPar = utils.CRI("waitSimPar");
#endregion Protected Fields
#region Protected Methods
/// <summary>
/// Salvo valori PLC
/// </summary>
/// <param name="updatedPar"></param>
protected override void plcWriteParams(ref List<objItem> updatedPar)
{
dataConf currMem = null;
int byteSize = 0;
byte[] MemBlock = new byte[1];
string memAddrWrite = "";
string serObj = "";
if (updatedPar != null)
{
// controllo i parametri... ne gestisco 4...
foreach (var item in updatedPar)
{
try
{
memAddrWrite = "";
// cerco in area memMapWrite...
if (memMap.mMapWrite.ContainsKey(item.uid))
{
// recupero!
currMem = memMap.mMapWrite[item.uid];
byteSize = currMem.size;
memAddrWrite = currMem.memAddr;
MemBlock = new byte[byteSize];
// faccio preliminarmente upsertKey...
upsertKey(currMem.name, currMem.value);
serObj = JsonConvert.SerializeObject(item, Formatting.Indented);
lgInfo($"Inizio processing plcWriteParams per {currMem.name} | valore richiesto {currMem.value}{Environment.NewLine}---------------UPDATED PARAM---------------{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
serObj = JsonConvert.SerializeObject(currMem, Formatting.Indented);
lgInfo($"---------------MEMORY CONTENT---------------{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
lgInfo($"---------------MemBlock data---------------{Environment.NewLine}{BitConverter.ToString(MemBlock)}{Environment.NewLine}--------------- END data ---------------");
}
else
{
lgInfo($"Errore uid non trovato in area write memory: {item.uid}, ci sono {memMap.mMapWrite.Count} in area write");
}
}
catch (Exception exc)
{
lgError($"Eccezione in fase di plcWriteParams per item {item.uid} con valore {item.value}{Environment.NewLine}{exc}");
}
}
}
}
/// <summary>
/// Decremento duration del bit indicato secondo stesse regole di ritardo dei bit di wait
@@ -226,21 +556,27 @@ namespace IOB_WIN_NEXT
case 2:
bit2.duration--;
break;
case 3:
bit3.duration--;
break;
case 4:
bit4.duration--;
break;
case 5:
bit5.duration--;
break;
case 6:
bit6.duration--;
break;
case 7:
bit7.duration--;
break;
default:
break;
}
@@ -248,6 +584,27 @@ namespace IOB_WIN_NEXT
}
}
#endregion Protected Methods
#region Private Fields
private List<string> alarmMessages = new List<string>();
private int currSimAlarmCode = 0;
private Random rnd = new Random();
#endregion Private Fields
#region Private Methods
/// <summary>
/// Decodifica il resto dell'area x i dati accessori (allarmi, ...)
/// </summary>
private void decodeOtherData()
{
}
/// <summary>
/// Effettua decodifica aree memoria alla bitmap usata x MAPO
/// </summary>
@@ -655,7 +1012,7 @@ namespace IOB_WIN_NEXT
}
/// <summary>
/// provo a chiamare split ODL
/// provo a chiamare split ODL
/// </summary>
private void trySplitOdl()
{
@@ -674,351 +1031,6 @@ namespace IOB_WIN_NEXT
}
#endregion Private Methods
#region Protected Methods
/// <summary>
/// Salvo valori PLC
/// </summary>
/// <param name="updatedPar"></param>
protected override void plcWriteParams(ref List<objItem> updatedPar)
{
dataConf currMem = null;
int byteSize = 0;
byte[] MemBlock = new byte[1];
string memAddrWrite = "";
string serObj = "";
if (updatedPar != null)
{
// controllo i parametri... ne gestisco 4...
foreach (var item in updatedPar)
{
try
{
memAddrWrite = "";
// cerco in area memMapWrite...
if (memMap.mMapWrite.ContainsKey(item.uid))
{
// recupero!
currMem = memMap.mMapWrite[item.uid];
byteSize = currMem.size;
memAddrWrite = currMem.memAddr;
MemBlock = new byte[byteSize];
// faccio preliminarmente upsertKey...
upsertKey(currMem.name, currMem.value);
serObj = JsonConvert.SerializeObject(item, Formatting.Indented);
lgInfo($"Inizio processing plcWriteParams per {currMem.name} | valore richiesto {currMem.value}{Environment.NewLine}---------------UPDATED PARAM---------------{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
serObj = JsonConvert.SerializeObject(currMem, Formatting.Indented);
lgInfo($"---------------MEMORY CONTENT---------------{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
lgInfo($"---------------MemBlock data---------------{Environment.NewLine}{BitConverter.ToString(MemBlock)}{Environment.NewLine}--------------- END data ---------------");
}
else
{
lgInfo($"Errore uid non trovato in area write memory: {item.uid}, ci sono {memMap.mMapWrite.Count} in area write");
}
}
catch (Exception exc)
{
lgError($"Eccezione in fase di plcWriteParams per item {item.uid} con valore {item.value}{Environment.NewLine}{exc}");
}
}
}
}
#endregion Protected Methods
#region Public Methods
/// <summary>
/// Processo i task richiesti e li elimino dalla coda 1:1 (in realtà SOLO forceSetPzCount x ora)
/// </summary>
/// <param name="task2exe"></param>
public override Dictionary<string, string> executeTasks(Dictionary<string, string> task2exe)
{
// Verificare il protocollo: dovrebeb togliere SOLO i task eseguiti...
Dictionary<string, string> taskDone = new Dictionary<string, string>();
// controlo SE sia disabilitata simulazione principale
if (!disableSimStatus)
{
string taskVal = "";
// verifico non sia null
if (task2exe != null)
{
// cerco task specifici
foreach (var item in task2exe)
{
taskVal = "";
// converto richiesta in enum...
taskType tName = taskType.nihil;
Enum.TryParse(item.Key, out tName);
// controllo sulla KEY
switch (tName)
{
case taskType.setArt:
case taskType.setComm:
case taskType.setProg:
case taskType.setPzComm:
memMap.mMapWrite[item.Key].value = item.Value;
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | UPDATED memMap.mMapWrite";
break;
case taskType.setParameter:
// richiedo da URL i parametri WRITE da popolare
lgInfo("Chiamata processMemWriteRequests");
taskVal = processMemWriteRequests();
// se restituiscce "" faccio altra prova...
if (string.IsNullOrEmpty(taskVal))
{
// i parametri me li aspetto come stringa composta paramName|paramvalue
if (item.Value.Contains("|"))
{
string[] paramsJob = item.Value.Split('|');
taskVal = $"REQUEST SET PARAMETERS: {paramsJob[0]} --> {paramsJob[1]}";
}
else
{
taskVal = $"WRONG REQUEST FOR SET PARAMETERS: {item.Value} doesnt contain pipe for splitting key/value";
}
}
break;
case taskType.nihil:
case taskType.fixStopSetup:
case taskType.forceResetPzCount:
case taskType.sendWatchDogMes2Plc:
case taskType.startSetup:
case taskType.stopSetup:
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
break;
case taskType.forceSetPzCount:
// forzo sul SIM il valore pzCount dell'IOB...
int newPzCount = contapezziPLC;
bool fatto = int.TryParse(item.Value, out newPzCount);
if (fatto)
{
// verifico SE sia ammesso il cambio ...
int deltaPzCount = newPzCount - contapezziPLC;
double maxDelta = DateTime.Now.Subtract(plcLastPzRead).TotalMinutes / (plcAvgTc / 60);
// se incremento superiore del doppio atteso --> segnalo errore e NON accetto
if (deltaPzCount > (maxDelta * maxPzDeltaPerc) / 100)
{
lgError($"[DELTA CHECK]: intremento contapezziPLC troppo elevato: lettura {newPzCount} | contapezzi attuale: {contapezziPLC} | ultima lettura PLC: {plcLastPzRead} | TCiclo medio: {plcAvgTc}s | incremento accettato ");
}
else
{
contapezziPLC = newPzCount;
taskVal = $"Set new contapezziPLC: {contapezziPLC}";
}
}
break;
default:
taskVal = "SKIPPED | NO EXEC";
break;
}
// aggiungo task!
taskDone.Add(item.Key, taskVal);
}
}
}
return taskDone;
}
/// <summary>
/// Recupera e processa allarmi CNC...
/// </summary>
public override Dictionary<string, string> getCncAlarms()
{
Dictionary<string, string> outVal = new Dictionary<string, string>();
return outVal;
}
/// <summary>
/// Recupero dati dinamici...
/// </summary>
public override Dictionary<string, string> getDynData()
{
// valore non presente in vers default... se gestito fare override
Dictionary<string, string> outVal = new Dictionary<string, string>();
// verificare periodo SIM parametri... se passato li invio altrimenti NO... FIX a 20 sec
if (lastSimData.AddSeconds(waitSimPar) < DateTime.Now)
{
Random rnd = new Random();
// controllo conf memorie json (se ci sono...)
try
{
if (memMap.mMapWrite.Count > 0)
{
foreach (var item in memMap.mMapWrite)
{
outVal.Add(item.Key, item.Value.value);
}
}
if (memMap.mMapRead.Count > 0)
{
foreach (var item in memMap.mMapRead)
{
// se il TIPO di valore è livello --> simulo variazione da MAX --> min, con un delta in CALO pari a factor * (80-120)%
if (item.Value.name == "SIM_LEVEL")
{
// verifico last value
float lastVal = 0;
float.TryParse(item.Value.value, out lastVal);
if (lastVal == 0)
{
lastVal = item.Value.maxVal - (float)item.Value.factor;
}
// decremento casuale...
float newVal = lastVal - ((float)item.Value.factor * rnd.Next(40, 120) / 100);
// se inferiore a minimo --> massimo!
if (newVal < item.Value.minVal)
{
newVal = item.Value.maxVal;
}
// salvo il suo VALUE...
item.Value.value = $"{newVal}";
outVal.Add(item.Key, $"{newVal}");
}
// altrimenti siulazione random walk...
else
{
if (item.Value.factor == 1)
{
// uso factor come valore MAX ammesso
int randVal = rnd.Next(item.Value.minVal, item.Value.maxVal);
outVal.Add(item.Key, randVal.ToString());
}
else
{
// uso factor come fattore di divisione x simulare decimali
float randVal = ((float)rnd.Next(item.Value.minVal, item.Value.maxVal)) / (float)item.Value.factor;
outVal.Add(item.Key, randVal.ToString());
}
}
}
}
}
catch
{ }
lastSimData = DateTime.Now;
}
return outVal;
}
/// <summary>
/// Recupero programma in lavorazione
/// </summary>
/// <returns></returns>
public override string getPrgName()
{
// NOME DEL SIM!
string prgName = $"PROG_{cIobConf.codIOB}";
return prgName;
}
/// <summary>
/// Recupero info sistema generiche
/// <returns></returns>
public override Dictionary<string, string> getSysInfo()
{
// valore non presente in vers default... se gestito fare override
Dictionary<string, string> outVal = new Dictionary<string, string>();
outVal.Add("MACHINE", "IOB_SIM");
return outVal;
}
/// <summary>
/// Effettua vero processing contapezzi
/// </summary>
public override void processContapezzi()
{
}
/// <summary>
/// Processo contatori eventi...
/// </summary>
public override void processVHF()
{
if (lastEvCheck.AddMilliseconds(periodoMSec) < DateTime.Now)
{
// decremento contatore ultimo evento
try
{
if (bit2 != null)
bit2.wait--;
if (bit3 != null)
bit3.wait--;
if (bit4 != null)
bit4.wait--;
if (bit5 != null)
bit5.wait--;
if (simDich != null)
simDich.wait--;
if (simRC != null)
simRC.wait--;
if (simRS != null)
simRS.wait--;
}
catch
{ }
lastEvCheck = DateTime.Now;
}
}
/// <summary>
/// Effettua lettura semafori principale
/// <paramref name="currDispData">Parametri da aggiornare x display in form</paramref>
/// </summary>
public override void readSemafori(ref newDisplayData currDispData)
{
base.readSemafori(ref currDispData);
// controlo SE sia disabilitata simulazione principale
if (!disableSimStatus)
{
// decodifica e gestione
decodeToBaseBitmap();
decodeOtherData();
reportRawInput(ref currDispData);
}
}
/// <summary>
/// Effettua reset del contapezzi
/// </summary>
/// <returns></returns>
public override bool resetcontapezziPLC()
{
bool answ = false;
// ...SE abilitato da conf IOB
if (cIobConf.optPar.Count > 0 && getOptPar("ENABLE_PZ_RESET") == "TRUE")
{
// fingo di aver fatto...
answ = true;
}
return answ;
}
public override void tryConnect()
{
base.tryConnect();
connectionOk = true;
}
public override void tryDisconnect()
{
base.tryDisconnect();
connectionOk = false;
}
#endregion Public Methods
}
/// <summary>
+7 -1
View File
@@ -57,6 +57,11 @@ namespace IOB_WIN_NEXT
/// </summary>
protected int MAXCNC = 1;
/// <summary>
/// Valore minimo x considerare variazione delta parametri IOB solo x dati DataOra esecuzione
/// </summary>
protected int MinDeltaSec = 2;
/// <summary>
/// Modalità di avvio
/// </summary>
@@ -662,6 +667,7 @@ namespace IOB_WIN_NEXT
CMDREBO = fIni.ReadString("SERVER", "CMDREBO", "/IOB/sendRebootGateway?GWIP=");
CMDIOB2CALL = fIni.ReadString("SERVER", "CMDIOB2CALL", "/IOB/getIob2call?GWIP=");
MAXCNC = fIni.ReadInteger("IOB", "MAXCNC", 1);
MinDeltaSec = fIni.ReadInteger("IOB", "MinDeltaSec", 1);
string STARTLIST = fIni.ReadString("IOB", "STARTLIST", "");
// Gestione IOB da avviare
IOB2START = new List<string>();
@@ -703,7 +709,7 @@ namespace IOB_WIN_NEXT
{
firstIob = IOB2START[0];
}
redisMan = new RedisIobCache(MPIP, firstIob, "NA");
redisMan = new RedisIobCache(MPIP, firstIob, "NA", MinDeltaSec);
}
/// <summary>
+1 -1
View File
@@ -443,7 +443,7 @@ namespace IOB_WIN_NEXT
false,
false,
m_configuration.ApplicationName,
30 * 60 * 1000,
60 * 60 * 1000,
CurrUserIdentity,
null
);
+2 -2
View File
@@ -3,10 +3,10 @@
<package id="Autoupdater.NET.Official" version="1.7.0" targetFramework="net462" />
<package id="EasyModbusTCP" version="5.6.0" targetFramework="net462" />
<package id="EgwProxy.Icoel" version="3.6.2206.2811" targetFramework="net462" />
<package id="EgwProxy.MultiCncLib" version="3.6.2207.1116" targetFramework="net462" />
<package id="EgwProxy.MultiCncLib" version="3.6.2207.1211" targetFramework="net462" />
<package id="EgwProxy.OsaiCncLib" version="3.6.2205.2015" targetFramework="net462" />
<package id="EntityFramework" version="6.4.4" targetFramework="net462" />
<package id="MapoSDK" version="6.14.2206.2718" targetFramework="net462" />
<package id="MapoSDK" version="6.14.2207.2913" targetFramework="net462" />
<package id="MathNet.Numerics" version="4.15.0" targetFramework="net462" />
<package id="Microsoft.CodeAnalysis.NetAnalyzers" version="6.0.0" targetFramework="net462" developmentDependency="true" />
<package id="Microsoft.VisualStudio.SlowCheetah" version="4.0.8" targetFramework="net462" developmentDependency="true" />
+14 -24
View File
@@ -34,8 +34,7 @@ MOVE /Y %2"zh" %2"lib\"
if %1 == "Release" goto Release
if %1 == "Debug" goto Debug
REM if %1 == "FANUC" goto FANUC
REM if %1 == "SIEMENS" goto SIEMENS
if %1 == "Remote_DEBUG" goto RemoteDebug
:Release
REM INIZIO eliminando i files pdb
@@ -46,29 +45,20 @@ goto END
:Debug
echo Debug: nulla da eliminare
REM copia script verso server remoto
REM ROBOCOPY . \\10.150.0.1\Steamware\IOB-WIN-NEXT-DEB /MIR
goto END
:RemoteDebug
echo Debug remoto: effettuo robocopy sync
REM copia script verso server remoto (FINASSI)
ROBOCOPY . \\10.150.0.1\Steamware\IOB-WIN-NEXT-DEB /MIR
goto END
REM :CMS
REM echo CMS: Elimino files IOT di SCM
REM REM INIZIO eliminando i files pdb
REM del /S %2"*.pdb""
REM del %2"DATA\CONF\IOT_ByteList.map"
REM del %2"DATA\CONF\IOT_WordList.map"
REM del %2"DATA\CONF\IOT_DWordList.map"
REM del %2"DATA\CONF\IOT_StringList.map"
REM del %2"DATA\CONF\EsaKvara.ini"
REM del /S %2"SCMEgwProxy.MultiCncLib.dll"
REM del /S %2"SCMEgwProxy.MultiCncLib.xml"
REM ora verifico tipo controllo esatto...
REM if %1 == "CMS-FANUC" goto FANUC
REM if %1 == "CMS-SIEMENS" goto SIEMENS
REM if %1 == "CMS-OSAI" goto OSAI
REM
REM :FANUC
REM goto END
REM
REM :SIEMENS
REM goto END
:END
echo Fatto!
+16 -75
View File
@@ -2,83 +2,24 @@
echo Effettua setup dei file specifici per i vari ambienti pre build installer: verifica da nome configurazione %1
REM if %1 == "Release" goto Release
REM if %1 == "Debug" goto Debug
REM if %1 == "FANUC" goto CMS
REM if %1 == "SIEMENS" goto CMS
REM
REM :Release
REM echo Release: nulla da copiare
REM goto END
REM
REM :Debug
REM echo Debug: copia file ini x simulazione ESA
if %1 == "Release" goto Release
if %1 == "Debug" goto Debug
if %1 == "Remote_DEBUG" goto RemoteDebug
:Release
echo Release: nulla da copiare
goto END
:Debug
echo Debug: copia file ini x simulazione Debug
REM del %2"DATA\CONF\EsaKvara.ini"
REM copy %2"Resources\SCM\EsaKvara_SIM.ini" %2"DATA\CONF\EsaKvara.ini"
REM goto END
REM
REM :CMS
REM echo CMS: copio files CMS - Zogno
REM del %2"Resources\MTCA.ico"
REM del %2"DATA\CONF\Adapter_ItemList.xml"
REM del %2"DATA\CONF\AlarmList.map"
REM del %2"DATA\CONF\AlarmListCNC.map"
REM del %2"DATA\CONF\AnalogData.map"
REM del %2"DATA\CONF\CounterList.map"
REM del %2"DATA\CONF\StatusList.map"
REM REM del /F /Q %2"DATA\CONF\*.*"
REM copy %2"Resources\CMS\CMS.ico" %2"Resources\MTCA.ico"
REM copy %2"Resources\CMS\AlarmListEmpty.map" %2"DATA\CONF\AlarmListCNC.map"
REM REM ora verifico tipo controllo esatto...
REM if %1 == "CMS-FANUC" goto FANUC
REM if %1 == "CMS-SIEMENS" goto SIEMENS
REM if %1 == "CMS-OSAI" goto OSAI
REM
REM :SCM
REM echo SCM: copio files SCM - Rimini
REM del %2"Resources\MTCA.ico"
REM del %2"DATA\CONF\Adapter_ItemList.xml"
REM del %2"DATA\CONF\AlarmList.map"
REM REM del %2"DATA\CONF\EsaKvara.ini"
REM del %2"DATA\CONF\IOT_ByteList.map"
REM del %2"DATA\CONF\IOT_WordList.map"
REM del %2"DATA\CONF\IOT_DWordList.map"
REM del %2"DATA\CONF\IOT_StringList.map"
REM REM del /F /Q %2"DATA\CONF\*.*"
REM copy %2"Resources\SCM\SCM.ico" %2"Resources\MTCA.ico"
REM copy %2"Resources\SCM\SCM_ESA.xml" %2"DATA\CONF\Adapter_ItemList.xml"
REM copy %2"Resources\SCM\AlarmListEsaGv.map" %2"DATA\CONF\AlarmList.map"
REM copy %2"Resources\SCM\AlarmListEsaGvCNC.map" %2"DATA\CONF\AlarmListCNC.map"
REM copy %2"Resources\SCM\EsaKvara_PROD.ini" %2"DATA\CONF\EsaKvara.ini"
REM copy %2"Resources\SCM\IOT_ByteList.map" %2"DATA\CONF\IOT_ByteList.map"
REM copy %2"Resources\SCM\IOT_WordList.map" %2"DATA\CONF\IOT_WordList.map"
REM copy %2"Resources\SCM\IOT_DWordList.map" %2"DATA\CONF\IOT_DWordList.map"
REM copy %2"Resources\SCM\IOT_StringList.map" %2"DATA\CONF\IOT_StringList.map"
REM goto END
REM
REM :FANUC
REM copy %2"Resources\CMS\FANUC.xml" %2"DATA\CONF\Adapter_ItemList.xml"
REM copy %2"Resources\CMS\AlarmListFANUC.map" %2"DATA\CONF\AlarmList.map"
REM copy %2"Resources\CMS\AnalogDataFANUC.map" %2"DATA\CONF\AnalogData.map"
REM copy %2"Resources\CMS\CounterListFANUC.map" %2"DATA\CONF\CounterList.map"
REM copy %2"Resources\CMS\StatusListFANUC.map" %2"DATA\CONF\StatusList.map"
REM goto END
REM
REM :SIEMENS
REM copy %2"Resources\CMS\SIEMENS.xml" %2"DATA\CONF\Adapter_ItemList.xml"
REM copy %2"Resources\CMS\AlarmListSIEMENS.map" %2"DATA\CONF\AlarmList.map"
REM copy %2"Resources\CMS\AnalogDataSIEMENS.map" %2"DATA\CONF\AnalogData.map"
REM copy %2"Resources\CMS\CounterListSIEMENS.map" %2"DATA\CONF\CounterList.map"
REM copy %2"Resources\CMS\StatusListSIEMENS.map" %2"DATA\CONF\StatusList.map"
REM goto END
REM
REM :OSAI
REM copy %2"Resources\CMS\OSAI.xml" %2"DATA\CONF\Adapter_ItemList.xml"
REM copy %2"Resources\CMS\AlarmListOSAI.map" %2"DATA\CONF\AlarmList.map"
REM copy %2"Resources\CMS\AnalogDataOSAI.map" %2"DATA\CONF\AnalogData.map"
REM copy %2"Resources\CMS\CounterListOSAI.map" %2"DATA\CONF\CounterList.map"
REM copy %2"Resources\CMS\StatusListOSAI.map" %2"DATA\CONF\StatusList.map"
REM goto END
goto END
:RemoteDebug
echo RemoteDebug: nulla da copiare
goto END
:END
echo Fatto!
+19
View File
@@ -60,6 +60,25 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote_DEBUG|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Remote_DEBUG\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote_DEBUG|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Remote_DEBUG\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />