outputs, switches, addresses and srcp

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 19.05.2013, 01:31

I am kind of confused I guess.

The way I understand it in the srcp world there are 3 identifiers for an accessory. They are bus, address, and port. There is a 4th field called "action" that either turns the accessory either "on/straight" or "off/thrown" For now we can ignore bus.


In the Rocrail world the address and port are handled differently depending..,

In the case of a srcp switch, the address and port are combined to create a srcp address (MADA) and what determines if the accessory is "on" or "off" is a change in srcp port number and not the "action" field.

Below is an example. This is the trace of a srcp switch being toggled from straight to thrown. The switch is defined in rocrail with a address of 89 and a port of 3. Note that the srcp port number changes when the state is toggled.

Switch [sw1-srcp] will be set to [straight,0,0]
command written: SET 1 GA 355 1 1 250
srcp response: 1368921625.459 200 OK
switch 355 port 1 = 1
Switch [sw1-srcp] will be set to [turnout,0,0]
command written: SET 1 GA 355 0 1 250
srcp response: 1368921626.235 200 OK
switch 355 port 0 = 1

I am not saying that this is bad or good but what I am asking is if this is the right way to do things.

Should the Rocrail address and Rocrail port number be directly mapped or not to the srcp command?

In other words, which way should the srcp command look like for a switch defined in Rocrail with an Rocrail address of 89 and Rocrail port of 3?

SET 1 GA 89 3 [0-1] 250
or
SET 1 GA 355 [0-1] 1 250

Which one is correct?
Last edited by Richard-TX on 19.05.2013, 03:08, edited 1 time in total.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 19.05.2013, 01:59

Liviu M wrote:Hello,

I think one explanation for the "strange" situation can be found in the definition of port & addresses in the DCC protocol:

My two cents,
Liviu
I agree. There are too many definitions of address and port.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 19.05.2013, 03:04

Liviu M wrote:Hello,

I think one explanation for the "strange" situation can be found in the definition of port & addresses in the DCC protocol:

Or, if the ports can have only one state, one accessory can have at most 8 ports (D2..D0).
So, no chance to have port 17 or port 92.

My two cents,
Liviu
But that is the DCC protocol, not SRCP. The SRCP spec says this:



Protocol by server

The server uses the initialisation parameters from its own configuration. The parameter list MAY give some parameters. Address, port and value are not limited.


Taken to it's extreme, a srcp client could generate a message using a port number of 92 and it could be valid. It all depends on what device srcpd is going to talk to. If srcpd was controlling a device with 72 or more ports, then that would be appropriate. However if that device was a DCC device, then srcpd should generate an error message.

The NMRA has absolutely nothing to say about srcp. It is outside of the scope of their jurisdiction and to be honest, I want it to stay that way.

I just want to be certain that what we are doing is correct.

Better to do things once and do them right than to do them multiple times and have it be wrong.

Having said all that, keeping the SRCP library MADA is perfectly acceptable if that is what is best for everyone. My viewpoint is a little myopic at times.

rjversluis
Site Admin
Posts: 39295
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Post by rjversluis » 19.05.2013, 05:23

Richard-TX wrote:SET 1 GA 89 3 [0-1] 250
or
SET 1 GA 355 [0-1] 1 250

Which one is correct?
The answer is not easy.
The way it is mapped now is based on dual coil switch motors:
One address with two ports for the coils.

Using your first example will make things a bit clearer and confusing:
One address for one coil. This means the second coil would be
SET 1 GA 89 4 [0-1] 250

rjversluis
Site Admin
Posts: 39295
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Post by rjversluis » 19.05.2013, 07:58

SRCP wrote:NMRA-DCC Format
Valid addresses are from 1 to 511, valid ports are 0 or 1, valid values are: 0 and 1
http://srcpd.sourceforge.net/srcp/srcp-084.html

It seems that the protocol only supports port 0 and 1...
Based on NMRA:
128 decoders with 2x4 ports.

rjversluis
Site Admin
Posts: 39295
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Post by rjversluis » 19.05.2013, 08:48

SRCP missed a change; They should have made addressing FLAT:
INIT <bus> GA <addr> <protocol> <optional further parameters>

This command initializes a GA at address <addr> in the server. The following parameters are permitted:
M
Maerklin/Motorola Format
Valid addresses are from 1 to 324, valid ports are 0 or 1, valid values are: 0 and 1

N
NMRA-DCC Format
Valid addresses are from 1 to 511, valid ports are 0 or 1, valid values are: 0 and 1

S
Selectrix Format
Valid addresses are from 0 to 111, valid ports are 1 to 8, valid values are: 0 and 1

P
Protocol by server
The server uses the initialisation parameters from its own configuration. The parameter list MAY give some parameters. Address, port and value are not limited.
:thumb_down: :thumb_down: :thumb_down: :thumb_down: :thumb_down:

The way it is now is totally weird. And they should make it FLAT in 0.9... (If it will ever see the daylight.)
Last edited by rjversluis on 19.05.2013, 12:58, edited 1 time in total.

Liviu M
Posts: 893
Joined: 03.12.2011, 20:44

Post by Liviu M » 19.05.2013, 09:27

Hello Richard,
Richard-TX wrote: The NMRA has absolutely nothing to say about srcp. It is outside of the scope of their jurisdiction and to be honest, I want it to stay that way.
Yes, you have right.
I suppose I was a little confuse. I doesn't want to say NMRA govern the SCRP, but the SCRP's addressing mode was inspired/influenced by NMRA - '8 ports for one address'.
Taking your example with address 1 port 92, to don't allow any confusion you shouldn't use any addresses between 2-12.
The boards with more than 8 ports will occupy/block all the necessary addresses.

But this is just my though, is not necessary the good one. :)

Regards,
Liviu

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 22.05.2013, 11:20

Liviu M wrote:Hello Richard,


Taking your example with address 1 port 92, to don't allow any confusion you shouldn't use any addresses between 2-12.
The boards with more than 8 ports will occupy/block all the necessary addresses.

Liviu
Liviu,

Now I don't understand. How is that possible?

To draw a parallel, a computer had one ip address. On that computer is up to 65,000 ports. That one computer won't block any other address no matter how many ports it has. The same applies with srcp I think.

Maybe I just don't understand.

Richard

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 22.05.2013, 12:22

rjversluis wrote:SRCP missed a change; They should have made addressing FLAT:


The way it is now is totally weird. And they should make it FLAT in 0.9... (If it will ever see the daylight.)
As far as I am concerned we should make the srcp library flat with regards to accessories.

The way I see it when looking at Rocrails configuration screen, there should be a direct correlation between that and the srcp command structure.

In other words,

Rocrail Bus = srcp bus
Rocrail Protocol = srcp protocol
Rocrail Address = srcp address
Rocrail port = srcp port
srcpd action turns the device either on or off.

This gives the greatest flexibility and extensibility.

I have been thinking about this for almost a week and given all the pros and cons to the issue, I feel it is the right thing to do.

I vote for changing switches to a flat addressing scheme. Outputs are nearly flat already so why should switches be any different?

Unless someone comes up with a compelling reason not to go to flat, lets do it now before any new software gets distributed. I am on the verge of releasing srcpd2.2.4-rpi and I would rather change my code now than in the future.

When can we go to flat accessory addressing for srcp Rob?

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 22.05.2013, 12:30

I just tested my version of srcpd. I defined a maximum of 9999 accessories in the srpcd.conf file.

srcpd had no issues dealing with port number 9999 on device number 9999. :lol: That was with srcpd running on a Rpi with it's limited resources.

rjversluis
Site Admin
Posts: 39295
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Post by rjversluis » 22.05.2013, 14:40

Richard-TX wrote: As far as I am concerned we should make the srcp library flat with regards to accessories.
You first have to change the SRCP protocol definition.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 22.05.2013, 15:24

rjversluis wrote:
Richard-TX wrote: As far as I am concerned we should make the srcp library flat with regards to accessories.
You first have to change the SRCP protocol definition.
What is wrong with it?

Seems OK like it is.

0.8 says this about the SET command for accessories.

SET <bus> GA <addr> <port> <value> <delay>

value = action which in this case is either 0 or 1

Rocrail Outputs do things almost that way now.

What else am I missing?

Richard

rjversluis
Site Admin
Posts: 39295
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Post by rjversluis » 22.05.2013, 15:30

Richard,

this is not FLAT but PADA.

FLAT is:

SET <bus> GA <addr> <value> <delay>

An address should point only to one I/O, not to two I/Os. <port>

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 22.05.2013, 15:34

Here is an sample Rocrail trace. I configured an output and toggled it ON and then OFF It is configured within rocrail as address 2 port 0.

command written: SET 2 GA 4 0 0 -1
srcp response: 1369233055.260 200 OK
command written: SET 2 GA 4 0 1 -1

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 22.05.2013, 15:36

rjversluis wrote:Richard,

this is not FLAT but PADA.

FLAT is:

SET <bus> GA <addr> <value> <delay>

An address should point only to one I/O, not to two I/Os. <port>
Flat isn't what is needed.

Change that to a PADA...I think

Post Reply

Return to “srcp”