Exemplo n.º 1
0
        public ScriptedBrakeController(ScriptedBrakeController controller, MSTSLocomotive locomotive)
        {
            Simulator  = locomotive.Simulator;
            Locomotive = locomotive;

            scriptName                     = controller.scriptName;
            MaxPressurePSI                 = controller.MaxPressurePSI;
            MaxOverchargePressurePSI       = controller.MaxOverchargePressurePSI;
            ReleaseRatePSIpS               = controller.ReleaseRatePSIpS;
            QuickReleaseRatePSIpS          = controller.QuickReleaseRatePSIpS;
            OverchargeEliminationRatePSIpS = controller.OverchargeEliminationRatePSIpS;
            ApplyRatePSIpS                 = controller.ApplyRatePSIpS;
            SlowApplicationRatePSIpS       = controller.SlowApplicationRatePSIpS;
            EmergencyRatePSIpS             = controller.EmergencyRatePSIpS;
            FullServReductionPSI           = controller.FullServReductionPSI;
            MinReductionPSI                = controller.MinReductionPSI;

            CurrentValue = controller.CurrentValue;
            MinimumValue = controller.MinimumValue;
            MaximumValue = controller.MaximumValue;
            StepSize     = controller.StepSize;

            controller.Notches.ForEach(
                (item) => { Notches.Add(new MSTSNotch(item)); }
                );

            Initialize();
        }
Exemplo n.º 2
0
        public void Parse(string lowercasetoken, STFReader stf)
        {
            switch (lowercasetoken)
            {
            case "engine(trainbrakescontrollermaxsystempressure":
            case "engine(enginebrakescontrollermaxsystempressure":
                MaxPressurePSI = stf.ReadFloatBlock(STFReader.Units.PressureDefaultPSI, null);
                break;

            case "engine(ortstrainbrakescontrollermaxoverchargepressure":
                MaxOverchargePressurePSI = stf.ReadFloatBlock(STFReader.Units.PressureDefaultPSI, null);
                break;

            case "engine(trainbrakescontrollermaxreleaserate":
            case "engine(enginebrakescontrollermaxreleaserate":
                ReleaseRatePSIpS = stf.ReadFloatBlock(STFReader.Units.PressureRateDefaultPSIpS, null);
                break;

            case "engine(trainbrakescontrollermaxquickreleaserate":
            case "engine(enginebrakescontrollermaxquickreleaserate":
                QuickReleaseRatePSIpS = stf.ReadFloatBlock(STFReader.Units.PressureRateDefaultPSIpS, null);
                break;

            case "engine(ortstrainbrakescontrolleroverchargeeliminationrate":
                OverchargeEliminationRatePSIpS = stf.ReadFloatBlock(STFReader.Units.PressureRateDefaultPSIpS, null);
                break;

            case "engine(trainbrakescontrollermaxapplicationrate":
            case "engine(enginebrakescontrollermaxapplicationrate":
                ApplyRatePSIpS = stf.ReadFloatBlock(STFReader.Units.PressureRateDefaultPSIpS, null);
                break;

            case "engine(trainbrakescontrolleremergencyapplicationrate":
            case "engine(enginebrakescontrolleremergencyapplicationrate":
                EmergencyRatePSIpS = stf.ReadFloatBlock(STFReader.Units.PressureRateDefaultPSIpS, null);
                break;

            case "engine(trainbrakescontrollerfullservicepressuredrop":
            case "engine(enginebrakescontrollerfullservicepressuredrop":
                FullServReductionPSI = stf.ReadFloatBlock(STFReader.Units.PressureDefaultPSI, null);
                break;

            case "engine(trainbrakescontrollerminpressurereduction":
            case "engine(enginebrakescontrollerminpressurereduction":
                MinReductionPSI = stf.ReadFloatBlock(STFReader.Units.PressureDefaultPSI, null);
                break;

            case "engine(ortstrainbrakescontrollerslowapplicationrate":
            case "engine(ortsenginebrakescontrollerslowapplicationrate":
                SlowApplicationRatePSIpS = stf.ReadFloatBlock(STFReader.Units.PressureRateDefaultPSIpS, null);
                break;

            case "engine(enginecontrollers(brake_train":
            case "engine(enginecontrollers(brake_engine":
            case "engine(enginecontrollers(brake_brakeman":
                stf.MustMatch("(");
                MinimumValue = stf.ReadFloat(STFReader.Units.None, null);
                MaximumValue = stf.ReadFloat(STFReader.Units.None, null);
                StepSize     = stf.ReadFloat(STFReader.Units.None, null);
                CurrentValue = stf.ReadFloat(STFReader.Units.None, null);
                string token = stf.ReadItem();                      // s/b numnotches
                if (string.Compare(token, "NumNotches", true) != 0) // handle error in gp38.eng where extra parameter provided before NumNotches statement
                {
                    stf.ReadItem();
                }
                stf.MustMatch("(");
                stf.ReadInt(null);
                stf.ParseBlock(new STFReader.TokenProcessor[] {
                    new STFReader.TokenProcessor("notch", () => {
                        stf.MustMatch("(");
                        float value = stf.ReadFloat(STFReader.Units.None, null);
                        int smooth  = stf.ReadInt(null);
                        string type = stf.ReadString();
                        Notches.Add(new MSTSNotch(value, smooth, type, stf));
                        if (type != ")")
                        {
                            stf.SkipRestOfBlock();
                        }
                    }),
                });
                break;

            case "engine(ortstrainbrakecontroller":
            case "engine(ortsenginebrakecontroller":
                if (Locomotive.Train as AITrain == null)
                {
                    scriptName = stf.ReadStringBlock(null);
                }
                break;
            }
        }