예제 #1
0
        public static bool GetSMPStatusIndividual(Machine.Beam beam, Machine.Page1.SMPFlags smpFlags)
        {
            switch (smpFlags)
            {
            case Machine.Page1.SMPFlags.Link_Status_of_Beam_Permits:
                return(CheckLinkStatusOfBeamPermits(beam));

            case Machine.Page1.SMPFlags.Global_Beam_Permit:
                return(CheckGlobalBeamPermit(beam));

            case Machine.Page1.SMPFlags.Setup_Beam:
                return(CheckSetupBeam(beam));

            case Machine.Page1.SMPFlags.Beam_Presence:
                return(CheckBeamPresence(beam));

            case Machine.Page1.SMPFlags.Moveable_Devices_Allowed_In:
                return(CheckMoveableDevicesAllowedIn(beam));

            case Machine.Page1.SMPFlags.Stable_Beams:
                return(CheckStableBeams(beam));

            default:
                return(false);
            }
        }
예제 #2
0
        public static bool GetBeamDumpStatusIndividualComponent(Machine.Beam beam, Machine.BeamDump.Components components)
        {
            switch (components)
            {
            case Machine.BeamDump.Components.BeamDumped:
                return(CheckBeamDumpedIndividual(beam));

            case Machine.BeamDump.Components.Kicker:
                return(CheckKickerIndividual(beam));

            case Machine.BeamDump.Components.BETS:
                return(CheckBETSIndividual(beam));

            case Machine.BeamDump.Components.IPOC_U_Beam_Dump_Pane:
                return(CheckIPOCBeamDumpPaneIndividual(beam));

            case Machine.BeamDump.Components.LASS:
                return(CheckLASSIndividual(beam));

            case Machine.BeamDump.Components.RETRIGGER:
                return(CheckRetriggerIndividual(beam));

            case Machine.BeamDump.Components.XPOC:
                return(CheckXPOCIndividual(beam));

            case Machine.BeamDump.Components.REMOTE_U_Beam_Dump_Pane:
                return(CheckRemoteBeamDumpPaneIndividual(beam));

            case Machine.BeamDump.Components.ON_U_Beam_Dump_Pane:
                return(CheckONBeamDumpPaneIndividual(beam));

            case Machine.BeamDump.Components.REMOTE_U_Injection_Pane:
                return(CheckRemoteInjectionPaneIndividual(beam));

            case Machine.BeamDump.Components.ON_U_Injection_Pane:
                return(CheckOnInjectionPaneIndividual(beam));

            case Machine.BeamDump.Components.TIMING_ON:
                return(CheckTimingOnIndividual(beam));

            case Machine.BeamDump.Components.CONDITIONING:
                return(CheckConditioningIndividual(beam));

            case Machine.BeamDump.Components.TIMEOUT:
                return(CheckTimeoutIndividual(beam));

            case Machine.BeamDump.Components.IPOC_U_Injection_Pane:
                return(CheckIPOCInjectionPaneIndividual(beam));

            case Machine.BeamDump.Components.IQC:
                return(CheckIQCIndividual(beam));

            default:
                return(false);
            }
        }
예제 #3
0
        private static bool CheckKickerIndividual(Machine.Beam beam)
        {
            switch (beam)
            {
            case Machine.Beam.Beam1:
                if (!GetBeamDumpStatusAsync(out Bitmap beamOneKickerImg))
                {
                    return(false);
                }
                else
                {
                    if (beamOneKickerImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamOneKickerImg.GetPixel(73, 60)   //Kicker
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            case Machine.Beam.Beam2:
                if (!GetBeamDumpStatusAsync(out Bitmap beamTwoKickerImg))
                {
                    return(false);
                }
                else
                {
                    if (beamTwoKickerImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamTwoKickerImg.GetPixel(472, 60),           //Kicker
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            default:
                return(false);
            }
        }
예제 #4
0
        private static bool CheckIPOCBeamDumpPaneIndividual(Machine.Beam beam)
        {
            switch (beam)
            {
            case Machine.Beam.Beam1:
                if (!GetBeamDumpStatusAsync(out Bitmap beamOneIPOCBeamDumpPaneImg))
                {
                    return(false);
                }
                else
                {
                    if (beamOneIPOCBeamDumpPaneImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamOneIPOCBeamDumpPaneImg.GetPixel(323, 60),           //IPOC - Beam Dump Pane
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            case Machine.Beam.Beam2:
                if (!GetBeamDumpStatusAsync(out Bitmap beamTwoIPOCBeamDumpPane))
                {
                    return(false);
                }
                else
                {
                    if (beamTwoIPOCBeamDumpPane == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamTwoIPOCBeamDumpPane.GetPixel(723, 60),           //IPOC - Beam Dump Pane
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            default:
                return(false);
            }
        }
예제 #5
0
        private static bool CheckRetriggerIndividual(Machine.Beam beam)
        {
            switch (beam)
            {
            case Machine.Beam.Beam1:
                if (!GetBeamDumpStatusAsync(out Bitmap beamOneRetriggerImg))
                {
                    return(false);
                }
                else
                {
                    if (beamOneRetriggerImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamOneRetriggerImg.GetPixel(200, 82),           //RETRIGGER
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            case Machine.Beam.Beam2:
                if (!GetBeamDumpStatusAsync(out Bitmap beamTwoRetriggerImg))
                {
                    return(false);
                }
                else
                {
                    if (beamTwoRetriggerImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamTwoRetriggerImg.GetPixel(600, 82),           //RETRIGGER
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            default:
                return(false);
            }
        }
예제 #6
0
        private static bool CheckRemoteBeamDumpPaneIndividual(Machine.Beam beam)
        {
            switch (beam)
            {
            case Machine.Beam.Beam1:
                if (!GetBeamDumpStatusAsync(out Bitmap beamOneRemoteBeamDumpPaneImg))
                {
                    return(false);
                }
                else
                {
                    if (beamOneRemoteBeamDumpPaneImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamOneRemoteBeamDumpPaneImg.GetPixel(81, 101),           //REMOTE - Beam Dump Pane
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            case Machine.Beam.Beam2:
                if (!GetBeamDumpStatusAsync(out Bitmap beamTwoRemoteBeamDumpPaneImg))
                {
                    return(false);
                }
                else
                {
                    if (beamTwoRemoteBeamDumpPaneImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamTwoRemoteBeamDumpPaneImg.GetPixel(481, 101),           //REMOTE - Beam Dump Pane
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                };

            default:
                return(false);
            }
        }
예제 #7
0
        private static bool CheckOnInjectionPaneIndividual(Machine.Beam beam)
        {
            switch (beam)
            {
            case Machine.Beam.Beam1:
                if (!GetBeamDumpStatusAsync(out Bitmap beamOneOnInjectionPanelImg))
                {
                    return(false);
                }
                else
                {
                    if (beamOneOnInjectionPanelImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamOneOnInjectionPanelImg.GetPixel(194, 168),           //ON - Injection Pane
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            case Machine.Beam.Beam2:
                if (!GetBeamDumpStatusAsync(out Bitmap beamTwoOnInjectionPaneImg))
                {
                    return(false);
                }
                else
                {
                    if (beamTwoOnInjectionPaneImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamTwoOnInjectionPaneImg.GetPixel(594, 168),           //ON - Injection Pane
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            default:
                return(false);
            }
        }
예제 #8
0
        private static bool CheckTimingOnIndividual(Machine.Beam beam)
        {
            switch (beam)
            {
            case Machine.Beam.Beam1:
                if (!GetBeamDumpStatusAsync(out Bitmap beamOneTimingOnImg))
                {
                    return(false);
                }
                else
                {
                    if (beamOneTimingOnImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamOneTimingOnImg.GetPixel(333, 168),           //TIMING ON
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            case Machine.Beam.Beam2:
                if (!GetBeamDumpStatusAsync(out Bitmap beamTwoTimingOnImg))
                {
                    return(false);
                }
                else
                {
                    if (beamTwoTimingOnImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamTwoTimingOnImg.GetPixel(733, 168),           //TIMING ON
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            default:
                return(false);
            }
        }
예제 #9
0
        private static bool CheckConditioningIndividual(Machine.Beam beam)
        {
            switch (beam)
            {
            case Machine.Beam.Beam1:
                if (!GetBeamDumpStatusAsync(out Bitmap beamOneConditioningImg))
                {
                    return(false);
                }
                else
                {
                    if (beamOneConditioningImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamOneConditioningImg.GetPixel(65, 189),           //CONDITIONING
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            case Machine.Beam.Beam2:
                if (!GetBeamDumpStatusAsync(out Bitmap beamTwoConditioningImg))
                {
                    return(false);
                }
                else
                {
                    if (beamTwoConditioningImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamTwoConditioningImg.GetPixel(465, 189),           //CONDITIONING
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            default:
                return(false);
            }
        }
예제 #10
0
        private static bool CheckLinkStatusOfBeamPermits(Machine.Beam beam)
        {
            switch (beam)
            {
            case Machine.Beam.Beam1:
                if (!GetPage1PageAsync(out Bitmap linkStatusofBeamPermitsBeam1Img))
                {
                    return(false);
                }
                else
                {
                    if (linkStatusofBeamPermitsBeam1Img == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        linkStatusofBeamPermitsBeam1Img.GetPixel(872, 572)
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            case Machine.Beam.Beam2:
                if (!GetPage1PageAsync(out Bitmap linkStatusofBeamPermitsBeam2Img))
                {
                    return(false);
                }
                else
                {
                    if (linkStatusofBeamPermitsBeam2Img == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        linkStatusofBeamPermitsBeam2Img.GetPixel(945, 572)
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            default:
                return(false);
            }
        }
예제 #11
0
        private static bool CheckBeamDumpedIndividual(Machine.Beam beam)
        {
            switch (beam)
            {
            case Machine.Beam.Beam1:
                if (!GetBeamDumpStatusAsync(out Bitmap beamOneDumpedImg))
                {
                    return(false);
                }
                else
                {
                    if (beamOneDumpedImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamOneDumpedImg.GetPixel(192, 38),            //BeamOneDumped
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            case Machine.Beam.Beam2:
                if (!GetBeamDumpStatusAsync(out Bitmap beamTwoBeamDumpedImg))
                {
                    return(false);
                }
                else
                {
                    if (beamTwoBeamDumpedImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamTwoBeamDumpedImg.GetPixel(593, 38),            //BeamTwoDumped
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            default:
                return(false);
            }
        }
예제 #12
0
        private static bool CheckMoveableDevicesAllowedIn(Machine.Beam beam)
        {
            switch (beam)
            {
            case Machine.Beam.Beam1:
                if (!GetPage1PageAsync(out Bitmap moveableDevicesAllowedInBeam1Img))
                {
                    return(false);
                }
                else
                {
                    if (moveableDevicesAllowedInBeam1Img == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        moveableDevicesAllowedInBeam1Img.GetPixel(872, 686)
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            case Machine.Beam.Beam2:
                if (!GetPage1PageAsync(out Bitmap moveableDevicesAllowedInBeam2Img))
                {
                    return(false);
                }
                else
                {
                    if (moveableDevicesAllowedInBeam2Img == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        moveableDevicesAllowedInBeam2Img.GetPixel(945, 686)
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            default:
                return(false);
            }
        }
예제 #13
0
        private static bool CheckGlobalBeamPermit(Machine.Beam beam)
        {
            switch (beam)
            {
            case Machine.Beam.Beam1:
                if (!GetPage1PageAsync(out Bitmap globalBeamPermitBeam1Img))
                {
                    return(false);
                }
                else
                {
                    if (globalBeamPermitBeam1Img == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        globalBeamPermitBeam1Img.GetPixel(872, 600)
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            case Machine.Beam.Beam2:
                if (!GetPage1PageAsync(out Bitmap globalBeamPermitBeam2Img))
                {
                    return(false);
                }
                else
                {
                    if (globalBeamPermitBeam2Img == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        globalBeamPermitBeam2Img.GetPixel(945, 600)
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            default:
                return(false);
            }
        }
예제 #14
0
        private static bool CheckStableBeams(Machine.Beam beam)
        {
            switch (beam)
            {
            case Machine.Beam.Beam1:
                if (!GetPage1PageAsync(out Bitmap stableBeamsBeam1Img))
                {
                    return(false);
                }
                else
                {
                    if (stableBeamsBeam1Img == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        stableBeamsBeam1Img.GetPixel(872, 715)
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            case Machine.Beam.Beam2:
                if (!GetPage1PageAsync(out Bitmap stableBeamsBeam2Img))
                {
                    return(false);
                }
                else
                {
                    if (stableBeamsBeam2Img == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        stableBeamsBeam2Img.GetPixel(945, 715)
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            default:
                return(false);
            }
        }
예제 #15
0
        public static bool GetBeamSMPStatus(Machine.Beam beam)
        {
            switch (beam)
            {
            case Machine.Beam.Beam1:
                if (!GetPage1PageAsync(out Bitmap beam1StatusImg))
                {
                    return(false);
                }
                else
                {
                    if (beam1StatusImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beam1StatusImg.GetPixel(872, 572),
                        beam1StatusImg.GetPixel(872, 600),
                        beam1StatusImg.GetPixel(872, 629),
                        beam1StatusImg.GetPixel(872, 658),
                        beam1StatusImg.GetPixel(872, 686),
                        beam1StatusImg.GetPixel(872, 715)
                    };
                    if (colors[2] == Color.FromArgb(255, 0, 255, 0) && colors[5] == Color.FromArgb(255, 0, 255, 0))     // some weird mode we haven't see before
                    {
                        throw new Exception("New weird LHC mode discovered");
                    }
                    else if (colors[5] == Color.FromArgb(255, 0, 255, 0))     // if in stable beams remove the setup flag
                    {
                        colors.RemoveAt(2);
                    }
                    else if (colors[2] == Color.FromArgb(255, 0, 255, 0))     // if in setup remove the stable beams flag
                    {
                        colors.RemoveAt(5);
                    }

                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            case Machine.Beam.Beam2:
                if (!GetPage1PageAsync(out Bitmap beam2Statusimg))
                {
                    return(false);
                }
                else
                {
                    if (beam2Statusimg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beam2Statusimg.GetPixel(945, 572),
                        beam2Statusimg.GetPixel(945, 600),
                        beam2Statusimg.GetPixel(945, 629),
                        beam2Statusimg.GetPixel(945, 658),
                        beam2Statusimg.GetPixel(945, 686),
                        beam2Statusimg.GetPixel(945, 715)
                    };
                    if (colors[2] == Color.FromArgb(255, 0, 255, 0) && colors[5] == Color.FromArgb(255, 0, 255, 0))     // some weird mode we haven't see before
                    {
                        throw new Exception("New weird LHC mode discovered");
                    }
                    else if (colors[5] == Color.FromArgb(255, 0, 255, 0))     // if in stable beams remove the setup flag
                    {
                        colors.RemoveAt(2);
                    }
                    else if (colors[2] == Color.FromArgb(255, 0, 255, 0))     // if in setup remove the stable beams flag
                    {
                        colors.RemoveAt(5);
                    }

                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            default:
                break;
            }
            return(false);
        }
예제 #16
0
        public static bool GetBeamBeamDumpStatus(Machine.Beam beam)
        {
            switch (beam)
            {
            case Machine.Beam.Beam1:
                if (!GetBeamDumpStatusAsync(out Bitmap beamDumpBeamOneImg))
                {
                    return(false);
                }
                else
                {
                    if (beamDumpBeamOneImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamDumpBeamOneImg.GetPixel(192, 38),  //BeamOneDumped
                        beamDumpBeamOneImg.GetPixel(73, 60),   //Kicker
                        beamDumpBeamOneImg.GetPixel(200, 60),  //BETS
                        beamDumpBeamOneImg.GetPixel(323, 60),  //IPOC - Beam Dump Pane
                        beamDumpBeamOneImg.GetPixel(76, 80),   //LASS
                        beamDumpBeamOneImg.GetPixel(200, 82),  //RETRIGGER
                        beamDumpBeamOneImg.GetPixel(326, 82),  //XPOC
                        beamDumpBeamOneImg.GetPixel(81, 101),  //REMOTE - Beam Dump Pane
                        beamDumpBeamOneImg.GetPixel(193, 102), //ON - Beam Dump Pane
                        beamDumpBeamOneImg.GetPixel(90, 168),  //REMOTE - Injection Pane
                        beamDumpBeamOneImg.GetPixel(194, 168), //ON - Injection Pane
                        beamDumpBeamOneImg.GetPixel(333, 168), //TIMING ON
                        beamDumpBeamOneImg.GetPixel(65, 189),  //CONDITIONING
                        beamDumpBeamOneImg.GetPixel(286, 188), //TIMEOUT
                        beamDumpBeamOneImg.GetPixel(111, 210), //IPOC - Injection Pane
                        beamDumpBeamOneImg.GetPixel(290, 210)  //IQC
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            case Machine.Beam.Beam2:
                if (!GetBeamDumpStatusAsync(out Bitmap beamDumpBeamTwoImg))
                {
                    return(false);
                }
                else
                {
                    if (beamDumpBeamTwoImg == null)
                    {
                        return(false);
                    }
                    List <Color> colors = new List <Color>
                    {
                        beamDumpBeamTwoImg.GetPixel(593, 38),   //BeamTwoDumped
                        beamDumpBeamTwoImg.GetPixel(472, 60),   //Kicker
                        beamDumpBeamTwoImg.GetPixel(600, 60),   //BETS
                        beamDumpBeamTwoImg.GetPixel(723, 60),   //IPOC - Beam Dump Pane
                        beamDumpBeamTwoImg.GetPixel(476, 80),   //LASS
                        beamDumpBeamTwoImg.GetPixel(600, 82),   //RETRIGGER
                        beamDumpBeamTwoImg.GetPixel(726, 82),   //XPOC
                        beamDumpBeamTwoImg.GetPixel(481, 101),  //REMOTE - Beam Dump Pane
                        beamDumpBeamTwoImg.GetPixel(593, 102),  //ON - Beam Dump Pane
                        beamDumpBeamTwoImg.GetPixel(490, 168),  //REMOTE - Injection Pane
                        beamDumpBeamTwoImg.GetPixel(594, 168),  //ON - Injection Pane
                        beamDumpBeamTwoImg.GetPixel(733, 168),  //TIMING ON
                        beamDumpBeamTwoImg.GetPixel(465, 189),  //CONDITIONING
                        beamDumpBeamTwoImg.GetPixel(686, 188),  //TIMEOUT
                        beamDumpBeamTwoImg.GetPixel(511, 210),  //IPOC - Injection Pane
                        beamDumpBeamTwoImg.GetPixel(690, 210)   //IQC
                    };
                    return(!colors.Any(c => c != Color.FromArgb(255, 0, 255, 0)));
                }

            default:
                break;
            }
            return(false);
        }
예제 #17
0
 public static bool GetSMPStatus(Machine.Beam beam, Machine.Page1.SMPFlags smpFlag)
 {
     return(GetSMPStatusIndividual(beam, smpFlag));
 }
예제 #18
0
 public static bool GetBeamDumpStatusIndividual(Machine.Beam beam, Machine.BeamDump.Components components)
 {
     return(GetBeamDumpStatusIndividualComponent(beam, components));
 }