I have noticed a little error in your code.
The formula for lrt = R1/(Vref-Vo)
But you wrote: lrt = (Vref-Vo)/R1
Could that be your problem?
Greetings and Regards,
Thanks James. The calculation is correct as it computes the current.
I have resolved the issue by working with NI support. A program is attached for future reference.