Considering how most designs these days are a mix of analog and digital circuits (nearly everything has an MCU or FPGA!) I'm surprised that there isn't a clean way to simulate how those circuits interact. There are simulators for verifying HDL, and simulators for verifying analog circuits, but no simulators that let you test both together? I'm really surprised that a SPICE simulator doesn't support some sort of discrete-time algorithmically-defined component. Some really simple algorithms before ridiculously complicated functions, assuming they can even be translated into pure functions at all.
You can do mixed-signal simulation with a number of tools. ngspice has extensions for this. There's a learning curve.
LTSpice also does mixed-signal simulation, but it's restricted in how the user can define their own digital blocks. You have a number of basic logic/digital primitives, and beyond that, all the rest is hidden from them. But LTSpice sure does make heavy use of mixed-signal sim. for most of their advanced models that include digital blocks, such as SMPS chips.
So with LTSpice, you can do mixed-signal sim, but the user is limited to basic logic primitives. They're probably not going to be convenient for what you want to achieve.
But as I suggested from my link, you can use arbitrary sources and functions for simulating a PID. It will just take a bit of thinking.