@milicolazo I have encountered the exact same problem when I was looking into solar elongation a while back. I think the issue is with the z component of heliocentric distance: error in heliocentricZ · Issue #38 · lsst-sssc/lsst-simulation · GitHub
The linked example shows that the z component is way off, reaching ~1 au for an MBA when it should be near ~0. I suspect that somewhere along the lines there was a mix up between degrees and radians in a trig function when calculating the coordinates (because I’ve made this mistake before and it looked similar).