Ejemplo n.º 1
0
        public void Unload()
        {
            BIDSSharedMemoryData BSMD = new BIDSSharedMemoryData();
            OpenD OD = new OpenD();

            StaticSMemLib.Write(in BSMD);
            StaticSMemLib.Write(in OD);
            //StaticSMemLib.Dispose();//static化に伴い不要になる
        }
Ejemplo n.º 2
0
        public void SetElapseData(ElapseData data)
        {
            chp.R = data.Handles.Reverser;
            chp.P = data.Handles.PowerNotch;
            chp.B = data.Handles.BrakeNotch;
            BIDSSharedMemoryData BSMD = new BIDSSharedMemoryData()
            {
                HandleData = new Hand()
                {
                    B = data.Handles.BrakeNotch,
                    P = data.Handles.PowerNotch,
                    R = data.Handles.Reverser,
                    C = data.Handles.ConstSpeed ? 1 : 0
                },
                StateData = new State()
                {
                    BC  = data.Vehicle.BcPressure.ToFloat(),
                    BP  = data.Vehicle.BpPressure.ToFloat(),
                    ER  = data.Vehicle.ErPressure.ToFloat(),
                    I   = 0,
                    MR  = data.Vehicle.MrPressure.ToFloat(),
                    SAP = data.Vehicle.SapPressure.ToFloat(),
                    T   = (int)data.TotalTime.Milliseconds,
                    V   = data.Vehicle.Speed.KilometersPerHour.ToFloat(),
                    Z   = data.Vehicle.Location
                },
                IsDoorClosed = data.DoorInterlockState == DoorInterlockStates.Locked,
                IsEnabled    = true,
                VersionNum   = int.Parse(StaticSMemLib.VersionNum),
                SpecData     = new Spec()
                {
                    B = hd.B, P = hd.P
                }
            };
            OpenD OD = new OpenD()
            {
                Cant          = data.Vehicle.Cant,
                ElapTime      = data.ElapsedTime.Milliseconds,
                IsEnabled     = true,
                Pitch         = data.Vehicle.Pitch,
                Radius        = data.Vehicle.Radius,
                SelfBPosition = data.Handles.LocoBrakeNotch,
            };

            if (data.PrecedingVehicle != null)
            {
                OD.PreTrain = new OpenD.PreTrainD()
                {
                    IsEnabled = true,
                    Distance  = data.PrecedingVehicle.Distance,
                    Location  = data.PrecedingVehicle.Location,
                    Speed     = data.PrecedingVehicle.Speed.KilometersPerHour
                };
            }
            else
            {
                OD.PreTrain = new OpenD.PreTrainD()
                {
                    IsEnabled = false
                }
            };
            StaticSMemLib.Write(in BSMD);
            StaticSMemLib.Write(in OD);
        }

        Hand hd = new Hand();
Ejemplo n.º 3
0
 [MethodImpl(MIOpt)]        //関数のインライン展開を積極的にやってもらう.
 public OpenD Read(out OpenD D) => D = SMC_OpenD.Read();