...
...we’re currently taking the PLC’s internal encoder numerator, which is a floating point number less than zero, multiplying it by 10^6, and sending it as an integer. So, the “unit” of the output is baked into the protocol.
Data Format 2.0.
...
0
Version 2.0.0 of encoder_channel_t adds a uint16_t field 'scaleDenom.' If nonzero, it is the denominator of a rational scale value.
'encoderValue' (shape: 1): 23563414
'timing' (shape: 1): 505870
'scale' (shape: 1): 1
'scaleDenom' (shape: 1): 150
'mode' (shape: 1): 0
'error' (shape: 1): 0
'majorVersion' (shape: 1): 2
'minorVersion' (shape: 1): 0
'microVersion' (shape: 1): 0
See the definitions of encoder_header_t and encoder_channel_t in github: UdpEncoder.hh
Zach writes:
...if the denominator is used, we do no pre or post multiplication of the values. If I need to express something like numerator = 1.16 and denominator = 5.0, I would send 116 and 500 which maintains the same ratio as the original.
In the specific case of this encoder, I send 1 and 150 exactly and your code on the other side simply doesn’t do the *1e-6 step because a denominator is present.
...
Viewing Encoder Value in AMI
Run Encoder Sim on Remote Host
Earlier (2022) the sim was limited to localhost.
Code Block | ||||
---|---|---|---|---|
| ||||
-bash-4.2$ hostname
drp-tst-acc01
-bash-4.2$ nc -lvu 172.21.148.201 5006
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Listening on 172.21.148.201:5006
Ncat: Connection from 172.21.148.110.
sim_updencodersim_updencodersim_updencodersim_updencodersim_updencoder |
Code Block | ||||
---|---|---|---|---|
| ||||
(ps-4.5.26) -bash-4.2$ hostname
daq-tst-dev03.pcdsn
(ps-4.5.26) -bash-4.2$ sim_udpencoder -r 0 -a 172.21.148.201 | head -4
Version PulseID TimeStamp Markers BeamReq BsaInit BsaActiv BsaAvgD BsaDone
10000 374b0fc41f 3e4f023b73138 10040 0 0 0 0 0
10000 374b0fc420 3e4f023b7356d 10040 0 0 0 0 0
10000 374b0fc421 3e4f023b739a2 10040 0 0 0 0 0 |