Ejemplo n.º 1
0
        private static void Governor()
        {
            if (Operation == Operations.Broken)
            {
                return;
            }
            if (Operation == Operations.Stabilizing)                                    // Ramming outrigger into ground
            {
                Foot.Enabled = true;
                Foot.Lock();
                Foot.AutoLock = true;
            }
            if (Operation == Operations.StabilizeCorrecting)                // Elastic Wheel Compression
            {
                Foot.Enabled  = true;
                Foot.AutoLock = false;
                Foot.Unlock();
            }
            if (!Operations.IsMoving(Operation) && Foot.IsLocked)                            // Automatically secures piston only when attached to ground
            {
                OutRiggerSecure();
            }
            else                                                                            // Otherwise avoids Klang-tom Forces (Piston Force on Self Locked Landing Gear)
            {
                OutRiggerRelease();
            }
            if (Operation != Operations.Retracted)                          // Driving or movement confusing ResolveOperation
            {
                Cockpit.HandBrake = true;
            }
            if (Operation == Operations.Retracted)                          // Attaching to random items in transit
            {
                Foot.Enabled  = true;
                Foot.AutoLock = false;
                Foot.Unlock();
            }
            if ((Cockpit.GetShipSpeed() > (Math.Abs(Piston.Velocity) * MoveDectect) && Operation != Operations.Retracted) || Operation == Operations.Extended)                // Falling over while extended
            {
                Foot.Enabled = true;
                Foot.Lock();

                Foot.AutoLock = true;
            }
        }
Ejemplo n.º 2
0
        private static void ResolveOperation()
        {
            //Parameter Checking
            if (GroundClearance < 0.0f)
            {
                Warnings.Add("GroundClearance should be set to correct distance in metres, otherwise possible ship bouncing.");
            }
            if (Piston == null)
            {
                Operation = Operations.Broken;
                throw new BlockNullReferenceException("Piston");
            }
            if (Cockpit == null)
            {
                Operation = Operations.Broken;
                throw new BlockNullReferenceException("Cockpit");
            }
            if (Foot == null)
            {
                Operation = Operations.Broken;
                throw new BlockNullReferenceException("Foot");
            }

            double PistonCurrentPosition = PistonGetCurrentPosition(Piston);

            if (Piston.Velocity == 0 || !Piston.Enabled)
            {
                if (Piston.Status == OutrigStatus.Extended)
                {
                    Operation = Operations.Extended;
                }
                else if (Piston.Status == OutrigStatus.Retracted)
                {
                    Operation = Operations.Retracted;
                }
                else
                {
                    Operation = Operations.Stabilized;
                };
            }
            else if (Piston.Velocity > 0 && ExtendMatch)
            {
                if (Piston.Status == PistonStatus.Stopped || Piston.Status == OutrigStatus.Extended)
                {
                    Operation = Operations.Extended;
                }
                else if (Foot.IsLocked)
                {
                    Operation = Operations.Extending;
                }
                else
                {
                    Operation = Operations.Stabilizing;
                };
            }
            else
            {
                if (
                    (Piston.Velocity < 0 && ExtendMatch && PistonCurrentPosition <= GroundClearance && Foot.IsLocked) ||
                    (Cockpit.GetShipSpeed() < Math.Abs(Piston.Velocity) * MoveDectect && Foot.IsLocked)                       //In-case GroundClearance value is incorrect
                    )
                {
                    Operation = Operations.StabilizeCorrecting;
                }
                else if (Piston.Status == PistonStatus.Stopped || Piston.Status == OutrigStatus.Retracted)
                {
                    Operation = Operations.Retracted;
                }
                else
                {
                    Operation = Operations.Retracting;
                };
            };
        }