Skip to main content

Well if nothing else, we've certainly made everyone a little more oscilloscope proficient and now everyone is using scopes to check their signals which is a good thing I think. The track signal test from 1-10 (counting good vs bad packets) just doesn't give you the same quality information as measuring the voltage right there. We're all learning together, which I guess is the point of all this.

Anyways I have ordered a pile of those PSX-AC for our club to try out, and I've also cataloged all the scope traces in a nice 20 page document and sent them over to the guys MTH who I've been in discussion with. They certainly seem interested, and willing to take a look at circuit design options. I expect to be sending them some of the failed TIUs next week also. I'm sure they'll get further than me since they have like.... drawings and a schematic to work off. If we figure out the failure mechanism and failed devices/components, I will certainly pass that along on here.

 

 

rad400 posted:

The question comes up every now and then about TIU active vs passive mode signal strength to the track.  So with the information from the above comments I did some DCS signal strength measurements to see if there is an actual difference between having a TIU in Active Vs. Passive mode.  From the preliminary results shown below, the DCS Active mode provided a stronger DCS signal to the track.  As a sample, I used the "Watch Dog" signal which is generated at power on and the "Read" signal.  

Has anyone else seen or can confirm these results?   

Bob D

 

Active mode  - Watch Dog Signal

DS1Z_QuickPrint13

 

Passive mode - Watch Dog Signal

DS1Z_QuickPrint4

 

Active Mode - Read signal

DS1Z_QuickPrint11

 

Passive Mode - Read signal

DS1Z_QuickPrint5

 

Hey

For some reason your images aren't showing up (at least for me) but what you describe follows circuit principles. In passive mode the source (xmfr, brick, battery, solar cell, nuclear reactor, or whatever you use) is across your TIU output so the impedance is lower, leading to a lower voltage developed across the rails.

Theory also says if you put a choke like the ones gunrunnerjohn suggests in series with the power supply than passive mode should become almost identical to active mode because you're raising the impedance at the DCS frequency range (but not at 60Hz). The imaginary part of impedance ZL presented by a choke or inductor with inductance L goes up with frequency f.   j is what circuit designers call i.... sqrt(-1)

ZL =2j(pi)f L

 

Adrian! posted:
rad400 posted:

The question comes up every now and then about TIU active vs passive mode signal strength to the track.  So with the information from the above comments I did some DCS signal strength measurements to see if there is an actual difference between having a TIU in Active Vs. Passive mode.  From the preliminary results shown below, the DCS Active mode provided a stronger DCS signal to the track.  As a sample, I used the "Watch Dog" signal which is generated at power on and the "Read" signal.  

Has anyone else seen or can confirm these results?   

Bob D

 

Active mode  - Watch Dog Signal

DS1Z_QuickPrint13

 

Passive mode - Watch Dog Signal

DS1Z_QuickPrint4

 

Active Mode - Read signal

DS1Z_QuickPrint11

 

Passive Mode - Read signal

DS1Z_QuickPrint5

 

Hey

For some reason your images aren't showing up (at least for me) but what you describe follows circuit principles. In passive mode the source (xmfr, brick, battery, solar cell, nuclear reactor, or whatever you use) is across your TIU output so the impedance is lower, leading to a lower voltage developed across the rails.

Theory also says if you put a choke like the ones gunrunnerjohn suggests in series with the power supply than passive mode should become almost identical to active mode because you're raising the impedance at the DCS frequency range (but not at 60Hz). The imaginary part of impedance ZL presented by a choke or inductor with inductance L goes up with frequency f.   j is what circuit designers call i.... sqrt(-1)

ZL =2j(pi)f L

 

I resent the post with another set of pictures.  Hopefully these pictures show up in the post.

Bob D

Adrian! posted:

Theory also says if you put a choke like the ones gunrunnerjohn suggests in series with the power supply than passive mode should become almost identical to active mode because you're raising the impedance at the DCS frequency range (but not at 60Hz). The imaginary part of impedance ZL presented by a choke or inductor with inductance L goes up with frequency f.   j is what circuit designers call i.... sqrt(-1)

ZL =2j(pi)f L

That would be a good experiment to try.  I'd love to be able to unconditionally recommend passive mode if you didn't lose signal.   Then the big difference is the emergency shutdown, and there are other ways to accomplish that.

gunrunnerjohn posted:
Adrian! posted:

Theory also says if you put a choke like the ones gunrunnerjohn suggests in series with the power supply than passive mode should become almost identical to active mode because you're raising the impedance at the DCS frequency range (but not at 60Hz). The imaginary part of impedance ZL presented by a choke or inductor with inductance L goes up with frequency f.   j is what circuit designers call i.... sqrt(-1)

ZL =2j(pi)f L

That would be a good experiment to try.  I'd love to be able to unconditionally recommend passive mode if you didn't lose signal.   Then the big difference is the emergency shutdown, and there are other ways to accomplish that.

I can do that test with the hi power 22uh choke in passive mode on the same network I did the previous testing. The choke is at the club and I will pick it up on Wednesday and try it out.

Just a word about automotive fuses.  Being a flat wire fuse, these are slow blow fuses as the thermal path out of the fuse metal is very short compared to wire fuses.  In an automobile, the loads and applied voltages are fairly very controlled these days, so these fuses address two problems:

1. They can be fairly easily removed; older fuse forms almost demanded a fuse puller.

2. Oversize fuses cannot be substituted.  This was generally not true of the older fuses.  Preventing burn-up in a wiring harness is very important now, because the connector devices are no longer stabilized from year to year.  This leads to very expensive repairs ($800 a typical average, last time my mechanic commented on it).

Does a delay in opening prevent TUI rebooting?  I can see that such a fuse of 10 amps probably would coordinate with the 20 amp automotive fuse on each particular input line to the TUI (meaning the 10 blowing and the 20 not blowing).  Reaching the 20 would certainly cause a delay.

Fuse coordination is often done with a 2:1 ratio, but if it is critical, 3:1 ratio is wise.  That would mean a 7-amp output if using fuses.   If I wanted a 10-amp output at the rail (the limit at 18-volts, powerwise but a delay is permitted), I would use a magnetic breaker with adjustable air damping added.  An adjustable magnetic trip could be used if a 12-amp output limited to 15-volts was occasionally wanted, but I do not know of any source for such breakers offhand.  Thus two breakers with a switchover arrangement would be required.  Note that the placement of a breaker upstream or downstream of the TIU will not change the protection from a derailment it provides.

I have seen the 12-amp thermal breaker on the Z4000 fail to protect a downstream TUI output, altho in this case I knew that less than 20 amps had been drawn and that there had to be damage to the TUI on that output.  The cause of this was following the recommendation to use a maximum of #16 wires to conduct the DCS signal.  I was looking a considerable cost to my club to correct this.  Oddly, over the same distance (90 feet plus some drops of 25 feet or #18 on the TUI output), the accessory 10 and 14v outputs had been wired with #12 wire from the beginning.

It is actually untrue that larger wire will have an adverse effect on the signal strength, in a practical sense, with a DCS signal on even quite large layouts.  The reason that signal wires (low-capacitance insulation) larger than 16 are not available from stock is that if carrying signal alone, the copper cost is uneconomical compared to other solutions.  On the other hand, if relying on thermal breakers, the standard rule of limiting voltage drop to 5% from transformer to track, and including in the track resistance to most distant point of the power block.  Both the wire out and the wire back must be considered.  (The greater speed and sensitivity of magnetic breakers might be considered as a means of cutting the cost of copper--10% voltage drop perhaps--if the engines have cruise control.)

(Also note that the protective circuit of an electronic throttle using MOSFET transistors is generally equivalent to a magnetic breaker, but that the relay in Lionel bricks up to now has not been a breaker by itself alone.)

The issue that limits the block length over which DCS can be transmitted is signal jitter   (assuming that all the standard caveats are followed).  It is caused by capacitance in the circuit.  I'll explain what that is and why capacitance causes it in a later post here, and a countermeasure.  Hopefully soon.

--Frank

The Problem of Jitter in the DCS Signal

As discussed in one of the posts above, each sending of a command string by the TUI is preceeded by a single special "word" (combination of 1's & 0's).  This special word has restrictions upon it.  Certain strings of the 0's & 1's are more reliably recognized by the receiver in the locomotive.  The explanation why this is so is complicated (& left out).

The same consideration applies to the decoding word stored in the receiver.   So if the number of 0's & 1's is three,  the decoding key is probably easily guessed.  However, it is in the programming, and by copyrighting the programming the commercial production of competing receivers is prevented, or at least highly discouraged.  However, a necessary function of the encoding is to make the sending of the information immune to all the electrical noise on the track-- roller sparks, wheel sparks, you name it.

Two or three features can assist in noise resistance.  One is increasing the number of times the encoded signal is sent, by using a series of adjacent frequency bands.  Then, if the sequences of 0's & 1's sent on each band is 31 pulses long,  a set of  31 vectors are somehow* formed.  A vector here is a line vector consisting of the 31 signal pulses.  (* ..."Somehow" is an engineering technical term representing all possible explanations, used when the writer has totally forgotten.  Its use is permitted when the explanation doesn't matter anyway.) 

Now the rotational polar vector approach described in the posts above is an entirely different approach to explaining the DCS signal.  Fortunately, within our lifetimes, the long proposed theory that all mathematical explanations of an engineering problem (or phenomenum) are in fact equivalent, was proven true. (I assume if the same answers result.)  So we need not worry about one theory being right and the other wrong.

So the different approach I use gets one more quickly to jitter in the DCS signal.  It is actually the patented explanation, and the number 31 also is an published by MTH.  Now 31 is a choice that results in a set of 31 "orthogonal" vectors.  Such vectors are each at right angles to the other 30 vectors.   This means that a noise error in any one vector will not affect any of the other vectors.

The orthogonal vectors are the sets of three vectors, eight, fifteeen, 31 as here, 63, and so on.  The formula is N orthogonal vectors = (2^n)-1, except zero.  (Don't ask me why.)  They are actually what are called degenerative cases of the more general theory (posted earlier here using the rotational vector approach) that includes all n vectors.  As such, there are a lot of whiskers removed from the orthogonals' math, as we used to say.

The set of 3 vectors can be visualized as the familiar 3 vectors X, Y & Z of the space in which we live, each at right angles to the other 2.

The detection of whether a pulse is plus or minus depends on sampling  it at a particular time.  They travel at about 3/4s the speed of light, so the speed of the receiver hardly matters.  But this speed is partly determined by the capacitance of the circuit.   And very unfortunately for DCS, capacitance will vary with applied frequency.  (This is a property of various material between the rails, while the standard formula assumes ideal invariants.)

The DCS frequencies lack a carrier,  and so vary over a factor of about two orders of magnitude, or 10 x 10= 100  to one.  This relative movement of the pulses among the various 0's & 1's vectors transmitted is called jitter.  As a certain amount of this jitter builds up with distance the DCS signal becomes unreadable by the receiver.

In the case I investigated, an end-fed power block about 175 feet long lost DCS signal at the 140-foot point.  A bulb was investigated for the inductance of its filament coil, and found to offset about 40 feet of track.   I was truly amazed that the two were even in the same ballpark.  BTW, it was the nano- ballpark.

I'll cover some practical suggestions shortly, related to the above insight.

--Frank

 

F Maguire posted:

The Problem of Jitter in the DCS Signal

As discussed in one of the posts above, each sending of a command string by the TUI is preceeded by a single special "word" (combination of 1's & 0's).  This special word has restrictions upon it.  Certain strings of the 0's & 1's are more reliably recognized by the receiver in the locomotive.  The explanation why this is so is complicated (& left out).

The same consideration applies to the decoding word stored in the receiver.   So if the number of 0's & 1's is three,  the decoding key is probably easily guessed.  However, it is in the programming, and by copyrighting the programming the commercial production of competing receivers is prevented, or at least highly discouraged.  However, a necessary function of the encoding is to make the sending of the information immune to all the electrical noise on the track-- roller sparks, wheel sparks, you name it.

Two or three features can assist in noise resistance.  One is increasing the number of times the encoded signal is sent, by using a series of adjacent frequency bands.  Then, if the sequences of 0's & 1's sent on each band is 31 pulses long,  a set of  31 vectors are somehow* formed.  A vector here is a line vector consisting of the 31 signal pulses.  (* ..."Somehow" is an engineering technical term representing all possible explanations, used when the writer has totally forgotten.  Its use is permitted when the explanation doesn't matter anyway.) 

Now the rotational polar vector approach described in the posts above is an entirely different approach to explaining the DCS signal.  Fortunately, within our lifetimes, the long proposed theory that all mathematical explanations of an engineering problem (or phenomenum) are in fact equivalent, was proven true. (I assume if the same answers result.)  So we need not worry about one theory being right and the other wrong.

So the different approach I use gets one more quickly to jitter in the DCS signal.  It is actually the patented explanation, and the number 31 also is an published by MTH.  Now 31 is a choice that results in a set of 31 "orthogonal" vectors.  Such vectors are each at right angles to the other 30 vectors.   This means that a noise error in any one vector will not affect any of the other vectors.

The orthogonal vectors are the sets of three vectors, eight, fifteeen, 31 as here, 63, and so on.  The formula is N orthogonal vectors = (2^n)-1, except zero.  (Don't ask me why.)  They are actually what are called degenerative cases of the more general theory (posted earlier here using the rotational vector approach) that includes all n vectors.  As such, there are a lot of whiskers removed from the orthogonals' math, as we used to say.

The set of 3 vectors can be visualized as the familiar 3 vectors X, Y & Z of the space in which we live, each at right angles to the other 2.

The detection of whether a pulse is plus or minus depends on sampling  it at a particular time.  They travel at about 3/4s the speed of light, so the speed of the receiver hardly matters.  But this speed is partly determined by the capacitance of the circuit.   And very unfortunately for DCS, capacitance will vary with applied frequency.  (This is a property of various material between the rails, while the standard formula assumes ideal invariants.)

The DCS frequencies lack a carrier,  and so vary over a factor of about two orders of magnitude, or 10 x 10= 100  to one.  This relative movement of the pulses among the various 0's & 1's vectors transmitted is called jitter.  As a certain amount of this jitter builds up with distance the DCS signal becomes unreadable by the receiver.

In the case I investigated, an end-fed power block about 175 feet long lost DCS signal at the 140-foot point.  A bulb was investigated for the inductance of its filament coil, and found to offset about 40 feet of track.   I was truly amazed that the two were even in the same ballpark.  BTW, it was the nano- ballpark.

I'll cover some practical suggestions shortly, related to the above insight.

--Frank

 

Okay some details and corrections.... for education purposes...

You seem be describing OFDM with parallel vectors and multiple transmit bands, which definitely not DCS.  DCS is a CDMA scheme with polar NRZ signaling I don't know where the old tutorial went and I can't find it.... so let me plunk it here again (lightly updated to be in chronological order)

==========

Quick Refresher

===========

First of all DCS is a spread-spectrum technique which is a subset of CDMA (Code-Division Multiple Access). The specific technique used is called Direct-Sequence Spread Spectrum, or abbreviated DS/SS for short. Beyond model trains, DS/SS is employed in most wifi (802.11abgn,ac) and in wideband radar systems. It's large spreading ratio (spreading small data over larger bandwidth) is attractive for communication systems as it makes the link robust to multi-path, fast fade and channel distortions, while in radar the low energy density prevents it from easily being jammed or overrun by local transmitter leakage.

 

Okay so back to the trains:

The concept of spread-spectrum is that you use a long string of multiple bits (at a faster rate) to represent a single bit (at a slower rate). At the receiver you then correlate (multiply bitwise and add along the length of the packet ) the long string received against the known string of bits. The advantage of this over straight 1's and 0's is that even if a few bits are flipped due to interference and bad contact, the majority are left alone and so the data still makes it through. The number of bits that have to match to be considered a successful code detection is called the "Confidence interval" of the CDMA or DSS receiver system.

========================================================================

How it transmits -by example

========================================================================

Lets look at an example where the DCS TIU sends a command to the train. A command is typically a short packet of several bytes:  3F 2A 44 22     (something like this). It can be longer when downloading sound files, but for most functions (speed, bell, whistle, ...)  it's pretty short, like 20 byte max. Note that for DCS the first byte in every packet is a constant value. Making the first value constant is common in DS/SS systems as it helps with packet detection and frame synchronization.

To make the math simpler lets do a simple 1 byte example...

We want to send byte "34" to the train through the DCS system.

So in base 2:    34 (hex) = 8'b00110100 (bin)   (what we want to send)

As mentioned the spread spectrum replaces each bit with a string of multiple bits. In DCS the string of bits used to replace each bit in the packet is exactly 31 long.  These 31 bit strings are often called PN codes (short for Pseudo-Noise), because they look like a noise signal in the frequency domain. For DCS only 2 PN codes are used (one for 1s and one for 0s) and they are complementary (meaning one code is the negation of the other). While this isn't the general case for DS/SS (any code could be used), I think DCS uses it to simply the correlator in the receiver.

So we will have 2 PN codes for DCS, each 31 bits long:

When I see a 0 in my packet I send: "0101011001001101111001011100110"

When I see a 1 in my packet I send: "1010100110110010000110100011001"

So in order to send 34 (00110100 in binary) the actual sequence of data streamed to the track will be:

(0101011001001101111001011100110)(0101011001001101111001011100110)(1010100110110010000110100011001)(1010100110110010000110100011001)(0101011001001101111001011100110)(1010100110110010000110100011001)(0101011001001101111001011100110(0101011001001101111001011100110)

Often in DS/SS systems we refer to each 1 or 0 actually transmitted as a "spreading-chip" (nothing do do with like microchip, it's just a name). So a "bit" is referring to the 1 or 0 at the packet level and a "chip" is referring to a 1 or 0 inside the PN code.

So since each PN code has 31 chips inside, and our packet is 1 byte (which is 8 bits) our entire sequence on the track should be: 31 X 8 = 248 spreading-chips. DCS has a "chip-rate" of 3.75 MHz meaning that every 1/3.75MHz = 266ns the next 1 or 0 in the transmission sequence appears on the track. Unlike WiFi or LTE, the sequence is not unconverted onto an RF carrier, it's just directly streamed out onto the track.

So in our example this 248 spreading-chip long code goes down the track and into the locomotive where it's picked up by the PS2/3 board in the locomotive.

Note that the above example is not the real PN codes, but they're down below somewhere.

If DS/SS is still confusing you, NI has a great tutorial here:

http://www.ni.com/white-paper/4450/en/

Okay great so how do we get our original code back?

==============

De-Spreading

==============

The process of turning the 31 spread-chip PN-codes back into each the single 0 or 1 in our packet is called de-spreading.  Essentially we need to build a circuit that looks at the code on the track and compares it to the known code and identifies it as either the one or zero code.

Even though the real DCS system is 31 bits, I don't want to type all night so lets pretend its only 5 bits long.

Imagine we have a DCS-like 5-chip ds/ss system where

PN for 0 = "11011"

PN for 1 = "00100"

and we want to send the packet 101.

The transmitted sequence will be 00100 11011 00100

 Clock Considerations:

Okay cool. So the first thing we need to think about is the clocking scheme. The chips in the transmitted sequence are updated at a rate of 3.75MHz meaning that every 266ns we will see the next symbol on the track. Now if we also clock the receiver at the same speed, in theory we will get 1 copy of each sample into our locomotive and can start comparing to the known PN codes. The trick is that in reality this does not work becasue your receiver will sample at Ttrain= n(266ns) + to1 (where to is the initial delay) while the TIU transmitter is putting the data onto the track at Ttiu= n(266ns) + To2. If you're really unlucky with To1 and To2 (which are simply a function of when you turn the TIU and train on) you could have the situation where the train receiver is looking at the track in the same instant the TIU is transitioning between values. Since the value is changing while you are trying to read it under this condition, you end up with a mess and nothing is reliably received. In comm system design we call this problem " clock synchronization", and the general set of solutions are called Clock-Data Recovery or "CDR" for short.

Basically there are 2 categories of techniques for CDR to align the transmitter and receiver clocks. One is called "phase-tracking" and the other is called "Phase-picking".

->Phase tracking solutions use a phase-lock loop to generate the receiver clock at the same frequency as the transmitter by directly locking on the transitions between chips. They then delay the locked clock by exactly T/2 (133ns in this case) to make sure the receiver is always sampling at the instant in the middle the last and next transition of the transmitter:

 TX Clock edges:    X            X          X          X          X  (time where data changes)

RX Clock edges:          X          X          X          X (time where data is read)

It's not used in DCS but it's the 99.999% more common way to solve clock synchronization, if you open a modern Qualcomm baseband modem, this is what's in there.

-> Okay so phase-picking (the one that DCS uses). What we do in phase-picking is say we know the data is changing every 266ns, so if I take samples at 133ns (twice as fast), I know that at least one of every two samples will be at a time when the data is not changing.

 TX Clock edges:    X         X          X          X            (time where data changes)

RX Clock edges:    X    X    X    X    X    X    X           X (time where data is read)

So what we do is sample at twice the rate (3.75MHz X 2 = 7.5 MHz) and then we are covered... sort of. Time for more of the hardcore details.... In general you can imagine with this approach that if a given sample n is bad, then the next sample n+1 is probably okay, and the sample after that is probably bad again. Basically we assume that either (all the even samples we took) , or (all the odd samples we took) will be good. So we actually build two receivers in parallel, one looking at the even values and one looking at the odd values.

Okay so this assumption has 1 big conditional. It's only true if one clock frequency is exactly twice the other. This is of course not true in practice as the clocks will drift a little. So right now we have spreading-chips coming every 266ns and we're sampling at 133ns. Lets say for example the Rx clock was a bit off so we had 266ns and 132ns. This means in the RX two samples will be 132X2 = 264ns, meaning we will start sampling (266-264)=2ns early on the next spreading-chip. 2ns compared to 266ns so that is not a big deal. So the next chip was expected to start at 266ns but really starts at 264ns and then it's only 264ns long too, so when we expected to end 2 chips at 266X2=532ns we actually ended at only 528ns (4ns error). The longer we make the packet the more the chip-to-chip slip (called cycle slippage in communication design). Typically we design what we call the "coherence span", which is the total number of chips you can have over which the slip is less than half of the chip time at the end of the entire sequence. In this case the chip time is 266ns (and a half-chip time is 133ns), and we're slipping 2ns each chip so 133/2= 66 chips is the most we can send for each packet. In reality 1ns/133ns is a really big error, typically in ds/ss systems we talk about clock frequency errors in the parts per million. Still, the "coherence-span" is the fundamental parameter in a communication system that limits how long a packet can be.

For those interested: Phase tracking also has a coherence-span, which is related to how well the phase-lock loop can hold phase over time (called phase noise or timing jitter).

Okay cool, so that's the clocking out of the way.  On to the decoding

 Decoding part:

Okay so now we sampled the incoming packet correctly. Remember from here on we actually do everything on two copies (then even samples and the odd samples), but I will leave that out of this part to make it easier to understand.

So thinking about our DCS-like code coming in to the receiver that we sent in the above example:

00100 11011 00100

It will actually be time dependent at the receiver, that is we will receive one byte at a time. We can use a thing called a shift register that stores bits in the sequence they were received in:

[D4]->[D3]->[D2]->[D1]->[D0]

This is a 5 bit shift register.... when the first clock comes the track data moves into D5, whatever was in D5 before moves to D4, what was in D4 moves into D3 and so on down to D0. The data that was in D0 is just forgotten.

So imagine we are receiving a sequence like 01001 as an example. In time what will happen is

start: D4=X D3=X D2=X D1=X D0=X 

after 1 clock:  D4=1 D3=X D2=X D1=X D0=X 

after 2 clock:  D4=0 D3=1 D2=X D1=X D0=X 

after 3 clock:  D4=0 D3=0 D2=1 D1=X D0=X 

after 4 clock:  D4=1 D3=0 D2=0 D1=X D0=X 

after 5 clock:  D4=0 D3=1 D2=0 D1=0 D0=1

(x are values we don't know.... because we don't know what was inside to begin with)

So what we do next is cool. We use XNOR gates.

An XNOR gate is a circuit with 2 inputs and 1 output. If the 2 inputs are the same (both 0 or both 1) it outputs a 1, if they are different it outputs a zero.

1 XOR 1 = 1          0 XOR 1 = 0          0 XOR 1 = 0           0 XOR 0 = 1

So we can put the XOR between the known PN_code and the shift register. When they match we can write down that we received a 1 or 0 accordingly. Mathwise:

Our PN_code is {PN4 PN3 PN2 PN1 PN0}

When we have (PN4 XOR D4)=1  AND (PN3 XOR D3)=1  AND (PN2 XOR D2)=1  AND (PN1 XOR D1)=1  AND (PN0 XOR D0)=1  it means we have a match.  The next step is we add up all the xor results.

So lets say our PN code was the 11011 from above and we had a 01010 in the shift register at this instant. Then the XOR output would be

11011

01010

=====

01110  (0 when they don't match, 1 when they do)

We can add these up to get 0+1+1+1+0 = 3

We call this summation the "code-correlation".

So the more numbers that match, the closer the input code is to the known PN_code in our memory and the higher our code correlation. Now remember that our PN_code for 0 is the opposite of the PN_code for 1.

So if the result is totally different than our PN_code for 1, the code-correlation will be 0 (which means the shift register data exactly matches our code for 0).

 

 What's the Probability of false detection of our PN code:

This is where it gets interesting if you want to do some statistical analysis....

The real DCS code is 31 chips. 

Now imagine we pick 31 random values of 1 and 0 and assemble them into a chip code. Basically this is the same as guessing 1 or 0 thirty-one times. You would expect about 50% of the bits you you guessed to be right which means of the 31 chips, about 15 would be correct. Going through the shift register and XOR, this means that the code-correlation will have a statistical mean somewhere around 31/2 (so about 15.5).

Short hand note: often we call code-correlation "Cx" for short. So some statistics now

we would say the expected value of Cx   or E(Cx) = 15.5

So choosing 1 or 0 has equal probability (called a binomial probability distribution). The statistical variance Var(Cx) is going to be (1-0.5)/0.25 or about 2, or a standard deviation of about sqrt(2). This means that if we randomly pump data in 99% of the time the Cx will land within 3 standard deviations of the mean (IE between 15.5 - 3Xsqrt(2) and 15.5+3Xsqrt(2)) or (11.3 to 19.7). So if we consider 6 standard deviations next ( 6sqrt(2) = 8.4) that means that a random stream of data has a 1 in 506,797,356 chance of providing a Cx outside the range of 7.1 to 23.9. What this is really saying is there is less than a 1 in 500 million chance of accidently matching (31-7) = 24 bits or more.

Similarly for completeness:

Matching 25 bits or more is about a 1 in 13 billion chance

Matching 27 bits or more is about a 1 in 16.2 trillion chance

Okay so the chip time was 266ns right?  (266x 10^-9 s) so receiving 16.2 trillion chips would take 4 million seconds (about 50 days). So unless you run the train for 50 days straight you will never see enough chips to have 27 spreading-chips matched randomly....

 

Confidence Threshold:

Right okay so all the statistics was to set up this concept. Remember we said that when:

Cx=0 means all the bits are matching the PN_code for 0

Cx=31 means all the bits are matching the PN_code for 1.

 

Well sometimes the track contacts can glitch or we go over a turnout switch and lose a bit or something... so is it really necessary to only detect when all of the code matches? Remember that one in 16.2 trillion chance above.

So we define a confidence threshold value called "Ct"... basically a number that says "if more than this many bits match" we still take it as a 1 or 0 in our packet.

Right so back to the 5 chip example:

Lets set the confidence threshold to 4

so if we have a PN_code of 11011

and we receive

11011 (the right code)

then the Cx=5    and    (Cx=>Ct) so we take the number.

Similarly

if there's a glitch and receive

11(1)11 (one flipped chip)

then the Cx=4    and   still (Cx=>Ct) so we take the number.

This is the big advantage of ds/ss is that it's error tolerant. So then we get into fundamental optimization concepts. In the DCS system Ct has values from 15 to 31.  (Its not 0 to 31 because Cx going from 0 to 15 means we're matching the 0 code instead of the 1 code). If we make Ct very high ... say 30 or 31, then the probability of random error is very low, like 1 in quadrillions, but the tolerance to flipped bits is low (none or only 1 bit can be flipped) , alternatively if we lower Ct to like 25, then we can tolerate a lot of errors, but the probability of a false detection is also going up a lot... So you have to design a Ct that's reasonable at both ends of the scale. The "signal strength" you see on the remote is actually the Cx values added up for all the bits in the packet with some scaling applied.

 So usually once you've detected those 1's and 0s for the packet, you put them into an packet-buffer with an index register that counts how many bits you've received so far. A separate circuit  (not discussed here... maybe later) called a command decoder recognizes those packet sequences as commands. Each time a command is detected, the  command decoder resets the index counter to 0 and clears the packet buffer so that the ds/ss receiver becomes ready to receive the next packet sequence. Unfortunately all of these are inside the programmable FPGA on the PS2/3 boards so they aren't accessible unless you make your own on an FPGA.

Luckily for you, if you have an FPGA, I have the RTL code attached here to play with. Just a basic verilog a basic DCS transmitter and receiver are attached. These have been tested on my MTH TIUs and engines . DCS_decoder.v is the receiver and DCS_spoof.v is the TX. Here's some videos of exactly these RTLs running on an ARTY 7 FPGA:

DCS Decoder Example

DCS_Transmitter Example

 

 

 

Attachments

Last edited by Adrian!

Actually...since I wrote that tutorial up there so long ago, I've made a new decoder that spits the data out a UART at 9600 baud that you can collect with a term emulator. It's attached if anyone wants to play with it.

You need a MAX232 or something to go between the angry RS232 levels, and 3.3V FPGA levels and clock at 7.5M of course.

Here's a cute little movie going over everything in the tutorial basically and demoing this code:

 Links for the hardware used to get the signal out of the track or the driver to put the signal into the track

Attachments

Videos (1)
SERIAL
Files (2)
Last edited by Adrian!
Adrian! posted:

Actually...since I wrote that tutorial up there so long ago, I've made a new decoder that spits the data out a UART at 9600 baud that you can collect with a term emulator. It's attached if anyone wants to play with it.

You need a MAX232 or something to go between the angry RS232 levels, and 3.3V FPGA levels and clock at 7.5M of course.

Here's a cute little movie going over everything in the tutorial basically and demoing this code:

 Links for the hardware used to get the signal out of the track or the driver to put the signal into the track

Adrain

Good post, but I am missing something on how easy it was for you to capture the various DCS signals.  In your attached video, it seemed it was very easy to capture the DCS signal on your scope w/o hitting the freeze frame button on the scope.  Every time you sent a command from the handheld the DCS signal appeared on the scope automatically and stayed there.  Can you provide a simplified description of how you accomplished this.  I don't want to read the 0s & 1s on my PC, just want an easy way to capture and view on the scope.  

Also, I built the 4 stage butterworth filter you described and when viewing on a scope the 18v track AC is not completely flat as viewed in your video.  Mine looks like the picture below.  What else do I need to do to flatten out the AC track voltage signal.

Sorry for the novice questions.

Thanks,

Bob D

DS1Z_QuickPrint12

 

 

Attachments

Images (1)
  • DS1Z_QuickPrint12
rad400 posted:
 
Adrain

Good post, but I am missing something on how easy it was for you to capture the various DCS signals.  In your attached video, it seemed it was very easy to capture the DCS signal on your scope w/o hitting the freeze frame button on the scope.  Every time you sent a command from the handheld the DCS signal appeared on the scope automatically and stayed there.  Can you provide a simplified description of how you accomplished this.  I don't want to read the 0s & 1s on my PC, just want an easy way to capture and view on the scope.  

Also, I built the 4 stage butterworth filter you described and when viewing on a scope the 18v track AC is not completely flat as viewed in your video.  Mine looks like the picture below.  What else do I need to do to flatten out the AC track voltage signal.

Sorry for the novice questions.

Thanks,

Bob D

 

 

Hey there,

Really there's not much to it, you just need a digital scope that has hold off function and single edge (not automatic) triggering. I trigger off the very first edge at 3-4V and then just adjust the hold-off and time-base to look at different parts. The scope I use for this stuff is this one: scope

I'm not sure why your traces are different than mine. Our club uses PH180 bricks which have smooth waveforms, but you maybe on a Z4000 or something similar that has adjustable voltages. Often there's a chopping or switching circuit that creates spikes at 60 Hz with some broadband content that gets through the filter. Have a look at these wave-forms at the top of this post to see what I'm referring to. The remedy should be to either push out the corner frequency of the filter more (you can double up on the resistors in parallel, or caps in series).... or just put more stages, or both.

 

Your questions are good ones!

 

~Adrian

Adrian! posted:
rad400 posted:
 
Adrain

Good post, but I am missing something on how easy it was for you to capture the various DCS signals.  In your attached video, it seemed it was very easy to capture the DCS signal on your scope w/o hitting the freeze frame button on the scope.  Every time you sent a command from the handheld the DCS signal appeared on the scope automatically and stayed there.  Can you provide a simplified description of how you accomplished this.  I don't want to read the 0s & 1s on my PC, just want an easy way to capture and view on the scope.  

Also, I built the 4 stage butterworth filter you described and when viewing on a scope the 18v track AC is not completely flat as viewed in your video.  Mine looks like the picture below.  What else do I need to do to flatten out the AC track voltage signal.

Sorry for the novice questions.

Thanks,

Bob D

 

 

Hey there,

Really there's not much to it, you just need a digital scope that has hold off function and single edge (not automatic) triggering. I trigger off the very first edge at 3-4V and then just adjust the hold-off and time-base to look at different parts. The scope I use for this stuff is this one: scope

I'm not sure why your traces are different than mine. Our club uses PH180 bricks which have smooth waveforms, but you maybe on a Z4000 or something similar that has adjustable voltages. Often there's a chopping or switching circuit that creates spikes at 60 Hz with some broadband content that gets through the filter. Have a look at these wave-forms at the top of this post to see what I'm referring to. The remedy should be to either push out the corner frequency of the filter more (you can double up on the resistors in parallel, or caps in series).... or just put more stages, or both.

 

Your questions are good ones!

 

~Adrian

I have been using Z4000 in all my testing.  Don't have any bricks, next week when I get back I will try using a good old ZW.  

I have also been emailing the designer of the PSX- AC units and he indicated the PSX unit are DCS friendly.  In some of the older units the is a cap that will need to be removed for DCS operation.  

Bob D

And there's seems to be a lot of "generic" FSK decoders according to google...  the fancy one I stumbled onto is but $500.  Alas... 

Just to clarify.  When you say protocol -- you mean the actual command codes?  I have those...  but not how they are encoded over the RF link.  You say its FSK at 455khz...  but the details I imagine of that signal are not known to get to bytes... ?

It's a serial data stream, so bits to bytes.  The track signal is modulated at a 3,030 BPS rate.  I think it was explained that it was a compromise for some relationship to the 455khz signal, it would have been easier to read if it had a standard baud rate.  If you really want to know, see if you can track down Jon Z. from Lionel, SantaFeFan here on OGR.

gunrunnerjohn posted:

At this point, I think it's time to consider something like the PSX-AC to break the circuit instantly when there is a short.  I'm not sure why nobody else sees this level of failure, but that should go a long ways to solving the issue of having a short persist and damage something.

Sigh...

Well... after an army of PH180 bricks driving an army of PSX-AC units for each of (VAR1 VAR2 FIX1 FIX2) on each of the 5 TIUs in our layout... with the 22uH choke in there and the passive connection on each TIU output... we're still not there. All PSX-ACs are set to trip at 8.4A.

I put a brand new TIU 6.10 out of the box in Wednesday November 15 that measured 15-16V pk-pk differential for the DCS signal on all 4 outputs (VAR1 VAR2,FIX1 FIX2) while connected to the layout and PSX-AC/bricks through the choke.  I just measured it again (Nov 20):

Nov 15:    VAR1: 15.8V    VAR2: 15.7V    FIX1: 15.6V   FIX2: 15.7V

Nov 20:    VAR1: 1.3V    VAR2: 14.7V    FIX1: 14.6V   FIX2: 12.7V

I could argue for "burn-in", but that 1.3V says no.

 

Well that wasn't cheap. Any more ideas?

What event occurred on VAR1 and what was it powering?  What ever occurred did not take out the other channels as was implied by your previous testing.  Also when you measured the output was that while attached to the layout or on a bench unconnected to anything else?  Does a TIU reset or turning on VAR1 signal effect the output?  G

stan2004 posted:

What became of the failed units you sent to mth? Seems to me you need to know the problem before prescribing a solution?

 

The TIU circuit designer is contracted and not in-house so it's been a bit slow. My understanding is they are still debugging them. Ill post when I know something I can share!

GGG posted:

What event occurred on VAR1 and what was it powering?  What ever occurred did not take out the other channels as was implied by your previous testing.  Also when you measured the output was that while attached to the layout or on a bench unconnected to anything else?  Does a TIU reset or turning on VAR1 signal effect the output?  G

So our layout is wired a bit weird, each channel does a section of track, not complete loops. VAR1 was literally powering a 2-3 ft section of track between two switches and that's it. The other OK-ish channels are powering the parts where people actually setup trains and I would expect a lot more shorts and derailments as people miss the track with the wheel flanges, and put on the trains without turning the power off and such. The measured voltages are in-situ connected to the layout, PSX-AC and supply (through the DCS blocking choke) measured 6 days apart. In that 6 days we had our open house so maybe 20-30 different trains running... up to 5-6 at once , lots of people, lots of derailments and train wrecks.

I've cycled all the settings fixed/var mode, DCS signalling on/off and resets. The driver circuitry is cooked just like the others before it. The symptoms are identical.

I've changed pretty much every active SMD on the TIU board except the FPGA itself (you can follow above in this thread) and still not figured out exactly where the failure is. MTH's contractor is now doing the same thing I think.

 

Adrian! posted:

Deep down I know the root cause is we're too rough on the trains and layout... but changing people and behavior is too hard (and not what I went to school for) so I'm trying to design my way out of this...

With the roughness you have on the layout, how do you have the PSX set for, auto reset or manual reset?

Add Reply

Post
The DCS Forum is sponsored by

OGR Publishing, Inc., 1310 Eastside Centre Ct, Ste 6, Mountain Home, AR 72653
800-980-OGRR (6477)
CONTACT US
www.ogaugerr.com

×
×
×
×
Link copied to your clipboard.
×
×