private bool ChangeRPM(Double RPM)
        {
            //allow for checking of maximum speeds and insure IPM is positive
            double CheckRPM = Math.Abs(RPM);

            if (CheckRPM > RPMmax)
            {
                CheckRPM = RPMmax;
            }
            else
            {
                if (CheckRPM < RPMmin)
                {
                    CheckRPM = RPMmin;
                }
            }
            if (Math.Abs(CheckRPM - SpiRPM) > epsilon)
            {
                SpiRPM = CheckRPM;
                //int speed = (int)(RPM * 3.7022); //Adjusted by BG and CC 9/7/12
                controller.WriteModbusQueue(1, 2002, (int)(SpiRPM * 3.772), false);
                return(true);
            }
            return(false);
        }
예제 #2
0
        private void Connect()
        {

            if (controller.WriteModbusQueue(2, 1798, 1, true))
            {
                controller.WriteModbusQueue(3, 0x0300, 04, false);//give lateral motor master frequency control to rs-485
                controller.WriteModbusQueue(3, 0x0301, 03, false);//give lateral motor Source of operation command  to rs-485
                controller.WriteModbusQueue(3, 0x010D, 0, false);//set Traverse motor direcction (Fwd/Rev) to be controled by rs-485
                controller.WriteModbusQueue(3, 0x0705, 0, false);//set lateral speed to zero
                IsLatCon = true;
            }
            else
            {
                MesQue.WriteMessageQueue("Connection to Traverse Motor Failed");
                IsLatCon = false;
            }
        }
 //attempts to connect to the transverse motors. returns true if sucessful. Returns false if unsucessful.
 private void Connect()
 {
     //double hz = ((double)nmTraIPM.Value) * 5.3333;
     if (controller.WriteModbusQueue(2, 1798, 1, true))
     {
         controller.WriteModbusQueue(2, 0x0300, 04, false); //give Traverse motor master frequency control to rs-485
         controller.WriteModbusQueue(2, 0x0301, 03, false); //give Traverse motor Source of operation command  to rs-485
         controller.WriteModbusQueue(2, 0x0705, 0, false);  //set Traverse speed to zero
         controller.WriteModbusQueue(2, 0x010D, 0, false);  //set Traverse motor direcction (Fwd/Rev) to be controled by rs-485
         IsTraCon = true;
     }
     else
     {
         MesQue.WriteMessageQueue("Connection to Traverse Motor Failed");
         IsTraCon = false;
     }
 }