# Readback values not matching commanded values.

#### 2feb12

New little stars were installed on tiedowns 4 and 8. The programs for all 3 tiedowns were recompiled with the latest zworld compiler.
When running the tiedowns, a command Speed error would appear on the monitor display. This error occurs when the velocity read back from the amplifier differs from the commanded velocity by more than 50 a/d counts (this is a parameter set in the eeprom).
Resolved:problem always present, but old dynamic C compiler abs() function probably always returned 0).

10feb12  changed voltage divider resistor for spdMonitor from 46.2 K to 22K.
02feb12:ran tiedowns 3=>22 inches. measured the output voltages at the tiedowns , and then compared the readbacks
25jan12: looked at some readback value while tiedowns moved. no voltages were measured at the tiedowns.

## 10feb12: spdMon 46.2K resistor -> 22K. Command speed errors alway present.

The analog input signal conditioning board had a 46.2K resistor used for the spdMonitor input. This is supposed to map the maximum output of the amplifier speed monitor (8volts) to the 2.5 volts input of the a/d (in mode 0). The previous days measurements showed that this wasn't happenning. Using a power supply and pot it was found that a 22K resistor generated the maximum a/d counts (2047) when 8 volts was applied to the input of the a/d signal contiditioning board. For a voltage divider to give this:
• Vt=8v, V1=5.5V, V2=2.5V
• Vt 8 volts is the max output of amp speed monitor
• V1=5.5V is the drop across the R1 resistor on the signal conditioning board.
• V2=2.5V is the value we want at the a/d when 8 volts is on the signal conditioning input. There must be an R2 resistor connected to ground after the R1 resistor,,.
• Vt=I*Rt = I*(R1 + R2)
• V1=IR1, V2=IR2,
• V1/V2 = R1/R2= 2.2
• If R1 was 46.2 volts then R2 shold be 21K.
• It looks like there is probably a 10K resistor R2  from the a/d input to ground so:
• R1=22K is the correct value for R1 in this case
The little star program reports a command speed error (st_fault bit B2 counting from 0) whenever the difference between the commanded velocity and the spdMonitor readback is greater than a predetermined value read from  eeprom. This value has historically been  50 counts.
Looking back over data from 2005 to 2012 , this diference has always been greater than 50 counts many times, but the fault status bit was always 0.
Looking at the little star code, the program uses the statement  abs(cmdSpdReq - spdMonReadback) < 50 counts. --> set spdCmdErr.

After recompiling the little star program with the new compiler (5.24) the status bit error started to appear. My guess is that the abs() function did not work in the previous versions of the little start compiler and always returned 0.

The  plots show the ReqVelCmd - SpdMonReadback for 10feb12 and 11mar11 (.ps) (.pdf):
• Page 1 10feb12 .
• Commaned Velocity - Speed monitor readback
• black=td12,red=td4, green=td8, .
• top:  Commanded - spdMonitor vs hour for about 30 minutes in the afternoon when
• These measurements have the 22k resistor in the signal conditioning board for the spdMonitor input.
• blue trace is the scaled commanded velocity.  300 shows  a commaned velocity of 2048 counts (the maximum)
• td 8 error is the negative of  td12 and td 4.
• Bottom: Plot cmdVel-spdMon versus commanded velocity counts.
• The slopes show the relative error in the resistor R1 used to make the difference 0. Part of this difference may be the different voltages that the three amps output when commanded with 2048 counts input.
• Page 2 11mar11
• These plot show the same info as page 1
• This data had the 46.2K resisitor in the A/Dsignal conditioning board for the spdMonitor  input.
• The errors are much larger.
• There were no  spcCmdErrors on this day (used the old compiler).

### What we should do:

• verify that there is a 10K resistor connecting the a/d input and ground on the a/d card.  This will use resistor packs: RN 2,3 and have one end of the resistor pack tied to ground. (11feb12 checked.. 10K resistor present and connected to ground via cable)
• Switch speed monitor signal conditioning R1 resistor  to 22K. (11fe12 done..)
• When maximum requested velocity was put on the 3 amplifiers, the amp speed monitor output (measured with a dvm) was :
• 7.38,7.51,8.01
• The amps probably have different calibrations. They may also have different torque limitations (that may limit the speed under high torques).
• These voltage differences will map into count differences of 150 - 200 counts. So  it is not reasonable to expect the commanded - measured counts to be < 50 counts.
• Change the eeprom value to be 250 or 300 counts. (11feb12 .. max value in eeprom is 100 need to update that..).
• this will a least catch when the dac  goes crazy,....but note, the error is only a warning.. it does not stop the motor.
processing: x101/120210/tdtrk.pro

## 02feb12: Move tiedowns, measure voltages, compare readbacks.

On 02feb12 jorge and company moved the tiedowns from 3" to 22", 22" to 3", and 3" to 22".
While moving the voltages at the various tiedowns were measured:

 td Velocity cmd Voltage at amps Volts SpdMonitor voltage at amps Direction moved 12 10.05 7.38 3" to 22" 4 -9.3 -7.51 22" to 3" 8 10.23 8.05 3" to 22"
Notes:
• When the maximum velocity command is requested, the amp input voltage should be +/- 10 volts
• that is what was measured so the dac output is working ok.
• Maximum velocity on the motor have a speed monitor readback of about 8 volts.
• This was also ok.
The status readback from the tiedowns was plotted during these moves (.ps)   (.pdf):
• Page 1:
• Top: tiedown local time - AST station clock
• td12=black,red=td4, green=td8
• Normally td12, and td4 = 0 and td8 = .1 (since it is read .1 secs after the other two).
• Td4 has .1 second jumps during the day. This must be an extra interrupt causing this. It may be that some of the new little star code has enabled an interrupt somewhere.
• Bottom: Tiedown motion for a short portion of the test.
• This was at the start where the tiedowns were commanded from 14 to 3" and then from 3" to 22"
• Page 2: comparing the read back values:
• td12: black, td4:red, td8: green
• Top: velocity Command sent to dacs.
• For the move it was requesting the maximum of  |2048| counts.
• This should have generated 10 volts on the amplifier input.. it did so the dacs are working.
• 2nd: velocity feedback.
• The dac output is routed back to the a/d and read.l
• It should be +/- 2048.. It isn't so something is wrong with this adc readback.
• the jumps are just rfi getting into the amp.
• 3rd: overplot velCmd, velFeedback, and ampSpeedMonitor for td12.
• velCmd:black, velFeedback:red, speedMonitor:red.
• all 3 tiedowns were doing the same thing so is just plotted td12
• These numbers should all be about the same.. they aren't, so the a/d readback is not correct.
• The speed monitor voltage of 8 volts  should be giving maxium speed readback around 2048. The resistors before the a/d should be  setup  for this.
• So something is wrong in the resistors, pico fuses, or a/d setup.
• bottom: ratios of velFdBack and spdMon/  velocityCmd
• These ratios should be 1.
• spdMon/velCmd = .539
• velFdBack/velCmd= .732

## Summary:

• the time jumps in td4 are probably coming from some interrupts in the new little start software causing an extra 100 ms count in our interrupt routine.
• The dacs are working ok
• the readbacks of velocity feedback and speed Monitor to not match the requested commanded velocity.
• The speed monitor readback difference is causing an error to appear in the control room : speed error.
• Since all 3 tiedowns have the same error, it probably isn't a bad resistor or pico fuse (but see below...)
• Some voltage readbacks are working correctly .. but they have different a/d configurations.
• Velocity Feedback and spdmonitor are biPolar readbacks.. But negative 24 volts is also bipolar and it is working.
• The  only common thing between these readbacks is that they are the only readbacks that use 46K resistors..
• I wonder if we installed a badly marked batch of 46K resistors on all these a/d boards ??
processing: x101/120202/tietest.pro

## 25jan12: Look at readback values when tiedowns moving.

• Each frame is a different tiedown
• black: the commanded speed.
• green: the speed read back from the amplifier.
• red: Commanded - ampSpeed
A cmdSpdErr will occur if the difference is greater than 50 counts.
The red plots (difference) are about equal to the amp speed (green). It might be that the a/d converter is configured incorrectly and it is reading a factor of 2 too little.

processing: x101/120126/chktd.pro