remove obsolete code/comments
This commit is contained in:
parent
4ff8e05755
commit
cf2179dea5
|
@ -1,48 +1,7 @@
|
|||
-- occupation.lua
|
||||
--[[
|
||||
Collects and manages positions where trains occupy and/or reserve/require space
|
||||
THIS SECTION ABOVE IS OUTDATED, look below
|
||||
|
||||
Zone diagram of a train:
|
||||
|___| |___| --> Direction of travel
|
||||
oo oo+oo oo
|
||||
=|=======|===|===========|===|=======|===================|========|===
|
||||
|SafetyB|CpB| Train |CpF|SafetyF| Brake |Aware |
|
||||
[1] [2] [3] [4] [5] [6] [7] [8]
|
||||
|
||||
ID|Name |Desc
|
||||
0 Free Zone that was occupied before, which has now been left
|
||||
1 Train Zone where the train actually is.
|
||||
2 SafetyB Safety zone behind the train. extends 4m
|
||||
3 SafetyF Safety zone in front of the train. extends 4m
|
||||
If a train is about to enter this zone, immediately brake it down to 2
|
||||
4 CpB Backside coupling zone. If the coupling zones of 2 trains overlap, they can be coupled
|
||||
5 CpF Frontside coupling zone
|
||||
6 Brake Brake distance of the train. Extends to the point ~5 nodes in front
|
||||
of the point where the train would stop if it would regularily brake now.
|
||||
7 Aware Awareness zone. Extends 10-20 nodes beyond the Brake zone
|
||||
Whenever any of the non-aware zones of other trains are detected here, the train will start to brake.
|
||||
|
||||
Table format:
|
||||
occ[y][x][z] = {
|
||||
[1] = train 1 id
|
||||
[2] = train 1 ZoneID
|
||||
// [3] = entry seqnum*
|
||||
...
|
||||
[2n-1] = train n id
|
||||
[2n ] = train n ZoneID
|
||||
// [3n-2] = train n id
|
||||
// [3n-1] = train n ZoneID
|
||||
// [3n ] = entry seqnum*
|
||||
}
|
||||
occ_chg[n] = {
|
||||
pos = vector,
|
||||
train_id,
|
||||
old_val, (0 when entry did not exist before)
|
||||
new_val, (0 when entry was deleted)
|
||||
}
|
||||
|
||||
---------------------
|
||||
It turned out that, especially for the TSS, some more, even overlapping zones are required.
|
||||
Packing those into a data structure would just become a huge mess!
|
||||
Instead, this occupation system will store the path indices of positions in the corresponding.
|
||||
|
|
|
@ -703,40 +703,6 @@ advtrains.te_register_on_remove(function(id, train)
|
|||
--atdebug(id,"tnc remove",train.index,train.end_index)
|
||||
end)
|
||||
|
||||
-- Calculates the indices where the window borders of the occupation windows are.
|
||||
-- TODO adapt this code to new system, probably into a callback (probably only the brake distance code is needed)
|
||||
local function calc_occwindows(id, train)
|
||||
local end_index = advtrains.path_get_index_by_offset(train, train.index, -train.trainlen)
|
||||
train.end_index = end_index
|
||||
local cpl_b = end_index - COUPLE_ZONE
|
||||
local safety_b = advtrains.path_get_index_by_offset(train, cpl_b, -SAFETY_ZONE)
|
||||
local cpl_f = end_index + COUPLE_ZONE
|
||||
local safety_f = advtrains.path_get_index_by_offset(train, cpl_f, SAFETY_ZONE)
|
||||
|
||||
-- calculate brake distance
|
||||
local acc_all = t_accel_all[1]
|
||||
local acc_eng = t_accel_eng[1]
|
||||
local nwagons = #train.trainparts
|
||||
local acc = acc_all + (acc_eng*train.locomotives_in_train)/nwagons
|
||||
local vel = train.velocity
|
||||
local brakedst = (vel*vel) / (2*acc)
|
||||
|
||||
local brake_i = math.max(advtrains.path_get_index_by_offset(train, train.index, brakedst + BRAKE_SPACE), safety_f)
|
||||
local aware_i = advtrains.path_get_index_by_offset(train, brake_i, AWARE_ZONE)
|
||||
|
||||
return {
|
||||
safety_b,
|
||||
cpl_b,
|
||||
end_index,
|
||||
train.index,
|
||||
cpl_f,
|
||||
safety_f,
|
||||
brake_i,
|
||||
aware_i,
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
--returns new id
|
||||
function advtrains.create_new_train_at(pos, connid, ioff, trainparts)
|
||||
local new_id=advtrains.random_id()
|
||||
|
|
Loading…
Reference in New Issue