Thanks for your answer, very appreciated! =)
I have seen your example here beforehand and those by @charlesm93 and tried to mimic that function in the first post using linear interpolation. I guess I was close but I lack of experience in stan. The code in my second post works but without using a separate function.
There are some other hurdles now, but I guess I better open separate issues for them…