123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using Aitex.Sorter.Common;
- using Venus_RT.Devices;
- using MECF.Framework.Common.Routine;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.SubstrateTrackings;
- using Venus_Core;
- using Aitex.Core.RT.Log;
- using Aitex.Core.Util;
- using System.Collections.Generic;
- using System.Linq;
- using Venus_RT.Modules.Schedulers;
- using Venus_RT.Scheduler;
- using System;
- namespace Venus_RT.Modules
- {
- class TMCycle : ModuleRoutineBase, IRoutine
- {
- enum TMCycleStep
- {
- Start,
- ReturnBack,
- Cycling,
- End,
- }
- private bool IsModuleAvailable(ModuleName module) => dictSchedulers.Keys.Contains(module) && dictSchedulers[module].IsAvailable;
- List<ModuleName> tmCycleRoutine = new List<ModuleName>() { ModuleName.LLA, ModuleName.PMA, ModuleName.PMB, ModuleName.LLB };
- int cycleCount = 1;
- ModuleName _sourceModule = ModuleName.LLA;
- ModuleName _destinationModule = ModuleName.LLB;
- SchedulerTMRobot _TMRobot = new SchedulerTMRobot();
- Dictionary<ModuleName, SchedulerModule> dictSchedulers = new Dictionary<ModuleName, SchedulerModule>();
- public TMCycle() : base(ModuleName.System)
- {
- Name = "TM Cycle";
- void _initMoudle(ModuleName name, SchedulerModule sche)
- {
- if (ModuleHelper.IsInstalled(name))
- {
- dictSchedulers[name] = sche;
- }
- }
- _initMoudle(ModuleName.LLA, new SchedulerLoadLock(ModuleName.LLA));
- _initMoudle(ModuleName.LLB, new SchedulerLoadLock(ModuleName.LLB));
- _initMoudle(ModuleName.PMA, new SchedulerPM(ModuleName.PMA));
- _initMoudle(ModuleName.PMB, new SchedulerPM(ModuleName.PMB));
- _initMoudle(ModuleName.PMC, new SchedulerPM(ModuleName.PMC));
- _initMoudle(ModuleName.PMD, new SchedulerPM(ModuleName.PMD));
- }
- public RState Start(params object[] objs)
- {
- if (objs.Length == 2)
- {
- var modules = ((string[])objs[0]).ToList();
- if (modules.Count >= 2)
- tmCycleRoutine.Clear();
- foreach(var mod in modules)
- {
- try
- {
- ModuleName module = ModuleHelper.Converter(mod);
- tmCycleRoutine.Add(module);
- }
- catch(Exception _)
- {
- LOG.Write(eEvent.ERR_ROUTER, "TMCycle", $"Invalid module string: {mod}");
- return RState.Failed;
- }
- }
- cycleCount = (int)objs[1];
- }
- return Runner.Start(Module, Name);
- }
- public RState Monitor()
- {
- Runner.Run((int)TMCycleStep.Start, NullFun)
- .LoopStart((int)TMCycleStep.ReturnBack, "Cycle", cycleCount, ReturnBack, IsReturnDone)
- .LoopEnd((int)TMCycleStep.Cycling, Cycling, IsCycleDone)
- .End((int)TMCycleStep.End, NullFun, _delay_50ms);
- return Runner.Status;
- }
- private bool ReturnBack()
- {
- if(_TMRobot.IsAvailable)
- {
- for(int i = 0; i < tmCycleRoutine.Count - 1; i++)
- {
- if(IsModuleAvailable(tmCycleRoutine[i]) && IsModuleAvailable(tmCycleRoutine[i+1]))
- {
- }
- }
- }
- return true;
- }
- private bool IsReturnDone()
- {
- return true;
- }
- private bool Cycling()
- {
- return true;
- }
- private bool IsCycleDone()
- {
- return true;
- }
- public void Abort()
- {
- }
- }
- }
|