Gestione preliminare overrides x multipath

This commit is contained in:
Samuele E. Locatelli
2017-04-20 13:03:53 +02:00
parent 297bfb2233
commit 152f505c5e
2 changed files with 89 additions and 20 deletions
+30
View File
@@ -251,6 +251,26 @@ namespace MTC_Adapter
/// </summary>
public Sample mPathRapidOver;
/// <summary>
/// Override Jog
/// </summary>
public Sample mPathJogOver;
/// <summary>
/// Override Spindle_01
/// </summary>
public Sample mPathSpindleOver_01;
/// <summary>
/// Override Spindle_02
/// </summary>
public Sample mPathSpindleOver_02;
/// <summary>
/// Override Spindle_03
/// </summary>
public Sample mPathSpindleOver_03;
/// <summary>
/// Override Spindle_04
/// </summary>
public Sample mPathSpindleOver_04;
/// <summary>
/// Posizione X
/// </summary>
public Sample mPathPosActX;
@@ -302,6 +322,11 @@ namespace MTC_Adapter
mPathFeed = new Sample(string.Format("{0}_FeedRate", ident));
mPathFeedOver = new Sample(string.Format("{0}_FeedOverr", ident));
mPathRapidOver = new Sample(string.Format("{0}_RapidOverr", ident));
mPathJogOver = new Sample(string.Format("{0}_JogOverr", ident));
mPathSpindleOver_01 = new Sample(string.Format("{0}_SpindleOver_01", ident));
mPathSpindleOver_02 = new Sample(string.Format("{0}_SpindleOver_02", ident));
mPathSpindleOver_03 = new Sample(string.Format("{0}_SpindleOver_03", ident));
mPathSpindleOver_04 = new Sample(string.Format("{0}_SpindleOver_04", ident));
mPathPosActX = new Sample(string.Format("{0}_PosActX", ident));
mPathPosActY = new Sample(string.Format("{0}_PosActY", ident));
mPathPosActZ = new Sample(string.Format("{0}_PosActZ", ident));
@@ -1080,6 +1105,11 @@ namespace MTC_Adapter
mAdapter.AddDataItem(vettPath[i].mPathFeed);
mAdapter.AddDataItem(vettPath[i].mPathFeedOver);
mAdapter.AddDataItem(vettPath[i].mPathRapidOver);
mAdapter.AddDataItem(vettPath[i].mPathJogOver);
mAdapter.AddDataItem(vettPath[i].mPathSpindleOver_01);
mAdapter.AddDataItem(vettPath[i].mPathSpindleOver_02);
mAdapter.AddDataItem(vettPath[i].mPathSpindleOver_03);
mAdapter.AddDataItem(vettPath[i].mPathSpindleOver_04);
mAdapter.AddDataItem(vettPath[i].mPathPosActX);
mAdapter.AddDataItem(vettPath[i].mPathPosActY);
mAdapter.AddDataItem(vettPath[i].mPathPosActZ);
+59 -20
View File
@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace MTC_Adapter
{
@@ -326,6 +327,8 @@ namespace MTC_Adapter
{
base.processStrobe();
// reset dello SB parent...
// oggetti "accessori" x processing (1 byte di strobe x ogni path)
StFlag8 currStrobe;
StFlag8 currAck;
@@ -870,7 +873,6 @@ namespace MTC_Adapter
// anche il secondo!
procPath02_Status();
}
}
/// <summary>
/// Processa status del path 01...
@@ -1416,33 +1418,43 @@ namespace MTC_Adapter
{
base.getGlobalData();
#if false
// accodo dati path in DataMonitor......
StringBuilder sb = new StringBuilder();
// dati base...
sb.AppendLine(string.Format("POWER {0}: | EmStop:{1:N3} | ProcSel: {2}", mPower.Value, mEStop.Value, mProcSel.Value));
// leggo dati globali...
inizio = DateTime.Now;
allDynData = OSAI_ref.getAllDynData();
#if false
allDynData = OSAI_ref.getAllDynData();
if (utils.CRB("recTime")) TimingData.addResult("R-ALL-DYN-DATA", DateTime.Now.Subtract(inizio).Ticks);
FeedRate = allDynData.actf;
#endif
FeedRate = -999; // !!!FARE!!!
int memIndex = 12000;
byte[] PathData = new byte[4];
// area path1/2: 7 WORD x ogni path...
int memIndex = 19151;
ushort[] PathData_mem = new ushort[14];
inizio = DateTime.Now;
OsaiMemRW(R, FANUC.MemType.R, memIndex, ref PathData);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-PathData", PathData.Length), DateTime.Now.Subtract(inizio).Ticks);
OsaiMemRW_Word(R, OSAI.MemTypeWord.MW_CODE, memIndex, ref PathData_mem);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-PathData", PathData_mem.Length * 2), DateTime.Now.Subtract(inizio).Ticks);
// 2016.07.19 mod con Fabio
//JogRateOver = PathData[0];
FeedRateOver = PathData[1];
RapidOver = PathData[2];
SpeedRateOver = PathData[3];
// 2017.04.20: recupero OVER per Jog/Feed/Rapid/Spindle x i path multipli (qui cablati 1-2)
ushort[] currPathData = new ushort[7];
// processo ora i dai dei path... di sicuro il primo
Array.Copy(PathData_mem, 0, currPathData, 0, 7);
procPathOverride(0, currPathData, ref sb);
//...e se c'è pure il secondo...
if (currAdpConf.nPath > 1)
{
Array.Copy(PathData_mem, 7, currPathData, 0, 7);
// anche il secondo!
procPathOverride(1, currPathData, ref sb);
}
sb.AppendLine(string.Format("FeedRate: {0} mm/min", FeedRate));
sb.AppendLine(string.Format("FeedRateOver: {0} %", FeedRateOver));
sb.AppendLine(string.Format("RapidOver: {0} %", RapidOver));
sb.AppendLine(string.Format("SpeedRateOver: {0} %", SpeedRateOver));
// se ho allarmi li accodo...
if (allDynData.alarm != 0)
@@ -1450,7 +1462,9 @@ namespace MTC_Adapter
sb.AppendLine(string.Format("Allarmi CNC: {0}", allDynData.alarm));
inizio = DateTime.Now;
allarmiCNC = OSAI_ref.getCncAlarm();
#if false
allarmiCNC = OSAI_ref.getCncAlarm();
#endif
if (utils.CRB("recTime")) TimingData.addResult("R-CNC-ALARMS", DateTime.Now.Subtract(inizio).Ticks);
checkCNCAlarms();
}
@@ -1465,9 +1479,32 @@ namespace MTC_Adapter
getMtzDataFromPlc();
// gestisco lettura dati status da PLC...
getStatusDataFromPlc();
#endif
getStatusDataFromPlc();
}
/// <summary>
/// Processa i dati di override di un path
/// </summary>
/// <param name="currIdx">idx path (zero based)</param>
/// <param name="dataVector">vettore 7 valori dei dati (valori int16 jog/feed/rapid/spindle[1..4])</param>
/// <param name="sb">StringBuilder da aggiornare</param>
private void procPathOverride(int currIdx, ushort[] dataVector, ref StringBuilder sb)
{
// prendo quella GLOBALE...
vettPath[currIdx].mPathFeed.Value = FeedRate;
// leggo da vettore... CABLATO DIVISO PER 100!!!
vettPath[currIdx].mPathJogOver.Value = dataVector[0] / 100;
vettPath[currIdx].mPathFeedOver.Value = dataVector[1] / 100;
vettPath[currIdx].mPathRapidOver.Value = dataVector[2] / 100;
vettPath[currIdx].mPathSpindleOver_01.Value = dataVector[3] / 100;
vettPath[currIdx].mPathSpindleOver_02.Value = dataVector[4] / 100;
vettPath[currIdx].mPathSpindleOver_03.Value = dataVector[5] / 100;
vettPath[currIdx].mPathSpindleOver_04.Value = dataVector[6] / 100;
// salvo stringa!
sb.AppendLine(string.Format("P{0} - Override % Jog|Feed|Rapid: {1}|{2}|{3}", currIdx + 1, dataVector[0] / 100, dataVector[1] / 100, dataVector[2] / 100));
sb.AppendLine(string.Format("P{0} - Override % Spindle 1|2|3|4: {1}|{2}|{3}|{4}", currIdx + 1, dataVector[3] / 100, dataVector[4] / 100, dataVector[5] / 100, dataVector[6] / 100));
}
/// <summary>
/// Carico file conf dati CMS
/// </summary>
@@ -1795,7 +1832,9 @@ namespace MTC_Adapter
public override void getPath()
{
base.getPath();
//NON richiamo metodo base... ma faccio override qui (e altrove...)
checkPath();
#if false
// recupero vettore generale G MODE
@@ -1879,11 +1918,11 @@ namespace MTC_Adapter
public override void getAxis()
{
#if false
// mostro assi in DataMonitor......
StringBuilder sb = new StringBuilder();
inizio = DateTime.Now;
#if false
CMSCncLib.Focas1.ODBPOS posAssi = OSAI_ref.getAllAxisPos();
if (utils.CRB("recTime")) TimingData.addResult("R-AXIS_POS", DateTime.Now.Subtract(inizio).Ticks);