Project VAG: Using Arduino Due for current control

Hello again!

I've managed to transfer the signal using the unipolar to bipolar converter. The signal of the primary current can now be read with the analog input pins (zero-crossing gives an 2000-value to the analog input, sine wave will therefor be about 500 ... 3500.

Calculating the RMS value is easy as that:
-> read the highest/lowest number between two zero-crossings
-> calculate the difference between the highest/lowest number and 200
-> RMS = difference / sqrt(2)

For the next step, I would like to add a 100 Hz wave to the (DC-)auxillary current. The modulated auxiliary current (secondary) must also be synchronized such that maximum auxiliary current occurs precisely at positive and negative peaks of the main reactor current (primary).

Any ideas for this?

Edit: This is what I want to be the secondary current