openOMSI GitHub Discord

Docs / Routes and rail / Trolleybuses

The gear: blocks of a vehicle's .bus

6 min readEdit this pagedocs/TROLLEYBUS.md

On this page
  1. Variables for the model and the sound
  2. A script's lifting gear

Inside a block every line is key value ...; keys left out keep the default.

[trolley_pole]              one per pole
side left                   left | right (or -1 | 1)
pos -0.3 1.0 4.16           the hinge on the roof (x right, y forward, z up, m)
length 6.7                  boom length (m)
rest_angle -1.5             elevation lying on the hook (degrees)
work_angle 16               elevation in work (degrees): where the spring's force is rated
max_angle 45                the highest it rises loose, held by its rope (degrees)
tip_force 120               what the shoe presses the wire with at work_angle (N)
mass 16                     boom with rope (kg)
head_mass 3                 head and shoe (kg)
groove_depth 0.06           how far the wire sits in the shoe (m)
funnel 0.07                 half the width the horns catch a wire in (m)
max_wire_angle 40           how far the boom may stand off the wire (degrees)
kink_speed 3.0              sideways speed of the shoe a bend of the wire may ask (m/s)
retriever 35                a rope retriever pulls it down at this rate after dewiring (deg/s)
motor 1                     raised and lowered from the cab
boom_bounce 1.1             the boom's bounce on a script's lifting gear (Hz)
boom_damping 0.12           how quickly that bounce dies away (damping ratio)
visible 1                   the game draws the boom and its rope (0: the model draws its own)
reach 9                     how far from the rope's handle it can be handled (m)
OMSI file
[trolley_rheostat]          a series DC drive with a resistor controller (all keys optional)
gear_ratio 9.6              motor to wheels
gear_efficiency 0.93
motors 1
armature_ohm 0.14           armature and series field
flux_sat 3.3                flux linkage at saturation (V s/rad)
flux_half_amps 25           the current at which half of it is built up
steps 14                    resistor steps
start_ohm 2.6               the whole external resistance
field_steps 0.72 0.5        flux kept in the field-weakening steps
step_up_s 0.22              seconds a step takes when the controller climbs / falls
step_down_s 0.08
current_min 120             the pedal's current at its ends (A, per motor)
current_max 280
brake_current 220           dynamic braking: the largest generator current (A)
brake_excitation 0.75
brake_force 56000           mechanical brakes with the pedal down (N)
overspeed 380               motor speed limit (rad/s)

[trolley_async]             an inverter drive
max_force 30000             force at the wheels from standstill (N)
max_power_kw 170            power at the wheels above the corner speed
efficiency 0.9
regen_power_kw 150
regen_force 26000
chopper 1                   a brake resistor takes what the line will not
v_min 480                   voltage below which the force fades
v_trip 380                  voltage below which the inverter trips
v_regen_max 720
brake_force 56000

[trolley_battery]           optional, for the asynchronous drive
kwh 4
kw 30
max_kmh 15

[trolley_aux]
6.0                         lights, compressor and heater taken from the line (kW)

[trolley_vars]              names of the script variables the gear reads, if the model's differ
direction Trolley_Direction     > 0.5 forward, < -0.5 reverse, else neutral (default: forward)
indicator_left Blinker_Left     for switches in `indicator` mode
indicator_right Blinker_Right
raise_request Trolley_Poles_Raise   +1 raise, -1 lower the poles that have a motor
switch_request Trolley_Switch_Request   radio: -1 left, +1 right, 2 momentary toggle, 0 none (without it: indicator)
switch_code Trolley_Switch_Code         radio switches: the route code, 0 none
switch_channel Trolley_Switch_Channel   radio switches: the channel sent on

A vehicle whose own script or a plugin moves its poles puts an empty [trolley_none] block in its .bus: the game then gives it no gear, and does not read poles off its model either (the meshes keep their own [visible] and animations). Without any of these blocks the vehicle is taken as a plain trolleybus when its model looks like one (see TROLLEY_MODS.md).

OMSI file
[trolley_none]

Each section of an articulated vehicle has its own .bus, read on its own: the block goes in the .bus of the section whose model carries the poles (usually the rear one, as on the Ikarus 280T).

With a modelled drive the vehicle's own M_Wheel is replaced by the drive's force (times the wheel radius of the driven axle) and the drive's mechanical brake force is added to Brakeforce (the vehicle's variable list must declare Brakeforce, M_Wheel, Throttle and Brake, as every vehicle's does).

Without a drive block the script's driving torque is kept but scaled by the line voltage over the nominal voltage, and cut when the poles bring no current: a mod's scripted drive works on a wire and stops without one.

Variables for the model and the sound#

The game writes these every physics step (declared in the model or not; a model may animate or make sound by them):

Variable Meaning
Trolley_Pole<k>_Elev, _Azim pole k (1, 2...): elevation over the horizontal and swing from straight back (degrees, + to the right)
Trolley_Pole<k>_State 0 down on the hook, 1 being pulled down, 2 in the hand, 3 loose, 4 on the wire with the contact open, 5 on the wire
Trolley_Pole<k>_Contact 1 while the shoe touches the wire
Trolley_Pole<k>_Force what the shoe presses with (N)
Trolley_Pole<k>_Bounce 0..1 how hard the boom bounces on its script's lifting gear
Trolley_Pole<k>_Hit 0..1 how hard its last hit was (on the wire, back on it, against its rope)
Trolley_Pole<k>_Shoe_Yaw, _Shoe_Pitch the head's swivel against the boom (degrees): about the boom's up axis (+ to the right), then about its side axis (+ the far end up), so that the shoe lies along the wire; off the wire it swings back to 0
Trolley_Volts, Trolley_Amps the voltage at the bus and the current from the line (negative: given back)
Trolley_Powered 1 while both poles are on live wire
Trolley_Notch the rheostat controller's position
Trolley_Arc 0..1 how hard an arc burns now
Trolley_Hiss 0..1 the shoes' hiss
Trolley_Battery the battery's charge, 0..1

A vehicle whose model carries its own poles puts visible 0 in its [trolley_pole] and rotates its pole meshes by Trolley_Pole<k>_Elev and _Azim. Its head (the shoe and what swivels with it) turns on top of that by _Shoe_Yaw and then _Shoe_Pitch, about the head's pivot: a boom standing at 15 degrees under a level wire has _Shoe_Pitch -15, the shoe level on the wire.

A script's lifting gear#

A vehicle's script can run its poles' lifting gear itself, as an OMSI 2 door script runs its doors: it declares and writes Trolley_Pole<k>_Gear, where the gear's carriage is, 0 on the hook, 1 just under the wire (the wire above it, else where the pole left the wire, else its work_angle).

The boom rides on the carriage as a spring (boom_bounce, boom_damping), so wherever the carriage stops or starts the boom bounces; at 1 the gear lets it go, and its spring puts the shoe on the wire. Going below 1 from the wire takes the shoe off it; at 0 the hook catches the boom once it has come down.

The script times the run as it likes (a delay, a stop halfway, the speeds, from its own constant file) and fires its run's sound itself, with a trigger of its own, as a door script does.

The pole follows the variable from its first change until the run's end (on the wire or the hook); a variable left as it is moves nothing, so a hand or the cab still puts a pole up or down. Taken by hand, a pole leaves the script's run. Without the variable motor 1 works as before.

'raise from the hook: 2 s to halfway, 3 s there, 2 s on
(L.L.gear_t) (L.S.Timegap) + (S.L.gear_t)
(L.L.gear_t) 2 < {if} (L.L.gear_t) 4 / {else} (L.L.gear_t) 5 < {if} 0.5 {else} (L.L.gear_t) 5 - 4 / 0.5 + 1 min {endif} {endif}
(S.L.Trolley_Pole1_Gear) (S.L.Trolley_Pole2_Gear)

Something wrong or missing? Fix it on GitHub or open an issue.

↑↓ to move↵ to open