private void AssignMulticastDelegate() { DecideInvocationOrder = new MethodInvocationOrderDecider(DummyMethod); if (SetupChange_CV_Base.constKPI == true || SetupChange_CV_Base.KPIChangeRequested) { DecideInvocationOrder += invokeKPIClosedLoop; } if (SetupChange_CV_Base.constCaster == true || SetupChange_CV_Base.CasterChangeRequested) { DecideInvocationOrder += invokeCasterClosedLoop; } if (SetupChange_CV_Base.constCamber == true || SetupChange_CV_Base.CamberChangeRequested) { DecideInvocationOrder += invokeCamberClosedLoop; } if (SetupChange_CV_Base.constToe == true || SetupChange_CV_Base.ToeChangeRequested) { DecideInvocationOrder += invokeToeClosedLoop; } //if (SetupChange_CV_Base.constCaster == true || SetupChange_CV_Base.deltaCaster != 0 ) //{ // DecideInvocationOrder += invokeCasterClosedLoop; //} //if (SetupChange_CV_Base.constKPI == true || SetupChange_CV_Base.deltaKPI != 0) //{ // DecideInvocationOrder += invokeKPIClosedLoop; //} if (SetupChange_CV_Base.deltaToeLinkLength != 0 || SetupChange_CV_Base.deltaTopFrontArm != 0 || SetupChange_CV_Base.deltaTopRearArm != 0 || SetupChange_CV_Base.deltaBottmFrontArm != 0 || SetupChange_CV_Base.deltaBottomRearArm != 0 || SetupChange_CV_Base.deltaPushrod != 0) { DecideInvocationOrder += invokeLinkLengthClosedLoop; } }
/// <summary> /// Called ONLY once before the start of a closed Loop. Sort of an initializer method to teach this class which Requested Change is the Parent Change /// </summary> /// <param name="_currentChange">Enum which teaches this class which the parent change is </param> public void ClosedLoop_Solver(CurrentChange _currentChange) { //CurrentChange currentChange = _currentChange; if (_currentChange == CurrentChange.Camber) { primaryClosedLoopMethod = new PrimaryClosedLoopMethod(ClosedLoop_ChangeCamber_Invoker); if (DecideInvocationOrder.GetInvocationList().Contains(invokeCamberClosedLoop)) { DecideInvocationOrder -= invokeCamberClosedLoop; } } else if (_currentChange == CurrentChange.Toe) { primaryClosedLoopMethod = new PrimaryClosedLoopMethod(ClosedLoop_ChangeToe_Invoker); if (DecideInvocationOrder.GetInvocationList().Contains(invokeToeClosedLoop)) { DecideInvocationOrder -= invokeToeClosedLoop; } } else if (_currentChange == CurrentChange.KPI) { primaryClosedLoopMethod = new PrimaryClosedLoopMethod(ClosedLoop_ChangeKPI_Invoker); if (DecideInvocationOrder.GetInvocationList().Contains(invokeKPIClosedLoop)) { DecideInvocationOrder -= invokeKPIClosedLoop; } } else if (_currentChange == CurrentChange.Caster) { primaryClosedLoopMethod = new PrimaryClosedLoopMethod(ClosedLoop_ChangeCaster_Invoker); if (DecideInvocationOrder.GetInvocationList().Contains(invokeCasterClosedLoop)) { DecideInvocationOrder -= invokeCasterClosedLoop; } } //else if (_currentChange == CurrentChange.RideHeight) //{ //} else if (_currentChange == CurrentChange.LinkLength || _currentChange == CurrentChange.RideHeight) { primaryClosedLoopMethod = new PrimaryClosedLoopMethod(ClosedLoop_ChangeLinkLengths_Invoker); if (DecideInvocationOrder.GetInvocationList().Contains(invokeLinkLengthClosedLoop)) { DecideInvocationOrder -= invokeLinkLengthClosedLoop; } } if (DecideInvocationOrder != null) { SolveSetupChange(); } }
/// <summary> /// Enumeration to decide which the Parent Change is. That is, the Entry point of the Setup Change Closed Loop Solver /// </summary> /// <summary> /// Overloaded constructor to <see cref="SolverMasterClass"/> and <see cref="OutputClass"/> and <see cref="SetupChange_CornerVariables"/> along with lists /// </summary> /// <param name="_sMC"></param> /// <param name="_oC"></param> /// <param name="_setupChange_DB_Dictionary"></param> public SetupChange_ClosedLoopSolver(SolverMasterClass _sMC, List <OutputClass> _oC, ref Dictionary <string, double> _setupChange_DB_Dictionary, Angle _finalCamber, Angle _finalToe, Angle _finalCaster, Angle _finalKPI) { ///<summary>Assining the object of the <see cref="SolverMasterClass"/></summary> SMC = _sMC; ///<summary>Assining the object of the <see cref="OutputClass"/></summary> OC = _oC; ///<summary>Assining the object of the <see cref="SetupChange_CornerVariables"/></summary> SetupChange_CV_Base = new SetupChange_CornerVariables(); SetupChange_CV_Base = OC[0].sccvOP; ///<summary>Assining the object of the <see cref="SetupChangeDatabase"/></summary> SetupChange_DB = SMC.SetupChange_DB_Master; ///<remarks>---OBSELETE---</remarks> SetupChange_DB_Dictionary = _setupChange_DB_Dictionary; ///<summary>Initializing all the Lists of this class which will be used for the Setup Change Verificating and History maintainance</summary> InitializeLists(); ///<summary>Creating delegates which will be stored in a master Multicast Delegate. This master delegate will the Invocation list and will call the methods according to that lsit </summary> invokeCamberClosedLoop = new MethodInvocationOrderDecider(ClosedLoop_ChangeCamber_Invoker); invokeToeClosedLoop = new MethodInvocationOrderDecider(ClosedLoop_ChangeToe_Invoker); invokeCasterClosedLoop = new MethodInvocationOrderDecider(ClosedLoop_ChangeCaster_Invoker); invokeKPIClosedLoop = new MethodInvocationOrderDecider(ClosedLoop_ChangeKPI_Invoker); invokeLinkLengthClosedLoop = new MethodInvocationOrderDecider(ClosedLoop_ChangeLinkLengths_Invoker); ///<summary>Dumping all the above delegates into the Multicast delegate. This will be sorted eventually based on the entry point to the closed loop </summary> AssignMulticastDelegate(); FinalCamber = _finalCamber; FinalToe = _finalToe; FinalCaster = _finalCaster; FinalKPI = _finalKPI; }