Welcome to MattzoBricks › Forums › MattzoTrainController for Bluetooth (MTC4BT) › How to stop a loco on an enter2in sensor
- This topic has 4 replies, 2 voices, and was last updated 5 months, 1 week ago by Liam Molloy.
-
AuthorPosts
-
-
June 29, 2024 at 03:10 #7696Liam MolloyParticipant
Hallo, I am seeking to understand how the “pwrIncStep” and “pwrDecStep” values behave. Currently I have a Train Controller set up with the default value of 10. When a sensor detects a loco, it stops the train. However it slows down gently before coming to a complete stop. I think the “pwrDecStep” value is the cause of this behavior. I would like the loco to stop as soon as possible.
I think what happens is if the loco is set to a speed of 50, when then sensor sets the train to stop it does so by decreasing the speed by 10 over a period of time so 40, pause, 30, pause, 20, pause, 20, pause and 0. I want it to go from its current speed to 0 without the intermediate steps.
What are the rules for this slow down? Does it decrease by the value of “pwrDecStep” every x seconds? If so what is the timing threshold? 10 ms? 100 ms? 10 each time loop() is called? Would setting “pwrDecStep” to 100 have the effect I want? I only want the train to stop immediately if the speed command is set to zero. lets say I want to slow down from 50 to 30 would setting “pwrDecStep” to 100 set the value to -150 instead of 30?
Sorry if this has been documented elsewhere. I took a look at the documentation here and did not find an answer. I also looked on this forum first too.
Cheers,
Liam -
June 30, 2024 at 15:10 #7697Matthias RunteKeymaster
Hi Liam,
try leaving away the pwr*Step parameters, or set them to high values. This should solve your issue. If not, let me know. Then I need to look it up in the code.Cheers,
Mattze -
July 1, 2024 at 06:01 #7698Liam MolloyParticipant
Thanks Mattze!
I tried leaving the pwr*Step parameters. When I do this, their default value is 10. These can be found in loadControllerConfiguration.h.
I tried setting pwrDecStep to a high value of 100. The loco is still taking a longtime to slowdown and stop. It takes about 120cm from being detected by the sensor until it comes to a stop.
I am going to try with some other values to see if they make a difference.
Cheers,
Liam -
July 1, 2024 at 08:51 #7699Matthias RunteKeymaster
Ok, thanks. It has been quite some time since we developed it, so thanks for the analysis. I have taken a note that we enhance the documentation. We will also review the present implementation and probably add a feature for immediate stops, as in the MTC4PF.
Let me add that most people want gentle stops instead of immediate ones. If you want to stop the loco at a defined position, it might be better to work with two sensors per block (enter and in sensor), and start slowing down the loco when it hits the enter sensor. Then the loco continues with moderate or slow speed until it meets the in sensor. Also check the BBT feature of Rocrail, this also helps.
- This reply was modified 5 months, 1 week ago by Matthias Runte.
-
July 1, 2024 at 23:09 #7701Liam MolloyParticipant
Thanks Mattzo, my ultimate goal is to implement 2 sensors per block (enter and in) but at the moment I do not have all of the needed hardware. I currently have 10 sensors / 10 blocks, 16 switches and 4 2-aspect signals. I would need to double to 20 sensors to make enter and in work. All of the wiring I have currently looks like a big bowl of spaghetti and adding wiring for 10 more sensors scares me. One day I hope to build an MLC Mega to power all of this and make everything look clean and tidy 🙂 I will also research BBT in Rocrail.
I am not familiar with the MTC4PF. I will take a look at the code which implements immediate stop in there and see if I can fork the MLC4BT code and implement the functionality within. My C++ is a bit rusty but I will give it a try.
Thanks for all of the hard work you and the team have put into this product. I am having fun automating my lego train layout.
Cheers,
Liam
-
-
AuthorPosts
- You must be logged in to reply to this topic.