OpenBVE in real trains simulation

Go down

OpenBVE in real trains simulation

Post by maisvendoo on Sat Aug 11, 2018 6:29 pm

Hi! My team develop real train simulators. We use OpenBVE as visualization's subsystem of our simulator of Velaro RUS (EVS2 "Sapsan") high speed electrical train. Simulator has very significal train dynamics: discrete model of train mechanics, model of power subsystem, model of pneumatic brakes subsystem. This model run in separated computer with interface to hardware train's control panel. OpenBVE run in other computer. Both computers connect with Ethernet interface. You can see one of the many tests of with simulator on this video 



We use RouteViewer for visualization's subsystem. But I see, that RouteViewer render get not so fast graphics than render of main simulator OpenBve.exe. Is it so? May be use OpenBve.exe's render will be better solution?
avatar
maisvendoo

Posts : 13
Join date : 2018-08-04
Age : 36
Location : Russia

http://vk.com/crikrgups

Back to top Go down

Re: OpenBVE in real trains simulation

Post by Quork on Sat Aug 11, 2018 7:52 pm

The braking behaviour feels off to me somehow, but it's hard to tell; everything feels off when the actual forces can't be felt (even the professional simulators with their motion system feel off, with rotation not being a perfect representation of the actual thing; in fact I'd prefer them not to have a motion system at all than the really crude system the olde ones tend to have). Or it's because your student has a rather wild braking style ("I brake really well! Every passenger frantically nods in acknowledgement whenever I stop!") Laughing However, that's some really great work.
Yet I don't think using RouteViewer is such a good idea, if I were you, I'd rather use the main program and modify your custom software to use OpenBVE's plugin API.
avatar
Quork

Posts : 1192
Join date : 2012-05-05
Age : 27
Location : Hofheim a.T., Hessen (Hesse), European Union

Back to top Go down

Re: OpenBVE in real trains simulation

Post by leezer3 on Sat Aug 11, 2018 10:00 pm

The renderer in Route Viewer is definitely slower, but by exactly how much I don't know.....
It's also not as good at handling  textures with alpha channels, and there may be other issues I've not thought of off the top of my head Smile

How exactly are you moving the camera in Route Viewer?
I'm sure it'd be possible to do something similar in rhe main program without *too* much trouble.

Quork-
No way at all the plugin interface would be able to handle most of that.
It's only really a set of virtual handles and a lot of event based calls.

leezer3

Posts : 1176
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: OpenBVE in real trains simulation

Post by Quork on Sat Aug 11, 2018 11:03 pm

Well, at least the physics part should be possible. If the OpenBVE train files would only have constant forces as virtual notches from 0kN to 300kN and the plugin would select the right force depending on speed and handle...? Or am I overlooking something? After all, there is no need of thinking about display contents, since the displays are external in this use case, so they don't need to have any direct connection to OpenBVE.
avatar
Quork

Posts : 1192
Join date : 2012-05-05
Age : 27
Location : Hofheim a.T., Hessen (Hesse), European Union

Back to top Go down

Re: OpenBVE in real trains simulation

Post by maisvendoo on Sun Aug 12, 2018 11:10 am

leezer3 wrote:How exactly are you moving the camera in Route Viewer?
RouteViewer works as client application. I wrote TCP-client module for it. It connects to server computer and receive from this computer position on track and train velocity, which calculated in external physical model of train in server.

The code, which directly moves camera looks as:

Code:
/// <summary>
/// Processes the data recieved form server
/// </summary>
/// <param name="data">Data.</param>
private static void ProcessData(ref ReceivedData data)
{
 // Check route ID
 if (data.routeID == 0)
 return;

 if (routeID != data.routeID)
 {
 routeID = data.routeID;
 loadRoute(data.routeID);
 }

 World.CameraAlignmentDirection.TrackPosition = (double) data.velocity;
 World.CameraAlignmentSpeed.TrackPosition = (double) data.velocity;
}
Quork wrote:Or it's because your student has a rather wild braking style
In this video I personally drive the train  Smile
avatar
maisvendoo

Posts : 13
Join date : 2018-08-04
Age : 36
Location : Russia

http://vk.com/crikrgups

Back to top Go down

Re: OpenBVE in real trains simulation

Post by leezer3 on Sun Aug 12, 2018 10:05 pm

I don't see any immediate reason why a very similar approach wouldn't work with the main sim.
This will get you marginally better performance, but I'm not sure it'll help too much with the hitching you're seeing; The renderer itself is flawed.
Essentially, the hitch you're seeing is caused when it pre-loads the objects in the next block, and at the minute this is done in the single main blocking thread.

See this (out of date WIP....) branch here, specifically these two lumps of diff if you want to get a viewer-mode working in the main program:
https://github.com/leezer3/OpenBVE/pull/165/files#diff-927044392fb4a4e89b234846d8b0eaa3L54
https://github.com/leezer3/OpenBVE/pull/165/files#diff-51cce83aa2767fbbabc543028d4047bdL561

Cherry-picking these into the mainline branch and providing method to activate this mode should then give you a working viewer.
The reason it never made it into mainline was the fact that Route Viewer requires an entirely different control set, and I never really found a decent way short of more massive if statements to get this done.
Need to go back and think about it a bit more.....

leezer3

Posts : 1176
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: OpenBVE in real trains simulation

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


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