public void read(S7ProSim aS7ProSim) { if (mMemoryType != EPLCMemoryType.I) { if (mNeedWrite != true) { object lValue = null; switch (mMemoryType) //-V3002 { case EPLCMemoryType.DB: aS7ProSim.ReadDataBlockValue(mDB, mByte, mBit, DataType, ref lValue); break; case EPLCMemoryType.M: aS7ProSim.ReadFlagValue(mByte, mBit, DataType, ref lValue); break; case EPLCMemoryType.Q: if (mLength == 1) { aS7ProSim.ReadOutputPoint(mByte, mBit, DataType, ref lValue); break; } else { aS7ProSim.ReadOutputImage(mByte, mLength, ImageDataType, ref lValue); break; } } if (lValue != null) { setValueFromPLC(lValue); } } } }
private bool disposedValue = false; // 중복 호출을 검색하려면 protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO: 관리되는 상태(관리되는 개체)를 삭제합니다. Disconnect(); plcsim = null; } // TODO: 관리되지 않는 리소스(관리되지 않는 개체)를 해제하고 아래의 종료자를 재정의합니다. // TODO: 큰 필드를 null로 설정합니다. disposedValue = true; } }
public void write(S7ProSim aS7ProSim) { mNeedWrite = false; if (mMemoryType != EPLCMemoryType.Q) { object lValue = getValueForPLC(); switch (mMemoryType) //-V3002 { case EPLCMemoryType.DB: aS7ProSim.WriteDataBlockValue(mDB, mByte, mBit, ref lValue); break; case EPLCMemoryType.M: aS7ProSim.WriteFlagValue(mByte, mBit, ref lValue); break; case EPLCMemoryType.I: if (mLength == 1) { aS7ProSim.WriteInputPoint(mByte, mBit, ref lValue); break; } else { aS7ProSim.WriteInputImage(mByte, ref lValue); break; } } } }
public PlcSimulator() { _proSim = new S7ProSim(); //_proSim.ConnectionError += ProSimOnConnectionError; }
public void Connect() { mSimulator = new S7ProSim(); mSimulator.Connect(); }