Scriptable train control system
#31
Posted 12 February 2014 - 02:23 AM
FYI, I made a mistake in my calculation.
For the French automatic block, we need an array of 2 signals for the worst stop sequence : VL (green) => (VL) (green blinking) => (A) (yellow blinking) => A (yellow) => S (red) or C (double red).
The first change, (VL), provokes a speed limit of 160 km/h at the next signal. So, we only have to consider the sequence (A) => A => S or C. We need to know AFTER the (A) aspect the distance to the signal that has the S or C aspect. So we need the information of 2 signals.
For the TVM system, it is the same because the system needs : the current speed limit, the speed limit in the next block section and the speed limit in the block section after this one. When the second block section gives a more restrictive speed limit that the first, the indication on the cab-signal blinks.
The worst case we'll have is the ETCS... because in Level 2, we'll have to look at the aspects of the signals that are 4 or 5 block sections ahead on high speed lines.
PS : I have access to the SNCF technical documentation because I work as an engineer in a CCS company in France.
#32
Posted 12 February 2014 - 04:29 AM
Note that if the user requests more than one signal, this might not always be available - no information is provided beyond the first signal at state STOP.
If TCS systems need information on multiple signals and speedpost, the best option would be to pass on the original list - or at least the info out of this original list.
With regards to the variable nature of the information, a list seems more appropriate than an array.
Regards,
Rob Roeterdink
#33
Posted 12 February 2014 - 05:30 AM
#34
Posted 12 February 2014 - 12:32 PM
#35
Posted 12 February 2014 - 01:16 PM
Common\Scripting.cs(165,58): error CS0241: Default parameter specifiers are not permitted
Did you use something from C# 4 by accident?
#36
Posted 12 February 2014 - 01:38 PM
public delegate T NextSignalFunc<T>(int forsight = 0);
I wasn't even aware of it. On internet now I read, that this is supported from the beginning (C# 1), just the compiler needs to be of higher version... (wtf?) This was the reason I haven't noticed it. I remove it.
Edit: Removed. Then 0 needs to be explicitly defined in NextSignalSpeedLimitMpS(0). Sorry.
#37
Posted 13 February 2014 - 12:19 AM
When NextSignalItem is called for NextPostSpeedLimitMpS, an exception is thrown at line 222 because there is no element in the list.
#38
Posted 13 February 2014 - 01:14 AM
gpz, on 12 February 2014 - 01:38 PM, said:
I suspect there's a mixup there; it is not supported in C# before version 4, but it is supported by .NET (and the CLR) in version 1. It was supported by the runtime from the start because optional and named parameters existed in VB. They were added to C# later. (Feature support in the runtime being different from the languages that run on it can be confusing.)
#39
Posted 13 February 2014 - 02:25 AM
Serana, on 13 February 2014 - 12:19 AM, said:
When NextSignalItem is called for NextPostSpeedLimitMpS, an exception is thrown at line 222 because there is no element in the list.
#40
Posted 13 February 2014 - 09:31 AM
#41
Posted 13 February 2014 - 12:21 PM
But, there is another modification to do, otherwise the target distance doesn't update regularly.
In TrainControlSystem.cs, at line 227, please delete :
if (forsight >= list.Count)
and keep the SearchTrainInfo function.
I nearly finished the KVB system. I had to use Maple in order to find the formula of the alert and emergency speed curve. That's because the formula written by the engineers of SNCF is a formula of braking distance. You'll see, the formula of the speed curve is quite complex. But it works really well ! :good2:
I still have to modify the vigilance monitor.
#42
Posted 13 February 2014 - 01:04 PM
Serana, on 13 February 2014 - 12:21 PM, said:
In TrainControlSystem.cs, at line 227, please delete :
if (forsight >= list.Count)
and keep the SearchTrainInfo function.
Are you sure about this? Because if you check it, Update() function looks like this:
public void Update() { if (Script == null) return; SignalSpeedLimits.Clear(); SignalAspects.Clear(); SignalDistances.Clear(); PostSpeedLimits.Clear(); PostDistances.Clear(); // Auto-clear alerter when not in cabview if (Locomotive.AlerterSnd && Simulator.Confirmer.Viewer.Camera.Style != ORTS.Viewer3D.Camera.Styles.Cab) Script.AlerterPressed(); Script.Update(); }
So all the lists are cleared at the beginning of the Update(). My idea was that the lists would not be updated at every query, just once at a particular Update(). Although they are fully updated at the next Update(). I think that interval should be enough.
It is great if you can create such a formula for the speed curve!! I think eventually we should include it into the API into some kind of a GenerateSpeedCurve class or method! :good2:
#43
Posted 13 February 2014 - 02:02 PM
I managed to reproduce the discontinuous transmission of the KVB using a previous distance variable. If the next signal distance variable is bigger than the previous distance, it means we have just passed a signal.
Could it be possible to have a function that returns the slope of the track ? I need that because braking distances are shorter when the train is climbing and the KVB cares about that. Thanks.
For the speed curve, the one I coded is specific to the KVB. Other systems may not use the same thing.
A more generic formula is : distance = (speed^2 - targetSpeed^2) / 2 * deceleration.
The speed curve formula is : speed = sqrt(2 * deceleration * distance + targetSpeed^2).
The deceleration is a parameter of the train.
In order not to have a EB when passing a signal, you have to use : speed = max(speed, 30 km/h) for example if you want to approach the signal at 30 km/h.
The KVB formula is different because it adds several things :
The braking establishement delay : 2 seconds for trains that have electropneumatic brakes, another formula for those who don't, and another for heavy freight trains. This braking delay multiplied by the speed of the train is added to the distance formula. We get the emergency curve.
For the alert curve, we add an anticipation time of 5 seconds.
For current speed control, we add 5 km/h to the speed limit in order to have the alert speed. We add 10 km/h to the speed limit in order to have the emergency braking speed.
For double red aspect (on protection signals), these speeds are reduced to 2,5 km/h and 5 km/h respectively. The approach speed is reduced to 10 km/h.
#44
Posted 13 February 2014 - 11:35 PM
I cannot build (compile) any changes once I update to #2026. #2025 worked fine for me.
When I attempt to build, I get the following message:
Error 22 The command "if not Debug == Release echo $Revision: 000 {:content:}gt;Revision.txt if not Debug == Release date /t>>Revision.txt if not Debug == Release time /t>>Revision.txt call "G:\Open Rails Source Code\Open Rails Repository\openrails\Source\3rdPartyLibs\GNU.Gettext\BuildMenuLocales.bat"" exited with code -2146232576. Menu
Is this an issue my end?
Thanks
Peter
#45
Posted 13 February 2014 - 11:52 PM
There is maybe a bug in the localization build script that has been modified in revision 2026.
http://www.elvastowe...view=getnewpost