private List <MachineState> BuildMeasurementList() { var machineState = MachineState.InitNew(); var measurementList = new List <MachineState>(); machineState.X1 = machineState.X2 = machineState.Y1 = machineState.Y2 = MeasurementFOV / 2; machineState.MU = MUPerShot; var wedgeAngles = new int[] { 10, 15, 20, 25, 30, 45, 60 }; var wedgeList = wedgeAngles.Select(a => $"Y1IN{a}").Concat(wedgeAngles.Select(a => $"Y2OUT{a}")); energiesToMeasure.ToList().ForEach(en => { var copy = machineState.Copy(); copy.Energy = en; foreach (var wedge in wedgeList) { var changeState = copy.Copy(); changeState.Energy = en; measurementList.Add(changeState); } }); return(measurementList); }
/// <summary> /// Creates a list of machine states which we will mode up one by one to take measurements /// </summary> /// <returns></returns> private static List <MachineState> BuildMeasurementList() { //PHOTONS var machineState = MachineState.InitNew(); var measurementList = new List <MachineState>(); var electronOFList = new string[] { "A6", "A10", "A15", "A20", "A25" }.Select(cone => { var changeState = machineState.Copy(); changeState.Accessory = cone; changeState.Energy = Autodrive.Linacs.Energy._6MeV; changeState.MU = 250; return(changeState); }).ToList(); //Add to measurement list, make a copy for other energy electronOFList.ForEach(p => { //Add 6MeV first measurementList.Add(p); //Foreach other energy copy a task foreach (var en in new Energy[] { _9MeV, _12MeV, _15MeV, _18MeV }) { var copy = p.Copy(); copy.Energy = en; measurementList.Add(copy); } }); return(measurementList); }
/// <summary> /// Creates a list of machine states which we will mode up one by one to take measurements /// </summary> /// <returns></returns> private static List <MachineState> BuildMeasurementList() { //PHOTONS var machineState = MachineState.InitNew(); var measurementList = new List <MachineState>(); var photonOFList = new double[] { 4, 14, 15, 20, 30, 40 }.Select(fov => { var changeState = machineState.Copy(); changeState.X1 = changeState.X2 = fov / 2; changeState.Y1 = changeState.Y2 = fov / 2; changeState.Energy = Autodrive.Linacs.Energy._6X; changeState.MU = 250; return(changeState); }).ToList(); //Add to measurement list, make a copy for other energy photonOFList.ForEach(p => { measurementList.Add(p); var copy = p.Copy(); copy.Energy = Autodrive.Linacs.Energy._15X; measurementList.Add(copy); }); return(measurementList); }
public void Run() { if (string.IsNullOrEmpty(SavePath)) { Logger.Log("Save path is empty. Will save to desktop\n"); SavePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "mulinearity.txt"); } ; //Move to Scanning Depth Logger.Log("Moving scanning chamber...\n"); _scan1D.GoToDepth(ScanningDepthMM).Wait(); var ms = MachineState.InitNew(); ms.X1 = ms.X2 = ms.Y1 = ms.Y2 = 5; foreach (var en in energiesToTest) { foreach (var mu in musToTest) { var movingMs = ms.Copy(); movingMs.Energy = en; movingMs.MU = mu; var jr = new Job(movingMs); jr.DepthOfMeasurentMM = ScanningDepthMM; for (int n = 0; n < RepeatMeasurements; n++) { Logger.Log($"Working on {en}, {mu} MU, Measurement {n + 1}\n"); _linac.SetMachineState(movingMs); //Start measuring _el.Reset(); _el.StartMeasurement(); if (n == 0) { _linac.BeamOn(); } else { _linac.RepeatBeam(); } Thread.Sleep(_linac.WaitMsForMU(mu)); //Stop and get measurement _el.StopMeasurement(); var measured = _el.GetValue().Measurement; Logger?.Log($"Measured : {measured}\n"); //Save results jr.AddMeasurement(_el.GetValue().Measurement); } JobWriter.AppendResult(SavePath, jr); } } }
public void Run() { //Put couch and gantry and home position var ms = MachineState.InitNew(); ms.Energy = Linacs.Energy._6X; //ms.CouchLat = 101; //ms.CouchLng = 101; //ms.CouchVert = 101; //ms.CouchRot = 181; //_linac.SetMachineState(ms); //Thread.Sleep(8000); ms.Time = 99; //Set through different x y jaw combos and beam on to film/portal var jawShows = JawShots.GetXYCalibrationShots(_linac); //jawShows.Run(); //Shoot a couple square fields to test for coincidence //jawShows = JawShots.GetLightFieldCoincidence(_linac); //jawShows.Run(); //TESTING FOR COUCH RELATIVE MOTION ACCURACY //Step couch 20 cm long and lat to shoot a square ms = _linac.GetMachineStateCopy(); ms.CouchLat += 8; ms.CouchLng += 8; ms.X1 = ms.X2 = ms.Y1 = ms.Y2 = 1; //2 x 2 field ms.MU = 400; _linac.SetMachineState(ms); _linac.BeamOn(); Thread.Sleep(_linac.WaitMsForMU(400)); //Move couch to other side shoot a square ms.CouchLat -= 16; ms.CouchLng -= 16; _linac.SetMachineState(ms); _linac.BeamOn(); Thread.Sleep(_linac.WaitMsForMU(400)); //Collimator Star //var cs = new CollimatorStarShot(_linac); //cs.Run(); //Couch Star var cos = new CouchStarShot(_linac); cos.Run(); }
private List <Job> BuildMeasurementList(bool photons = true, bool electrons = true) { var machineState = MachineState.InitNew(); var measurementList = new List <Job>(); var lastPhotonFovHalf = 0.5; if (photons) { var changeState = machineState.Copy(); lastPhotonFovHalf = changeState.X1 = changeState.X2 = photonFovCM / 2; changeState.Y1 = changeState.Y2 = photonFovCM / 2; changeState.MU = MUPerShot; changeState.DoseRate = DoseRate._600; foreach (var en in energyDepths.Where(e => EnergyHelper.IsPhoton(e.Item1))) { var copy = changeState.Copy(); copy.Energy = en.Item1; measurementList.Add(new Job(copy) { DepthOfMeasurentMM = en.Item2 }); } } if (electrons) { //ELECTRONS var changeState = machineState.Copy(); changeState.X1 = changeState.X2 = changeState.Y1 = changeState.Y2 = lastPhotonFovHalf; changeState.DoseRate = DoseRate._600; changeState.Accessory = electronCone; changeState.MU = MUPerShot; foreach (var en in energyDepths.Where(e => !EnergyHelper.IsPhoton(e.Item1))) { var copy = changeState.Copy(); copy.Energy = en.Item1; measurementList.Add(new Job(copy) { DepthOfMeasurentMM = en.Item2 }); } } return(measurementList); }
private List <MachineState> BuildMeasurementList(bool photons = true, bool electrons = true) { var machineState = MachineState.InitNew(); var measurementList = new List <MachineState>(); if (photons) { //PHOTONS photonsFovs.ToList().ForEach(fov => { var changeState = machineState.Copy(); changeState.X1 = changeState.X2 = fov / 2; changeState.Y1 = changeState.Y2 = fov / 2; changeState.MU = MUPerShot; foreach (var en in energyDepths.Where(e => EnergyHelper.IsPhoton(e.Key))) { var copy = changeState.Copy(); copy.Energy = en.Key; measurementList.Add(copy); } }); } if (electrons) { //ELECTRONS electronCones.ToList().ForEach(cone => { var changeState = machineState.Copy(); changeState.Accessory = cone; changeState.MU = MUPerShot; foreach (var en in energyDepths.Where(e => !EnergyHelper.IsPhoton(e.Key))) { var copy = changeState.Copy(); copy.Energy = en.Key; measurementList.Add(copy); } }); } return(measurementList); }
static void Main(string[] args) { var linac = new CSeriesLinac(); linac.Initialize("COM9"); var logger = new Logger(); logger.Logged += (log) => Console.WriteLine(log); linac.Logger = logger; var ms = MachineState.InitNew(); ms.Energy = Energy._6X; ms.X1 = 5; ms.X2 = 5; linac.SetMachineState(ms); var ss = ServiceModeSession.Instance; ss.Logger = logger; ss.AddWaitTime("test", 7000); ss.Wait(); var time = new TimerLogger("Test", 7000, 1000, logger); time.CompletionEvent.WaitOne(); Console.WriteLine("Timer complete"); Console.Read(); var max = new Max4000(); max.Initialize("COM1"); var verify = max.Verify(); var status = max.GetStatus(); var dv = new DoseView1D(); dv.Initialize("COM3"); dv.GoToDepth(64.2).Wait(); var test = dv.GetOrigin(); //var linac = new CSeriesLinac(); //linac.Initialize("COM5"); // linac.OverrideDefaultInterlocks(); //var of = @"C:\Users\variansupport\Desktop\photonOoutputFactors.txt"; //var edwOF = @"C:\Users\variansupport\Desktop\edwFactors.txt"; //var jobs = JobResultReader.Read(of); //var edwJobs = JobResultReader.Read(edwOF).ToList(); //var table = AccessoryOFProcessor.GetTableRows(edwJobs); //foreach(var t in table) //{ // t.PrintToConsole(); //} //Console.ReadLine(); //var dv = new DoseView1D(); //dv.Initalize("COM12"); //var max = new Max4000(); //max.Initialize("COM9"); //max.Verify(); //// max.Zero().Wait(); //var bias = max.SetBias(Autodrive.Electrometers.Bias.NEG_100PERC); //max.SetMode(Autodrive.Electrometers.MeasureMode.CHARGE); //var linac = new CSeriesLinac(); //linac.Initialize("COM10"); //var ofTest = new EDWFactors(linac, max, dv); //ofTest.Logger.Logged += Logger_Logged; //ofTest.Run(); // var session = ServiceModeSession.Instance; // session.Keyboard = new VetraKeyboard("COM3"); // session.KeySpeedMs = 100; //// session.EnterDefaultPassword(); // session.ResetConsoleState(); // //session.ToggleDefaultInterlocks(); // session.MachineState.GantryRot = 180; // session.MachineState.CollimatorRot = 180; // session.MachineState.X1 = 5.0; // session.MachineState.X2 = 5.0; // session.MachineState.Y1 = 5.0; // session.MachineState.Y2 = 5.0; // session.MachineState.CouchLat = 100.2; // session.MachineState.CouchVert = 127.9; // session.MachineState.CouchLng = 54.4; //MonthlyMechanicals.InitializePosition(); //MonthlyMechanicals.CouchStarShot(); Console.Read(); // var tasks = new List<ITask>(); }