Vexatos / Computronics

A ComputerCraft/OpenComputers addon mod.
125 stars 51 forks source link

Manual Electric Locomotive control using Locomotive Relay #179

Open aerojas opened 8 years ago

aerojas commented 8 years ago

As far as I know, there is no way to control remotely a locomotive without using destination or automated track setups. What I'm suggesting is implement methods that allows manual control of Electric Locomotives using a computer and the Locomotive Relay. Which methods? I'm thinking about these methods:

As a very optional method, I suggest a way to know the locomotive's coordinates in the world.

These methods would allow more flexibility in train control, allowing remote control in non automated lines, or while maneuvering trains of different lenghts so automated setups are not possible without needing to redo part of the line/yard. Also it would allow centralized control of several trains from a single location, maybe even using a touch screen to select trains, command actions and watch its positions on the screen. I think that it would not be insanely complex to implement as the core of the implementation is some sort of wrapping the EntityLocomotive code of Railcraft into the Locomotive Relay code.

English is not my primary language, so some text may appear nonsense.

Thank you.

Vexatos commented 8 years ago

Something similar can already be done using the Locomotive Relay by using setDestination. All the routing and speed changing itself would have to be done by Railcraft's routing devices and tracks, but that's kind of the fun part, isn't it?

aerojas commented 8 years ago

I agree something similar could be done using setDestination and RC tracks, but that approach is only convenient for fixed-length trains and repetitive operations, or main route travel (station-to-station), not something like yard operations, which I had in mind when I wrote this suggestion. While operating several compositions, your needs may change constantly - couple a part of a train with new carts, add more Locomotives from one train from another, help a train stopped without energy in its batteries - all these cases can't be generalized, and so, automated by one solution - we would have to change the tracks constantly to fit each maneuver. Also automating in such degree all a railway is not achievable until mid to late game.

Each approach would have its own advantages and disadvantages:

As far as I know, neither OC nor CC has ways to configure and control RC tracks with multiple behaviors like Locomotive Track - except only those controllable through Redstone, so I think this feature is needed for full OC/CC Locomotive control and flexibility. It is not that feature will override RC tracks and devices, because is less complex to put some tracks and switches than coding the same, but when manual control is required, the feature would be an interesting approach.

Vexatos commented 8 years ago

If ever done: increaseSpeed() would be setSpeed(getSpeed() + 1), not sure if I'd make it return false or just error on invalid speed (would determine if you need custom error checking or pcall here)

Vexatos commented 8 years ago

Well, @aerojas, there are drivers for Locomotive and Limiter Tracks (and Routing Switches, Routing Detectors, Routing Tracks, Launching Tracks and Priming Tracks). Just place an Adapter next to it if you use OpenComputers, or the Computer directly when using CC (or something like the OpenPeripheral Peripheral Proxy). With those drivers, you can change the mode of the Locomotive Track or the speed of the Limiter track, you'd just need your locomotive to pass it after configuring it, of course. Doesn't that suffice? (You see, I might be too keen on not making this too easy. I am open for suggestions.)

aerojas commented 8 years ago

Yes, I recognize you can be worried about the suggestion. But, as I said before, Tracks and other RC devices are useful for automated setups or permanent tracks with single function, like a simple station. No coding required, easy to install and operate. I find reasonable using them in tracks I know I will use for a long time in a same repetitive operation, but not for one unique and manual operation (I would need to remake all the setup over and over). A manual, computer-driven setup would allow me to control several Locomotives at once from a sort of Yard Control Tower at my will, while using an automated setup I would need to figure out how and where to lay all the tracks and devices and make sure redstone signals are in the correct timing, something is not worth the effort if the operation is done only a few times. In compensation, the player have to invest more time coding an application to control its trains, but the task would be rewarded with a versatile system.

RC Tracks and devices won't be unused because a computer cannot replace some or all RC components, and I don't think players would bother coding a switch where they can use a Routing Switch which is easier.

Thank you.

Vexatos commented 8 years ago

But... I just said you can control Locomotive and Limiter tracks... And routing switches, detectors and tracks using Computers. Just place an Adapter block next to them. Wouldn't that suffice?

TheCadde commented 8 years ago

I want to add my vote to this suggestion with the following...

The most critical part here is the suggestion is for controlling locomotives AT the yard, anywhere, anytime. As if you had a semi intelligent operator operating the locomotive. Having that operator run over what could be many many locomotive controller/limiter tracks just to change speed make such a system needlessly complex to design. Not to mention possibly very lag inducing?

And then there's that pet peeve of mine... You can't control the speed of a locomotive that is currently boosted on a high speed track. "A non issue" you say? Not when you have a main line set up with blocks as in real life with signals showing the state of the block in front of it.

IRL, you have signals for "PASS FULL SPEED", "PASS HALF SPEED", "PASS SLOW" and of course "STOP". You have signals that show what the block in front is currently doing so an operator can make an informed decision. If the operator sees that the next block is going to be "HALF SPEED" then he's going to let of the accelerator in preparation to match the next blocks speed limit, as there is no way he's going to be able to slow the train down in time before he passes the next signal through visual feedback.

So basically, these blocks say "you will need to slow down before the next block" and "you would have to come to a complete stop at the next signal" which means the operator needs to act long before that next signal.

So again, there's no locomotive limiter track for HS tracks. Currently one would have to design ugly and pointless diverging lines to set the loco speed on a mainline. We already have the ability to go from HS to regular speed which is good. But after that, there's no way to control whether the loco should go half speed without also diverging off the HS track.

Now you might ask, does it matter? Well, we are getting into personal preference here. I would like to use ONE track rather than an assortment of many different tracks with side tracks for controlling locomotives. And personally i would much rather have the loco "operator" stop and start depending on the aspect shown than have a bunch of locking+limiter tracks and constantly go from HS to regular speed like a rubber band at every block signal. (Short of the side track for such operations that is)

Ok, "isn't this a Railcraft issue though? Shouldn't RC provide a HS limiter track or simply make them HS?" I am sure there's a good reason as to why there's no HS control tracks beyond boosters. Such as trains/carts passing these too quickly for them to apply a change. It would be much better (IMHO) if a locomotive had a dumb operator that would react to what the signal aspects are and adjust his speed or running mode accordingly before passing the next signal.

That is, rather than force the train on some loop to update it's running parameters... :)

Vexatos commented 8 years ago

The Locomotive Relay is not meant for long-distance control, it's got a limited range (128 blocks). Unless you have Locomotive Relays every couple of signal blocks or only in stations, I don't see how it would be manageable to properly manage high speed tracks which are meant for long-distance travel.

I guess it's still fewer blocks than an H.S. speed dial.

v1993 commented 3 years ago

The workaround for Locomotive Relay's limited range is probably to make a Microcontroller Railcart. Come to think of it - if attached directly to locomotive it probably shouldn't even need a relay at all.

I imagine that such cart should have existing locomotive relay functionality plus ability to control locomotives if attached to them and fire some event when passing signals (or possibly in some other situations too?). This seems to be a fairly nice solution with limitations being the same as they are for other microcontrollers/robots/drones: limited slots, EEPROM must be used for programming, etc.