Added Osai m157
This commit is contained in:
@@ -932,6 +932,16 @@ namespace CMS_CORE_Library.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PLC_RM157Data(ref List<M157InputModel> value)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PLC_WM157Timer(int process, ushort timerVal)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PLC_RScadaValue(string memIndex, SCADA_MEM_TYPE memType, ref object value)
|
||||
{
|
||||
if (memType == SCADA_MEM_TYPE.BOOL)
|
||||
|
||||
@@ -1146,6 +1146,16 @@ namespace CMS_CORE_Library.Fanuc
|
||||
return PLC_WStrobe(M156_INPUT_ACK, M156_INPUT_STROBE, (uint)process);
|
||||
}
|
||||
|
||||
public override CmsError PLC_RM157Data(ref List<M157InputModel> value)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PLC_WM157Timer(int process, ushort timerVal)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
private CmsError WriteMacroValue(int processId, int memIndex, double val)
|
||||
{
|
||||
int num = 1;
|
||||
|
||||
@@ -330,6 +330,14 @@ namespace CMS_CORE_Library.Models
|
||||
public double Value;
|
||||
}
|
||||
|
||||
public class M157InputModel
|
||||
{
|
||||
public uint Process;
|
||||
public ushort Timer;
|
||||
public bool CountdownIsActive;
|
||||
public bool TimerInputNeeded;
|
||||
}
|
||||
|
||||
public struct M154DataModel
|
||||
{
|
||||
public uint Process;
|
||||
|
||||
@@ -583,6 +583,10 @@ namespace CMS_CORE_Library
|
||||
|
||||
public abstract CmsError PLC_WM156Response(int process, double responseVal);
|
||||
|
||||
public abstract CmsError PLC_RM157Data(ref List<M157InputModel> value);
|
||||
|
||||
public abstract CmsError PLC_WM157Timer(int process, ushort timerVal);
|
||||
|
||||
public abstract CmsError PLC_RScadaValue(string memIndex, SCADA_MEM_TYPE memType, ref object value);
|
||||
|
||||
public abstract CmsError PLC_WScadaValue(string memIndex, SCADA_MEM_TYPE memType, object value);
|
||||
|
||||
@@ -1144,6 +1144,68 @@ namespace CMS_CORE_Library.Osai
|
||||
return PLC_WStrobe(M156_INPUT_ACK, M156_INPUT_STROBE, (uint)process);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override CmsError PLC_RM157Data(ref List<M157InputModel> value)
|
||||
{
|
||||
byte dataAreNeeded = 0;
|
||||
CmsError cmsError = MEM_RWByte(R, 0, M157_INPUT_NEEDED.MemType, M157_INPUT_NEEDED.Address, 0, ref dataAreNeeded);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
byte countdownActive = 0;
|
||||
cmsError = MEM_RWByte(R, 0, M157_INPUT_COUNTDOWN_ACTIVE.MemType, M157_INPUT_COUNTDOWN_ACTIVE.Address, 0, ref countdownActive);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
List<ushort> timerValues = new List<ushort>();
|
||||
|
||||
cmsError = MEM_RWWordList(R, 0, M157_TIMER.MemType, M157_TIMER.Address, M157_TIMER.Address, M157_TIMER.Size / 2, ref timerValues);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
bool[] dataNeededArray = ByteToBits(dataAreNeeded);
|
||||
bool[] countdownActiveNeeded = ByteToBits(countdownActive);
|
||||
|
||||
for (int processId = 1; processId <= MAX_PROCESS_NUMBER; processId++)
|
||||
{
|
||||
// check if modal to choose date has to be shown
|
||||
if (dataNeededArray[processId - 1])
|
||||
{
|
||||
value.Add(new M157InputModel()
|
||||
{
|
||||
Process = (uint)processId,
|
||||
TimerInputNeeded = true,
|
||||
CountdownIsActive = false,
|
||||
Timer = 0
|
||||
}); ;
|
||||
}
|
||||
else if (countdownActiveNeeded[processId - 1])
|
||||
{
|
||||
// check if timeout modal has to be shown
|
||||
value.Add(new M157InputModel()
|
||||
{
|
||||
Process = (uint)processId,
|
||||
TimerInputNeeded = false,
|
||||
CountdownIsActive = true,
|
||||
Timer = timerValues[processId - 1]
|
||||
}); ;
|
||||
}
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
public override CmsError PLC_WM157Timer(int process, ushort timerVal)
|
||||
{
|
||||
CmsError cmsError = MEM_RWWord(W, 0, MEMORY_TYPE.Osai_GD, M156_RESPONSE_MEMORY + (process - 1), ref timerVal);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
return PLC_WStrobe(M157_INPUT_ACK, M157_INPUT_STROBE, (uint)process);
|
||||
}
|
||||
|
||||
public override CmsError PLC_RM154Data(ref List<M154DataModel> data, ref bool MTCOnOff)
|
||||
{
|
||||
MTCOnOff = false;
|
||||
@@ -2398,12 +2460,13 @@ namespace CMS_CORE_Library.Osai
|
||||
// Filter per master axes and process
|
||||
if ((charName < 'a' || charName > 'z') && charName != 'S' && charName != '\0' && axesProcess[i] == process)
|
||||
{
|
||||
var isVisible = ids.Where(x => x == i + 1)?.FirstOrDefault() == 0 ? false : true;
|
||||
// Add to returned value
|
||||
axesData.Add(new AxisModel()
|
||||
{
|
||||
Id = i + 1,
|
||||
Name = charName.ToString(),
|
||||
IsSelectable = ids.Where(x => x == i + 1)?.FirstOrDefault() == 0 ? false : true
|
||||
IsSelectable = true
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -5087,6 +5150,12 @@ namespace CMS_CORE_Library.Osai
|
||||
internal static MEMORY_CELL M156_INPUT_STROBE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4337, 1);
|
||||
internal static MEMORY_CELL M156_INPUT_ID_LIST = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4338, 8);
|
||||
|
||||
internal static MEMORY_CELL M157_INPUT_NEEDED = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4343, 1);
|
||||
internal static MEMORY_CELL M157_INPUT_COUNTDOWN_ACTIVE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4345, 1);
|
||||
internal static MEMORY_CELL M157_INPUT_ACK = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4347, 1);
|
||||
internal static MEMORY_CELL M157_INPUT_STROBE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4337, 1);
|
||||
internal static MEMORY_CELL M157_TIMER = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4338, 8);
|
||||
|
||||
internal static int M156_RESPONSE_MEMORY = 910;
|
||||
|
||||
internal static MEMORY_CELL M154_SWITCH_ONOFF = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4000, 1, 2);
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
// Check connection
|
||||
Item item = new Item("DB258.DBX0.0");
|
||||
DataSvc svc = new DataSvc();
|
||||
DataSvc svc = HighPriorityDataSvc();
|
||||
|
||||
svc.Read(item);
|
||||
Connected = true;
|
||||
@@ -1573,6 +1573,16 @@ namespace CMS_CORE_Library.Siemens
|
||||
return PLC_WStrobe(M156_INPUT_ACK, M156_INPUT_STROBE, (uint)process);
|
||||
}
|
||||
|
||||
public override CmsError PLC_RM157Data(ref List<M157InputModel> value)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PLC_WM157Timer(int process, ushort timerVal)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PLC_RScadaValue(string memIndex, SCADA_MEM_TYPE memType, ref object value)
|
||||
{
|
||||
if (memType == SCADA_MEM_TYPE.BOOL)
|
||||
|
||||
Reference in New Issue
Block a user