duminică, 3 aprilie 2016

Deceleration Formula For ESU v3.5

Ever since work started on this layout, it became evident that stopping trains in front of signals in a realistic manner is a must. In the early days an oval track loop was used with detectors mounted at various points to perform some measurements. I would say copious amounts of time have been spent over this operation during the years, with scores of written pages.
The first thing was getting a consistent terminology. It was during my discussions with Lenz in the beginning of 2010 - when I couldn't figure out how the decoder in the their BR66 was working - when this was established. The value displayed on the DCC handheld controller is the external speed step. As a side node, I've never had a need to switch to anything else than the default 28-step mode. Internally, the DCC decoders use the internal speed step, which translated into the voltage applied to the motor. Separating between the 2 allows creation of custom speed curves, allowing for example accelerating in small increments at lower speeds. The decoders themselves can use 2 modes of operations: 1. CV2, CV5 and CV6 are used to specify relative values for the start, max and medium speed respectively. 2 a user defined speed table is programmed in a specific set of CVs (for ESU LokSound v3.5, this is the range CV67-96).
However trains also have acceleration and deceleration, which DCC models by using correspondent registers for each: CV3 and CV4. The NMRA standard makes things very simple, by saying that the time taken to cycle between 2 subsequent external speed steps is equal to CV3 * 0.869 / .  Unfortunately in practice things aren't that simple. Lenz uses a different formula, based on internal speed steps, and ESU doesn't seem to implement it also.
In august last year I spent almost one day in getting measurements for the Brawa V100, equipped with an ESU LokSound v3.5. To be more exact, the goal was to answer the question "what is the formula for the time taken to bring the locomotive to a stop ?". A section on the layout itself was used for measuring, with several lines of C# code written to send instructions to the Lenz LZV100 via the Lenz LI-USB-Ethernet interface. However since I had no way at the time to detect when a locomotive came to a stop, I had to sit next to the track and press a key when the locomotive would stop - *every* time. There wasn't enough data to see a pattern, so solving this problem was postponed.
Original sheet containing measurements
results for the Brawa V100 tests
done in August 2015
The issue to be solved was detecting when the locomotive was actually stopped. With this out of the way, measuring tests could be fully automated. Since there are already quite a few Phidgets boards I've bought during the time, a current sensor sensitive enough would do. From past observations I figured their most sensitive one would do the job, so I went ahead and purchased 2 of them (an additional one for 1. backup in case the first one fails and 2. error reduction in measurements by averaging, would this were to become an issue). Hooking one of them to the old Phidgets 1018 board that was no longer used revealed it did the job, the only glitch being measuring rapidly dropping currents (eg suddenly breaking the circuit) wouldn't result in a 0 value being read out, however for locomotive under normal deceleration rates this was no issue.
The Hardware setup
Completing the hardware setup involved getting the right number of coils around the current detector. Being an AC current detector, only one of the wires needs to be inserted through its area. Its possible to reinsert the same wire multiple times through this area, thus resulting in increased sensitivity (albeit increasing error). 2 passings of the wire proved low enough to provide enough sensitivity for when the locomotive becomes stopped versus moving with the minimum possible speed step.
Speed measurement for CV2/5/6 set. Note that
the top 2 straight lines are actually artifacts due
to automatic connection of points in the series
First thing to check was that real speed versus internal speed was linear for the ESU v3.5, or in other words measure the real speed (cm/s) for each external speed step. The default decoder user speed curve - which is linear - was activated using bit 4 in CV29. The code for speed profiling was actually implementing a state machine, along the following path: locomotive gets configured with CV3=1 and CV4=3, in order to allow quick acceleration but a slower stop; it gets sent on its way using the maximum external speed step; when hitting the 1st detector the time is marked; when hitting the 2nd one the speed can be computed, given each distance between the detectors is known in each direction (this IS important, since the distance between detectors can differ depending on the way and based on the detector orientation) - also a stop command is sent; once the idle current level is detected, the external speed step is decreased by 1 and the locomotive sent the other way and the process continues. The data was automatically saved in a .csv for post-analysis. 160 runs were captured. The first thing to notice was that indeed the real speed is indeed linear with the internal speed step, so no surprise here (the correlation coefficient was averaged to 0.26 (real speed / internal speed step). Secondly, when switching to the CV2/5/6 mode for the speed curve, the profile was indeed verified to be as in the ESU v3.5 LokSound manual (pg 19, an online copy here) - namely the speed curve didn't end up as an exponential function (hint: Lenz does this), but as 2 simple lines "broken" at the middle point. Thirdly, if the CV6 value (mid) is greater than CV5, then the detector will simply consider a straight line for the speed curve, based on CV2 and CV5 only.
Brawa V100 after the runs were done
Next, deceleration was considered. The state machine was slightly altered, to consider 4 detectors and operated as follows: CV3 is always set to 1, while CV4 is chosen each time; locomotive gets send with the maximum speed; once the first detector gets triggered, a stop command is sent; once the threshold value for current is hit (signalling the locomotive just stopped), the time it took to stop is marked. Then, depending if the detector behind the 2nd one on the direction of the run (called the fallback detector) is triggered, the locomotive is moved safely until this fallback one is hit. Then the locomotive is again issued a stop command, the idle current value is waited for, after which the speed gets decreased by one and the locomotive sent the other way. This slightly complicated way was chosen in order to leverage a flat section of track between the 2 "principal" detectors, however at this point I think it was just overkill. 252 runs were done. Running in both the user defined speed curve, as well as the CV2/5/6 one, confirmed that the ESU LokSound v3.5 doesn't take into account the internal speed steps, but only the external ones (Lenz does the opposite).
Time to stop versus external speed step, for 4 different
CV4 values, given CV2=3,CV5=35, CV6=13. Note the
linear aspect, suggesting dependency on external
speed step only
The graphs indicated that a linear function could be used to generalize for any CV4 value, provided the reference of this one was slightly moved "up" - to give a few more details, on the graph to the right, the place where all the lines meet is at 1.13 on the vertical axis; the fraction of the differences between the time value for 2 curves corresponding to the same external speed step  minus the "base" point (1.13) will roughly be the same and equal to the fraction of CV4s involved (eg time value for external step 20 on the top line, corresponding to CV4=20, minus 1.13, all divided by the time value for external speed step 20 on the 2nd line from the bottom, corresponding to CV4=10, minus 1.13, will equal approximately 2, the same ratio of 20:10).
A final formula based on the linear functions for 2 sets of results belonging to CV4=5 and CV4=10 was deducted:

t(E, CV4) = (a*E + b - B) * CV4 / 10 + B

where a=0,337; b=0,479; B=1,13.


The difference between the real measured value and the one computed based on the formula usually stays inside 0.2 seconds, but there are exceptions.

miercuri, 3 februarie 2016

Corrections On Wiring the Viessmann 4016

Soldering the wires for Viessmann 4016
Since these days I've been starting to prepare the landscape for the retaining walls that will sit behind the Faller station, supporting the track going up, things have to be in order. A bunch of wires however sat in the way - the connections for the only Viessmann 4016 signal on the layout, not yet installed. After testing each LED of the signal using the transformer, the signal's own wires were soldered to the feeders already on the layout. However when powering up, with power from the panel board and hooking up the laptop to the USB interface controlling the aspects for this signal - something odd: the main signal would not show Hp2, but only Hp1 (a list of signal aspects can be found in the Viessmann 401x manual, there's one online here). Also the Hp0+Sh1 wouldn't turn on the shunting lights. On the distant signal part, it was even stranger - only the ge2 LED will be on, and cyclic through the aspects wouldn't trigger any change.
  Turns out there were 2 factors causing it:
  1. The plugs at the end of the wires coming out of the Viessmann modules and leading to the connectors on the panel board had poor contact. The fact the the tiny metal tubes - where the plugs fit - are actually made out of two halves doesn't help, since if the bent wire happens to slide between, there will be no contact. Fiddling with the plugs made the dark LEDs issue go away
   2. I wrongly *assumed* that it's the brown output of the Viessmann transformer that's supposed to to be used as input to the desired states on the 5220 module, but it turns out this isn't so. After quickly reading through the manual and running across a diagram for a normal + distant signal on the same mast, showing the wire leading to the rt1 LED being used as input for the "dark aspect" of the distant signal, it become obvious it's the yellow that's needed. Also, I only accounted for 3 aspects of the distant signal in my original plan, when in fact there's an additional one - Vr0 - displayed when neither of the inputs are ON. Looking back I didn't knew what the aspects were supposed to be in the first place, nor what the correct wiring was. Reading the manual thoroughly made things clearer.

As for the wiring of the distant signal, in order not to use an additional relay of a Phidget 1017 (there's still 1 left on one board and 5 on another), I've took advantage that the "dark aspect" of the distant signal is only "showed" when the main signal on the same mast is in a Hp0 state (or Hp0+Sh1). By also using the fact that all the relays on the 1017 are DPDT (double pole double throw), the output selecting between the groups Hp0/Hp+Sh1 and Hp1/Hp2 was used to toggle between feeding the "dark aspect" input, or serving as input itself to yet another relay switching between Vr0 (essentially no wire connected) and (yet !) another relay switching between Vr1 and Vr2. The photo below shows the yellow wire, which is connected to the yellow Viessmann transformer output, used as input. There are 2 green wires used as outputs - the one labelled "OFF 5220" is actually the one controlling the "dark aspect"; the red electrical tape further up was used to cover the soldering needed to extend this wire, originally connected to a different relay. The other green wire is the one leading to the stairway mechanism mentioned above - the empty output on the next relay can be clearly seen.


miercuri, 13 ianuarie 2016

Painting the Roof and Auxiliary Elements of the Faller Station

Although the roof of the Faller station came out of the box sporting some nice burnt out marks, given the technology used to produce it, it still didn't look quite all right and proper painting had to be done. Along with the roof, 4 other element types had to be painted as well: the rain pipes, benches, trash bins and the window sills being mounted on the roof itself.
For the roof itself, the following formula was used: 
- 0.6 Tamiya Yellow (XF-3)
- 0.4 Tamiya Flat Red (XF-7)
- 1.0 Thinner (acrylic)
3 coats were applied, out of which the first was a light one.
For the rain pipes, benches, trash bins and window sills, it was decided to use gray for all of them - one of the reasons being that the box cover image actually had these gray as well. All were simply placed on a sticky tape side up - fixed itself on 2 perpendicular pieces of sticky tape. The "stickiness" was strong enough to hold the pieces down under the air flow of the airbrush. 3M Vinyl masking tape was used on certain parts of the window sills, since those will be glued on - and paint shouldn't get in the way.
The rain pipes only also had 2 coats of Tamiya Smoke, so they get a touch of metallic look.

Final roof color

Auxiliary elements getting ready
to be airbrushed
Bench before being painted

Bench after 2 coats of Tamiya J.N. Grey
Rain pipe detail after painting
with Tamiya J.N. Grey

Rain pipe detail after painting
with Tamiya J.N. Grey and 1 coat
of Tamiya Smoke

Rain pipe detail after painting
with Tamiya J.N. Grey and 2 coats
of Tamiya Smoke

duminică, 10 ianuarie 2016

Glueing the Roof on the Faller Station

  Once the decision to have the roof of the main station detachable was made, the next step was how to actually glue this in place. Additionally, painting will also have to be done, since (1) the bare plastic won't look well under any kind of lighting and (2) there needs to be some tooth for the weathering powders to actually adhere to.
  All needed in order to have one continuous piece ready for painting was to glue the main sides of the roof together, followed by the 2 small panels located on each side and also the ridge caps (a long one for the joint of the 2 main sides + 2 smaller ones for each panel-set on the sides).
  The pieces were first washed (a drop of liquid wash detergent added to a some warm water) and completely dried, while also removing some of the burnt plastic that resulted from the laser cutting process, since in some cases this was found right on the joints where adhesive would have been applied. For the 2 main sides and corresponding ridge cap, Bison 5-min Epoxy was used, while for the rest - Bison Plastic Cement. Reading around the web suggested that the epoxy is superior in strength to the plastic cement - albeit a rather short and subjective process on my part, hence the reason for it being used on the main roof sides. The masking tape was only used to keep the side panels together, given that like this they would rest just fine, unable to fall off until the cement set.
  It was also a good chance to test the Proses Magnetic Clamps that I bought one year ago, and they did a really good job in holding the main roof together until the epoxy became solid; luckily enough, there was just enough space between the paper mask and the roof for the underside of the clamps to fit into.