Fix not available function in S7Net
This commit is contained in:
@@ -54,20 +54,18 @@ namespace CMS_CORE_Library.S7Net
|
||||
|
||||
private const string ACT_PROG_LINES_PATH = "/Channel/ProgramInfo/actPartProgram";
|
||||
private const string ACT_PROG_NAME_PATH = "/Channel/ProgramPointer/progName";
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Global Variables
|
||||
private static DateTime Last_Static_Read;
|
||||
|
||||
private ushort TimeoutConn;
|
||||
private static string Cnc_name;
|
||||
private static string Cnc_SftVersion;
|
||||
private static string Cnc_SeriesNum;
|
||||
private static string Cms_MachNumber;
|
||||
private static string PlcRirm_SeriesNum;
|
||||
private static uint ConfChannelNo;
|
||||
private static uint MaxChannelNo;
|
||||
private static uint SiemensLanguage;
|
||||
private static string UnitOfMeasure;
|
||||
|
||||
// Alarms data
|
||||
@@ -141,7 +139,6 @@ namespace CMS_CORE_Library.S7Net
|
||||
// Setup parametri
|
||||
Ip = IpAddress;
|
||||
Port = RemotePort;
|
||||
TimeoutConn = ConnectionTimeOut;
|
||||
// mesasggi generici PLC
|
||||
PlcMessages = new Dictionary<int, string>();
|
||||
}
|
||||
@@ -171,7 +168,6 @@ namespace CMS_CORE_Library.S7Net
|
||||
// Setup parametri
|
||||
Ip = IpAddress;
|
||||
Port = RemotePort;
|
||||
TimeoutConn = ConnectionTimeOut;
|
||||
// mesasggi generici PLC
|
||||
PlcMessages = new Dictionary<int, string>();
|
||||
}
|
||||
@@ -199,21 +195,6 @@ namespace CMS_CORE_Library.S7Net
|
||||
if (AxesSvc == null)
|
||||
AxesSvc = new DataSvc();
|
||||
}
|
||||
|
||||
if (SelectedProcessSvc == null)
|
||||
{
|
||||
SelectedProcessSvc = new DataSvc();
|
||||
|
||||
SelectedProcessSvc.Subscribe(ManageSelectedProcess, new Item[]
|
||||
{
|
||||
new Item() { Path = "DB258.DBX2582.2" },
|
||||
new Item() { Path = "DB258.DBX2586.2" },
|
||||
new Item() { Path = "DB258.DBX2590.2" },
|
||||
new Item() { Path = "DB258.DBX2594.2" },
|
||||
new Item() { Path = "DB258.DBX2598.2" },
|
||||
new Item() { Path = "DB258.DBX2602.2" },
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
// Setup the alarms (with DB bitmap) --> PlcMessages
|
||||
@@ -229,32 +210,6 @@ namespace CMS_CORE_Library.S7Net
|
||||
#endif
|
||||
}
|
||||
|
||||
#if false
|
||||
if (this.EnableTools)
|
||||
{
|
||||
// Setup tooltable listeners
|
||||
if (SiemensToolSvc == null)
|
||||
{
|
||||
SiemensToolSvc = new ToolMngmntSvc(1);
|
||||
ToolMngmtListGuid = SiemensToolSvc.Subscribe(ToolMngmtSvcHandler);
|
||||
SetupToolTableData();
|
||||
}
|
||||
|
||||
// Setup magazine position listener
|
||||
if (MagazinePositionSvc == null)
|
||||
{
|
||||
MagazinePositionSvc = new DataSvc();
|
||||
SetupMagazinePositionListener();
|
||||
}
|
||||
|
||||
// Setup magazine action
|
||||
if (MagazineActionsSvc == null)
|
||||
{
|
||||
MagazineActionsSvc = new DataSvc();
|
||||
SetupMagazineActionListener();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -456,41 +411,22 @@ namespace CMS_CORE_Library.S7Net
|
||||
string filePath;
|
||||
try
|
||||
{
|
||||
messages = new Dictionary<int, string>();
|
||||
|
||||
PlcMessages = new Dictionary<int, string>();
|
||||
CultureInfo cultureInfo = CultureInfo.CreateSpecificCulture(language);
|
||||
string langName = "";
|
||||
if (cultureInfo.IsNeutralCulture)
|
||||
langName = cultureInfo.EnglishName;
|
||||
else
|
||||
langName = cultureInfo.Parent.EnglishName;
|
||||
|
||||
// Setup the path of NC alarms translations file
|
||||
filePath = PLC_MESSAGES_FILE_PATH + "cmsalarm_" + cultureInfo.ThreeLetterISOLanguageName.ToUpper() + ".ts";
|
||||
if (!File.Exists(filePath))
|
||||
return INCORRECT_LANGUAGE_ERROR;
|
||||
//Setup the Path
|
||||
filePath = PLC_MESSAGE_PATH + @"Messaggi_" + langName + @".txt";
|
||||
|
||||
// Open file reader
|
||||
XDocument xmlTranslationsFile;
|
||||
|
||||
using (StreamReader oReader = new StreamReader(filePath, Encoding.ASCII))
|
||||
{
|
||||
xmlTranslationsFile = XDocument.Load(oReader);
|
||||
}
|
||||
|
||||
// Read file with LINQ
|
||||
var messagesList = xmlTranslationsFile
|
||||
.Root
|
||||
.Descendants("context")
|
||||
.Elements()
|
||||
.Where(x => x.Name == "message")
|
||||
.Select(x => new
|
||||
{
|
||||
Key = Convert.ToInt32(x.Element("source").Value.Split('/').FirstOrDefault()),
|
||||
Value = x.Element("translation").Value
|
||||
});
|
||||
|
||||
foreach (var message in messagesList)
|
||||
{
|
||||
// If not contain key
|
||||
if (!messages.Keys.Contains(message.Key))
|
||||
messages.Add(message.Key, message.Value);
|
||||
}
|
||||
//Read From Files
|
||||
messages = File.ReadAllLines(filePath, Encoding.Default)
|
||||
.Select(line => line.Split(','))
|
||||
.Where(line => line.Count() == 2)
|
||||
.ToDictionary(line => Convert.ToInt32(line[0]), line => line[1].Trim());
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
@@ -538,11 +474,11 @@ namespace CMS_CORE_Library.S7Net
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
#endregion Contructor & global methods
|
||||
#endregion Contructor & global methods
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region High level methods
|
||||
#region High level methods
|
||||
|
||||
// Get the processes-count configurated
|
||||
public override CmsError NC_RProcessesNum(ref ushort ProcNumber)
|
||||
@@ -583,13 +519,7 @@ namespace CMS_CORE_Library.S7Net
|
||||
// Get the NC Language
|
||||
public override CmsError NC_RLanguage(ref CultureInfo Language)
|
||||
{
|
||||
CmsError cmsError = ReadStaticNCData();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
Language = ConvertToSTEPLanguage(SiemensLanguage);
|
||||
|
||||
return NO_ERROR;
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
// Set the NC Language
|
||||
@@ -686,108 +616,25 @@ namespace CMS_CORE_Library.S7Net
|
||||
// Get the Nc Active Alarms
|
||||
public override CmsError NC_RActiveAlarms(ref List<AlarmModel> alarms)
|
||||
{
|
||||
// leggo bitmap allarmi e valorizzo con configurazione
|
||||
|
||||
|
||||
// FIXME!!!!
|
||||
#if false
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
ushort nReturn;
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
//Clear the OLD Message
|
||||
alarms.Clear();
|
||||
|
||||
//Execute the method
|
||||
nReturn = OpenNC.ReadCurrentEmergMsg(0, out MSGEMERGENCY errEmgy, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
|
||||
//If there's an error
|
||||
if (errEmgy.CodeErr != 0)
|
||||
{
|
||||
MESSAGE_TEXT MessageEmgy = new MESSAGE_TEXT();
|
||||
Cndex.MSG_EMERGENCY CndexErrorEmgy = ConverToCndexMessage(errEmgy);
|
||||
|
||||
//Translate using OSAI .DLL (a new one!)
|
||||
OSAIErrorManagerLibrary.TranslateEmergMsg(ref CndexErrorEmgy, ref MessageEmgy);
|
||||
|
||||
//Add alarm to list with the new converted string message
|
||||
AddNcAlarmToList((ushort)CndexErrorEmgy.Code_Err, OsaiToStepMessage(MessageEmgy), DateTime.Now, alarms);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
|
||||
#endif
|
||||
|
||||
#if false
|
||||
alarms = SiemensAlarms.
|
||||
Where(x => (x.Id < IDMinPLCMessage || x.Id > IDMaxPLCMessage) && (x.Id < IDMinChannel || x.Id > IDMaxChannel))
|
||||
.Select(x =>
|
||||
{
|
||||
uint id = x.Instance == 1 ? (uint)x.Id : Convert.ToUInt32((x.Id & 0xffff) | (x.Instance << 24));
|
||||
return new AlarmModel()
|
||||
{
|
||||
Id = id,
|
||||
Message = x.Message,
|
||||
IsWarning = false,
|
||||
Process = 0,
|
||||
DateTime = x.TimeStamp
|
||||
};
|
||||
})
|
||||
.GroupBy(x => x.Id).Select(x => x.First())
|
||||
.ToList();
|
||||
#endif
|
||||
|
||||
return NO_ERROR;
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
// Set the Nc Active Page of the NC
|
||||
public override CmsError NC_SetScreenVisible(SCREEN_PAGE screen)
|
||||
{
|
||||
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError NC_WMDICommand(int processId, string mdiString)
|
||||
{
|
||||
// Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
#if false
|
||||
try
|
||||
{
|
||||
FileSvc fileSvc = new FileSvc();
|
||||
var a = fileSvc.ReadMdaBuffer(1);
|
||||
fileSvc.WriteMdaBuffer(processId, mdiString);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
#endif
|
||||
|
||||
return NO_ERROR;
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
#endregion High level methods
|
||||
#endregion High level methods
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region PLC High-level data
|
||||
#region PLC High-level data
|
||||
|
||||
public override CmsError PLC_RWManageWatchdog()
|
||||
{
|
||||
@@ -1102,35 +949,12 @@ namespace CMS_CORE_Library.S7Net
|
||||
|
||||
public override CmsError PLC_RWorkedTimeHead(int head, ref uint time)
|
||||
{
|
||||
int index = (head - 1) * 4;
|
||||
|
||||
// Read Worked time
|
||||
CmsError cmsError = MEM_RWDWord(R, 0, HEADS_WORKED_TIMES.MemType, HEADS_WORKED_TIMES.Address, HEADS_WORKED_TIMES.SubAddress + index, ref time);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
return NO_ERROR;
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PLC_WResetWorkedTimeHead(int head)
|
||||
{
|
||||
byte usControlWord = 0;
|
||||
|
||||
if (head <= 0 || head > MAX_HEADS_NUMBER)
|
||||
return INCORRECT_PARAMETERS_ERROR;
|
||||
|
||||
// Read status
|
||||
CmsError cmsError = MEM_RWByte(R, 0, HEAD_RESET_WORKED_TIME.MemType, HEAD_RESET_WORKED_TIME.Address, HEAD_RESET_WORKED_TIME.SubAddress, 0, ref usControlWord);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
// Re-Write it status
|
||||
usControlWord = Convert.ToByte((usControlWord & 0xE0) | (head & 0X1F));
|
||||
cmsError = MEM_RWByte(W, 0, HEAD_RESET_WORKED_TIME.MemType, HEAD_RESET_WORKED_TIME.Address, HEAD_RESET_WORKED_TIME.SubAddress, 0, ref usControlWord);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
return NO_ERROR;
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PLC_RWorkedTimeMachine(ref uint time)
|
||||
@@ -1201,17 +1025,7 @@ namespace CMS_CORE_Library.S7Net
|
||||
|
||||
public override CmsError PLC_WHeadOverride(uint id, HEAD_OVERRIDE_SIGN sign)
|
||||
{
|
||||
if (id > MAX_HEADS_NUMBER)
|
||||
return INCORRECT_PARAMETERS_ERROR;
|
||||
|
||||
MEMORY_CELL currentStrobeCell = sign == HEAD_OVERRIDE_SIGN.PLUS ? HEADS_STROBE_INCREMENT : HEADS_STROBE_DECREMENT;
|
||||
|
||||
// Write strobe into memory
|
||||
CmsError cmsError = PLC_WStrobe(HEADS_ACK, currentStrobeCell, id);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
return NO_ERROR;
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
// MACHINE COUNTERS
|
||||
@@ -1254,123 +1068,11 @@ namespace CMS_CORE_Library.S7Net
|
||||
|
||||
public override CmsError PLC_ROperatorInputIsNeeded(ref List<M155InputIsNeededModel> value)
|
||||
{
|
||||
byte val = 0;
|
||||
// Read memory
|
||||
CmsError cmsError = MEM_RWByte(R, 0, M155_INPUT_NEEDED.MemType, M155_INPUT_NEEDED.Address, M155_INPUT_NEEDED.SubAddress, 0, ref val);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
// Convert byte to an array of bits
|
||||
bool[] bits = ByteToBits(val);
|
||||
uint processId = 1;
|
||||
|
||||
string[] parameters;
|
||||
string actualLine = "";
|
||||
|
||||
foreach (bool bit in bits)
|
||||
{
|
||||
if (bit)
|
||||
{
|
||||
// Read active program line
|
||||
cmsError = PROC_ReadActiveLine(processId, ref actualLine);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
// Parse line & get parameters
|
||||
parameters = ExtractM155ParametersFromNcCodeLine(actualLine);
|
||||
if (parameters.Count() == 0)
|
||||
{
|
||||
value.Add(new M155InputIsNeededModel()
|
||||
{
|
||||
Process = processId,
|
||||
IsNeeded = bits[processId - 1],
|
||||
Message = "",
|
||||
Type = M155_TYPE.REAL,
|
||||
Buttons = new Dictionary<byte, string>()
|
||||
});
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
byte i = 1;
|
||||
if (parameters[0].ToUpper().Trim() == "SHOWVAL")
|
||||
{
|
||||
try
|
||||
{
|
||||
// Skip first parameter because it's the message string
|
||||
// Set button with -> id = 1..5 -> value = parameter value
|
||||
Dictionary<byte, string> buttons = parameters.Skip(2)?.ToDictionary(x => i++, x => x);
|
||||
|
||||
#if false
|
||||
// Read machine variable
|
||||
DataSvc dataSvc = new DataSvc();
|
||||
Item item = new Item()
|
||||
{
|
||||
Path = string.Format("/channel/parameter/r[c{0} , 155]", processId),
|
||||
};
|
||||
|
||||
dataSvc.Read(item);
|
||||
|
||||
value.Add(new M155InputIsNeededModel()
|
||||
{
|
||||
Process = processId,
|
||||
IsNeeded = bits[processId - 1],
|
||||
Message = parameters[1] ?? "",
|
||||
Type = M155_TYPE.SHOW_VAL, // if there aren't buttons is a simple request,
|
||||
Value = Convert.ToDouble(item.Value),
|
||||
Buttons = buttons
|
||||
});
|
||||
#endif
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Skip first parameter because it's the message string
|
||||
// Set button with -> id = 1..5 -> value = parameter value
|
||||
Dictionary<byte, string> buttons = parameters.Skip(1)?.ToDictionary(x => i++, x => x);
|
||||
|
||||
value.Add(new M155InputIsNeededModel()
|
||||
{
|
||||
Process = processId,
|
||||
IsNeeded = bit,
|
||||
Message = parameters[0] ?? "",
|
||||
Type = parameters.Count() > 1 ? M155_TYPE.MULTIPLE_BUTTONS : M155_TYPE.REAL, // if there aren't buttons is a simple request
|
||||
Buttons = buttons
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Next path
|
||||
processId++;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PLC_WOperatorInputResponse(int process, double responseVal)
|
||||
{
|
||||
#if false
|
||||
try
|
||||
{
|
||||
DataSvc dataSvc = new DataSvc();
|
||||
Item item = new Item()
|
||||
{
|
||||
Path = string.Format("/channel/parameter/r[c{0} , 155]", process),
|
||||
Value = responseVal
|
||||
};
|
||||
|
||||
dataSvc.Write(item);
|
||||
|
||||
return PLC_WStrobe(M155_INPUT_ACK, M155_INPUT_STROBE, (uint)process);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
#endif
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
@@ -2017,11 +1719,11 @@ namespace CMS_CORE_Library.S7Net
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
#endregion PLC High-level data
|
||||
#endregion PLC High-level data
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region PROCESS (PATH) High-level data
|
||||
#region PROCESS (PATH) High-level data
|
||||
|
||||
// Get the process Mode
|
||||
public override CmsError PROC_RMode(ushort ProcNumber, ref PROC_MODE Mode)
|
||||
@@ -2385,11 +2087,11 @@ namespace CMS_CORE_Library.S7Net
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion PROCESS (PATH) High-level data
|
||||
#endregion PROCESS (PATH) High-level data
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region PROCESS-AXES (PATH) High-level data
|
||||
#region PROCESS-AXES (PATH) High-level data
|
||||
|
||||
public override CmsError AXES_RInterpPosition(ushort channel, ref Dictionary<string, double> axes)
|
||||
{
|
||||
@@ -2705,11 +2407,11 @@ namespace CMS_CORE_Library.S7Net
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion PROCESS-AXES (PATH) High-level data
|
||||
#endregion PROCESS-AXES (PATH) High-level data
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region NC Low-level function: single valiable in memory
|
||||
#region NC Low-level function: single valiable in memory
|
||||
|
||||
//Read-Write a Boolean-Value inside the NC.
|
||||
public override CmsError MEM_RWBoolean(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemBit, ref bool Value)
|
||||
@@ -2904,11 +2606,11 @@ namespace CMS_CORE_Library.S7Net
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
#endregion NC Low-level function: single valiable in memory
|
||||
#endregion NC Low-level function: single valiable in memory
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region Low level methods
|
||||
#region Low level methods
|
||||
|
||||
public override CmsError MEM_RWByteList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<byte> Values)
|
||||
{
|
||||
@@ -3210,11 +2912,11 @@ namespace CMS_CORE_Library.S7Net
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#endregion Low level methods
|
||||
#endregion Low level methods
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region NC Low-level function: Parameters
|
||||
#region NC Low-level function: Parameters
|
||||
|
||||
public override CmsError NC_RParam(short Index, short Bit, ref bool Value)
|
||||
{
|
||||
@@ -3241,11 +2943,11 @@ namespace CMS_CORE_Library.S7Net
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
#endregion NC Low-level function: Parameters
|
||||
#endregion NC Low-level function: Parameters
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region File Management
|
||||
#region File Management
|
||||
|
||||
/// <summary>
|
||||
/// Get list of recipe (from local PC area)
|
||||
@@ -3728,11 +3430,11 @@ namespace CMS_CORE_Library.S7Net
|
||||
return path.Replace('\\', '/');
|
||||
}
|
||||
|
||||
#endregion File Management
|
||||
#endregion File Management
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region Siemens Tools Management
|
||||
#region Siemens Tools Management
|
||||
|
||||
public override CmsError TOOLS_RConfiguration(ref ToolTableConfiguration config)
|
||||
{
|
||||
@@ -3879,11 +3581,11 @@ namespace CMS_CORE_Library.S7Net
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
#endregion Siemens Tools Management
|
||||
#endregion Siemens Tools Management
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region Nc Tool Manager
|
||||
#region Nc Tool Manager
|
||||
|
||||
public override CmsError TOOLS_RMagazineConfig(ref List<NcMagazineConfigModel> config)
|
||||
{
|
||||
@@ -3985,11 +3687,11 @@ namespace CMS_CORE_Library.S7Net
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
#endregion Nc Tool Manager
|
||||
#endregion Nc Tool Manager
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region Subordinate Private Functions
|
||||
#region Subordinate Private Functions
|
||||
|
||||
#if false
|
||||
// Manage the Alarms - Called automatically on changes
|
||||
@@ -4166,48 +3868,16 @@ namespace CMS_CORE_Library.S7Net
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
#if false
|
||||
DataSvc ReadStaticData = DefaultPriorityDataSvc();
|
||||
Item ItemNcType = new Item(NC_TYPE_PATH);
|
||||
Item ItemNcVersion = new Item(NC_VERSION_PATH);
|
||||
Item ItemMaxChannelNo = new Item(MAX_CHANNEL_NO_PATH);
|
||||
Item ItemConfChannelNo = new Item(CONF_CHANNEL_NO_PATH);
|
||||
Item ItemLanguage = new Item(LANGUAGE_PATH);
|
||||
Item ItemSerialNumber = new Item(SERIAL_NO_PATH);
|
||||
Item ItemUnitOfMeasure = new Item(UNIT_OF_MEASURE);
|
||||
cmsError = ConvertMemToPath(MATR_MACCH_SIEMENS.MemType, MATR_MACCH_SIEMENS.Address, MATR_MACCH_SIEMENS.SubAddress, 0, 1, 'W', out string itemString);
|
||||
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
Item ItemMachineNumber = new Item(itemString);
|
||||
|
||||
//Read All Data
|
||||
ReadStaticData.Read(ItemNcType);
|
||||
ReadStaticData.Read(ItemNcVersion);
|
||||
ReadStaticData.Read(ItemMaxChannelNo);
|
||||
ReadStaticData.Read(ItemConfChannelNo);
|
||||
ReadStaticData.Read(ItemLanguage);
|
||||
ReadStaticData.Read(ItemSerialNumber);
|
||||
ReadStaticData.Read(ItemMachineNumber);
|
||||
ReadStaticData.Read(ItemUnitOfMeasure);
|
||||
|
||||
//Setup variables
|
||||
Cnc_name = GetName((uint)ItemNcType.Value);
|
||||
Cnc_SftVersion = Regex.Replace(((double)ItemNcVersion.Value).ToString(), ".{2}", "$0.").TrimEnd('.'); ;
|
||||
Cnc_SeriesNum = ((string)ItemSerialNumber.Value);
|
||||
|
||||
MaxChannelNo = (uint)ItemMaxChannelNo.Value;
|
||||
ConfChannelNo = (uint)ItemConfChannelNo.Value;
|
||||
SiemensLanguage = (uint)ItemLanguage.Value;
|
||||
Cms_MachNumber = ((uint)ItemMachineNumber.Value).ToString();
|
||||
UnitOfMeasure = (uint)ItemUnitOfMeasure.Value == 0 ? MILLIMETERS : INCHES;
|
||||
|
||||
#endif
|
||||
//Save NOW
|
||||
// completare nuove variabili (matricola macchina, seriale PLC, firmware PLC)
|
||||
ConfChannelNo = 1;
|
||||
Last_Static_Read = DateTime.Now;
|
||||
Cnc_name = $"{currPLC.CPU}";
|
||||
Cnc_SftVersion = "0.0.0";
|
||||
Cnc_SeriesNum = "000";
|
||||
// FIXME
|
||||
Cms_MachNumber = ""; // matricola macchina, DB604.DBB6720..6723
|
||||
Cnc_SftVersion = "SMC000"; // versione SW del firmware PLC/CNC | DB604.DBB6724..6745
|
||||
Cnc_SeriesNum = "SMC111"; // seriale PLC/CNC | DB604.DBB6746..6763
|
||||
PlcRirm_SeriesNum = "V.0.0.0"; // seriale PLC/CNC | DB604.DBB6764..6767
|
||||
UnitOfMeasure = MILLIMETERS;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -4373,7 +4043,7 @@ namespace CMS_CORE_Library.S7Net
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Subordinate Private Functions
|
||||
#endregion Subordinate Private Functions
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -4382,6 +4052,9 @@ namespace CMS_CORE_Library.S7Net
|
||||
|
||||
internal static class MEMORY_ADDRESS
|
||||
{
|
||||
// Tabella DB principale
|
||||
internal const int TABLE = 604;
|
||||
|
||||
// aree Parametri
|
||||
internal static MEMORY_CELL PARAMETER_DATA = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 600, 20, 8000);
|
||||
internal static MEMORY_CELL PARAMETER_RT_DATA = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 601, 8, 3200);
|
||||
@@ -4399,12 +4072,13 @@ namespace CMS_CORE_Library.S7Net
|
||||
internal static MEMORY_CELL RISC_ESP_DATA = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 500, 9728, 1024);
|
||||
internal static MEMORY_CELL RISC_OVP_DATA = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 500, 10752, 1024);
|
||||
internal static MEMORY_CELL RISC_ICH_DATA = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 500, 11776, 4096);
|
||||
|
||||
|
||||
// produzione
|
||||
internal static MEMORY_CELL PROCESS_STATUS = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 605, 0, 2);
|
||||
|
||||
// ciclo produzione
|
||||
internal const int TABLE = 604;
|
||||
// Machine number
|
||||
internal static MEMORY_CELL NEW_MATR_MACC = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 604, 6720, 4);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4475,9 +4149,6 @@ namespace CMS_CORE_Library.S7Net
|
||||
|
||||
internal static MEMORY_CELL MAGAZINE_ACTION = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 4000, 16);
|
||||
|
||||
internal static MEMORY_CELL BALLUF_ACTION_ACK = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 4014, 1);
|
||||
internal static MEMORY_CELL BALLUF_ACTION_STROBE = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 4015, 1);
|
||||
internal static MEMORY_CELL BALLUF_ACTION_DATA = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 4016, 1);
|
||||
|
||||
//old CMS-Control variables
|
||||
internal static MEMORY_CELL HEADS_WORKED_TIMES = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 254, 60, 4);
|
||||
@@ -4488,12 +4159,5 @@ namespace CMS_CORE_Library.S7Net
|
||||
internal static MEMORY_CELL EXP_CANDY_MEM = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 255, 92, 1);
|
||||
|
||||
|
||||
internal static MEMORY_CELL SELF_ADAPTIVE_PATH = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 253, 16, 4);
|
||||
|
||||
internal static MEMORY_CELL BALLUF_EMPTY_TABLE = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 111, 0, 486);
|
||||
|
||||
// Machine number
|
||||
internal static MEMORY_CELL MATR_MACCH_SIEMENS = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 255, 0, 1);
|
||||
internal static MEMORY_CELL NEW_MATR_MACC = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 258, 3060, 4);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user