How to call IPOPT Optimiser built with CasADi in PLECS?

I am trying to run some optimisation routine. I have a working version of optimiser wrapped in a function. It takes in a vector of 6 rows as input arguments and spits out a vector of 3 rows.

The optimiser is built with symbolic expressions using CasADi and solver used is IPOPT.

I want to use this optimiser in my simulation in parallel with my controller in plecs to check how well it performs.

Has anyone ever done something similar?