public void Update() { //Output. for (int i = 0; i < m_iMaxOut; i++) { m_aOut[i].Stat.bAtrVal = Dio.GetOut(m_aOut[i].Para.iAdd); //Check Delay. if (m_aOut[i].Stat.bVtrVal) { m_aOut[i].DelayOff.Clear(); //Check if (m_aOut[i].Para.iOnDelay > 0) //&& m_aOut[i].Stat.bVtrVal != m_aOut[i].Stat.bAtrVal) { if (!m_aOut[i].DelayOn.OnDelay(m_aOut[i].Stat.bVtrVal != m_aOut[i].Stat.bAtrVal, m_aOut[i].Para.iOnDelay)) { continue; } } } else { m_aOut[i].DelayOn.Clear(); if (m_aOut[i].Para.iOffDelay > 0) //&& m_aOut[i].Stat.bVtrVal != m_aOut[i].Stat.bAtrVal) { if (!m_aOut[i].DelayOff.OnDelay(m_aOut[i].Stat.bVtrVal != m_aOut[i].Stat.bAtrVal, m_aOut[i].Para.iOffDelay)) { continue; } } } //Edge. if (m_aOut[i].Stat.bVtrVal != m_aOut[i].Stat.bAtrVal) { m_aOut[i].Stat.bUpEdge = !m_aOut[i].Stat.bAtrVal; m_aOut[i].Stat.bDnEdge = m_aOut[i].Stat.bAtrVal; //노트북에서 사용시에 Actual Virtual Log problems. if (!m_aOut[i].Para.bNotLog) { Log.Trace(string.Format("OUTPUT({0:000}) {1} is {2} with Delay {3}", i, m_aOut[i].Para.sEnum, m_aOut[i].Stat.bVtrVal ? "On" : "Off", m_aOut[i].Stat.bVtrVal ? m_aOut[i].Para.iOnDelay : m_aOut[i].Para.iOffDelay), ti.Dyi); } } else { m_aOut[i].Stat.bUpEdge = false; m_aOut[i].Stat.bDnEdge = false; } Dio.SetOut(m_aOut[i].Para.iAdd, m_aOut[i].Stat.bVtrVal); } //Ouput 밑에 있어야 하고 Input 위에 있어야 ... Dio.Update(); for (int i = 0; i < m_iMaxIn; i++) { m_aIn[i].Stat.bAtrVal = Dio.GetIn(m_aIn[i].Para.iAdd); //Check if (m_aIn[i].Para.iOnDelay > 0 && !m_aIn[i].Stat.bVtrVal) { if (!m_aIn[i].DelayOn.OnDelay(m_aIn[i].Stat.bAtrVal != m_aIn[i].Stat.bVtrVal, m_aIn[i].Para.iOnDelay)) { m_aIn[i].Stat.bUpEdge = false; m_aIn[i].Stat.bDnEdge = false; continue; } } if (m_aIn[i].Para.iOffDelay > 0 && m_aIn[i].Stat.bVtrVal) { if (!m_aIn[i].DelayOff.OnDelay(m_aIn[i].Stat.bAtrVal != m_aIn[i].Stat.bVtrVal, m_aIn[i].Para.iOffDelay)) { m_aIn[i].Stat.bUpEdge = false; m_aIn[i].Stat.bDnEdge = false; continue; } } //Edge. if (m_aIn[i].Stat.bVtrVal != m_aIn[i].Stat.bAtrVal) { m_aIn[i].Stat.bUpEdge = !m_aIn[i].Stat.bVtrVal; m_aIn[i].Stat.bDnEdge = m_aIn[i].Stat.bVtrVal; if (!m_aIn[i].Para.bNotLog) { Log.Trace(string.Format("INPUT({0:000}) {1} is {2} with Delay {3}", i, m_aIn[i].Para.sEnum, m_aIn[i].Stat.bAtrVal ? "On" : "Off", m_aIn[i].Stat.bAtrVal ? m_aIn[i].Para.iOnDelay : m_aIn[i].Para.iOffDelay), ti.Dxi); } } else { m_aIn[i].Stat.bUpEdge = false; m_aIn[i].Stat.bDnEdge = false; } //Set Input. m_aIn[i].Stat.bVtrVal = m_aIn[i].Stat.bAtrVal; } }
public void Update() { //Output. for (int i = 0; i < m_iMaxOut; i++) { //Check Delay. if (m_aOut[i].Stat.bVtrVal) { m_aOut[i].DelayOff.Clear(); if (m_aOut[i].Para.iOnDelay > 0) { if (!m_aOut[i].DelayOn.OnDelay(m_aOut[i].Stat.bVtrVal != m_aOut[i].Stat.bAtrVal, m_aOut[i].Para.iOnDelay)) { continue; } } } else { m_aOut[i].DelayOn.Clear(); if (m_aOut[i].Para.iOffDelay > 0) { if (!m_aOut[i].DelayOff.OnDelay(m_aOut[i].Stat.bVtrVal != m_aOut[i].Stat.bAtrVal, m_aOut[i].Para.iOffDelay)) { continue; } } } //Edge. if (m_aOut[i].Stat.bVtrVal != m_aOut[i].Stat.bAtrVal) { m_aOut[i].Stat.bUpEdge = !m_aOut[i].Stat.bAtrVal; m_aOut[i].Stat.bDnEdge = m_aOut[i].Stat.bAtrVal; //노트북에서 사용시에 Actual Virtual Log problems. //Log.Trace("IO Change",string.Format("OUT_{0:000}_{1} is {2} with Delay {3}",i,m_aOut[i].Para.sEnum , m_aOut[i].Stat.bVtrVal ? "On":"Off", m_aOut[i].Stat.bVtrVal ? m_aOut[i].Para.iOnDelay : m_aOut[i].Para.iOffDelay) ); } else { m_aOut[i].Stat.bUpEdge = false; m_aOut[i].Stat.bDnEdge = false; } //Set Output. Dio.SetOut(m_aOut[i].Para.iAdd, m_aOut[i].Stat.bVtrVal); m_aOut[i].Stat.bPreVal = m_aOut[i].Stat.bAtrVal; m_aOut[i].Stat.bAtrVal = Dio.GetOut(m_aOut[i].Para.iAdd); if (m_aOut[i].Stat.bPreVal != m_aOut[i].Stat.bAtrVal) { Log.Trace("IO Change", string.Format("OUT_{0:000}_{1} is {2} with Delay {3}", i, m_aOut[i].Para.sEnum, m_aOut[i].Stat.bAtrVal ? "On" : "Off", m_aOut[i].Stat.bAtrVal ? m_aOut[i].Para.iOnDelay : m_aOut[i].Para.iOffDelay)); } } for (int i = 0; i < m_iMaxIn; i++) { m_aIn[i].Stat.bAtrVal = Dio.GetIn(m_aIn[i].Para.iAdd); //Check if (m_aIn[i].Para.iOnDelay > 0 && !m_aIn[i].Stat.bVtrVal) { if (!m_aIn[i].DelayOn.OnDelay(m_aIn[i].Stat.bAtrVal != m_aIn[i].Stat.bVtrVal, m_aIn[i].Para.iOnDelay)) { m_aIn[i].Stat.bUpEdge = false; m_aIn[i].Stat.bDnEdge = false; continue; } } if (m_aIn[i].Para.iOffDelay > 0 && m_aIn[i].Stat.bVtrVal) { if (!m_aIn[i].DelayOff.OnDelay(m_aIn[i].Stat.bAtrVal != m_aIn[i].Stat.bVtrVal, m_aIn[i].Para.iOffDelay)) { m_aIn[i].Stat.bUpEdge = false; m_aIn[i].Stat.bDnEdge = false; continue; } } //Edge. if (m_aIn[i].Stat.bVtrVal != m_aIn[i].Stat.bAtrVal) { m_aIn[i].Stat.bUpEdge = !m_aIn[i].Stat.bVtrVal; m_aIn[i].Stat.bDnEdge = m_aIn[i].Stat.bVtrVal; Log.Trace("IO Change", string.Format("IN_{0:000}_{1} is {2} with Delay {3}", i, m_aIn[i].Para.sEnum, m_aIn[i].Stat.bAtrVal ? "On":"Off", m_aIn[i].Stat.bAtrVal ? m_aIn[i].Para.iOnDelay : m_aIn[i].Para.iOffDelay)); } else { m_aIn[i].Stat.bUpEdge = false; m_aIn[i].Stat.bDnEdge = false; } //Set Input. m_aIn[i].Stat.bVtrVal = m_aIn[i].Stat.bAtrVal; } }