internal PlcMemoryInfoTrigger(Object triggerValue, TriggerTypes type, string name, string description, EventMemory memoryType = EventMemory.DM, UInt32 readOffset = 0, AccessSize accessSize = AccessSize.WORD, BitPlace bitPlace = BitPlace.NOBIT, bool isEnable = true, Object constantValue = null) : base(name, description, memoryType, readOffset, accessSize, bitPlace, isEnable, constantValue) { TriggerValue = triggerValue; TriggerType = type; }
/// <summary> /// /// </summary> /// <param name="description"></param> /// <param name="memoryType">CIO はBitのみ</param> /// <param name="readOffset"></param> /// <param name="accessSize">CIO はBit限定</param> /// <param name="isEnable"></param> /// <param name="bitPlace"></param> public PlcMemoryInfo(string name, string description, EventMemory memoryType = EventMemory.DM, UInt32 readOffset = 0, AccessSize accessSize = AccessSize.WORD, BitPlace bitPlace = BitPlace.NOBIT, bool isEnable = true, Object constantValue = null) : this() { // 初期化 Name = name; Description = description; MemoryType = memoryType; AccessSize = accessSize; IsEnable = isEnable; ReadOffset = readOffset; BitPlace = bitPlace; ConstantValue = constantValue; }
// obsoleted private UInt32 ReadAsUInt32(EventMemory memoryType, UInt32 readOffset, AccessSize accessSize, BitPlace bitPlace = BitPlace.NOBIT) { switch (accessSize) { case AccessSize.BIT: return((UInt16)(HasFlags_AND(memoryType, readOffset, bitPlace) ? 0 : 1)); case AccessSize.BYTE: throw new NotImplementedException("Word Access Address しか無い場合、Byte指定はあり得ない。上位/下位のどちらかが取得不能なので"); case AccessSize.WORD: return(ReadAsUInt16(memoryType, readOffset)); case AccessSize.DWORD: return((UInt32)(ReadAsUInt16(memoryType, readOffset) << 16) + ReadAsUInt16(memoryType, (UInt32)readOffset + 1)); default: return(UInt32.MinValue); } }
/// <summary> /// WORD2SmallInt 未対応。obsoleted /// </summary> /// <param name="memoryType"></param> /// <param name="readOffset"></param> /// <param name="accessSize"></param> /// <param name="bitPlace"></param> /// <returns></returns> private string ReadAsString(EventMemory memoryType, UInt32 readOffset, AccessSize accessSize, BitPlace bitPlace = BitPlace.NOBIT) { switch (accessSize) { case AccessSize.BIT: return(HasFlags_AND(memoryType, readOffset, bitPlace).ToString()); case AccessSize.BYTE: throw new NotImplementedException("Word Access Address しか無い場合、Byte指定はあり得ない。上位/下位のどちらかが取得不能なので"); case AccessSize.WORD: return(ReadAsUInt16(memoryType, readOffset).ToString()); case AccessSize.DWORD: return(ReadAsUInt16(memoryType, readOffset).ToString() + ReadAsUInt16(memoryType, readOffset + 1).ToString()); default: return("illegal parameter"); } }