Controling LM317 digitally
The main issue, is that OA1 is connected in the wrong polarity; swap the
connection to the (+) and (-) terminals.

The use of a resistor to pull-down the output (in order to correctly
bias the LM317) is problematic because it's output-value dependent.

Instead, you can use the OA2 section to regulate current
with a transistor, taking the +24V power as a rough reference
voltage value, thus:







simulate this circuit &ndash; Schematic created using CircuitLab

This current sink should be constant down to under 1V (and the LM317
can't be driven under 1.2V output, in any case).  

If a negative power supply were available, the transistor
and an emitter resistor would be the only current-sink components required; just ground the base and connect emitter through the right resistor value
to the (-V).