Aggiunta gestione lettura status del SubMode...
This commit is contained in:
Binary file not shown.
@@ -18,13 +18,18 @@ namespace MTC_Sim
|
||||
/// <param name="adpConf"></param>
|
||||
public AdapterFanuc(CMS_MachineSim caller, AdapterConf adpConf) : base(caller, adpConf)
|
||||
{
|
||||
if (utils.CRB("verbose")) lg.Info("Start init Adapter FANUC");
|
||||
Runtime.CreateNC();
|
||||
|
||||
FANUC_ref = (FANUC)Runtime.NC;
|
||||
|
||||
if (utils.CRB("verbose")) lg.Info("FANUC_ref da CMSCncLib");
|
||||
|
||||
// disconnetto e connetto...
|
||||
if (utils.CRB("verbose")) lg.Info("FANUC: tryDisconnect");
|
||||
tryDisconnect();
|
||||
if (utils.CRB("verbose")) lg.Info("FANUC: tryConnect");
|
||||
tryConnect();
|
||||
if (utils.CRB("verbose")) lg.Info("End init Adapter FANUC");
|
||||
}
|
||||
|
||||
public override void tryDisconnect()
|
||||
@@ -496,14 +501,25 @@ namespace MTC_Sim
|
||||
vettPath[idxPath].mPathType.Value = "ASSERV";
|
||||
}
|
||||
|
||||
// !!!FARE!!! verificare funzioni x status SUBMODE
|
||||
|
||||
// verifico sulla STRB_DW3 i submode che POTREBBERO tutti sovrapposti...
|
||||
if (STRB_DW3 != StFlag32.NONE)
|
||||
{
|
||||
string SubMode = "";
|
||||
// cerco i bit alzati --> aggiungo relativo submode!
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
// converto! e aggiungo allarmi sollevati al corretto controller allarmi...
|
||||
if (STRB_DW3.HasFlag((StFlag32)Math.Pow(2, i)))
|
||||
{
|
||||
SubMode += string.Format("# {0} #", elencoSubMode[i.ToString()]);
|
||||
}
|
||||
}
|
||||
|
||||
// devo aver già in memoria come allarmi la lista dei SUBMODE (32)
|
||||
|
||||
// leggo come allarmi i BIT attivi
|
||||
|
||||
// per ogni BIT attivo aggiungo nell'event del PATH (forzato a 1) l'elenco separato da spazio dei submode attivi
|
||||
|
||||
// se ho valori li salvo nell'event...
|
||||
if (SubMode != "") vettPath[idxPath].mPathSubMode.Value = SubMode.Trim();
|
||||
}
|
||||
}
|
||||
|
||||
public override void getConfigParam()
|
||||
|
||||
@@ -541,6 +541,8 @@ namespace MTC_Sim
|
||||
/// </summary>
|
||||
public allarme[] elencoAllarmi;
|
||||
|
||||
public Dictionary<string, string> elencoSubMode;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Prima word di strobe da array flag completo
|
||||
@@ -889,7 +891,7 @@ namespace MTC_Sim
|
||||
/// </summary>
|
||||
protected void loadAllarmi()
|
||||
{
|
||||
lg.Info("Inizio caricamento vettore allarmi");
|
||||
if (utils.CRB("verbose")) lg.Info("Inizio caricamento vettore allarmi");
|
||||
int totRighe = 0;
|
||||
string fileName = string.Format(@"{0}\{1}", Application.StartupPath, utils.CRS("AlarmList"));
|
||||
string linea;
|
||||
@@ -917,7 +919,36 @@ namespace MTC_Sim
|
||||
// inizializzo a zero il vettore allarmi...
|
||||
int numByte = (int)Math.Ceiling(Convert.ToDecimal(rumRiga) / 8);
|
||||
AlarmFlags = new byte[numByte];
|
||||
|
||||
if (utils.CRB("verbose")) lg.Info("Fine caricamento vettore allarmi");
|
||||
}
|
||||
/// <summary>
|
||||
/// caricamento allarmi da file
|
||||
/// </summary>
|
||||
protected void loadSubMode()
|
||||
{
|
||||
if (utils.CRB("verbose")) lg.Info("Inizio caricamento vettore SubMode");
|
||||
int totRighe = 0;
|
||||
string fileName = string.Format(@"{0}\{1}", Application.StartupPath, utils.CRS("SubMode"));
|
||||
string linea;
|
||||
totRighe = File.ReadLines(fileName).Count();
|
||||
// inizializzo
|
||||
elencoSubMode.Clear();
|
||||
// carica da file...
|
||||
System.IO.StreamReader file = new System.IO.StreamReader(fileName);
|
||||
// leggo 1 linea alla volta...
|
||||
string[] valori;
|
||||
while ((linea = file.ReadLine()) != null)
|
||||
{
|
||||
// SE non è un commento...
|
||||
if (linea.Substring(0, 1) != "#")
|
||||
{
|
||||
valori = linea.Split(':');
|
||||
elencoSubMode.Add(valori[0], valori[1]);
|
||||
}
|
||||
}
|
||||
// chiudo file
|
||||
file.Close();
|
||||
if (utils.CRB("verbose")) lg.Info("Fine caricamento vettore SubMode");
|
||||
}
|
||||
/// <summary>
|
||||
/// Decodifica file allarme
|
||||
@@ -942,7 +973,8 @@ namespace MTC_Sim
|
||||
lg.Info("Starting adapter...");
|
||||
// inizializzo vettori di utility..
|
||||
loadAllarmi();
|
||||
|
||||
loadSubMode();
|
||||
|
||||
// Start the adapter lib with the port number in the text box
|
||||
mAdapter.Port = port;
|
||||
mAdapter.Start();
|
||||
@@ -1008,7 +1040,7 @@ namespace MTC_Sim
|
||||
{
|
||||
// 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
|
||||
@@ -1405,7 +1437,7 @@ namespace MTC_Sim
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// recupera primo elemento codaM
|
||||
/// </summary>
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
<!--conf file-->
|
||||
<add key="adapterConfPath" value="AdapterConf"/>
|
||||
<add key ="adapterConfPathFull" value="C:\Users\samuele.STEAMWAREWIN\Documents\VisualStudioProjects\CMS-MTConn\MTC_Sim\MTC_Sim\AdapterConf"/>
|
||||
<add key="AlarmList" value="AlarmList.txt"/>
|
||||
|
||||
<add key="AlarmList" value="AlarmList.txt"/>
|
||||
<add key="SubMode" value="SubMode.txt"/>
|
||||
|
||||
</appSettings>
|
||||
</configuration>
|
||||
@@ -88,6 +88,9 @@
|
||||
<EmbeddedResource Include="SetupAdapter.resx">
|
||||
<DependentUpon>SetupAdapter.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<Content Include="SubMode.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="NLog.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
# Commenti con "#", elenco tipo codice:valore delle label dei SUB_MODE di FANUC
|
||||
0:DNC
|
||||
1:Blk/Blk
|
||||
2:BlkDel
|
||||
3:OpStop
|
||||
4:Teach
|
||||
5:Prg Test
|
||||
6:MLock
|
||||
7:DryRun
|
||||
8:Restart
|
||||
9:x1
|
||||
10:x10
|
||||
11:x100
|
||||
12:x1000
|
||||
13:
|
||||
14:
|
||||
15:
|
||||
16:
|
||||
17:
|
||||
18:
|
||||
19:
|
||||
20:Asse selezionato 1
|
||||
21:Asse selezionato 2
|
||||
22:Asse selezionato 3
|
||||
23:Asse selezionato 4
|
||||
24:Asse selezionato 5
|
||||
25:Asse selezionato 6
|
||||
26:Asse selezionato 7
|
||||
27:Asse selezionato 8
|
||||
28:Asse selezionato 9
|
||||
29:Asse selezionato 10
|
||||
30:Asse selezionato 11
|
||||
31:Asse selezionato 12
|
||||
Reference in New Issue
Block a user