**ALPHA** OS_ATS in C#

Page 1 of 6 1, 2, 3, 4, 5, 6  Next

View previous topic View next topic Go down

**ALPHA** OS_ATS in C#

Post by leezer3 on Wed Apr 30, 2014 1:20 pm

So, first off is the warning.

This is ALPHA level code. If you add an input value it doesn't like, then OpenBVE will probably crash.
Most features aren't implemented yet- Don't nag me to add them  Razz 
There are very probably bugs, this has been tested on a couple of systems only.

With that out of the way, attached is the first alpha of OS_ATS in C#.
So, what works:

  • Basic steam locomotive simulation.
  • Associated panel components.

What doesn't work:

  • Diesel & electric traction.
  • Safety systems.
  • Windscreen wipers/ raindrops
  • Fuelling- Fuel use is implemented, but fuelling relies on beacons., which come under safety systems.
  • Anything not mentioned here as specifically working  Laughing 


The attached file contains a version of the original OS_ATS steam test train modified to use the replacement ATS plugin- BVEC_ATS.dll

Configuration is loaded from BVEC_ATS.cfg - This is purposefully nearly identical to the original OS_ATS.cfg
The primary difference at present is that the traction paramater has been replaced with a section header.
Only the variables present in the BVEC_ATS.cfg file are currently supported- All others will cause the plugin to fail to load.
One additional parameter has been added at present- boilerstartwaterlevel


Finally, my thanks are due to Oskari Saarekas, whose original C++ code the traction simulation has largely been ported from, and Odyakufan, whose OD_ATS plugin was vandalized to build the framework that makes this work.
I will get to other traction types and implementing safety systems as soon as I can, but I've no idea how long this will take me  Smile 
Please ask for source if you want it, but I'd rather not post the source for incomplete buggy versions.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by Northern Line on Wed Apr 30, 2014 1:56 pm

This will be probably good for me to look at since I'm currently trying to learn how to code plugins in C#

One question, will this plugin be cross-platform compatible or is it specifically for one OS?

Northern Line

Posts : 273
Join date : 2011-07-12
Age : 23
Location : Tooting, London, England

http://www.bve-district.co.uk/

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Wed Apr 30, 2014 3:56 pm

Cross platform, that was the whole point of C# Smile
(Alright, that and the virus warning on OS_ATS, plus I was bored yesterday.....)

OS_ATS or for that matter any other train plugins don't do anything that's fundamentally Windows oriented (Sladen tried porting the C++ to other operating systems at one point, but I'm not sure it ever got to a working state), just a set of variables that get read in and out and alters the real power handle states.

In essence, BVE has three sets of handles-

  • Driver input- These are what's displayed on the panel
  • Plugin- A train plugin can alter these.
  • Actual- If the plugin is calling for brake, and the driver is calling for power, then the 'actual' handles will be in brake mode.


All train plugins do is alter the plugin handles based upon the inputs their given. One can 'block' inputs from the other, and you'll get the end result which is what actually moves your train.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Fri May 02, 2014 1:59 pm

Version 0.2 attached.

Changes:

  • Basic vigilance devices implemented under the [Vigilance] section of the configuration file.
  • Overspeed
  • Deadman's handle
  • DRA (New)

Still no sounds, AWS or TPWS, or additional traction types. Again, there will probably be bugs!

Changes from OS_ATS:
These vigilance devices are all my code, as opposed to ported from OS_ATS directly.
I've added a couple of new paramaters, and added a DRA device. New paramaters for this release are as follows:

  1. deadmanshandle : Possible states are 0 & 1- Selects whether a deadman's handle is installed.
  2. overspeedtime : A grace period in seconds before the overspeed device triggers the brakes. The warning speed is still there, this is an additional option.
  3. draenabled : Possible states are -1 (Disabled) and 0 (Enabled)
  4. draindicator : Sets the panel index for the DRA indicator

Further devices will be implemented in their own section, so [AWS] etc. Smile
Please refer to the OS_ATS documentation for details on any parameters present in the configuration file that I haven't specifically noted as being added. I will rewrite the documentation to include these values at a later date.


Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Open BVE with Plugins for Traction models?

Post by alex_farlie on Sat May 03, 2014 3:45 pm

Would it be possible to 'fork' the OpenBVE codebase to implement a plugin model for traction controls/physics models?

One of the thoughts was that it would then be possible to model slightly less conventional traction/physics models assuming someone was able to implement the plugin representing the relevant model...

Currently  Open BVE, only supports a physics model that allows for conventional adhesion, wheel on rail workings.  With ann extended  plugin architecture for 'physics' models , cog-wheel, cable hauled and many other interesting ideas become possible (something other sims can't do easily).

alex_farlie

Posts : 98
Join date : 2011-08-27

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by Greater Anglia Metro on Sat May 03, 2014 6:10 pm

Can an option for the vigilance to only go off when the train is stationary be added for LUL trains? This was missing from the older versions on the 72/73/95 etc. The 96 and OS_ATS 92 had this but I don't have the code and not sure anyone does anymore.

Greater Anglia Metro

Posts : 107
Join date : 2012-03-24
Age : 23
Location : London

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Sun May 04, 2014 7:47 pm

Greater Anglia Metro wrote:Can an option for the vigilance to only go off when the train is stationary be added for LUL trains? This was missing from the older versions on the 72/73/95 etc. The 96 and OS_ATS 92 had this but I don't have the code and not sure anyone does anymore.

Yes, that's easy enough.
Have you got some details on how it works please- Specifically what keys/ actions reset the vigilance timers, and the result of a vigilance application; I don't know tube stock, but I can't think that changing the power notch whilst stationary is likely to reset the vigilance?

With regards to 'alternate' physics models etc. the problem is really that you're unable to easily alter the fact that OpenBVE is based around a set of power notches, each with it's own acceleration curve.
It really depends what you're trying to do mind- Take the proposed example of a cog or rope based system; There's nothing inherantly foreign to these in terms of the current physics model with the right setup- This is off the top of my head, but still:
* Build your train.dat file with double (Or triple, depends on how steep your gradients go) the number of notches you require.
* Specify a beacon for when you enter or leave cog track.
* Set #2 of your acceleration notches should be modified appropriately for the cog track.
* Finally, setup your plugin to only allow use of these notches whilst in this section.

The issue you've got then is only a small display issue, in that you're able to move the drivers handle above the number of physical notches & into the simulated notches, but there's nothing you can do about that.
You could probably do some fancy arithmetic to get around this, but I'm not thinking that through too far  Razz

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by Greater Anglia Metro on Mon May 05, 2014 8:01 am

After the train has been standing for a set amount of seconds with no input from the driver (time varies slightly from stock to stock), an alarm sounds in the cab that is canceled by moving the TBC. 

The 92 and 96 from https://sites.google.com/site/londonundergroundbve/ have it.

Greater Anglia Metro

Posts : 107
Join date : 2012-03-24
Age : 23
Location : London

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Tue May 06, 2014 2:11 pm

Version 0.3 attached.

Changes:

  • Barebones AWS implemented, including AWS bell/ horn- Sounds for these borrowed from BVETmd. (This is only a test train anyways!)
  • Injector sound implemented.


Changes from OS_ATS:

  • I'm using a modified version of the AWS code from UKTrainSys for AWS and TPWS implementation. As such, the parameters awsindicatorappear and awsminspeed will probably be deprecated.
  • Added the parameter injectorsound - Sets the sound index for the injector sound. (Plays looped whilst the injectors are on)


Brake demands from the AWS, TPWS and the startup self-test are not currently implemented, but it's taking shape Smile
(I've now got several devices that can alter the power and brake handles, so I need to write a manager class to referee between them before things will work correctly)


The requested vigilance changes are on my list of things to add.
Again, any parameters not specifically present in the BVEC_ATS.cfg file are not currently supported.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

In respect of AWS and TPWS

Post by alex_farlie on Tue May 06, 2014 5:01 pm

http://www.rgsonline.co.uk/Railway_Group_Standards/Rolling%20Stock/Guidance%20Notes/GMGN2169%20Iss%201.pdf

and

http://www.rgsonline.co.uk/Railway_Group_Standards/Control%20Command%20and%20Signalling/Railway%20Group%20Standards/GERT8075%20Iss%201.pdf (Appendix B has a useful state diagram.)

I appreciate that it may be pushing the envelope to refer to Group Standards, but they are what the rail industry uses, and so I don't see why a plug-in developer shouldn't use them in an advisory capacity either.

alex_farlie

Posts : 98
Join date : 2011-08-27

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Tue May 06, 2014 5:59 pm

Useful links, cheers Smile

Exactly how deep the simulation will get I don't know- The intention was for a clone of OS_ATS that simply drops into place, but I seem to have started adding features  Shocked
The TPWS and AWS in OS_ATS also weren't perfect, hence why I decided to modify the UKTrainSys code a little to suit the needs of this plugin.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Fri May 09, 2014 8:22 pm

Version 0.4 attached.
Changes:

  • AWS brake demand and reset implemented.
  • TPWS implemented.
  • Fixed a bug with the pressure usage code (My fault entirely!)

Changes from OS_ATS:
Two additional sound indicies added to steam traction: 

  1. blowoffsound Single play, when blowoff triggers
  2. injectorsound Looped, plays whilst injectors are active


TPWS and AWS startup self-tests aren't currently implemented, and neither are the additional lights used in the Startup Self-Test.
The os_ats_elec demo train currently lacks traction modelling; The steam doesn't have working TPWS fitted.

Cheers

Chris Lees

http://www.bvecornwall.co.uk
Attachments
os_ats_trains.zip You don't have permission to download attachments.(511 Kb) Downloaded 4 times

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Mon May 12, 2014 2:32 pm

Version 0.5 attached.
Changes:

  • Electric traction implemented.
  • If an existing OS_ATS1.dll and OS_ATS1.cfg are present, but no BVEC_ATS.cfg, BVEC_ATS will attempt to upgrade any supported values. No logging for this at the moment.

Changes from OS_ATS:

  • UKTrainSys compatible ACB/VCB implemented. This uses two additional values: breakersound - The sound index of the breaker, and breakerindicator - The panel index of the breaker. Only auto-reset is currently possible, as I haven't got quite as far as implementing this into the traction manager.



Currently unsupported:

  • Diesel traction
  • AWS/ TPWS startup tests
  • Fuel filling
  • Door interlocking
  • Reverser power/ brake interlocks (The option to cut power and/ or apply brakes if the reverser is placed into neutral or reverse when the train is moving)
  • Travelometer
  • Overheating
  • Windscreen/ wipers


If you're interested in testing this, simply extract the attached zip archive into a folder containing a train which uses OS_ATS, and it'll attempt to upgrade any supported values.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Tue May 13, 2014 6:57 pm

Version 0.6
Changes:

  • Diesel traction implemented
  • Fixed a couple of conditions that could cause crashes (Again, my fault!)

Currently Unsupported:

  • Fuel filling
  • Door interlocking
  • Reverser power/ brake interlocks (The option to cut power and/ or apply brakes if the reverser is placed into neutral or reverse when the train is moving)
  • Travelometer
  • Overheating
  • Windscreen/ wipers


This version now has all major traction features complete. There are some interlocks and a few of the fancier bits missing at the moment, but it works surprisingly well!
If you're on a Mac/ Linux, I suggest trying the Class 104 trains from BVETMD- These are one of my test cases and should work reasonably well!

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Wed May 14, 2014 10:27 pm

Version 0.7
Changes From OS_ATS:
Revving of the engine with the reverser at neutral/ out of gear & stationary is now possible on diesel engines. This uses four new values in the [Diesel] section as follows:

  1. allowneutralrevs Possible states are 0 for disabled (Behaviour same as OS_ATS) or 1 for enabled.
  2. revsupsound Played once when the power notch is increased under these conditions
  3. revsdownsound Played once when the power notch is decreased under these conditions
  4. motorsound Played in a loop when the motor is revving at a variable pitch dependant on the power notch as a percentage of the total number of power notches. (For a train with 5 power notches, will be played at 20% pitch for notch 1, 40% pitch for notch 2 etc.)

Further notes-

  • The revs achieved in each power notch at neutral will be 90% of the percentage of the total number of power notches. (For a train with 5 power notches, notch 1 will achieve 190rpm, notch 2 will achieve 380rpm etc. out of the notional 1000rpm)
  • For sound playback, all three of revsupsound revsdownsound & motorsound are required.


Unsupported features have not changed from the previous version- Overheating and temperature is next on my list to implement Smile

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Thu May 15, 2014 1:25 am

Version 0.8 (Didn't intend this quite this quickly, but I found the crash in electric traction....)
Changes:

  • Fixed a crash in electric traction when passing over a neutral section (Remember to check for unassigned sounds.....)
  • Implemented temperature, thermometer and overheating [Steam and electric can heat based upon power notch, diesel can also heat based upon RPM if fitted with gears]


Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Thu May 15, 2014 11:54 pm

Version 0.9
Changes:

  • Fixed a couple more potential crashes.
  • The AWS & TPWS may now be isolated using key 0 if no warnings are in effect. (Minor change from OS_ATS which lets you isolate at any time)
  • Direction of travel and reverser indicators implemented- Place these and the interlocks values under the [Interlocks] section
  • Interlocks implemented (OS_ATS behaviour unless noted):


  1. doorpowerlock - Holds the power at 0 when the doors are open
  2. doorapplybrake - Applies service brakes when doors are open
  3. neutralrvrbrake - Applies brakes when the reverser is placed in neutral- 0 for disabled 1 for service brakes 2 for EB brakes
  4. neutralrvrbrakereset - New parameter, defining the conditions for the brakes to be reset after the reverser is placed in neutral- 0 is for behaviour the same as OS_ATS [Brakes are reset immediately upon placing the reverser into drive] 1 The train must come to a stand before the brakes are automatically reset 2 The train must come to a full stand and have full service brakes applied by the driver before the brakes are reset.


Again, this will attempt to upgrade any supported paramaters from the OS_ATS1.cfg file if no BVEC_ATS.cfg file is present. If you've tried an earlier version, please delete the BVEC_ATS.cfg file for the newer parameters to be added Smile

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Sat May 17, 2014 10:36 pm

Version 0.10
Changes:

  • Startup self-test sequence implemented.


Currently unsupported:

  • Windscreen raindrops/ wipers
  • Travelometer
  • Fuel filling
  • LU Type trainstop [TPWS works, this just needs a very small amount of additional code]


All features of UK mainline traction other than the windscreen/ wipers should now be implemented and working Smile
There are a couple of small additions that need to be made, but I'm not sure that these have seen particularly wide usage.

Please let me know if you try this and the train.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Mon May 19, 2014 11:09 pm

Version 0.11
Changes:

  • Rain & windscreen wipers implemented. [No drop sounds just yet, I'm considering changing the way these work a little]


I'll sort out writing a drop generator at some stage very soon, but in the meantime, this is how they work (As per OS_ATS):
The windscreen wiper has a nominal position ranging from 0 to 100.
Drops should be placed sequentially across the panel from left to right, at an approximately equidistant horizontal spacing, so for a 1000 px wide windscreen with 50 drops, you should horizontally place a drop every ~20 px
Vertical spacing can be random.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Wed May 21, 2014 3:08 pm

Version 0.12
Changes:

  • Wipers with a hold position on the right now work correctly. (Oversight!)
  • Fixed another potential crash.


I'm trying to test both the 1992TS & 1996TS with this, but the version of OS_ATS they're using doesn't appear to load on this machine, so I can't compare notes on what happens.
I also know nothing about tube stock, but at present they appear to be working as per designed- They both appear to be using the OS_ATS TPWS implementation (Anyone seen a train using Trainstop?)

*** NOTE:***
 Wipers are assigned to keys 8 & 9 at the moment.
This is likely to be permanent unless someone complains- I don't intend on allowing changes of keys in the config file, as this seems to me too much hassle for very little gain. The original OS_ATS key defaults assigned them to the same keys as the steam cutoff, and I see no reason for not allowing a steam train to be fitted with wipers.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Wed May 21, 2014 6:27 pm

This is a first attempt at paramater documentation Smile
http://www.bvecornwall.co.uk/wordpress/bvec_ats-configuration/

Complete for Version 0.12 and hopefully nicely legible.
I'm not going to bother noting differences from OS_ATS in this documentation I don't think, other than on the driving instructions.

The travelometer and fuel-filling are next on my list of things to look at, and I'm intending to make a few minor improvements to steam too. (Primarily I want to do sight glasses for the water level and a lever based reverser)

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by thehoviskid on Wed May 21, 2014 6:31 pm

Depending on the amount of work, allowing users to change key assignments can be useful- if you're on a laptop, no two have the same layout of the twiddly-keys (Page Up, Insert etc)! 

I don't know about anyone else, but I tend to allocate functions to places I can remember them, For example, I use the space-bar for the vigilance device because it works off the DSD pedal which is at "the bottom", but other people may prefer the AWS cancel to be there as it's a bigger button

thehoviskid

Posts : 128
Join date : 2011-07-09
Age : 39
Location : Heysham

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Wed May 21, 2014 10:52 pm

That's interesting- I was assuming most people used the OpenBVE keys assignments, rather than fiddling in the ATS configuration file.
For clarity, the current model works off the OpenBVE keys of S, A1 etc, rather than the physical keyboard key.
Short answer is that it's not difficult, but it's also not a small amount of work.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by thehoviskid on Thu May 22, 2014 8:20 pm

Ah, get you now.  No, never fiddle with that bit!

thehoviskid

Posts : 128
Join date : 2011-07-09
Age : 39
Location : Heysham

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Fri May 23, 2014 12:49 am

Version 0.13
Changes:

  • Fuel filling implemented.
  • The fuel level can no longer go below zero and cause oddities with the fuel gauge.
  • Travelometer implemented.


**NOTES & CHANGES:***
Running out of fuel currently has no effect, as per the original. This is on the list of things to change Smile
To fill fuel, you need to hold down the key 7 whilst stopped. This is a change from OS_ATS which filled automatically when in a fueling section. Water troughs are on the list of things to implement, I just need to figure out the best way to do it.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 749
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by Sponsored content Today at 9:15 pm


Sponsored content


Back to top Go down

Page 1 of 6 1, 2, 3, 4, 5, 6  Next

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum