Forum Moderator

OK, thanks. So, if the code is also failing on a smaller model the problem is with the UDF in some way. 

One quick check, add a few more UDM and UDS memory locations. As I don't know what else you're calling there's always a risk you missed something: this is a test and when running working code I assign the correct number of locations!