diff --git a/AgentBin/simulator/CMS_DEMO.xml b/AgentBin/simulator/CMS_DEMO.xml
index 0ad5e1a..9852ad1 100644
--- a/AgentBin/simulator/CMS_DEMO.xml
+++ b/AgentBin/simulator/CMS_DEMO.xml
@@ -226,11 +226,13 @@
+
+
diff --git a/AgentBin/simulator/SCM_DEMO.xml b/AgentBin/simulator/SCM_DEMO.xml
index e6943d9..3dc2e03 100644
--- a/AgentBin/simulator/SCM_DEMO.xml
+++ b/AgentBin/simulator/SCM_DEMO.xml
@@ -226,11 +226,13 @@
+
+
diff --git a/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml b/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml
index 32b138e..3dae1b3 100644
--- a/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml
+++ b/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml
@@ -15,6 +15,10 @@
VacPump_01_Status
0
+
+ VacPump_01_WrkTime
+ 0
+
@@ -26,6 +30,10 @@
VacPump_02_Status
0
+
+ VacPump_02_WrkTime
+ 0
+
diff --git a/MTC_Sim/MTC_Sim/AdapterConf/SCM_ESA.xml b/MTC_Sim/MTC_Sim/AdapterConf/SCM_ESA.xml
index a9445be..d62573e 100644
--- a/MTC_Sim/MTC_Sim/AdapterConf/SCM_ESA.xml
+++ b/MTC_Sim/MTC_Sim/AdapterConf/SCM_ESA.xml
@@ -15,6 +15,10 @@
VacPump_01_Status
0
+
+ VacPump_01_WrkTime
+ 0
+
@@ -26,6 +30,10 @@
VacPump_02_Status
0
+
+ VacPump_02_WrkTime
+ 0
+
diff --git a/MTC_Sim/MTC_Sim/AdapterFanuc.cs b/MTC_Sim/MTC_Sim/AdapterFanuc.cs
index ecc728d..3507ee7 100644
--- a/MTC_Sim/MTC_Sim/AdapterFanuc.cs
+++ b/MTC_Sim/MTC_Sim/AdapterFanuc.cs
@@ -841,11 +841,11 @@ namespace MTC_Adapter
}
else if (maintData[i].varName.StartsWith("Lubro_"))
{
- if (maintData[i].varName.EndsWith("_Count"))
+ if (maintData[i].varName.EndsWith("_Num"))
{
try
{
- numero = Convert.ToInt32(maintData[i].varName.Replace("Lubro_", "").Replace("_Count", ""));
+ numero = Convert.ToInt32(maintData[i].varName.Replace("Lubro_", "").Replace("_Num", ""));
}
catch
{ }
diff --git a/MTC_Sim/MTC_Sim/AdapterGeneric.cs b/MTC_Sim/MTC_Sim/AdapterGeneric.cs
index 5e24840..5196ad9 100644
--- a/MTC_Sim/MTC_Sim/AdapterGeneric.cs
+++ b/MTC_Sim/MTC_Sim/AdapterGeneric.cs
@@ -1230,10 +1230,12 @@ namespace MTC_Adapter
}
currPathPartId = new string[currAdpConf.nPath];
istPathPartId = new string[currAdpConf.nPath];
+ currPathPartCount = new uint[currAdpConf.nPath];
+ istPathPartCount = new uint[currAdpConf.nPath];
for (int i = 0; i < currAdpConf.nPath; i++)
{
// leggo tutti i dati...
- List> listaDR = currAdpConf.Axis[i].dataRefList;
+ List> listaDR = currAdpConf.Path[i].dataRefList;
// punto all'item
DataRefItem riPathProgr = listaDR.Find(x => x.Key == string.Format("Path_{0:00}_PartId", i + 1));
DataRefItem riPathPzTot = listaDR.Find(x => x.Key == string.Format("Path_{0:00}_PZ_TOT", i + 1));
@@ -1279,7 +1281,7 @@ namespace MTC_Adapter
mAlarmCNC.Normal();
mAlarmPLC.Normal();
mAlarmGeneral.Normal();
- lg.Info("Adapter Started!");
+ parentForm.displayTaskAndWait("Adapter Started!");
}
///
/// Effettua refresh del vettore privato degli allarmi attivi
@@ -1297,13 +1299,13 @@ namespace MTC_Adapter
public void stopAdapter()
{
mStatus.Value = "OFF";
- lg.Info("Stopping adapter...");
+ parentForm.displayTaskAndWait("Stopping adapter...");
// chiudo la connessione all'adapter...
tryDisconnect();
// Stop everything...
mAdapter.Stop();
dtStopAdp = DateTime.Now;
- lg.Info("Adapter Stopped!");
+ parentForm.displayTaskAndWait("Adapter Stopped!");
}
///
@@ -1318,62 +1320,76 @@ namespace MTC_Adapter
// controllo non sia già in esecuzione...
if (!adpRunning)
{
- // imposto flag adapter running..
- adpRunning = true;
-
- // avvio fase raccolta dati
- mAdapter.Begin();
-
- // processing degli strobes di allarme (da ULTIMA rappresentazione vettore dell'ADP)
- processAlarm();
- // processo e svuoto eventuali code di invio per Codici M/S/T
- trySendCodMST();
-
- // ciclo HF: recupero update status & strobes vari
- if (ciclo == gatherCycle.HF)
+ // provo ad avviare
+ try
{
- // parte che eseguo SEMPRE: RECUPERO stato di tutti gli strobe/status e degli ack attualmente noti
- getStrobeAndAckStatus();
-
- // faccio refresh degli allarmi segnalati (da strobe su vettore locale)
- refreshAlarmState(STRB_DW0, true);
- // acquisizione degli status
- processStatus();
- // processing degli strobes
- processStrobe();
+ // avvio fase raccolta dati
+ mAdapter.Begin();
+ // imposto flag adapter running..
+ adpRunning = true;
}
- else if (ciclo == gatherCycle.MF)
+ catch (Exception exc)
{
- // leggo parametri a media freq (dati globali, path, assi, Unità Operatrice)
- getGlobalData();
- getUnOp();
- getPath();
- getAxis();
+ parentForm.displayTaskAndWait(string.Format("Adapter NO STARTED!!!{0}{1}", Environment.NewLine, exc));
+ adpRunning = false;
}
- // ciclo lento
- else if (ciclo == gatherCycle.LF)
+ if (adpRunning)
{
- // leggo EVENTUALI parametri da config file
- getConfigParam();
- ///acquisisco dati su programma in esecuzione e dati generali (stato, orologio, power...)
- getSlowChangingData();
+ // processing degli strobes di allarme (da ULTIMA rappresentazione vettore dell'ADP)
+ processAlarm();
+ // processo e svuoto eventuali code di invio per Codici M/S/T
+ trySendCodMST();
- // eventuale log!
- if (utils.CRB("recTime")) logTimeResults();
+ // ciclo HF: recupero update status & strobes vari
+ if (ciclo == gatherCycle.HF)
+ {
+ // parte che eseguo SEMPRE: RECUPERO stato di tutti gli strobe/status e degli ack attualmente noti
+ getStrobeAndAckStatus();
+
+ // faccio refresh degli allarmi segnalati (da strobe su vettore locale)
+ refreshAlarmState(STRB_DW0, true);
+ // acquisizione degli status
+ processStatus();
+ // processing degli strobes
+ processStrobe();
+ }
+ else if (ciclo == gatherCycle.MF)
+ {
+ // leggo parametri a media freq (dati globali, path, assi, Unità Operatrice)
+ getGlobalData();
+ getUnOp();
+ getPath();
+ getAxis();
+ }
+ // ciclo lento
+ else if (ciclo == gatherCycle.LF)
+ {
+ // leggo EVENTUALI parametri da config file
+ getConfigParam();
+ ///acquisisco dati su programma in esecuzione e dati generali (stato, orologio, power...)
+ getSlowChangingData();
+
+ // eventuale log!
+ if (utils.CRB("recTime")) logTimeResults();
+ }
+ // ciclo lentissimo
+ else if (ciclo == gatherCycle.VLF)
+ {
+ lg.Info("Richiesta lettura completa allarmi attivi");
+ // faccio comunque rilettura completa allarmi...
+ forceAlarmCheck();
+ }
+
+ // INVIO dati variati!
+ mAdapter.SendChanged();
+
+ // tolgo flag running
+ adpRunning = false;
}
- // ciclo lentissimo
- else if (ciclo == gatherCycle.VLF)
+ else
{
- lg.Info("Richiesta lettura completa allarmi attivi");
- // faccio comunque rilettura completa allarmi...
- forceAlarmCheck();
+ lg.Info("ADP not running...");
}
-
- // INVIO dati variati!
- mAdapter.SendChanged();
-
- // tolgo flag running
- adpRunning = false;
}
else
{
diff --git a/MTC_Sim/MTC_Sim/App.config b/MTC_Sim/MTC_Sim/App.config
index 2d95857..51bdca7 100644
--- a/MTC_Sim/MTC_Sim/App.config
+++ b/MTC_Sim/MTC_Sim/App.config
@@ -4,7 +4,9 @@
+
+
diff --git a/MTC_Sim/MTC_Sim/MTC-Adapter.csproj b/MTC_Sim/MTC_Sim/MTC-Adapter.csproj
index 05ebc39..cd9c267 100644
--- a/MTC_Sim/MTC_Sim/MTC-Adapter.csproj
+++ b/MTC_Sim/MTC_Sim/MTC-Adapter.csproj
@@ -152,7 +152,9 @@
Always
-
+
+ Always
+
Always
diff --git a/MTC_Sim/MTC_Sim/MainForm.Designer.cs b/MTC_Sim/MTC_Sim/MainForm.Designer.cs
index 93e01fc..52b8203 100644
--- a/MTC_Sim/MTC_Sim/MainForm.Designer.cs
+++ b/MTC_Sim/MTC_Sim/MainForm.Designer.cs
@@ -115,7 +115,7 @@
this.STATUS_STRB_DW0 = new System.Windows.Forms.TextBox();
this.lblPLC_ADP = new System.Windows.Forms.Label();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
- this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
+ this.lblStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.MainProgrBar = new System.Windows.Forms.ToolStripProgressBar();
this.groupBox13 = new System.Windows.Forms.GroupBox();
this.cbPathSel = new System.Windows.Forms.ComboBox();
@@ -212,6 +212,8 @@
this.lblCodaM = new System.Windows.Forms.Label();
this.addCodM = new System.Windows.Forms.TextBox();
this.label20 = new System.Windows.Forms.Label();
+ this.lblApp = new System.Windows.Forms.ToolStripStatusLabel();
+ this.lblVers = new System.Windows.Forms.ToolStripStatusLabel();
this.groupBox4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PosAct)).BeginInit();
this.groupBox3.SuspendLayout();
@@ -1046,19 +1048,21 @@
//
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.toolStripStatusLabel1,
- this.MainProgrBar});
+ this.lblApp,
+ this.lblStatus,
+ this.MainProgrBar,
+ this.lblVers});
this.statusStrip1.Location = new System.Drawing.Point(0, 716);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(785, 25);
this.statusStrip1.TabIndex = 59;
this.statusStrip1.Text = "statusStrip1";
//
- // toolStripStatusLabel1
+ // lblStatus
//
- this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
- this.toolStripStatusLabel1.Size = new System.Drawing.Size(52, 20);
- this.toolStripStatusLabel1.Text = "Running";
+ this.lblStatus.Name = "lblStatus";
+ this.lblStatus.Size = new System.Drawing.Size(22, 20);
+ this.lblStatus.Text = "---";
//
// MainProgrBar
//
@@ -1449,7 +1453,7 @@
this.tbConf.Location = new System.Drawing.Point(4, 22);
this.tbConf.Name = "tbConf";
this.tbConf.Padding = new System.Windows.Forms.Padding(3);
- this.tbConf.Size = new System.Drawing.Size(777, 636);
+ this.tbConf.Size = new System.Drawing.Size(777, 640);
this.tbConf.TabIndex = 1;
this.tbConf.Text = "XML CONFIG";
//
@@ -1459,7 +1463,7 @@
this.wbXmlConf.Location = new System.Drawing.Point(3, 3);
this.wbXmlConf.MinimumSize = new System.Drawing.Size(20, 20);
this.wbXmlConf.Name = "wbXmlConf";
- this.wbXmlConf.Size = new System.Drawing.Size(771, 630);
+ this.wbXmlConf.Size = new System.Drawing.Size(771, 634);
this.wbXmlConf.TabIndex = 0;
//
// tpSIM
@@ -1479,7 +1483,7 @@
this.tpSIM.Controls.Add(this.groupBox12);
this.tpSIM.Location = new System.Drawing.Point(4, 22);
this.tpSIM.Name = "tpSIM";
- this.tpSIM.Size = new System.Drawing.Size(777, 636);
+ this.tpSIM.Size = new System.Drawing.Size(777, 640);
this.tpSIM.TabIndex = 2;
this.tpSIM.Text = "SIMULATION";
//
@@ -2017,6 +2021,22 @@
this.label20.TabIndex = 52;
this.label20.Text = "AddM";
//
+ // lblApp
+ //
+ this.lblApp.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
+ this.lblApp.ForeColor = System.Drawing.SystemColors.ControlText;
+ this.lblApp.Name = "lblApp";
+ this.lblApp.Size = new System.Drawing.Size(16, 20);
+ this.lblApp.Text = "...";
+ //
+ // lblVers
+ //
+ this.lblVers.Font = new System.Drawing.Font("Segoe UI", 8F);
+ this.lblVers.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
+ this.lblVers.Name = "lblVers";
+ this.lblVers.Size = new System.Drawing.Size(16, 20);
+ this.lblVers.Text = "...";
+ //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -2126,7 +2146,7 @@
private System.Windows.Forms.TextBox OPERATOR_ID;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.StatusStrip statusStrip1;
- private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
+ private System.Windows.Forms.ToolStripStatusLabel lblStatus;
private System.Windows.Forms.ToolStripProgressBar MainProgrBar;
private System.Windows.Forms.TextBox txtPzKo;
private System.Windows.Forms.Label label25;
@@ -2261,6 +2281,8 @@
private System.Windows.Forms.CheckBox ErrRT_03;
private System.Windows.Forms.Label lblOutMessage;
private System.Windows.Forms.Label label53;
+ private System.Windows.Forms.ToolStripStatusLabel lblApp;
+ private System.Windows.Forms.ToolStripStatusLabel lblVers;
}
}
diff --git a/MTC_Sim/MTC_Sim/MainForm.cs b/MTC_Sim/MTC_Sim/MainForm.cs
index c356b18..fde7b8f 100644
--- a/MTC_Sim/MTC_Sim/MainForm.cs
+++ b/MTC_Sim/MTC_Sim/MainForm.cs
@@ -31,6 +31,8 @@ namespace MTC_Adapter
protected int slowCount;
protected int alarmSyncCount;
+ protected int startTimerMs;
+
public static Logger lg;
@@ -70,21 +72,41 @@ namespace MTC_Adapter
Name = name; Value = value;
}
}
+ ///
+ /// mostra un testo sulal status bar ed attende startTimerMs
+ ///
+ ///
+ public void displayTaskAndWait(string txt2show)
+ {
+ lblStatus.Text = txt2show;
+ lg.Info(txt2show);
+ Thread.Sleep(startTimerMs);
+ }
#endregion
public MainForm()
{
InitializeComponent();
+ lblStatus.Text = "Loading";
+
+ // fix icon!
+ this.Icon = Icon.ExtractAssociatedIcon(defIconFilePath);
+
+ // fix versione!
+ lblApp.Text = string.Format("{0}", ConfigurationManager.AppSettings.Get("appName"));
+ lblVers.Text = string.Format(" v.{0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
+
+ startTimerMs = utils.CRI("startTimerMs");
lg = LogManager.GetCurrentClassLogger();
- lg.Info("Avvio MainForm");
+ displayTaskAndWait("Starting MainForm");
// inizio con tab control disabilitati
EnableTab(tabCtrlMain.TabPages[1], false);
EnableTab(tabCtrlMain.TabPages[2], false);
- // seabilitato autoload conf leggo file corretto...
+ // se abilitato autoload conf leggo file corretto...
if (utils.CRB("autoLoadConf"))
{
loadXmlFile(defConfFilePath);
@@ -95,7 +117,10 @@ namespace MTC_Adapter
tipoScelto = tipoAdapter.ND;
adpConf = new AdapterConf();
loadAdapterType();
+ displayTaskAndWait("Waiting for config file selection");
}
+
+ displayTaskAndWait("Running");
}
protected string defConfFilePath
{
@@ -104,6 +129,13 @@ namespace MTC_Adapter
return string.Format(@"{0}\{1}\{2}", Application.StartupPath, utils.CRS("adapterConfPath"), utils.CRS("defaultConfFile"));
}
}
+ protected string defIconFilePath
+ {
+ get
+ {
+ return string.Format(@"{0}\MTCA.ico", Application.StartupPath);
+ }
+ }
///
/// carica adapter richiesto
@@ -143,7 +175,7 @@ namespace MTC_Adapter
// carico i default values su interfaccia
setDefaults();
- lg.Info("Caricata conf per adapter {0}", tipoScelto);
+ displayTaskAndWait(string.Format("Caricata conf per adapter {0}", tipoScelto));
}
///
@@ -239,8 +271,11 @@ namespace MTC_Adapter
private void avviaAdapter()
{
+ displayTaskAndWait("Adapter starting");
+
int porta = Convert.ToInt32(port.Text);
agObj.startAdapter(porta);
+ displayTaskAndWait("Adapter started!");
// fix buttons start/stop/dump
start.Enabled = false;
@@ -248,9 +283,13 @@ namespace MTC_Adapter
dump.Enabled = true;
if (utils.CRB("openDumpOnStart"))
{
+ displayTaskAndWait("Dump Window starting");
apriDumpAgent();
+ displayTaskAndWait("Dump Windows OK");
}
+ displayTaskAndWait("Start Timers");
+
// Start timer periodico
gather.Interval = utils.CRI("timerIntMs");
gather.Enabled = true;
@@ -259,6 +298,8 @@ namespace MTC_Adapter
normCount = utils.CRI("normCount");
slowCount = utils.CRI("slowCount");
alarmSyncCount = utils.CRI("alarmSyncCount");
+
+ displayTaskAndWait("Timers Ready");
}
///
@@ -309,7 +350,6 @@ namespace MTC_Adapter
if (alarmSyncCount <= 0)
{
alarmSyncCount = utils.CRI("alarmSyncCount");
- //lg.Info("Reset alarmSyncCount");
// avvio fase raccolta dati e invio con adapter
agObj.gaterAndSend(gatherCycle.VLF);
@@ -322,7 +362,6 @@ namespace MTC_Adapter
if (slowCount <= 0)
{
slowCount = utils.CRI("slowCount");
- //lg.Info("Reset slowCount");
// avvio fase raccolta dati e invio con adapter
agObj.gaterAndSend(gatherCycle.LF);
@@ -362,7 +401,6 @@ namespace MTC_Adapter
if (normCount <= 0)
{
normCount = utils.CRI("normCount");
- //lg.Info("Reset normCount");
// avvio fase raccolta dati e invio con adapter
agObj.gaterAndSend(gatherCycle.MF);
@@ -378,7 +416,6 @@ namespace MTC_Adapter
if (fastCount <= 0)
{
fastCount = utils.CRI("fastCount");
- //lg.Info("Reset fastCount");
// avvio fase raccolta dati e invio con adapter
agObj.gaterAndSend(gatherCycle.HF);
@@ -853,6 +890,8 @@ namespace MTC_Adapter
///
private void loadXmlFile(string XmlConfFile)
{
+ displayTaskAndWait("Loading XML");
+
// Read the configuration object from a file
adpConf = AdapterConf.Deserialize(XmlConfFile);
@@ -861,12 +900,15 @@ namespace MTC_Adapter
loadAdapterType();
// carico file XML in web browser...
wbXmlConf.DocumentText = AdapterConf.rawXml(XmlConfFile);
-
+ displayTaskAndWait("XML loaded");
+
// avvio macchina con adapter specificato...
if (utils.CRB("autoStartOnLoad"))
{
+ displayTaskAndWait("Auto Starting...");
// avvio!
avviaAdapter();
+ displayTaskAndWait("Auto Started!");
}
}
///
diff --git a/MTC_Sim/MTC_Sim/SetupAdapter.cs b/MTC_Sim/MTC_Sim/SetupAdapter.cs
index 95e2781..043ff67 100644
--- a/MTC_Sim/MTC_Sim/SetupAdapter.cs
+++ b/MTC_Sim/MTC_Sim/SetupAdapter.cs
@@ -15,6 +15,16 @@ namespace MTC_Adapter
public SetupAdapter()
{
InitializeComponent();
+
+ // fix icon!
+ this.Icon = Icon.ExtractAssociatedIcon(defIconFilePath);
+ }
+ protected string defIconFilePath
+ {
+ get
+ {
+ return string.Format(@"{0}\MTCA.ico", Application.StartupPath);
+ }
}
///
/// Percorso file completo
@@ -235,6 +245,7 @@ namespace MTC_Adapter
// inizializzo list x parametri
listaDR = new List>();
listaDR.Add(new DataRefItem(string.Format("VacPump_{0:00}_Status", i + 1), "0"));
+ listaDR.Add(new DataRefItem(string.Format("VacPump_{0:00}_WrkTime", i + 1), "0"));
VacuumPump[i] = new element(string.Format("VacPump_{0:00}", i + 1), string.Format("Pompa {0}", i + 1), fonteDati.Random, listaDR);
}
// salvo oggetto
diff --git a/MTC_Sim/VersGen/AdapterVers.cs b/MTC_Sim/VersGen/AdapterVers.cs
index b00c7c3..fa594bc 100644
--- a/MTC_Sim/VersGen/AdapterVers.cs
+++ b/MTC_Sim/VersGen/AdapterVers.cs
@@ -5,7 +5,7 @@
using System.Reflection;
-[assembly: AssemblyVersion("1.0.6.91")]
-[assembly: AssemblyFileVersion("1.0.6.91")]
+[assembly: AssemblyVersion("1.0.7.92")]
+[assembly: AssemblyFileVersion("1.0.7.92")]
[assembly: AssemblyCopyright("Steamware-SCM-CMS © 2015-2016")]
[assembly: AssemblyCompany("Steamware-SCM-CMS")]
diff --git a/MTC_Sim/VersGen/AdapterVers.tt b/MTC_Sim/VersGen/AdapterVers.tt
index 1020724..7e0c273 100644
--- a/MTC_Sim/VersGen/AdapterVers.tt
+++ b/MTC_Sim/VersGen/AdapterVers.tt
@@ -6,8 +6,8 @@
using System.Reflection;
-[assembly: AssemblyVersion("1.0.6.<#= this.RevisionNumber #>")]
-[assembly: AssemblyFileVersion("1.0.6.<#= this.RevisionNumber #>")]
+[assembly: AssemblyVersion("1.0.7.<#= this.RevisionNumber #>")]
+[assembly: AssemblyFileVersion("1.0.7.<#= this.RevisionNumber #>")]
[assembly: AssemblyCopyright("Steamware-SCM-CMS © 2015-<#= DateTime.Now.Year #>")]
[assembly: AssemblyCompany("Steamware-SCM-CMS")]
<#+