OSAI M155_ACK
FANUC FIX
This commit is contained in:
@@ -113,7 +113,8 @@ namespace CMS_CORE_Application
|
||||
sw.Restart();
|
||||
|
||||
cmsError = N.PLC_WOperatorInputResponse(1, 230.0);
|
||||
|
||||
double test = 55.5423;
|
||||
N.MEM_RWDouble(true, 1, Nc.MEMORY_TYPE.Osai_GD, 900, ref test);
|
||||
Console.WriteLine("TIME " + sw.ElapsedMilliseconds);
|
||||
sw.Stop();
|
||||
|
||||
|
||||
@@ -1535,6 +1535,11 @@ namespace CMS_CORE_Library.Demo
|
||||
return MEM_RWInteger(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
|
||||
}
|
||||
|
||||
public override CmsError MEM_RWDouble(bool bWrite, int process, MEMORY_TYPE memType, int memIndex, ref double value)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError MEM_RWByteList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
|
||||
{
|
||||
return MEM_RWByteList(bWrite, Process, MemType, MemIndex, MemByteStart, Number, ref Value);
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace CMS_CORE_Library.Fanuc
|
||||
|
||||
// Paths
|
||||
private const string NC_SUPPORT_FILE_PATH = "//CNC_MEM/USER/PATH1/CMS/";
|
||||
private const string NC_PROGRAM_PATH = "//CNC_MEM/USER/PATH1/";
|
||||
|
||||
private const string PLC_MESSAGE_PATH = "C:/CMS/FANUC/";
|
||||
|
||||
@@ -1732,6 +1733,11 @@ namespace CMS_CORE_Library.Fanuc
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError MEM_RWDouble(bool bWrite, int process, MEMORY_TYPE memType, int memIndex, ref double value)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
// Siemens Version of Memory-Access Methods
|
||||
|
||||
@@ -2261,10 +2267,10 @@ namespace CMS_CORE_Library.Fanuc
|
||||
ODBPDFDRV baseDir = new ODBPDFDRV();
|
||||
short nReturn = cnc_rdpdf_drive(nLibHandle[0], baseDir);
|
||||
|
||||
path = "//" + baseDir.drive1 + "/USER/PATH1/";
|
||||
string absolutePath = FormatPathForNc(path, baseDir.drive1);
|
||||
|
||||
ODBPDFNFIL dataNum = new ODBPDFNFIL();
|
||||
nReturn = Focas1.cnc_rdpdf_subdirn(nLibHandle[0], path, dataNum);
|
||||
nReturn = Focas1.cnc_rdpdf_subdirn(nLibHandle[0], absolutePath, dataNum);
|
||||
if (nReturn != 0)
|
||||
return GetNcError(nReturn);
|
||||
|
||||
@@ -2278,11 +2284,11 @@ namespace CMS_CORE_Library.Fanuc
|
||||
{
|
||||
// Setup input data
|
||||
currDirInput.dummy = 0;
|
||||
currDirInput.path = path;
|
||||
currDirInput.path = absolutePath;
|
||||
|
||||
for (short i = 0; i < dataNum.dir_num; i++)
|
||||
{
|
||||
// Update index
|
||||
// Update index
|
||||
currDirInput.req_num = i;
|
||||
// Read directory data
|
||||
nReturn = cnc_rdpdf_subdir(nLibHandle[0], ref maxDir, currDirInput, currDirOutData);
|
||||
@@ -2292,10 +2298,10 @@ namespace CMS_CORE_Library.Fanuc
|
||||
// Add to list read data
|
||||
files.Add(new PreviewFileModel()
|
||||
{
|
||||
AbsolutePath = path + currDirOutData.d_f,
|
||||
AbsolutePath = FormatPathForHighLevel(absolutePath + currDirOutData.d_f, true),
|
||||
IsDirectory = true,
|
||||
Name = currDirOutData.d_f,
|
||||
Path = path
|
||||
Path = path + currDirOutData.d_f
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2307,7 +2313,7 @@ namespace CMS_CORE_Library.Fanuc
|
||||
ODBPDFADIR fileData = new ODBPDFADIR();
|
||||
|
||||
// Setup input data
|
||||
funcInput.path = path;
|
||||
funcInput.path = absolutePath;
|
||||
funcInput.type = 1;
|
||||
funcInput.size_kind = 1;
|
||||
funcInput.dummy = 0;
|
||||
@@ -2323,10 +2329,10 @@ namespace CMS_CORE_Library.Fanuc
|
||||
// Add to list read data
|
||||
files.Add(new PreviewFileModel()
|
||||
{
|
||||
AbsolutePath = (path + fileData.d_f).Replace('/', '\\'),
|
||||
AbsolutePath = FormatPathForHighLevel(absolutePath + fileData.d_f, false),
|
||||
IsDirectory = false,
|
||||
Name = fileData.d_f,
|
||||
Path = path.Replace('/', '\\')
|
||||
Path = path + fileData.d_f
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2343,14 +2349,16 @@ namespace CMS_CORE_Library.Fanuc
|
||||
{
|
||||
string partProgramContent = "";
|
||||
// Read NC part program content
|
||||
CmsError cmsError = ReadPartProgramContent(path, ref partProgramContent);
|
||||
|
||||
string absolutePath = FormatPathForNc(path, "");
|
||||
CmsError cmsError = ReadPartProgramContent(absolutePath, ref partProgramContent);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
// Add to list read data
|
||||
fileInfo = new InfoFile()
|
||||
{
|
||||
AbsolutePath = path,
|
||||
AbsolutePath = absolutePath,
|
||||
Name = Path.GetFileName(path),
|
||||
Content = partProgramContent.Split('\n').ToList()
|
||||
};
|
||||
@@ -2635,6 +2643,28 @@ namespace CMS_CORE_Library.Fanuc
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
private string FormatPathForNc(string path, string drive)
|
||||
{
|
||||
if (path == "\\\\")
|
||||
return NC_PROGRAM_PATH;
|
||||
|
||||
if (path.Contains("\\"))
|
||||
return NC_PROGRAM_PATH + path.TrimStart('\\') + "/";
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
private string FormatPathForHighLevel(string path, bool isFolder)
|
||||
{
|
||||
string tmp = path.Replace('/', '\\');
|
||||
|
||||
if (isFolder)
|
||||
tmp = tmp + "/";
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#endregion File Management
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -978,6 +978,8 @@ namespace CMS_CORE_Library
|
||||
|
||||
public abstract CmsError MEM_RWInteger(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref int Value);
|
||||
|
||||
public abstract CmsError MEM_RWDouble(bool bWrite, int process, MEMORY_TYPE memType, int memIndex, ref double value);
|
||||
|
||||
#endregion MEMORY Low-level function: single valiable in memory (to override)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -832,7 +832,11 @@ namespace CMS_CORE_Library.Osai
|
||||
|
||||
public override CmsError PLC_WOperatorInputResponse(int process, double responseVal)
|
||||
{
|
||||
return NO_ERROR;
|
||||
CmsError cmsError = MEM_RWDouble(W, 0, MEMORY_TYPE.Osai_GD, 900 + (process - 1), ref responseVal);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
return PLC_WStrobe(M155_INPUT_ACK, M155_INPUT_STROBE, (uint)process);
|
||||
}
|
||||
|
||||
public override CmsError PLC_RMTConnectData(ref List<MtConnectDataIsNeededModel> value)
|
||||
@@ -1837,29 +1841,28 @@ namespace CMS_CORE_Library.Osai
|
||||
return MEM_RWInteger(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
|
||||
}
|
||||
|
||||
public override CmsError MEM_RWByteList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
|
||||
public override CmsError MEM_RWDouble(bool bWrite, int process, MEMORY_TYPE memType, int memIndex, ref double value)
|
||||
{
|
||||
return MEM_RWByteList(bWrite, Process, MemType, MemIndex, MemByteStart, Number, ref Value);
|
||||
}
|
||||
ushort nReturn;
|
||||
doublearray val = new doublearray() { value };
|
||||
if (bWrite)
|
||||
{
|
||||
nReturn = OpenNC.WriteVarDouble((ushort)memType, (ushort)process, (ushort)memIndex, 1, val, out uint errorClass, out uint errorNum);
|
||||
// If there is an error
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
nReturn = OpenNC.ReadVarDouble((ushort)memType, (ushort)process, (ushort)memIndex, 1, out val, out uint errorClass, out uint errorNum);
|
||||
// If there is an error
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
|
||||
public override CmsError MEM_RWWordList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<ushort> Value)
|
||||
{
|
||||
return MEM_RWWordList(bWrite, Process, MemType, MemIndex, Number, ref Value);
|
||||
}
|
||||
value = val.FirstOrDefault();
|
||||
}
|
||||
|
||||
public override CmsError MEM_RWShortList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<short> Value)
|
||||
{
|
||||
return MEM_RWShortList(bWrite, Process, MemType, MemIndex, Number, ref Value);
|
||||
}
|
||||
|
||||
public override CmsError MEM_RWDWordList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<uint> Value)
|
||||
{
|
||||
return MEM_RWDWordList(bWrite, Process, MemType, MemIndex, Number, ref Value);
|
||||
}
|
||||
|
||||
public override CmsError MEM_RWIntegerList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<int> Value)
|
||||
{
|
||||
return MEM_RWIntegerList(bWrite, Process, MemType, MemIndex, Number, ref Value);
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#endregion NC Low-level function: variables List in memory
|
||||
@@ -2035,6 +2038,33 @@ namespace CMS_CORE_Library.Osai
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
public override CmsError MEM_RWByteList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
|
||||
{
|
||||
return MEM_RWByteList(bWrite, Process, MemType, MemIndex, MemByteStart, Number, ref Value);
|
||||
}
|
||||
|
||||
public override CmsError MEM_RWWordList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<ushort> Value)
|
||||
{
|
||||
return MEM_RWWordList(bWrite, Process, MemType, MemIndex, Number, ref Value);
|
||||
}
|
||||
|
||||
public override CmsError MEM_RWShortList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<short> Value)
|
||||
{
|
||||
return MEM_RWShortList(bWrite, Process, MemType, MemIndex, Number, ref Value);
|
||||
}
|
||||
|
||||
public override CmsError MEM_RWDWordList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<uint> Value)
|
||||
{
|
||||
return MEM_RWDWordList(bWrite, Process, MemType, MemIndex, Number, ref Value);
|
||||
}
|
||||
|
||||
public override CmsError MEM_RWIntegerList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<int> Value)
|
||||
{
|
||||
return MEM_RWIntegerList(bWrite, Process, MemType, MemIndex, Number, ref Value);
|
||||
}
|
||||
|
||||
|
||||
#endregion NC Low-level function: variables List in memory
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -3965,8 +3995,8 @@ namespace CMS_CORE_Library.Osai
|
||||
internal static MEMORY_CELL COUNTER_IS_RESETTABLE_STROBE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4304, 0, 2);
|
||||
|
||||
internal static MEMORY_CELL M155_INPUT_NEEDED = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4306, 1);
|
||||
internal static MEMORY_CELL M155_ACK = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4308, 1);
|
||||
internal static MEMORY_CELL M155_STROBE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4310, 1);
|
||||
internal static MEMORY_CELL M155_INPUT_ACK = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4308, 1);
|
||||
internal static MEMORY_CELL M155_INPUT_STROBE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4310, 1);
|
||||
|
||||
internal static MEMORY_CELL MTCONNECT_DATA_NEEDED = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4312, 1);
|
||||
internal static MEMORY_CELL AXES_BUTTON_VISIBLE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4320, 16);
|
||||
|
||||
@@ -1955,6 +1955,11 @@ namespace CMS_CORE_Library.Siemens
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError MEM_RWDouble(bool bWrite, int process, MEMORY_TYPE memType, int memIndex, ref double value)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError MEM_RWDWordList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int Number, ref List<uint> Value)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
|
||||
Reference in New Issue
Block a user