Motor Setup

In this dialog, the motor control parameters of a CTC-Loco-Module can be optimized using live data. To do this, the loco continuously transmits the value of the motor sensor, the target value, and the control value calculated by the PID controller. As long as all three values are 0, the diagram is "frozen".

The displayed parameters belong to the currently selected operation mode (motor mode) of the loco. The parameters kP, kI, and kD are only relevant in the motor mode "PID" and are ignored in the motor mode "direct".

When you click the corresponding set button, the value displayed to its left is transmitted directly to the loco and remains so until the loco is reset. Only when you click "Upload Motor Config" are your settings permanently saved.

Load control parameters (PID controller):

  • kP determines how directly the motor reacts to changes in the sensor. A value that is too high leads to jerky driving behavior, while a value that is too low causes the motor to react very slowly to changes in the target or sensor value.
  • kI determines how strongly the motor reacts to the sum of all target deviations.
  • kD determines how strongly the motor reacts to the difference between the current and previous sensor value.
  • the sample rate can only be set directly in the cfg.xml and should remain at the default value of 20 ms.

Motor output range:

  • Min and Max define the motor control range (0..1023). This allows the lower range in which the motor does not rotate to be excluded and the maximum speed to be limited.
  • With Creep , you set the creep speed, which is used when uncoupling ("coupling waltz"), as well as the target speed for decelerating to minimum speed.

Motor-Setup

Parameters for braking and acceleration:

  • Braking is the acceleration constant for braking processes (in mm/s²). The specified value is given as positive and multiplied by -1 in the loco. If the value is 0, a default value of 250 is used.
  • Accelerating is the constant for acceleration processes (in mm/s²). If the value is 0, a default value of 250 is used.
  • Brake factor is divided by 1000 and increased by 1 as an amplification factor in target braking. In the example (800), it is thus multiplied by 1.8. Increasing the brake factor can reduce the downward kink at the end of a braking process. A brake factor that is too high leads to a downward-curved braking curve.
  • Reaction specifies the time in milliseconds until the delay takes effect in the motor during braking. This parameter only works from Firmware 20230609 (CTC-App 4.17).

Note: As long as the Motor Setup dialog is open, the loco sends unsynchronized data packets for the diagram at a high rate. This increased data traffic can lead to more frequent data packet losses (#Msg.Miss in the statistics display ).

Optimization of braking parameters

To optimize the target braking, I use a circular track with a signal where the loco stops using 2 beacons. The loco is in front of the red signal and has set a speed of 70% in the example. Then the signal is opened and closed again as soon as the loco has started moving.

In the following example, you can see the loco arriving at 70% (700) (Piko BR 147 ), then the braking process down to minimum speed (parameter "Creep" 150), a short time at minimum speed, and the stop on the far right. In the first attempt, brake factor and deceleration are set to 0:

Braking before

Now the braking curve has been optimized and experimentally determined as optimal values for brake factor 800 and reaction 60:

Braking after

Note: If you want to know exactly, you can find the data transmitted during the measurement as "Motor-Setup.csv" in your user directory. This can be opened, for example, with Excel or LibreOffice and evaluated in detail there.