<commit_before>﻿using System;
using OpenBveApi.Runtime;

namespace Plugin
{
    internal class Mode_ATO : Device
    {
        const float ACCELERATION_POLL_RATE = 0.125f; //sec
        const float ATO_TARGET_DECELERATION_RATE = -0.7f; //m/s
        const float ATO_TIME_BETWEEN_NOTCH_CHANGE = 0.35f;
        const float ATO_LEVELLING_SPEED = 3.5f; //m/s
        //const float ATO_LEVELLING_DECELERATION_RATE = 0.3f;
        const float ATO_LEVELLING_DISTANCE = 8.0f;
        
        private enum AtoStates
        {
            NoStopInformation,
            Ready,
            Stopping,
            Levelling, 
            Stopped
        }
        private Train train;
        private double accelerationRate = 0.0;
        private double accelerationLastSpeed = 0.0;
        private Time accelerationLastPoll = new Time(0.0);
        private double notchLastChange = 0;
        private AtoStates atoState = AtoStates.NoStopInformation;

        private double? atoStoppingPosition = null;
        private int? atoReceivedData = null;<commit_msg>Tweaks to coasting distance when stopping.<commit_after>﻿using System;
using OpenBveApi.Runtime;

namespace Plugin
{
    internal class Mode_ATO : Device
    {
        const float ACCELERATION_POLL_RATE = 0.125f; //sec
        const float ATO_TARGET_DECELERATION_RATE = -0.7f; //m/s
        const float ATO_TIME_BETWEEN_NOTCH_CHANGE = 0.35f;
        const float ATO_LEVELLING_SPEED = 3.5f; //m/s
        //const float ATO_LEVELLING_DECELERATION_RATE = 0.3f;
        const float ATO_LEVELLING_DISTANCE = 6.0f;
        
        private enum AtoStates
        {
            NoStopInformation,
            Ready,
            Stopping,
            Levelling, 
            Stopped
        }
        private Train train;
        private double accelerationRate = 0.0;
        private double accelerationLastSpeed = 0.0;
        private Time accelerationLastPoll = new Time(0.0);
        private double notchLastChange = 0;
        private AtoStates atoState = AtoStates.NoStopInformation;

        private double? atoStoppingPosition = null;
        private int? atoReceivedData = null;
{'fraction_non_alphanumeric': 0.0643494598403006, 'fraction_numerical': 0.020666979802724285, 'mean_word_length': 2.174366616989568, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7520835', 'n_tokens_mistral': 683, 'n_tokens_neox': 643, 'n_words': 158}