Gestione nuova conf x Axis: comprende gruppo, e permette di caricare e salvare tenendo info base x assi... Aggiornata definizione base x AdapterItemList.xml di KVARA
This commit is contained in:
@@ -802,6 +802,27 @@ namespace MTC_Adapter
|
||||
{
|
||||
FeedRate = BitConverter.ToInt32(BitConverter.GetBytes(ncDevice.PLC_MemoryAreaIOT_DWord[byteNum]), 0);
|
||||
}
|
||||
else if (mapIOT_DWord[i].varName.StartsWith("IOT_FEED_"))
|
||||
{
|
||||
// recupero NUMERO
|
||||
try
|
||||
{
|
||||
numero = Convert.ToInt32(mapIOT_DWord[i].varName.Replace("IOT_FEED_", ""));
|
||||
// salvo in vettore SE possibile...
|
||||
if (numero <= FeedRateGrp.Length)
|
||||
{
|
||||
FeedRateGrp[numero - 1] = BitConverter.ToInt32(BitConverter.GetBytes(ncDevice.PLC_MemoryAreaIOT_DWord[byteNum]), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
lg.Error("Errore in inserimento vettore " + mapIOT_DWord[i].varName);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(exc, "Errore in decodifica " + mapIOT_DWord[i].varName);
|
||||
}
|
||||
}
|
||||
else if (mapIOT_DWord[i].varName.StartsWith("IOT_C_KU_AX_"))
|
||||
{
|
||||
// recupero NUMERO
|
||||
|
||||
@@ -416,6 +416,10 @@ namespace MTC_Adapter
|
||||
/// </summary>
|
||||
public Event mAxMastId;
|
||||
/// <summary>
|
||||
/// Gruppo di appartenenza dell'asse
|
||||
/// </summary>
|
||||
public Event mAxGrp;
|
||||
/// <summary>
|
||||
/// Event tipo asse: lineare, rotazionale...
|
||||
/// </summary>
|
||||
public Event mAxType;
|
||||
@@ -478,10 +482,31 @@ namespace MTC_Adapter
|
||||
public Axis(element baseElem)
|
||||
{
|
||||
ident = baseElem.ident;
|
||||
// valori da conf esplicita
|
||||
dataRefList = baseElem.dataRefList;
|
||||
try
|
||||
{
|
||||
mAxType = new Event(dataRefList[0].Key);
|
||||
mAxType.Value = dataRefList[0].Value;
|
||||
}
|
||||
catch
|
||||
{
|
||||
mAxType = new Event(string.Format("{0}_Type", ident));
|
||||
mAxType.Value = "LINEAR";
|
||||
|
||||
mAxType = new Event(dataRefList[0].Key);
|
||||
mAxType.Value = dataRefList[0].Value;
|
||||
}
|
||||
try
|
||||
{
|
||||
mAxGrp = new Event(dataRefList[1].Key);
|
||||
mAxGrp.Value = dataRefList[1].Value;
|
||||
}
|
||||
catch
|
||||
{
|
||||
mAxGrp = new Event(string.Format("{0}_Grp", ident));
|
||||
mAxGrp.Value = "00";
|
||||
|
||||
}
|
||||
// valori standard
|
||||
mAxMainProc = new MTConnect.Message(string.Format("{0}_MainProc", ident));
|
||||
mAxIsMaster = new MTConnect.Message(string.Format("{0}_IsMast", ident));
|
||||
mAxMastId = new Event(string.Format("{0}_MastId", ident));
|
||||
@@ -951,7 +976,10 @@ namespace MTC_Adapter
|
||||
|
||||
currAdpConf = adpConf;
|
||||
|
||||
// salvo al form chiamante
|
||||
// inizializzo vettore gruppi assi, MAX 20!!!
|
||||
FeedRateGrp = new int[20];
|
||||
|
||||
// salvo il form chiamante
|
||||
parentForm = caller;
|
||||
|
||||
// item disponibilità
|
||||
@@ -1917,6 +1945,10 @@ namespace MTC_Adapter
|
||||
/// </summary>
|
||||
public int FeedRate { get; set; }
|
||||
/// <summary>
|
||||
/// FeedRate di gruppo MAX 20!!!
|
||||
/// </summary>
|
||||
public int[] FeedRateGrp { get; set; }
|
||||
/// <summary>
|
||||
/// SpeedRate mandrino globale
|
||||
/// </summary>
|
||||
public int SpeedRate { get; set; }
|
||||
|
||||
@@ -121,6 +121,10 @@
|
||||
<Key>Axis_01_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_01_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -130,6 +134,10 @@
|
||||
<Key>Axis_02_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_02_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -139,6 +147,10 @@
|
||||
<Key>Axis_03_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_03_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -148,6 +160,10 @@
|
||||
<Key>Axis_04_Type</Key>
|
||||
<Value>ROTARY</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_04_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -157,6 +173,10 @@
|
||||
<Key>Axis_05_Type</Key>
|
||||
<Value>ROTARY</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_05_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -166,6 +186,10 @@
|
||||
<Key>Axis_06_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_06_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -175,6 +199,10 @@
|
||||
<Key>Axis_07_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_07_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -184,6 +212,10 @@
|
||||
<Key>Axis_08_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_08_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -193,6 +225,10 @@
|
||||
<Key>Axis_09_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_09_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -202,6 +238,10 @@
|
||||
<Key>Axis_10_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_10_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -211,6 +251,10 @@
|
||||
<Key>Axis_11_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_11_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -220,6 +264,10 @@
|
||||
<Key>Axis_12_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_12_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -229,6 +277,10 @@
|
||||
<Key>Axis_13_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_13_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -238,6 +290,10 @@
|
||||
<Key>Axis_14_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_14_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -247,6 +303,10 @@
|
||||
<Key>Axis_15_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_15_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
</Axis>
|
||||
|
||||
@@ -65,4 +65,7 @@
|
||||
063|IOT_PLC_MSG_10 |DWORD
|
||||
064|IOT_PLC_MSG_11 |DWORD
|
||||
065|IOT_PLC_MSG_12 |DWORD
|
||||
066|IOT_FEED |DWORD
|
||||
066|IOT_FEED |DWORD
|
||||
067|IOT_FEED_01 |DWORD
|
||||
068|IOT_FEED_02 |DWORD
|
||||
069|IOT_FEED_03 |DWORD
|
||||
@@ -121,6 +121,10 @@
|
||||
<Key>Axis_01_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_01_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -130,6 +134,10 @@
|
||||
<Key>Axis_02_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_02_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -139,6 +147,10 @@
|
||||
<Key>Axis_03_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_03_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -148,6 +160,10 @@
|
||||
<Key>Axis_04_Type</Key>
|
||||
<Value>ROTARY</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_04_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -157,6 +173,10 @@
|
||||
<Key>Axis_05_Type</Key>
|
||||
<Value>ROTARY</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_05_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -166,6 +186,10 @@
|
||||
<Key>Axis_06_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_06_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -175,6 +199,10 @@
|
||||
<Key>Axis_07_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_07_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -184,6 +212,10 @@
|
||||
<Key>Axis_08_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_08_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -193,6 +225,10 @@
|
||||
<Key>Axis_09_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_09_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -202,6 +238,10 @@
|
||||
<Key>Axis_10_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_10_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -211,6 +251,10 @@
|
||||
<Key>Axis_11_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_11_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -220,6 +264,10 @@
|
||||
<Key>Axis_12_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_12_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -229,6 +277,10 @@
|
||||
<Key>Axis_13_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_13_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -238,6 +290,10 @@
|
||||
<Key>Axis_14_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_14_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
@@ -247,6 +303,10 @@
|
||||
<Key>Axis_15_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_15_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
</Axis>
|
||||
|
||||
@@ -219,6 +219,8 @@ namespace MTC_Adapter
|
||||
}
|
||||
}
|
||||
|
||||
protected element[] oAxisLoad { get; set; }
|
||||
|
||||
private void btnCreateFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
// creo un nuovo file adapter...
|
||||
@@ -406,17 +408,47 @@ namespace MTC_Adapter
|
||||
if (numAxis > 0)
|
||||
{
|
||||
// creo elementi richiesti
|
||||
element[] Axis = new element[numAxis];
|
||||
element[] newAxis = new element[numAxis];
|
||||
// ciclo x istanziare!
|
||||
for (int i = 0; i < numAxis; i++)
|
||||
{
|
||||
// inizializzo list x parametri
|
||||
listaDR = new List<DataRefItem<string, string>>();
|
||||
listaDR.Add(new DataRefItem<string, string>(string.Format("Axis_{0:00}_Type", i + 1), "LINEAR"));
|
||||
Axis[i] = new element(string.Format("Axis_{0:00}", i + 1), listaDR);
|
||||
// se ho un vettore di assi uso i valori già letti..
|
||||
if (oAxisLoad != null && oAxisLoad.Length > 0 && i < oAxisLoad.Length)
|
||||
{
|
||||
newAxis[i] = oAxisLoad[i];
|
||||
// se non ho tutto aggiungo...
|
||||
if (newAxis[i].dataRefList.Count < 2)
|
||||
{
|
||||
// copio lista attuale
|
||||
listaDR = newAxis[i].dataRefList;
|
||||
// in base a cosa manca aggiunto...
|
||||
if (listaDR.Count == 0)
|
||||
{
|
||||
// aggiungo tutto con valori default
|
||||
listaDR.Add(new DataRefItem<string, string>(string.Format("Axis_{0:00}_Type", i + 1), "LINEAR"));
|
||||
listaDR.Add(new DataRefItem<string, string>(string.Format("Axis_{0:00}_Grp", i + 1), "00"));
|
||||
newAxis[i] = new element(string.Format("Axis_{0:00}", i + 1), listaDR);
|
||||
}
|
||||
else if (listaDR.Count == 1)
|
||||
{
|
||||
// aggiungo solo GRP con valori default, IPOTIZZO di avere solo type...
|
||||
listaDR.Add(new DataRefItem<string, string>(string.Format("Axis_{0:00}_Grp", i + 1), "00"));
|
||||
newAxis[i] = new element(string.Format("Axis_{0:00}", i + 1), listaDR);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// altrimenti popolo con valori default
|
||||
listaDR.Add(new DataRefItem<string, string>(string.Format("Axis_{0:00}_Type", i + 1), "LINEAR"));
|
||||
listaDR.Add(new DataRefItem<string, string>(string.Format("Axis_{0:00}_Grp", i + 1), "00"));
|
||||
newAxis[i] = new element(string.Format("Axis_{0:00}", i + 1), listaDR);
|
||||
}
|
||||
}
|
||||
// salvo oggetto
|
||||
c.Axis = Axis;
|
||||
c.Axis = newAxis;
|
||||
}
|
||||
|
||||
// Serializzo oggetto conf su file
|
||||
@@ -426,21 +458,23 @@ namespace MTC_Adapter
|
||||
private void btnLoad_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Read the configuration object from a file
|
||||
AdapterConf c2 = AdapterConf.Deserialize(filePath);
|
||||
AdapterConf objLoad = AdapterConf.Deserialize(filePath);
|
||||
|
||||
txtAdapter.Text = c2.NomeAdapt;
|
||||
cbTipoAdapt.SelectedText = c2.TipoAdapt.ToString();
|
||||
//cbTipoAdapt.SelectedItem = c2.TipoAdapt;
|
||||
numVacPump = c2.nVacuumPump;
|
||||
numVacAct = c2.nVacuumAct;
|
||||
numLubro = c2.nLubro;
|
||||
numCooler = c2.nCooler;
|
||||
numPress = c2.nPress;
|
||||
numTemp = c2.nTemp;
|
||||
numPath = c2.nPath;
|
||||
numUnOp = c2.nUnOp;
|
||||
numAxis = c2.nAxis;
|
||||
numMemArea = c2.nMemArea;
|
||||
txtAdapter.Text = objLoad.NomeAdapt;
|
||||
cbTipoAdapt.SelectedText = objLoad.TipoAdapt.ToString();
|
||||
//cbTipoAdapt.Refresh();
|
||||
numVacPump = objLoad.nVacuumPump;
|
||||
numVacAct = objLoad.nVacuumAct;
|
||||
numLubro = objLoad.nLubro;
|
||||
numCooler = objLoad.nCooler;
|
||||
numPress = objLoad.nPress;
|
||||
numTemp = objLoad.nTemp;
|
||||
numPath = objLoad.nPath;
|
||||
numUnOp = objLoad.nUnOp;
|
||||
numAxis = objLoad.nAxis;
|
||||
numMemArea = objLoad.nMemArea;
|
||||
// salvo assi correnti...
|
||||
oAxisLoad = objLoad.Axis;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user