This document outlines the communication protocol between automatic drafting equipment (autodrafters) and Tru-Test ID3000 and XR3000 indicators. The protocol uses two SCP commands, {RH} and {RD}, to initiate weighing, return the draft range, and record the weight. It allows for faster weighing and more accurate animal counting. The {RH} command starts weighing and returns the draft range when stable, while {RD} records the weight after the animal is drafted. The protocol handles exceptions like lost commands to ensure consistent weighing and drafting.
1 of 8
More Related Content
Auto drafterprotocol xr-3000 Tru-test
1. AutoDrafterProtocol.doc 28 May 2013 1 / 8
Product: XR3000
Topic: 3000 Indicator to Auto-Drafter Serial
Communication Protocol
Bulletin number: B001
Prepared by: J.R.S V.L. X.X
Version: 1.5
Purpose of this document
This document covers the {RH} {RD} protocols used between automatic drafting
equipment (autodrafters) and Tru-test ID3000 and XR3000 indicators. This protocol
depends on the autodrafter knowing when the animal is ready to be weighed, typically
from a physical switch attached to the input gate or the clamp. If this signal is not
available, a different protocol needs to be used.
This protocol allows the weighing indicator to use timing information available from
the draft controller to do faster weighing. It also allows the indicator to more
accurately count the animals. The protocol is also tolerant to errors in the
transmission of information in both directions.
The protocol uses two SCP commands and all communications are initiated by the draft
controller.
The two command protocol prevents three possible anomalies:
1. An animal was being drafted into one range by the controller but the weight
recorded by the weighing indicator was in a different draft range. This problem
was due to the feature of Tru-Test indicators whereby the weight display remains
live. So after the draft information had been sent to the controller and before the
controller had sent back the command to record the weight, it was possible for the
weight displayed to change (as a result of the animal moving its weight off the
entry gate) and the changed weight would be the one recorded.
2. The number of animals counted by the scale could be incorrect. This problem is
due to not seeing a return to zero weight inbetween animals. Also, if the
Autodrafter were to send two record commands, the indicator would record the
animal twice. By receiving definitive animal input gate signals, the indicator can
know for sure when it has a new animal.
3. The Autodrafter failed to receive the response of {RH} command. This problem
could be caused by lost {RH} command, or lost response of the {RH}, or that the
{RH} got reset in indicator for any other unknown reasons. Hence {RHx} command
is introduced to deal with this problem.
2. AutoDrafterProtocol.doc 28 May 2013 2 / 8
The {RH} {RD} Protocol (in brief)
The user opens the autodrafter input gate to let an animal enter. The user shuts the
input gate or clamps the autodrafter when the animal is in the correct position or it
does so automatically.
When the animal is secured the Autodrafter sends an {RH} command to the weighing
indicator automatically. Then the Autodrafter waits for the response of the {RH} from
the indicator. Usually Autodrafter employs a timer to prevent endless wait.
On receipt of the {RH} command, the weighing indicator weighs the animal, taking
either a fixed or variable period of time to do so depending on its damping settings.
The weighing indicator then responds to the {RH} command with a response such as
[2]. The number inside the square brackets indicates where to draft the animal. The
weighing indicator freezes the displayed weight.
The Autodrafter, on receiving the draft range in square brackets can now release the
animal in the respective direction and send an {RD} command to the weighing
indicator.
On receipt of the {RD} command, the weighing indicator records the (frozen) weight
and draft direction into its file.
However exceptions could happen in the above process. One of the exceptions is that
the Autodrafter fails to receive the response of {RH} command before the timer is
expired. The causes of this exception could be that indicator does not receive the {RH}
command (lost {RH} command), indicator receives the {RH} command but gets it reset
for certain unknown reasons, or indicator sends the response but the response gets
lost during the transmission. To handle this exception, Autodrafter is recommended to
re-send {RHx} command every certain period (usually three seconds) until it receives
the response. If Autodrafter re-sends {RH} command in this case, it may lead to the
indefinite “Waiting for Stable” issue because {RH} simply restarts the weighing cycle.
Note that indicator with old 3000 firmware would get a (13) error if it receives {RHx}
command.
The {RH} {RD} Protocol (annotated)
The weighing indicator uses the {RH} command to do the below things.
1. The weighing indicator is taken out of its normal live weighing mode (temporarily).
In case the weighing indicator somehow gets stuck in this mode, the {RH} will
automatically clear in the following ways: a zero or negative weight being present for
three seconds, receiving a {RR} or {RD} command. No response to the {RH} is sent if it
doesn?t complete. However, if cleared by a zero or negative weight, the indicator will
return a (14), ?Command cannot be executed at this time? error if error codes have
been switched on.
If Weight recording is switched off, then a zero or negative weight will not clear the
{RH} command. This allows drafting dependent on ID or EID, without weighing.
2. To know the exact time to start weighing.
3. To return a draft direction when the weight reading is stable.
3. AutoDrafterProtocol.doc 28 May 2013 3 / 8
4. To lock the weight display until an {RD} command is received. This ensures that
the weight that gets recorded is consistent with the draft range that was sent to the
autodrafter.
5. {RHx} command is used to handle the exception that Autodrafter does not get the
response after it sends {RH} or {RHx} command. When this happens, Autodrafter is
suggested sending {RHx} to do the retry until it succeeds receiving the response.
When a {RHx} command comes in, indicator will ignore this {RHx} if it is still
processing the {RH} command; otherwise indicator will do the same as a {RH}. This
will act as a safety catchall for lost {RH} command or its response [2], or if the {RH}
gets reset for any other unknown reasons. For the case where the {RH} response
and the {RHx} cross, then if the indicator is in waiting for {RD} state, it will ignore
the first {RHx} but act on the next {RHx} to restart.
6. The {RH} {RD} pair is taken as the definitive signal that new animals are passing
through the autodrafter. The pairs are used for recording and thus counting the
animals in each draft range. Customers expect these counts to agree with the
actual numbers of animals put through. (In the absence of an autodrafter, animal
counting is effectively achieved in the indicator by looking at the weight going up
and down. This is an error prone method because the weight need not return to
zero between animals or may even return to zero during the same animal if it
needs to be repositioned in the crush or crate.) With an autodrafter, especially one
that is partially under the control of an operator for each animal, it generally is able
to distinguish animals more reliably than the scale can. The indicator, therefore
makes exactly one record for each {RH} {RD} pair.
The {RD} command is separated out from the {RH} command for better reliability of the
system. It effectively gives the operator a longer window in which he can intervene. A
simpler system would have been for the indicator to automatically record when the
animal is weighed after an {RH}, and dispense with the {RD} command altogether. The
system can be used in this way. But in that system the operator would have no
opportunity to abort after the {RH} command is sent. (The animal may not be in the
weighing apparatus properly or there may be interference from another animal or
human or the operator may wish to send it through without weighing.) So that the
operation can be aborted by the user during the weighing time, the {RD} command is
used to tell the indicator to do the actual weight recording.
If provided with the means, the operator could override the autodrafter any time until
the autodrafter sends the {RD} command. In such a case, the Autodrafter should abort
the weighing cycle and start it again by first sending a {RR}, wait for its ?ack? and then
send a new {RH} command. If needed, an {RH} can be simply cancelled by sending the
{RR} command.
The reason that the {RH} must be cancelled using the {RR} before another {RH} is sent is
because without the {RR} the indicator may have responded to the first {RH} just as the
autodrafter sends the second {RH}. The response to the 1st {RH} and the second {RH}
may in effect cross each other in transit. To prevent the first response being seen as a
response to the second {RH} it is best to cancel the first {RH} first by sending a {RR} and
then waiting for the ack, disregarding any response from the first {RH} that may arrive
before the ack. Then send the new {RH}.
4. AutoDrafterProtocol.doc 28 May 2013 4 / 8
It is best to send the {RD} command immediately after the exit gate or crush is opened
but before the animal actually leaves as when the weight returns to zero, the indicator
will reset the {RH} command?s latched weight. Once the {RD} command is sent, the
animal is considered to be ?drafted? and the weight and draft direction are recorded in
the indicator. Once the {RD} command is sent it cannot be reversed by the Autodrafter.
Initialization
To begin communications the Autodrafter should send {ZA1} to see if the indicator is
talking. If it is it will receive an acknowledgment in the form of the carat character (^).
The Autodrafter sending the {ZA1} will also allow the weighing indicator to respond to
the {RD} command with a carat so that the controller can verify that the indicator has
received and executed the command successfully and so it can know when the
indicator is ready for another command. The Autodrafter should send a {ZE1}
command next. The {ZE1} command allows the indicator to respond with error codes
when an SCP command cannot be executed for some reason.
Before weighing any animals, the Autodrafter could send various setup commands to
ensure that essential setups in the indicator are correct. At another level, a ?user
initiated? or ?one off? set of setup commands could be sent to the weighing indicator to
set it up in such a way that it will immediately work, complete with a set of sample
draft limits. Subsequently the setups could then be changed manually in the indicator
to suit individual requirements. Almost any setup in the indicator can be controlled
through SCP commands. If a (FD) error code (unknown command) is received as a
result of sending setup type commands, the Autodrafter should assume that the
command is not implemented and continue regardless.
Following is a list of some of the commands that can be used to initialize the indictor
for drafting. This may not be an exhaustive list for a given application. Depending on
the types of drafting being done, and consequently how much control the user needs
over the setups, some of the commands in the second table could be moved to the
first, to be done every power up.
Commands that can be sent every time the autodrafter connects.
SR/XR3000 Setup Item SCP command Setup location
turn on Acknowledgements {ZA1}
Error messages = on {ZE1}
Drafting = Enabled {SEDR1} SETUP, DRAFT
Not Recorded Warning Messages =
Off
{SERW0} ESC SETUP, OPTIONS
Weight Output = Off {SXWE0} SETUP, >>, SERIAL
5. AutoDrafterProtocol.doc 28 May 2013 5 / 8
Commands that can be sent once at installation to make the system work.
SR/XR3000 Setup Item SCP command Setup location
Damping - Set to defaults {SDSD} ESC SETUP,
DAMPING
Damping Mode = Smart or Timed
as req
{SDDS1} or {SDDS2} ESC SETUP,
DAMPING
Damping Time 1.5s or as required {SDFL2} x depends on
Damping mode
ESC SETUP,
DAMPING
Damping delay {SDDL0.0} 0.0ms ESC SETUP,
DAMPING
Auto Resolution – Set To Defaults {SASD} ESC SETUP, AUTO
RES
Set Tare = 0.0 {SSST0.0} SETUP, SYSTEM
Auto Zero Track = On Net {SSAZ1} SETUP, SYSTEM
Power Up Zero = On {SSPU1} SETUP, SYSTEM
Reverse Weighing = Off {SSRW0} SETUP, SYSTEM
Recording mode = Manual {SSWR1} SETUP, SYSTEM
Enable prompt message {SMLS0,1} SETUP
Disable all Right Hand fields {SMRS0,0} through to
{SMRS25,0}
SETUP
Drafting Ways = 3 {SEDW3} SETUP DRAFT
Draft By = Weight {SDDT1} SETUP DRAFT
Icons = Large pen numbers {SDAN4} SETUP DRAFT
Set draft limits {SDTO0,30}
{SDTO1,50}
{SDTO2,2000}
SETUP DRAFT
{RH} response
The {RH} response is affected by the ICON setup in the draft setup screen in the
indicator. The {RHx} response is same as the response of {RH}.
The {RH} command returns weight ranges if the icons are set to L,M,H or Range No;
pen numbers if the icons are set to pen numbers; arrow numbers if the icons are set to
arrows.
6. AutoDrafterProtocol.doc 28 May 2013 6 / 8
Note that when L,M,H is used, the {RH} returns [1], [2] or [3] respectively. 1 means the
low weight range, 2 the middle and 3 the high weight range. If 2-way drafting is used,
the indicator will show L or H on its displays but the {RH} will return 1 or 2 respectively.
The Range No. setting works the same as L,M,H except that it can handle more than 3
draft ranges.
If arrows or pen numbers are used, another column appears in the drafting setup
screen. This column allows you to put an additional translation step between the
Range No. and the number that is actually sent out in response to the {RH} command.
This allows the ?direction that the animals are sent? to be set or changed in the
indicator without having to reconfigure the auto drafter. All the auto drafter need do
is send 1 straight ahead, 2 left, 3 right, 4 next left, 5 next right. This will match up
with the arrow codes returned by the indicator. If using pen numbers, the autodrafter
would need to be set up once to draft [1] to pen 1 [2] to pen 2 etc.
If the auto drafter itself has controls for directions, then the indicator should be set to
use L,M,H or Range numbers as the autodrafter will be expecting raw range numbers
representing lowest weight to highest weight rather than arrow codes or pen numbers.
The {RH} command returns [0] if drafting is switched off. This is the only case in which
[0] is returned as in all other cases if the Draft indication is not known, the response is
held back by the indicator waiting for operator input of some kind.
Holding back the animal
When drafting in the XR3000 indicator is set up to be by weight gain or some other life
data or file data field or there are other fields of data to be entered for each animal,
then the autodrafter must hold the animal until all is ready (e.g. the ID is entered). In
such scenarios, the response to the {RH} command is held back by the indicator so that
the autodrafter will not release the animal. The autodrafter may therefore have to wait
an indefinite amount of time before it receives the response to the {RH}. When the
response eventually does come, the autodrafter should still send an {RD} command to
record the weight unless the operator has initiated some kind of abort or restart. If the
indicator has weight recording switched off, the response to the {RD} will be (14),
which means ?command not executed?. The indicator does in fact still use this
command to know that the animal is finished with and released so it can clear that
animal?s data from the display. An {RR} command does the same thing.
This also avoids a potential problem where EIDs can be received by the indicator either
before or after the {RH} command is received. If the indicator did not know that the
last animal was finished with, it would not know to which animal the EID belonged.
Getting back to the {RH} command, its response can be held back by the indicator for
any of four things (in parallel):
1) till the weight is stable (only if weight recording is switched on)
2) ID resolved (if there is an ID on the right hand side of the weighing screen).
3) till the draft indicator is known (only if Drafting is switched on)
- automatically depending on what the Draft by is set to
- manually by the user entering data into the field that the Draft by is set to
7. AutoDrafterProtocol.doc 28 May 2013 7 / 8
- manually by the user overriding the draft indicator on the weighing screen
Note: If drafting is switched off, the {RH} response is [0].
Note: If a blank arrow or a zero pen number is specified for a particular draft
range in the draft setup screen, this is interpreted as ?draft indication unknown?
when the draft range occurs and the {RH} will not send back a response. The
user must override the draft direction in the weighing screen to get the animal
released. This is useful if, for example, the user wants to hold up particular
animals for special treatment.
The same result can also be achieved if drafting on an option field or a text
field by leaving out the rows for the option or text on which you do not want
the animal to be released. This is the only way to do it if using L,M,H or Range
Nos as the icons.
4) the last (non-ID) field on the Right hand side of the weighing screen is entered (if
there is one).
Note: the user would need to enter data into other fields first (in any order)
because as soon as he enters data into the last one, the animal will be released.
Note: the user can just press enter on this last field without entering data if he
wishes to accept the data already in the field or leave it blank.
Note: If the last (non-ID) field on the RHS is one for which the user does not
want to enter data (or press ENTER on) for every animal, he should rearrange
the fields so that the last one is one for which he does want to enter data every
time. This can be done by the order that fields are used in the setup screen or
it can be done by moving the last field to the left hand side of the weighing
screen where the indicator will not wait for it to be entered.
Overriding the draft direction, or Reweigh
The user can manually override the draft direction or press a key to reweigh the animal
during the animal handling sequence, provided he does so before the {RH} command
response is sent.
He can do this on the indicator or, if it is so equipped, the autodrafter controller.
On the Indicator
On the indicator, the user can enter a new draft direction on the weighing screen, or
press the Reweigh key.
On Reweigh there is no change to the protocol. The indicator simply restarts weighing
and the {RH} response is delayed.
On Draft direction override, the new draft direction is returned in the response. No
other change.
On the autodrafter
The autodrafter should send an {RR} to the indicator to cancel any pending {RH}, and
wait for it's acknowledge in case the {RH}'s response still comes through.
8. AutoDrafterProtocol.doc 28 May 2013 8 / 8
The autodrafter should then send a new {RH}
To override the draft direction after the response to the {RH} is received, the
autodrafter should send a {RI0,x} command to the indicator before sending the {RD}.
The {RI0,x} command sets the draft direction on the weighing screen, as if the user had
changed it there. The {RD} command will then record the actual draft direction that the
autodrafter used.
Getting the ID
If the autodrafter needs to know the ID, it can send an {RP} command before sending
the {RH} or after it has the {RH} response, before sending the {RD}. The {RP} command
will return any ID that has been entered since the previous {RD} command. The form
of the response is empty square brackets if there is no ID, or for example if the ID is
1234 then [ID1234]. The {RP} command, being a polling command is designed for
future use to be able to return other sorts of information.
Handling communication errors during weighing
If the indicator receives a second {RH} command, it does not matter as it will simply
restart the weighing cycle, which may cause the indefinite “Waiting for Stable” issue.
Therefore {RHx} command is used to do the re-sending job. When indicator receives
{RHx} command, it knows that the Autodrafter has sent {RH} or {RHx} but not received
its response, and how the indicator handles the incoming {RHx} command depends on
its current state. If the indicator receives a second {RD} command, it does not matter as
the indicator will only record a weight if it has had a {RH} command prior.
If there is a loss of or an error during communications in either direction, the
Autodrafter will either get no response or an error code or a garbled message. The
Autodrafter should check for error codes being returned (in round brackets). If so, it
should re-send the command {RHx}. The time taken to get a response from the {RH}
or {RHx} command can be indefinite as the indicator may wait for operator input. If
there is no response on the {RD} command, the autodrafter should timeout after 2
seconds before resending.
If the weighing indicator cannot execute an {RH} command, as for example when there
is no weight on the platform, it will respond with the error code (14).