Howto make use of the four SRCP ddl-s88 FB busses in Rocrail

Moderator: Moderators

Howto make use of the four SRCP ddl-s88 FB busses in Rocrail

Postby sberndl » 06.02.2014, 22:59

I am using SRCP as the (one and only) server in the Rocrail.ini:

The srcpd.conf consists of the <server> bus (0), the <ddl> bus (1) and the <ddl-s88> bus entry
defining the four FB buses. (2,3,4,5)
Rocrail.ini:

Code: Select all
  <digint iid="SRCP-1" lib="srcp" host="localhost" device="" sublib="tcp" restricted="false" stress="false" libpath="/opt/rocrail">
    <srcp cmdport="4303" srcpbus_server="0" srcpbusGL_m="16" srcpbusGL_ns="1" srcpbusGL_nl="1" srcpbusGL_ps="1" srcpbusGA_m="16" srcpbusGA_n="1" srcpbusGA_ps="1" srcpbusFB_s88="2" srcpbusFB_m6051="16" srcpbusFB_i8255="16"/>
  </digint>


I am using
Rocrail 6769 [47eeb34629a31bae9755c159a6927e1e4INFO 2 FB 1 1fb6d16f]
Build: Feb 2 2014 15:29:23

In my current hardware setup, two of the four busses (nr 2 and 3) have sensor logic attached.

Now I trigger the sensor 1 of the hardware on the FB 2:

Code: Select all
20140206.212739.081 r9999I info0855 OSRCP    0840 inforeader: [1391718459.081 100 INFO 2 FB 1 1 ]
20140206.212739.081 r9999c info0855 OSRCP    0977 sensor 1 = 1
20140206.212739.082 r9999I info0855 OModel   3722 unregistered event: co [SRCP-1]0:1:0 uidname=[]
20140206.212739.873 r9999I info0855 OSRCP    0840 inforeader: [1391718459.873 100 INFO 2 FB 1 0 ]
20140206.212739.873 r9999c info0855 OSRCP    0977 sensor 1 = 0
20140206.212739.874 r9999I info0855 OModel   3722 unregistered event: co [SRCP-1]0:1:0 uidname=[]


Now I do the same with the sensor 1 of the hardware on the FB 3:

Code: Select all
20140206.212744.211 r9999I info0855 OSRCP    0840 inforeader: [1391718464.211 100 INFO 3 FB 1 1 ]
20140206.212744.212 r9999c info0855 OSRCP    0977 sensor 1 = 1
20140206.212744.213 r9999I info0855 OModel   3722 unregistered event: co [SRCP-1]0:1:0 uidname=[]
20140206.212745.052 r9999I info0855 OSRCP    0840 inforeader: [1391718465.052 100 INFO 3 FB 1 0 ]
20140206.212745.052 r9999c info0855 OSRCP    0977 sensor 1 = 0
20140206.212745.053 r9999I info0855 OModel   3722 unregistered event: co [SRCP-1]0:1:0 uidname=[]


To my understanding, the SRCP info is correctly transmitted. First on FB2 and second on FB3.
Here's the srcpd log:

Code: Select all
Feb  7 19:23:50 <hostname> user.info srcpd[4108]: [session 4] New INFO client requested.
Feb  7 19:23:50 <hostname> user.info srcpd[4108]: [session 4] Send all data for bus number 0 to new client.
Feb  7 19:23:50 <hostname> user.info srcpd[4108]: [session 4] Send all data for bus number 1 to new client.
Feb  7 19:23:50 <hostname> user.info srcpd[4108]: [session 4] Send all data for bus number 2 to new client.
Feb  7 19:23:50 <hostname> user.info srcpd[4108]: [session 4] Send all data for bus number 3 to new client.
Feb  7 19:23:50 <hostname> user.info srcpd[4108]: [session 4] Send all data for bus number 4 to new client.
Feb  7 19:23:50 <hostname> user.info srcpd[4108]: [session 4] Send all data for bus number 5 to new client.
Feb  7 19:23:50 <hostname> user.info srcpd[4108]: [session 4] All messages send to new INFO client.
Feb  7 19:27:39 <hostname> user.info srcpd[4108]: [bus 2] FB 02/0001 is set to "1"
Feb  7 19:27:39 <hostname> user.info srcpd[4108]: [bus 2] FB 02/0001 is set to "0"
Feb  7 19:27:44 <hostname> user.info srcpd[4108]: [bus 3] FB 03/0001 is set to "1"
Feb  7 19:27:45 <hostname> user.info srcpd[4108]: [bus 3] FB 03/0001 is set to "0"


Rocrail translates both events as if they are coming from one and the same "sensor 1".
I cannot change (at least for all the experiments I did so far) this by setting a <bus> value in the sensor
interface (ok, understood, the bus field there has a different meaning and I leave it 0),
either in any other defintion of the srcp interface in rocrail.ini.

When I understood the description by Martin Wolf's S88 interface
http://forum.rocrail.net/download.php?id=1310 correctly, then he describes something like a "flat" port adressing of the sensors on the four FB busses:
The first bus defines "ports" from 1 - 496 (== 31 * 16)
The 2nd bus defines "ports" from 497 - 992
The 3rd bus from 993 - 1488
and the 4th and last bus from 1489 - 1985.

So I would expect, that the triggering the sensor 1 on the 2nd bus (INFO 3 FB 1 1) would feedback "sensor 497" has fired.
At least, something different than "sensor 1".

Hmm, can you help me finding my mistake?
What do I need to do, that rocrail translates the two different feedbacks from the two FB busses of the SRCP server into
two different sensor events?

Thanks so much for this.

Cheers
Bernd
sberndl
 

Postby Richard-TX » 07.02.2014, 00:03

I think we will need to see your rocrail.ini file
Richard
Dallas/Fort Worth
Texas USA
Richard-TX
 

Postby LDG » 07.02.2014, 02:04

Hi,
Richard-TX wrote:I think we will need to see your rocrail.ini file
... and the plan file.

Different bus numbers for devices on same bus type (i.e. s88) are not yet supported.

I am currently programming an extension in srcp command station so this might change in near future :roll:

Regards,
Lothar
LDG
Site Admin
 

Postby Richard-TX » 07.02.2014, 07:10

If I recall correctly, the address is the only identifier for a FB. Bus number does not matter except in determining what client gets the FB status. That is an internal function of srcpd.

If you can somehow wedge some additional software in, then that might help resolve your issue.


Below is a python script that may help.

Code: Select all
#!/usr/bin/python
# this program is to manually set the state of a feedback device.
# use by setfb <fb num> -p (0 or 1)
#this is normally only executed by the user as a test of the feedback system.
#the set GA program should  have this function internal as it is trivial to write.

import time
import sys
import getopt
import socket
#-------------------------------------------
dummy = ""
def main(argv):
   iaddr = 0
   port = 0
   try:
      opts, args = getopt.getopt(argv,"h:a:p:",["address="])
      #print '!checkservo.py -a <fbnum> -p <0-1>'
      if not argv:
         print 'Usage: setfb -a <address> -p <0-1>'
         sys.exit(2)

   except getopt.GetoptError:
      print ' usage: setfb -a <address> -p <0-1>'
      sys.exit(2)
   for opt, arg in opts:
      if opt == '-h':
         print 'setfb  -a <address> -p <0-1>'
         sys.exit()
      elif opt in ("-a", "--address"):
         address = arg
      elif opt in ("-p", "--port"):
         port = arg
   iaddr = iaddr - 1
   #print iaddr
   cmd = ""
   s = socket.socket()
   s.connect(("127.0.0.1",4303))
   dummy = s.recv(256)
   #print dummy
   s.send("go\n")
   dummy = s.recv(256)
   #print dummy
   if port == "0":
      #print "setting fb to 0"
      cmd = "set 2 fb " +  address + " 0\n"
      #print  cmd
      #s.send("set 1 fb 7 0\n")
      s.send(cmd)
      dummy = s.recv(256)
      #print dummy
   #print s.recv(256)
   if port == "1":
      #print "setting fb to 1"
      cmd = "set 2 fb " + address + " 1\n"
      #print  cmd
      #s.send("set 2 fb 7 0\n")
      s.send(cmd)
      dummy = s.recv(256)
      #print dummy
      s.send("TERM 0 SESSION\n")
   s.close()

if __name__ == "__main__":
   main(sys.argv[1:])

Richard
Dallas/Fort Worth
Texas USA
Richard-TX
 

Postby rjversluis » 07.02.2014, 07:26

Starting with revision 6786 the bus number will be part of the sensor event.
This means a break with existing srcp Rocrail plans because the bus number is missing in the sensor definitions.

The original srcp Rocrail implementation was unfortunately not programmed by myself and has still a lot of flaws in it. This was also one of them.

@Lothar: Sorry to cut you off but when I looked at the INFO parser I got 'unwell'. :crying:
Best Regards, Rob.
:!: PS: Do not forget to attach the usual files.
:!: PS: Nicht vergessen die übliche Dateien an zu hängen.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 

Postby LDG » 07.02.2014, 09:22

Hi,
rjversluis wrote:Starting with revision 6786 the bus number will be part of the sensor event.
This means a break with existing srcp Rocrail plans because the bus number is missing in the sensor definitions.

The original srcp Rocrail implementation was unfortunately not programmed by myself and has still a lot of flaws in it. This was also one of them.
...full ACK, there are several parts missing...
rjversluis wrote:@Lothar: Sorry to cut you off but when I looked at the INFO parser I got 'unwell'. :crying:
@Rob: 'unwell' :? I would call it 'sick' :shock:
I was thinking of a "code review" like I did with Rocrails srcp scripting daemon. There are several things missing i.e. dynamic change of device parameters (GL protocol/speed steps/#functions) without the need of a Rocrail restart. Srcp can handle these changes. For GL my work is almost finished :roll:
I think we may change the handling of srcp bus numbers in future. Moving them to the "bus" in Rocrail device definition (loco/feedback/switch/signal) similar to current FB change is a good approach. This would be another break with existing srcp Rocrail plans. I'll try to find out what is needed to get a reliable srcp implementation in future.
We might discuss some details by mail or phone or I'll send my patch(es) :wink:

Regards,
Lothar
LDG
Site Admin
 

Postby sberndl » 07.02.2014, 21:09

Hi folks,
what should I say? You guys are simply AWESOME!
I did not expect this fast and competent feedback & fix.

Just pulled the code, compiled and here we go:

Code: Select all
20140207.181210.620 r9999c info0840 OSRCP    0994 sensor 2:1=1
20140207.181210.621 r9999I info0840 OBlock   0412 ident =
20140207.181210.621 r9999W info0840 OBlock   0455 locId not set in block 01
20140207.181211.359 r9999I info0840 OSRCP    0843 inforeader: [1391793131.359 100 INFO 2 FB 1 0 ]
20140207.181211.360 r9999c info0840 OSRCP    0994 sensor 2:1=0
20140207.181211.360 r9999I info0840 OBlock   0412 ident =
20140207.181217.612 r9999I info0840 OSRCP    0843 inforeader: [1391793137.612 100 INFO 3 FB 1 1 ]
20140207.181217.612 r9999c info0840 OSRCP    0994 sensor 3:1=1
20140207.181217.613 r9999I info0840 OModel   3742 unregistered event: co [SRCP-1]3:1:0 uidname=[]
20140207.181218.361 r9999I info0840 OSRCP    0843 inforeader: [1391793138.360 100 INFO 3 FB 1 0 ]
20140207.181218.361 r9999c info0840 OSRCP    0994 sensor 3:1=0

Exactly this makes it possible to distinguish between the two sensors on the different busses.
Rob, as you wrote I just adapted the sensors (now with the according bus number) and it works perfectly!

THANKS so much for this quick fix.

I will stay tuned for more srcp stuff coming from this great Rocrail team.

Cheers
Bernd
sberndl
 

Postby Richard-TX » 08.02.2014, 00:24

rjversluis wrote:This means a break with existing srcp Rocrail plans...


Do you care to share those plans?
Richard
Dallas/Fort Worth
Texas USA
Richard-TX
 

Postby rjversluis » 08.02.2014, 08:09

Richard-TX wrote:
rjversluis wrote:This means a break with existing srcp Rocrail plans...


Do you care to share those plans?

I does mean the plan.xml file of SRCP users. The bus field must be set on the interface tab.
Best Regards, Rob.
:!: PS: Do not forget to attach the usual files.
:!: PS: Nicht vergessen die übliche Dateien an zu hängen.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 

Postby LDG » 08.02.2014, 12:54

Hi Bernd,

nevertheless will you share your rocrail.ini and plan file(s) with us (or me by PM) ?
I need some input to test source code modifications :wink:

@Richard: Do you also have some (test) plans for me ?

Regards,
Lothar
LDG
Site Admin
 

Postby Richard-TX » 08.02.2014, 16:51

Lothar,

I would be happy to send you my plans but I doubt that they would make a lot of sense. Much of what is defined is for testing. There are many switches defined with FB and almost all of the FB devices have 0 as a bus number. Having said that, if you still want it. I would be happy to send you what I have. I could explain why I don't have a good working layout, but that is a long story and one that is quickly getting resolved.

I did do some FB testing last night and so far all my tests are good.

The script I posted above is pretty much what I do in my Rpi external programs.

I am going to have to update my Rpi device in srcpd. While I did not exclude the bus number in my external programs, I didn't use it either. I still have to think about the ramifications.

Rob,

Thanks for adding the BUS number in the FB reporting. With all the requests that I made for SRCP some months ago, I didn't have the heart to ask you for one more. Frankly I was happy having an unlimited address number. Now that the bus number is active, the number of feedbacks is something like 16* infinity. :D :D
Richard
Dallas/Fort Worth
Texas USA
Richard-TX
 

Postby rjversluis » 08.02.2014, 16:57

Richard-TX wrote:Thanks for adding the BUS number in the FB reporting. With all the requests that I made for SRCP some months ago, I didn't have the heart to ask you for one more. Frankly I was happy having an unlimited address number. Now that the bus number is active, the number of feedbacks is something like 16* infinity. :D :D

Are you planning to take over control of all North America Railroads with Rocrail and SRCP?
Best Regards, Rob.
:!: PS: Do not forget to attach the usual files.
:!: PS: Nicht vergessen die übliche Dateien an zu hängen.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 

Postby Richard-TX » 09.02.2014, 08:03

Believe it or not Rob, I had this crazy idea about creating the world's largest model train layout. With some cooperation from Modellers all over the world, I envision rail operations spanning all of the continents.

For example:
I imagine seeing my train disappear into a tunnel here in Texas and a few moments later see it emerge from a tunnel in NYC (via web cam). It picks up a car/wagon and then disappears into a tunnel as it is on it's way to England, France, and then Germany as it makes its way to Australia. Every time it appear on webcam, it is in another country.

Of course this would require a large degree of cooperation from several people, but imagine the press. We could wind up seeing you on CNN. Another big plus is that everyone who participates has a souvenir of the event too.

The Worlds Largest Model Railroad - Controlled by Rocrail
"Spanning every continent on planet Earth. a team of model railroaders created the worlds largest model railroad controlled by one person using Rocrail Model Railroad software. Rob Versluis the author of Rocrail said, "Some have claimed that Rocrail does not scale. This proves that Rocrail does indeed scale and scales as large as the imagination allows...."


So the tunnels are worm holes....big deal.

If there were an internet connection to the space station, a special zero-g loco and track, there is no reason why a model train could not be controlled from your computer in Germany Rob.

Mount a camera on one of the cars and I think that you could sell tickets for a "ride" on the train. Small signs visible along the way would make it interesting. We had road signs in the US advertising a shaving cream called Burma-Shave. For more info see http://burma-shave.org/jingles/ and http://en.wikipedia.org/wiki/Burma-Shave


My job is

Keeping faces clean

And nobody knows

De stubble

I've seen


Image

Richard

PS - I get 5% of the ticket sales. :D
Richard
Dallas/Fort Worth
Texas USA
Richard-TX
 


Return to srcp