예제 #1
0
        /***************************************************************************************************************
        *  Custom Methods for our program.    Best practice says these SHOULD be in their own class files for
        *  orginization and readability
        ***************************************************************************************************************/

        // Create a Method to do our interlock for us
        // This method is passed the input collection so we can work on it directly.
        // we pass the Object specifically the Tri-list objects inputs,
        //then a number for the first and the last, and then finally the one we want selected
        // we pass the whole collection so this can be usable for any range and size.  Make your code reusable
        private void Interlock(DeviceBooleanInputCollection input, uint from, uint to, uint selected)
        {
            if (selected >= from && selected <= to) // Validate our data
            {
                for (uint i = from; i <= to; i++)   // Iterate through our items
                {
                    if (i == selected)
                    {
                        input[i].BoolValue = true;  // This is the one we want?  set it high
                    }
                    else
                    {
                        input[i].BoolValue = false; // Not what we want set it low
                    }
                    // NOTE: This is NOT a Break Before Make.   It has the potential of having two outputs high
                    //       at the same time for a very short amount of time
                    // HIDDEN CHALLENGE:  Modify this code to become Break Before Make and properly act exactly like a Simpl Interlock
                }
            }
        }
예제 #2
0
 public static bool GetBoolValue(this DeviceBooleanInputCollection inputs, string name)
 {
     return(inputs[name].BoolValue);
 }
예제 #3
0
 public static void Pulse(this DeviceBooleanInputCollection inputs, string name, int msTimeBetweenTransition)
 {
     inputs[name].Pulse(msTimeBetweenTransition);
 }
예제 #4
0
 public static bool GetBoolValue(this DeviceBooleanInputCollection inputs, uint index)
 {
     return(inputs[index].BoolValue);
 }
예제 #5
0
 public static void Pulse(this DeviceBooleanInputCollection inputs, string name)
 {
     inputs[name].Pulse();
 }
예제 #6
0
 public static void Pulse(this DeviceBooleanInputCollection inputs, uint index, int msTimeBetweenTransition)
 {
     inputs[index].Pulse(msTimeBetweenTransition);
 }
예제 #7
0
 public static void Pulse(this DeviceBooleanInputCollection inputs, uint index)
 {
     inputs[index].Pulse();
 }
예제 #8
0
 public static void SetFalse(this DeviceBooleanInputCollection inputs, string name)
 {
     inputs[name].BoolValue = false;
 }
예제 #9
0
 public static void SetFalse(this DeviceBooleanInputCollection inputs, uint index)
 {
     inputs[index].BoolValue = false;
 }
예제 #10
0
 public static void SetValue(this DeviceBooleanInputCollection inputs, string name, bool value)
 {
     inputs[name].BoolValue = value;
 }
예제 #11
0
 public static void SetValue(this DeviceBooleanInputCollection inputs, uint index, bool value)
 {
     inputs[index].BoolValue = value;
 }