News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

Convoy'current destination

Started by jameskuyper, December 29, 2022, 02:51:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jameskuyper

I couldn't find any way in the squirrel API to determine or change which schedule_entry_x is the current destination of a given convoy. Can those things be done?

Yona-TYT

Quote from: jameskuyper on December 29, 2022, 02:51:01 PMI couldn't find any way in the squirrel API to determine or change which schedule_entry_x is the current destination of a given convoy. Can those things be done?
Can you explain it with an example?. :P

jameskuyper

This is in connection with passenger and mail lines. With freight lines, you can set up a schedule to make convoys wait at a stop where a good is produced until it's fully loaded before moving on to the next entry in the schedule. Trains would be released at regular intervals, equal to the amount of time it takes for produce the amount of the relevant good that is needed to fill the convoy.
However, supply and demand of passengers and mail is much less predictable. At most stops on a passenger line, if you did that it would leave some other stop overflowing with passengers. There's one exception: the stop at which, if the convoys were evenly spaced and moving steadily around the line, a convoy would leave the stop with the largest number of passengers. If you set that stop, and only that stop, to load==100%, then the convoys would be released at fairly regular intervals.

My thought was to create a tool which could be applied to a convoy. It would examine all of the convoys using the same line, and determine which one(s) were the most full. Then it would identify which stop on the schedule that they visited last. What I really want is the most-recently visited stop, but I don't see any reason why the game would keep track of that. It does need to keep track of the next stop, and I could work backwards from that through the schedule to the previous stop.

Yona-TYT

Quote from: jameskuyper on December 30, 2022, 12:53:24 AMWhat I really want is the most-recently visited stop
Let's see if I understand... do you want to know which is the stop that changes its status to (saturated) faster? I mean the bus stop that fills up the fastest or do you want to know the last stop that the vehicle has traveled ?.

jameskuyper

I want to know the stop where departing buses have the largest number of passengers. That is the stop that determines the minimum number of busses that must be assigned to that line to keep all passengers moving promptly. Assign too few,and the busses will always leave some passengers behind at that stop.

Dwachs

Parsley, sage, rosemary, and maggikraut.

Andarix

A long time ago I wrote a script tool that determines the stations with more than 80% waiting passengers. Maybe this code will help you.

Script tool to check stations where passengers have been waiting for 4 months
check_waiting_pass.zip

checks stations for more than 80% waiting passengers (player and public)
attached script tool


jameskuyper

Keep in mind that the thing I'm looking for is a characteristic of a schedule entry, and not of the corresponding halt. Even if there are lots of people waiting at a given halt, if very few of them are waiting to use this line, it's not the halt schedule entry I'm looking for.
More specifically, a schedule could involve two or more entries visiting the same halt, presumably while going in different directions. If most of the passengers loading from that halt want to go south, not north, I would probably want the schedule entry at which the schedule has the bus moving south for the next stop.
Finally, this doesn't just depend upon upon one schedule entry, but upon the whole sequence of them that makes up a schedule. Consider a Southbound bus starting at the North end of the line. At the first station it picks up lots of passengers. As it heads southward it pucks up a smaller number of passengers and drops off an increasing number of passengers, until at the south end everybody gets dropped off. I'm not saying that this is the inherent pattern on all north/south lines, I'm just talking about a line where this is the pattern. I've seen precisely that pattern on passenger trains taking people from the suburbs into Washington DC.
With that pattern, there will be a point where the net number of passengers added at each stop will switch from positive to negative. By definition, the number of passengers on the bus will have a local maximum between those two stops. The stop at which this happens needn't be particularly crowded. However, the stop where the global maximum is achieved is the stop that I want, because it's that global maximum that determines whether or not additional busses are needed. If enough busses have been assigned to that line, setting load=100% for that schedule entry would allow it to act as the metronome which spaces out the buses best.

Having written that out, I just realized it might make a better metronome to use the schedule entry at which the largest number of new passengers is loaded, and to set the load to a value lower than 100%, that corresponds to the typical loading level after leaving that schedule entry. However, that would be even harder to do, because I'm pretty sure the game has no reason to keep track of the number of passengers loaded by a particular line at a given schedule entry.

Andarix

#8
The passengers have a destination at the stations.

You then only have to determine the passengers with their destinations and then compare them with the order of the stops in the timetable.

Or the other way around, determine the following stops in the timetable and then determine the passengers who have these stops as their destination.

Another script tool of mine checks for crowded stations. Either globally over the whole map or if a station is clicked, the stations that are connected to this station.

Then they have to set an upper limit for waiting passengers from which they want to continue using vehicles and compare it with this.
check_passenger_stops.zip

The connected stops of the clicked station are determined in the tool. For your own purposes, you must limit this list to the stops on the timetable. So first determine the stops in the timetable and then only query these stops at the station.

Then they have to set an upper limit for waiting passengers from which they want to continue using vehicles and compare it with this.

You cannot start with the vehicles because it always depends on how much space there is in the vehicle for boarding passengers. If a vehicle is full and no passenger gets out, then no passenger gets in either. Does that mean there are no passengers waiting at the station?


The script tool check_waiting_pass is actually intended to determine whether the waiting passengers at a station have increased over 4 months. If the number of people waiting increases, then the vehicles are no longer sufficient for transport.

I would do it like this

- Determine at which stations the people waiting get on
- find out where the people waiting want to go
- determine which lines serve the destination station
- Reinforce lines with vehicles

jameskuyper

Keep in mind that what I'm looking for is line-specific. If there's two or more different ways a passenger could get from one halt to another, the number I'm looking for is the number that (will use/have used) this particular line to do so. The description of halt_x.get_freight_to_halt() implies that it is the total for the halt, over all lines.
What I would really like to have could be calculated from a table that gives, for each pair of entries in a schedule, the long-term average number of passengers loaded at the first entry for unloading at the second.