Use the definition of RMS if you want to get it in the microprocessor.
IN MATLAB, have the block to do it!
In PSIM, you have the small button named RMS, click it and enter the fundamental freq. Remember to zoom to the range of waveform that you want to measure!
Press X button on the top toolbar, choose the time axis from 0.01 to 0.03 for example (in case of 50Hz), then press RMS to calculate the RMS value! if you want to calculate the RMS value continuously for control, it must be done by a block or programming!