XpressnetLib - .NET library for DCC model railroad control

XpressnetLib - .NET library for DCC model railroad control

Postby JBr » Tue Jun 28, 2011 10:40 am

Hi everybody,

I've been playing with controlling my digital trains and accessories using computer interface for some time now. During that time I wrote few small applications to test some things and finally I ended up working on a class library that could be used to build your own applications. As I remember what a pain in the haggis it was to find anything about XpressNet programming or any examples on-line, I decided to offer the library publicly for free.

I'm writing it in C# but it should be possible to use it in any .NET enabled programming language. Currently it contains all the functionality supported by the Roco command station/booster from Multimaus start-set (part nr. Roco #10764). It requires connection to PC using any of the GenLI family of interfaces (GenLI, GenLI-USB, GenLI-Bluetooth) or the original Li100 from Lenz. However, it hasn't been tested with the original Lenz equipment yet so I can't be 100% sure it works without problems. Also it should work with any "open source" command stations (like H-central, NanoX etc.) that support connection to the PC using one of the interfaces mentioned earlier.

The library contains not only the methods for train control but also for accessory control. I'm using it in my "custom electro-mechanical interlocking stand" which controls turnouts, signals and railway crossing signals on my layout. See the picture bellow.

I've set up a small website with information, downloads and on-line documentation at http://xpressnetlib.brozek.org .

Currently the library is available in compiled form as .DLL library, but it may go open source sometime in the future. Also available for download is a sample application (simple "cab" Windows application) which demonstrates how to use the library practically. The package with the sample app contains both compiled .EXE and full source codes.

If anyone of you is using GenLI or Li100/101 with their layout, I'd appreciate if you download the sample app, try the compiled .exe (Windows with .NET Framework 4 required) and let me know if it works for you or not. Also anyone willing to try to use the library in their own app is welcome and any feedback appreciated.

Image
XpressnetLib - .NET class library for DCC model railroad control
User avatar
JBr
 
Posts: 69
Joined: Sat Sep 18, 2010 3:28 pm
Location: Czech Republic

Re: XpressnetLib - .NET library for DCC model railroad contr

Postby ConducTTor » Tue Jun 28, 2011 11:25 am

THAT my friend is uber cool. My hat's off to you - I'll be downloading the library when I get home.
What people think: "liberals/conservatives are ruining my country"
What the powerful know: divide and conquer
User avatar
ConducTTor
Site Admin
 
Posts: 8293
Images: 13
Joined: Sat May 23, 2009 4:52 pm
Location: Atlanta GA USA

Re: XpressnetLib - .NET library for DCC model railroad contr

Postby ConducTTor » Fri Jul 01, 2011 4:25 am

I've been interested in pc control for a while but haven't had the chance to do anything about it yet. Thanks to JBr's post and generous free software I've dived right into it. But, I'm just beginning to learn what is needed, possible, etc. Can someone who has experience with this give the rest of us a primer (I'm specifically interested in hardware)?
What people think: "liberals/conservatives are ruining my country"
What the powerful know: divide and conquer
User avatar
ConducTTor
Site Admin
 
Posts: 8293
Images: 13
Joined: Sat May 23, 2009 4:52 pm
Location: Atlanta GA USA

Re: XpressnetLib - .NET library for DCC model railroad contr

Postby dileTTante » Sun Jul 03, 2011 12:29 am

Until an expert shows up-- I think you need adapters mentioned in JBr's original post, such as Lenz LI-USB or LI_101. http://www.lenzusa.com/1newsite1/XpressNet.html

Or GenLI http://usuaris.tinet.cat/fmco/lokmaus_en.html

These interface PC to Xpressnet compatible DCC systems.
dileTTante
 
Posts: 694
Joined: Wed Jan 06, 2010 12:37 am

Re: XpressnetLib - .NET library for DCC model railroad contr

Postby ConducTTor » Sun Jul 03, 2011 12:39 am

I have the Lenz Compact which has an X-Bus connection. So I'm thinking just plug that into pc and I should be all set? I just need to find the Lenz serial connection settings and add them to the code. Ill report when I have something to report.
What people think: "liberals/conservatives are ruining my country"
What the powerful know: divide and conquer
User avatar
ConducTTor
Site Admin
 
Posts: 8293
Images: 13
Joined: Sat May 23, 2009 4:52 pm
Location: Atlanta GA USA

Re: XpressnetLib - .NET library for DCC model railroad contr

Postby JBr » Sun Jul 03, 2011 1:32 am

Unfortunately, it isn't that easy. Compact (I think it was also distributed in the US as Atlas Commander?) really needs one of the interface modules in order to be connected to PC. As far as I know LI100 and LI101 are out of production and Lenz currently only offers USB and ethernet interfaces (I guess they still need virtual COM port so they should probably work with the library). My suggestion would be to look for GenLI in any of its flavors or second-hand LI100/101.

Also, Compact only allows train control from the PC - decoder programming is not possible.
XpressnetLib - .NET class library for DCC model railroad control
User avatar
JBr
 
Posts: 69
Joined: Sat Sep 18, 2010 3:28 pm
Location: Czech Republic

Re: XpressnetLib - .NET library for DCC model railroad contr

Postby ConducTTor » Sun Jul 03, 2011 2:31 am

Thanks JBr. I was hoping to be able to try out the software at a minimal cost but I guess I have to start deciding what kind of system I want (Lenz / Roco / ESU / etc.) and buy the appropriate hardware before I can really play around. In the meantime, I'll pick up a LI100 if I come across one cheap.
What people think: "liberals/conservatives are ruining my country"
What the powerful know: divide and conquer
User avatar
ConducTTor
Site Admin
 
Posts: 8293
Images: 13
Joined: Sat May 23, 2009 4:52 pm
Location: Atlanta GA USA

Re: XpressnetLib - .NET library for DCC model railroad contr

Postby JBr » Sun Jul 03, 2011 2:54 am

I'm sticking to Roco for the time being. Some one from Netherlands joined GenLI interface with S88 feedback bus - if I could get my hands on this, I wouldn't need anything else. My layout is quite small and with this I could control everything without investing much.
XpressnetLib - .NET class library for DCC model railroad control
User avatar
JBr
 
Posts: 69
Joined: Sat Sep 18, 2010 3:28 pm
Location: Czech Republic

Re: XpressnetLib - .NET library for DCC model railroad contr

Postby dileTTante » Sun Jul 03, 2011 3:53 am

I have been waiting until I had one in my hands before saying anything but I intend to get the Sprog II suggested by Florida Bob (railtwister) in the thread about the ESU Navigator. Once I decided and called the local dealer I was told they had just sold their last one so I'm waiting for them to get new stock. It's about $110. Loconet or Xpressnet PC adaptors are about $100. The selling point for me is that the Sprog II can power a small layout on its own or feed a booster and it runs already from a PC.

This page http://www.train35.com/dcc10.html although in French shows how you can add an old stereo music amplifier to make a 4 amp booster or build a booster very simply which provides 6 amp.

JBr's image of the interlocking stand looks terrific and his offering the program libraries is also a good thing so I don't want to take away from that. However, I don't use windows os, am not likely to use Xpressnet and also point out that there are JMRI and RocRail layout control apps available also free of charge. Not criticizing, just saying there are alternatives. I use Haiku OS on my laptop which is also done in C+ (they say, I don't know} and am thinking this has got to be compatible with JBr's apps somehow. That would be great but I don't know anything about programming etc.
dileTTante
 
Posts: 694
Joined: Wed Jan 06, 2010 12:37 am

Re: XpressnetLib - .NET library for DCC model railroad contr

Postby JBr » Sun Jul 03, 2011 4:25 am

In theory, it should be possible to use my library in binary form in Mono and build Linux apps that use it. I may give it a try one day.

Just for clarification. My library is not meant as an alternative for Train Controller, JMRI or RocRail. It's more of a software platform helping people who would like to try creating their own apps for train/layout control. My interlocking stand is just an example of it. It is tailored for my layout and it isn't possible to use it on another layout without making it exact copy of mine, including all accessory decoder settings etc.

Although I'm thinking about creating a configurable version for small to middle-sized stations on modular layouts (up to 10-12 switches... maybe even with block dependency links to adjacent stations).
XpressnetLib - .NET class library for DCC model railroad control
User avatar
JBr
 
Posts: 69
Joined: Sat Sep 18, 2010 3:28 pm
Location: Czech Republic


Return to Electric / DCC

Who is online

Users browsing this forum: No registered users and 0 guests