SGTrains Forums
Signal problem - Printable Version

+- SGTrains Forums (http://forums.sgtrains.com)
+-- Forum: openBVE Singapore (http://forums.sgtrains.com/forumdisplay.php?fid=9)
+--- Forum: BVE Problems and Questions (http://forums.sgtrains.com/forumdisplay.php?fid=35)
+--- Thread: Signal problem (/showthread.php?tid=1953)



Signal problem - Samuel Lee - 14 August 2012

Hi all, as the openBVE website has down, I encountered difficulty on how to create a signal.

There have been extensive use of green go ahead signal such as:


.signal -2; PSR1; -1.5;1.5


which means a green / red 2 aspect signal named as "PSR1" is positioned on leftwards 1.5m away from track and 1.5m above the main track.

But, how to do the red light and forced stop before a position?


RE: .Signal problem - joeyfjj - 15 August 2012

(14 August 2012, 11:54 PM)Samuel Lee Wrote:   Show/Hide

You need to edit the .STA command, but i forgot which value


RE: .Signal problem - boylush - 15 August 2012

Do refer to https://dl.dropbox.com/u/15358085/smb237u/Openbve/develop/index.html


RE: .Signal problem - Mark4211 - 15 August 2012

I guess you meant this?
Quote:
Code:
.sta Name; ArrivalTime; DepartureTime; PassAlarm; Doors; ForcedRedSignal; System; ArrivalSound; StopDuration; PassengerRatio; DepartureSound; TimetableIndex
Quote:Available options for ForcedRedSignal:
0: Signals are unaffected by this station.
1: The signal immediately following the last station stop is hold at red until the train reaches the stopping area and the departure time.



RE: Signal problem - Samuel Lee - 15 August 2012

Thanks for the reply, but the codes shown still make the signal light as green. I dunno where did I did wrong

Code:
32850
.sta UPD Sidings;12.4645;12.4825;1;0;1;0;;0;0;;0
33000
.signal -2; UPD1; -1.5; 1;
.stop 0;10;10



RE: Signal problem - Samuel Lee - 17 August 2012

I hope this can make sticky by admins.


How to create red signals using DEFAULT BVE's signals:

Step 1: Code a station in desired position with stopping position.
Code:
[u]X[/u]
;.sta [i]Station Name[/i];[i]Arrival Time[/i];[i]Departure Time[/i];0;N;[b]1[/b];[i]Safety System[/i]; [i]Arrival Sound[/i];[i]Stop duration[/i] ;[i]Passenger Ratio[/i];[i]Departure Sound[/i] ;[i]Timetable Index[/i]
[u]Y[/u]
.stop 0;10;10
The underlined X and Y are positive integers denotes the position of the track. The stop command shall not be further explained. (Allows 10m margin and does not show the CSP sign)

The normal 0 is passed alarm and I don't SG MRT uses that. Hence I disabled it.

Safety System should be "1" as all SG (BVE & real life) trains are equipped with ATC. Unless it is in depot where ATC is unavailable, that's when 0 is used.

"N" means no doors should open. Other parameters include:
openBVE wiki Wrote: Show/Hide

You should change the bolded to "1" as it means Forced Red Signal.

Step 2: Put the official .signal code
Code:
[u]Z[/u]
.signal -2; <Unused for OpenBVE>; -1.5;1.5,

Notice that the position Z MUST be after the station stop point.
For details on how to use .signal, please refer to:

Track & Signalling Guide from OpenBVE Developer Guide

For in this instance, it is used the 2 light (Red & Green) signal positioned 1.5m leftwards and 1.5m above the track (Signal post cannot be in the middle of track and get hit by trains).

Further learning:

Q1Smile What if I have "Bukit Brown problem" (Crossover over a closed station)?

For closed stations, you should:

Code:
13000
;.sta Bukit Brown;P;[s]Departure Time[/s];0;N;[b]1[/b];1; [s]Arrival Sound[/s];0;[i]Passenger Ratio[/i];[s]Departure Sound[/s] ;[s]Timetable Index[/s]
[u]13070[/u]
.stop 0;10;10
13200
.signal -2; <Unused for OpenBVE>; -1.5;1.5,

For further reading of .sta code:

Further reading on .sta code

Note: The striked off ones are one's that can be left empty. We BVESG so far does not use Departure Sound (Maybe unless one day SMRT plays "Please hold on the grab poles" or another reminder of no eating & drinking before departure, then we may do adjustment accordingly) and Timetable Index (IDK). A closed station does not require precise arrival & departure time but we must use "P" or "L" to indicate this station is meant to be passed. I estimate CCL's carriage is about 70m. Change accordingly please.

Unlike BVE4 where .stop command can be forget for various lines that skip stations, openBVE still demand a stop position for every station. This is how "P" and "L" options come into handy.

Hence, even for "Tanah Merah" / "Jurong East" situation, whereby there are more than 1 crossover point to meet between stations, you can have code like

Code:
30000
;.sta EW4 Tanah Merah;12.2312;12.2533;0;1;[b]1[/b];1; ewl\ew4.wav;15;65;[s]Departure Sound[/s] ;[s]Timetable Index[/s]
30150
.stop 0;10;10
30151
.signal -2; <Unused for OpenBVE>; -1.5;1.5,
The 15 denotes minimum of 15 secs stay in the station. I presume a 65% load in EB.

This part is the immediate signal light for train to go / or halt for middle platform train to go towards PSR bound. Notice I allowed the slight delay in departure time (Instead of usual 15 sec ~ 30 sec, I put more than 2 minutes)? This is to cite a case of a peak hour fresh train from CHD is departing TNM for Simei to embark their journey which lead to delay in our time. But then, the signal light will auto change when the departure time comes close.

Then

Code:
30800
;.sta E42;[b]P[/b];12.2555;0;[b]N[/b];[b]1[/b];1;;[b]0[/b];65;[s]Departure Sound[/s] ;[s]Timetable Index[/s]
30801
.stop 0;10;10
30802
.signal -2; <Unused for OpenBVE>; -1.5;1.5,
This is skipped station of E42 in the EB > CGL crossover (I does not know the exact signal code for that and anyhow named it in the best guess.)

The departure time is up to one to play around. You may create a stop there (Delay the departure time longer) as the train is coming too close to the peak hour fresh train or you can make a smooth journey of not stopping at all by putting the departure time much closer to Tanah Merah's departure time.

A demo picture for default red signal:

[Image: Default.png]


How to create CUSTOM signals?

Heck! openBVE's signals does not looked like one used in Singapore MRT. What if I want to code signals for Crystal Movers based LRT lines?

Here's how:

Similar concept, but with differences and their advantages / disadvantages.

Step 1:

Code your custom signals. (Later to be elaborated)

Step 2:
Load the signals as you do for objects (.freeobj)
Code:
With Structure
Signal(33).Load ewl\signals\Test.animated
All the rails, walls, viaducts, PSDs and etc are omitted. The signals files are placed on EWL's object file. In future, I may create a shared library for each particular type of trains (1 signal folder for SG/PG LRT & CGA Skytrain & 1 signal folder for EWL / NSL etc.)

Step 3: Code the signal point straight
Code:
[u]X[/u]
[i].Section 0,[/i] .sigf 33;0; -1.5; 1

For reference:

[Image: Stop.png]


The advantage is the removal of need to create each mini stations (The points whereby trains are most likely needed to stop other than actual stations), but the disadvantage is by using .Section code, it freeze the
signal light indefinitely which makes it only useful at sidings or a point where the game prematurely ended due "signalling fault" (Lightning strikes on the signal? Tongue).

[Image: Lightning_Strikes.png]

Hence, the best way to solve "Bukit Brown" / "Tanah Merah" problem is to combine the both:

Code:
30800
;.sta E42;[b]P[/b];12.2555;0;[b]N[/b];[b]1[/b];1;;[b]0[/b];65;[s]Departure Sound[/s] ;[s]Timetable Index[/s]
30801
.stop 0;10;10
30802
[s].Section 0,[/s] .sigf 33;0; -1.5; 1

We can strike out the Section code, otherwise it will override the bolded "1", forced red signal until departure time.

[Image: Proceed.png]



Regarding the signal file, you need to create an animated file.

Basically you need to get the texture and lighting colour. And you code a box as "base" with 2 more files as lighting colour files (Depending on the number of aspect lights. Other system have yellow light and you need more files then).

Last, you create the animated file by:

Code:
[Object]
Position = 0, -2.65, 0
States = Test_SignalSingle_Pole.csv
;Position the base signal box as required

[Object]
Position = 0, 0, 0
States = SignalSG_0.csv, SignalSG_X.csv, SignalSG_2.csv
StateFunction = if[section == 0,0,(if[section==2,1,2])]
;Position the lighting as required. Then we got 3 states for SG signals. SignalSG_0.csv is the red colour file, SignalSG_X.csv is the lightning striked colour file (Or a major power outage) and SignalSG_2.csv is the white colour file.

;We will use this function to decide which light to appear:
;If section is 0, it means red light in openBVE codebase and we must treat it as red light. Hence, if section is 0, State in 0th index which is the red colour file base is used. However, if section is not 0, whereby ForcedRedSignal parameter in .sta command is 0 or .Section provided is anything other than 0, then another check will be done such that if section is 2 (Yellow light), then the power outage / lightning striked file will be used. In other cases, it will be using white light file which is located at 2nd index.


That's all I have.

Hope it helps.