Firstly, this model uses the Transport Delay for a phase shifted modulator. This is not recommended. See the excerpt from the Transport Delay's help below. The modulator by itself will not work (e.g. setting the input to the gain block to 0.001 results in an error). This must be resolved first. In additional to the Dual Active Bridge demo model, there's some useful forum posts on phase shifted modulators and variable delay C-Scripts.
The C-Script is a good option to translate your SFunction, however your implementation mixes several concepts incorrectly. For your SFunction - are you executing it in discrete or continuous time? Based on the zero-order hold in the PLECS model I'm assuming it's in discrete time.
Have you seen the PLECS: Using the C-Script Block tutorial? The discrete PI implementation referenced in the tutorial should give you a good starting place for your controller.