**ALPHA** OS_ATS in C#

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

View previous topic View next topic Go down

Re: **ALPHA** OS_ATS in C#

Post by Quork on Fri Aug 08, 2014 3:16 pm

Would it be possible to force the window on top of fullscreen view? Would it be possible to make the window shape adjustable (i.e. to fit it over a display on the cab view, which in most cases would need sheering and perspective)?

Quork

Posts : 1030
Join date : 2012-05-05
Age : 25
Location : Frankfurt am Main (Frankfurt on Main), Hessen (Hesse), European Union (Deutschland (Germany))

http://www.parkbahnschmiden.de/

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Sat Aug 09, 2014 11:13 pm

Quork wrote:Would it be possible to force the window on top of fullscreen view? Would it be possible to make the window shape adjustable (i.e. to fit it over a display on the cab view, which in most cases would need sheering and perspective)?

Force on top of fullscreen- I think so, although I haven't tried it yet.
Window shape adjustable, probably not; I'm hoping that I can get the background semi-transparent instead- I haven't tried playing with this seriously yet, it's more of a proof of concept at this stage.

I'm also hoping to get custom keypresses caught by the plugin rather than just relying on those provided by OpenBVE, but not sure on that one.

(It took me several hours of fiddling to get this right; Wish I was better at C# Sad )

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by Dexter on Sat Aug 09, 2014 11:46 pm

I think you can set the transparency using the "opacity" parameter... it is set in % if I remember correctly. Are you working with MS Visual Studio?

Dexter

Posts : 1780
Join date : 2011-07-08
Age : 31
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Sun Aug 10, 2014 1:01 am

Yep, that's along the lines of what I was thinking; The opacity parameter works to an extent, but it makes the text transparent as well Smile

I believe there's a way to sort this out, and hopefully get the window to be borderless as well;
http://www.c-sharpcorner.com/UploadFile/scottlysle/XparentFormsCS10282007212944PM/XparentFormsCS.aspx

I need to do some heavy fudging and see what I can come up with; I'm currently trying to get the window to launch without stealing focus....

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by hkmtrhah on Sun Aug 10, 2014 5:48 am

As what I remembered setting transparency/opacity of Forms created using C# code would not going to give some good result for you.
Of course for the shape of the window. Most of the people will create a background image of the shape of the window with anti-alising on drawings off, for a C# based (i.e. not WPF) window with special shape. (As to make transparent-ed window won't get some ugly borders on edges. You should know that if you are/have been a texture creator of BVE/oB)

You might want to create the window using WPF (Windows Presentation Foundation). It creates window with supporting alpha-channel background ... or sth.

(Such issues has been asked for quite many times on StackOverflow)

btw, how do you make the window open while loading plugin? I've only implemented similar functions by using Socket/Pipe/anything that's kind of IPC linking two process (openBVE with plugin loaded ------ Application to listen the Pipe from plugin, as you may be seen in one of my old post). Tried to load and start(show) a Form but getting an exception telling"IWindow32" not implemented in OpenBve.


Last edited by hkmtrhah on Mon Aug 11, 2014 1:37 am; edited 1 time in total (Reason for editing : I think I've typed something meaningless)

hkmtrhah

Posts : 34
Join date : 2013-06-19
Location : Hong Kong

http://about.me/hkgsherlock

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Sun Aug 10, 2014 11:33 am

That's interesting. All I did was to add a standard C# winform to the project, and use form.show()
I had a few minor problems getting communication working between the two, but that's about the sum of it.

This is the most recently posted version of OpenBVE, so I wonder if something changed at some point??

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
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 Sun Aug 10, 2014 10:29 pm

A considerable deal more fudging, and the debug window now has a semi-transparent background (I'm using the two stacked forms trick), and is nicely kept always on top, remembering it's position- This is stored in the registry and should be remembered between runs. [Changing between screen resolutions may well stuff things up. Please delete the HKEY_CURRENT_USER\BVEC_ATS registry key if you loose the window Razz ]

I believe the attached version should work correctly as a proof of concept Smile

The .Net target has also been changed to v4 (Should be no change).
The latest source is on Github for those interested.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by hkmtrhah on Mon Aug 11, 2014 7:42 am

leezer3 wrote:getting communication working between the two
"non thread-safe" or something?

hkmtrhah

Posts : 34
Join date : 2013-06-19
Location : Hong Kong

http://about.me/hkgsherlock

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Fri Aug 15, 2014 2:45 pm

hkmtrhah wrote:
leezer3 wrote:getting communication working between the two
"non thread-safe" or something?

Not properly instanced actually Razz
The first attempt acquired 100s of windows spawning endlessly......

Either way, this is version 0.222:
Changes:


  • Brake interventions being triggered inappropriately by the startup self-test manager.
  • Steam engines work correctly in reverse.
  • A sound-related crash.


Further (Alpha level) changes are as follows:

  • Debug window trigger moved to it's own key assignment: advancedrivingkey


Conrod changes modified somewhat, please see next post Smile

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
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 Aug 16, 2014 2:07 pm

This is a further modified alpha version of 0.222, with I believe complete conrod animation Smile

Conrod & related animations are available as follows in a new [Animations] section of BVEC_ATS.cfg:

  1. rodradius - Set the radius of the pivot point of your conrod in millimeters.
  2. gear_Yvariable_R - Sets the plugin variable which describes the motion in the Y-Axis (Right conrod)
  3. gear_Zvariable_R - Sets the plugin variable which describes the motion in the Z-Axis (Right conrod)
  4. gear_Yvariable_L - Sets the plugin variable which describes the motion in the Y-Axis (Left conrod)
  5. gear_Zvariable_L - Sets the plugin variable which describes the motion in the Z-Axis (Left conrod)
  6. wheelrotation_variable - Sets the variable which controls rotation of the wheel.


Your conrod object should be constructed placed with the point you wish to move around at the center of your wheel.
Use these as follows in an animated file:
Code:
[Object]
States = rod.b3d
TranslateYFunction=(pluginstate[149] /1000)
TranslateZFunction=(pluginstate[150] /1000)
Position = 0,-0.4,-2.25

Similarly, wheel rotation should be placed as follows:
Code:
[Object]
States = driving_1.b3d
Position = 0,0.875,3.84
RotateXFunction=(pluginstate[148] / 1000)

The next thing to do is to add cyclical animations. Whilst cyclical animations (And wheel rotation for that matter) are easily achievable by formulas in the .animated file, one thing you'll notice is that the rotation and the cyclical animation can get out of sync, for example under heavy braking.
Controlling them all from the plugin should eliminate that particular problem.

If anyone wishes to test this further, test results are appreciated.
As I find crashes I fix them, but my C# isn't perfect.....


Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
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 Sep 01, 2014 1:40 pm

Yet another version- .223 Smile
Changes:

  • Another steam locomotive cutoff bug fixed. (Zero pressure usage in any power notch other than zero- An integer division issue..)
  • The debug window now shows the current pressure generation and usage rates, and the current cutoff & optimum cutoff.


The cutoff & pressure usage show for all trains at the moment, not just steam locomotives; This will change when I've finished sorting everything out, but again this is mostly proof of concept here!

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
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 Oct 15, 2014 5:45 pm

Whilst I'm never quite sure that people are listening, this is version .224

Various bugs have been squashed in this release, as well as some more incomplete alpha level features. (I know.....)

The main one of interest is the provision of a function to animate cranks for steam locomotives. This works as follows:

  1. crankradius - Sets the radius of the pivot point of your crank in millimeters. [The crank is assumed to be on the same wheel as your conrod]
  2. cranklength - Sets the length of your crank in millimeters
  3. crankrotation_R - The variable which controls the rotation of your crank.
  4. crankvariable_R - The variable which controls the movement of your crank.
  5. crankrotation_L - The variable which controls the rotation of your crank.
  6. crankvariable_L - The variable which controls the movement of your crank.

They should be used in your .animated file as follows:
Code:
;Crank R
[Object]
states=crank.b3d
position=0,0.875,5.42
TranslateZFunction=(pluginstate[153] /1000)
RotateXFunction=(pluginstate[154] / 1000)

In the same manner as conrods, the pivot point of your crank should be set at 0,0,0
This will look off in Object Viewer, but when the plugin is loaded in the sim, the correct movement will be calculated as appropriate.

Take a look at the end of my WIP thread for a video example of conrods and cranks in action Smile

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
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 Sun Oct 26, 2014 8:21 pm

Version 0.225
Changes:
Added working 5-level steam heating on steam traction; This works as follows:

  1. steamheatindicator - The panel variable to display your steam heat gauge.
  2. steamheatpressureuse - The number of pressure units used a second by a level of steam heating (For example, if this value is 1, then the level 1 will use 1 pressure unit per second, level 2 will use 2 pressure units per second etc.)
  3. steamheatincreasekey - The key to increase the steam heat level.
  4. steamheatdecreasekey - The key to decrease the steam level.

Added working blowers for steam locomotives. These work as follows:

  1. blowers_pressurefactor - A double-precision floating point number representing the factor by which the pressure generated should be multiplied when the blowers are active.
  2. blowers_firefactor - A double-precision floating point number representing the factor by which the first temperature increase should be multiplied when the blowers are active. [The fire simulation code is mostly there, but hasn't been fully implemented yet]
  3. blowersindicator - The panel variable to display whether the blowers are active or not.
  4. blowerskey - The key to toggle the blowers on or off.

Added a flashing doors are closing light [May change again depending on feedback].
Two beacons are required for this to work:

  • beacon 30- Place this before your station. Set the optional data for the beacon to be the *minimum* stop time in seconds.
  • beacon 31- This should be placed 1m after beacon 30. Set the optional data for this beacon to be the total number of seconds since midnight for the station's set departure time. For example, a departure time of 09:00, the data value should be 32400

When you stop at a station and the doors are opened, the plugin will trigger a flashing indicator at the appropriate time before departure, either for the minimum stop time minus 30s if you are running late, or the departure time minus 30s if you are on time or early.

  1. flashingdoorlight - This should be placed in the [Animations] section of the configuration file, and controls the panel variable used to display this light.


A few more bugs have also been fixed for this one, as well as removing various unnecessary casts between number types.
As readers of my other thread probably know, I'm currently testing the Manor, and adding functions as I decide I need them, so as always this is decidedly a WIP.
If you want a feature, please let me know, and I can always see about implementing it Smile

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
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 Dec 22, 2014 1:32 pm

Any-one watching the source code for this will have seen some major changes over the last couple of months, although I haven't got as far as posting a complete build Smile
The changes in this one are somewhat incomplete, but important enough to post a preview version before Christmas.

This is version 0.227.
Changes:

  1. Working CAWS. This uses some modified code from Odyakufan, which has been tweaked to run in my framework Smile
  2. A mostly complete port of the OS_SZ_ATS Italian SCMT safety systems.
  3. Fixed even more crashes (If no vigilance devices were fitted I wasn't checking for null.....)


Using CAWS:
CAWS requires a new [CAWS] section in the configuration file. Available paramaters for this are as follows:

  1. ebindicator - The panel index lit when the CAWS system has applied EB brakes.
  2. aspectindicator - The panel index displaying the upcoming signal aspect.
  3. acknowledgementindicator - The panel index lit whilst the CAWS system has an uncancelled alert, but EB has not been applied.
  4. downgradesound - The sound index played (looping) whilst there is an uncancelled CAWS alert.
  5. upgradesound - The sound index played (once) when the next signal aspect changes in your favour.


SCMT:
As I'm sure some of you will realise, there are actually relatively few train plugins available for OpenBVE- To my knowledge, there are Simon Gathercole's UKSpt/ UKDT plugins, OS_ATS and several variants, UKTrainSys, Odyakufan's work, and a couple of Japanese ones.

Stefano Zilocchi produced a modified version of OS_ATS, called OS_SZ_ATS to simulate the Italian SCMT safety system, as well as supporting traction features. I've been in contact with him and a couple of members of the Italian BVE community, and I've been working hard on implementing this code into BVEC_ATS to provide a multi-platform solution for more trains Smile

I've been testing using the ALN 501 from http://www.trenomania.it/
At the moment, these features work:

  • Engine startup/ shutdown.
  • The LCM and constant speed devices.
  • SCMT self-test sequence.
  • Vigilante safety device.

Anything else is probably broken, or not working quite as it should, but please regard this as an ongoing view of where I'm trying to take this plugin Razz 


Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by graymac on Mon Dec 22, 2014 5:17 pm

Great update, Chris. I'm working on fitting the Irish stock with the BVEC_ATS plug in as a replacement for the UKTS fitted celtic stock. Initial trials and testing with the 29000 dmu has been completely successful, hopefuly all stock will be ready for release by the end of Q1 2015, along with upgraded Irish track at genuine 1600mm gauge (produced with the help of your improved TrackGen utility)

UPDATE 31/12/2014:
Work and testing goes on and here's a video elsewhere on this forum to show that the plug in works: http://bveworldwide.unlimitedboard.com/t1140-bvec_ats-plug-in-caws-implementation#12448

graymac

Posts : 1704
Join date : 2011-08-28
Location : Co Mayo, Eire

http://www.celtictrainsim.com

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Sat Feb 07, 2015 2:01 pm

So, work is still continuing on this little project Smile
I've now started to think about AI support- The attached version is decidedly alpha due to the AI support changes and should only really be used as a Proof of Concept, but demonstrates the way things are going.

Version 0.230
Changes:

  1. The start of basic AI support added, please see the notes below.
  2. Fixed some more potential issues internally.


AI Support Notes:
At the moment, the AI support is incomplete. This is what it can currently do:

  • Drive electric, steam and diesel locomotives.
  • Hits the deadman's handle switch as appropriate.

AWS, TPWS and the other safety systems are next on the list of things to implement, followed by a re-write of the automatic steam/ diesel functions.

(There's also a half-way complete PZB implementation, but that's not usable yet)

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by Quork on Sat Feb 07, 2015 3:00 pm

Wow Shocked I hadn't heard from you about PZB/Indusi since our initial information exchange, so I guessed you didn't want to implement this until way later. So these news came totally unexpected. That's real great =D This means the PDF I gave you is understandable and helpful? If there's anything unclear or missing, just ask me =)

Quork

Posts : 1030
Join date : 2012-05-05
Age : 25
Location : Frankfurt am Main (Frankfurt on Main), Hessen (Hesse), European Union (Deutschland (Germany))

http://www.parkbahnschmiden.de/

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by phontanka on Sun Mar 01, 2015 2:36 pm

I've just read through this thread, I'm really looking forward to this plugin.

phontanka

Posts : 211
Join date : 2012-05-08
Location : Hungary

http://phontanka.wordpress.com

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by Quork on Sun Mar 01, 2015 4:23 pm

This could easily become the most important technical addition to OpenBVE in 2015.

Quork

Posts : 1030
Join date : 2012-05-05
Age : 25
Location : Frankfurt am Main (Frankfurt on Main), Hessen (Hesse), European Union (Deutschland (Germany))

http://www.parkbahnschmiden.de/

Back to top Go down

Re: **ALPHA** OS_ATS in C#

Post by leezer3 on Mon Aug 03, 2015 2:15 pm

Mirror of most recent release on my site:
http://www.bvecornwall.co.uk/downloads/beta/BVEC_ATS.zip

Version 0.232
Changes:

1. cylindercocksound paramater added. A comma separated value pair, as follows:

  • The sound played looped whilst the cylinder cocks are open, and the throttle is above notch zero.
  •  The sound played once when the cylinder cocks are opened or closed.

2. blowersindicator added. The panel indicator shown whilst the blowers are active. (This was an oversight)
3. The automatic fireman has been considerably improved, and the blowers and injectors no longer bounce on and off. (Blowers will *always* be on if steam usage is over 60% greater than production)
4. Debug logging added to steam locomotives, and most power cutoff/ release calls- Create an empty [Debug] section at the end of your configuration file.

Edit:
Seeing as only a day, I won't bother with a new post for this one:
Version 0.233
Changes:
1. Fixes various conditions that could cause crashes.
2. Cleanup and standardise logging functions.
3. New standard string to number array function.
3. Tidy some functions into separate logically named files.
4. Fixed missing steam locomotive paramaters as follows:

  • cutoffchangespeed
  • boilerblowoffpressure
  • regulatorpressureuse


Various other internal changes too, mostly designed at cleaning up the code a little. This is very much a WIP.......

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
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 Sun Aug 16, 2015 10:09 pm

Been bashing again, due to a further request Very Happy
http://www.bvecornwall.co.uk/downloads/beta/BVEC_ATS.zip
This version of BVEC_ATS has now had odakyfanats merged in with some minor changes to play nice with traction modelling. This means the plugin now supports the following Japanese devices:

  • ATS-Sx (SN, SF, SK, SS, ST, SW)
  • ATS-P
  • ATS-Ps
  • ATC
  • Japanese standard EB.
  • TASC
  • Signal aspect/ speed limit calling.


odakyfanats configuration (Haven't got as far as knocking up my own page yet):
https://web.archive.org/web/20140917093214/http://odakyufan.zxq.net/odakyufanats/index.html

As BVEC_ATS is based upon the same template plugin as odakyfanats, this process was actually surprisingly trouble-free.
However, if you wish to use Japanese safety systems with traction modelling, you should increase any sound/ panel index you set to above 350.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
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 Aug 26, 2015 1:29 am

http://www.bvecornwall.co.uk/downloads/beta/BVEC_ATS.zip

A couple more minor features added this time Smile
Changelog:

  1. customindicatorsounds paramater added to the [Vigilance] section. This should be a comma separated list of values, and represents the sound index to be played once when each custom indicator is toggled. Use an empty space if you do not require a sound for an indicator.
  2. blowofftime paramater added. This represents the time in seconds taken for a steam locomotive's blowoff to reduce from the blowoff pressure to the maximum boiler pressure. If this is set, the pressure gauge will also nicely reduce, rather than jumping down.
  3. Restructures several parts of the code into much cleaner and more readable class types, and fixes (more) bugs along the way.


Those viewing the source will also note that I've done a considerable amount of work on a completely custom traction type for the Western I'm in the process of building.
I don't intend listing parameters for non-standard traction types, as there will always be a considerable number of locomotive specific hacks, but please ask if you're interested in details Smile

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
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 Thu Apr 07, 2016 5:34 pm

Could I have an idiots guide to "customindicatorsounds"? Does this make it possible for my tube trains to have push button announcements like "Stand clear of the closing doors"?

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 Thu Apr 07, 2016 7:43 pm

Absolutely Smile

Assume that this is the ATS section of your sound config file:
Code:
[ATS]
100 = StandClearDoors.wav
101 = MindTheGap.wav
102 = SorryForTheDelay.wav

We wish to attach these to identical panel variable numbers.
BVEC_ATS.cfg should have this in the interlocks section:
Code:
[Interlocks]
customindicators = 100,101,102
customindicatorsounds = 100,101,102

To set the key assignments, for these custom indicators, you require a Key Assignments section in BVEC_ATS.cfg:
Code:
[KeyAssignments]
customindicatorkey1 = D
customindicatorkey2 = E
customindicatorkey3 = F

This will set the keys to 2,3 and 4. (D, E & F refer to the internal BVE keys rather than keyboard keys)

Only slight trouble is that these are on-off switches, not push and hold.
You could get around that by not assigning them in your Panel2.cfg.

Let me know if you want a visible button, it's simple enough to add an optional parameter so that these are push and hold Smile

Dud code updated, test before you post......

Cheers

Chris Lees

http://www.bvecornwall.co.uk


Last edited by leezer3 on Fri Apr 08, 2016 1:53 pm; edited 2 times in total

leezer3

Posts : 747
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 Thu Apr 07, 2016 8:42 pm

Can't seem to get it working.

Ideally I want to push the button once and then it plays the .wav - no visual whatsoever

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 Sponsored content Today at 2:29 pm


Sponsored content


Back to top Go down

Page 5 of 6 Previous  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