The root-mean-square value of a waveform is defined as the square root of the integral of the square of the waveform, over a time interval (0,T_rms), divided by T_rms, i.e.:
X_rms = sqrt(1/T_rms integral_0^T_rms x(t)^2) (1)
If you need the rms value over a half cycle, you have to take T_rms=T/2, being T the period of your waveform. If you have a DC offset x(t)=x_0(t)+X_OFF hence x(t)^2=x_0(t)^2+ 2 * x_0(t) * X_OFF + X_OFF^2. The integral in (1) for the second term is twice the average of x_0(t) (possibly 0) times X_0 and, for the last term, it is just X_OFF^2.
The root-mean-square value of a waveform is defined as the square root of the integral of the square of the waveform, over a time interval (0,T_rms), divided by T_rms, i.e.:
X_rms = sqrt(1/T_rms integral_0^T_rms x(t)^2) (1)
If you need the rms value over a half cycle, you have to take T_rms=T/2, being T the period of your waveform. If you have a DC offset x(t)=x_0(t)+X_OFF hence x(t)^2=x_0(t)^2+ 2 * x_0(t) * X_OFF + X_OFF^2. The integral in (1) for the second term is twice the average of x_0(t) (possibly 0) times X_0 and, for the last term, it is just X_OFF^2.
The root-mean-square value of a waveform is defined as the square root of the integral of the square of the waveform, over a time interval (0,T_rms), divided by T_rms, i.e.:
X_rms = sqrt(1/T_rms integral_0^T_rms x(t)^2) (1)
If you need the rms value over a half cycle, you have to take T_rms=T/2, being T the period of your waveform. If you have a DC offset x(t)=x_0(t)+X_OFF hence x(t)^2=x_0(t)^2+ 2 * x_0(t) * X_OFF + X_OFF^2. The integral in (1) for the second term is twice the average of x_0(t) (possibly 0) times X_0 and, for the last term, it is just X_OFF^2.
What other information do you have available to you? If this is random sampling of a completely unknown signal, and you need a real-time answer, you're somewhat out of luck. If you know the frequency, you can calculate an RMS of the available samples across any half wave time period and obtain the RMS for that time period. It doesn't necessarily have to be centered on a zero crossing. If you don't know anything about what you're sampling, you can have a delayed processing where the waveform is analyzed to determine the frequency based on some filtering of the input data and then that is use to post process the appropriate data. At that point you should also have phase information to be able to align the sampling window to the zero crossing point of the waveform.
Thank you @ Paolo Stefano Crovetti for the detailed answer.
I have studied the conventional techniques for removing DC offset, but that causes some fluctuations in the resultant waveform which results in precision problems.
In-fact i am trying to use this RMS value to trip a CB in a protective devices.
I was wondering if there is any other algorithm for compensating the DC offset by using the energy of half cycle or something related to that (Other than conventional DC offset removal techniques)
I am planning to use this algorithm to control the tripping of a CB in a protective device.
I am sampling the voltage the current signals (60Hz) which is known to me, but i do not know about the behavior of DC offset.
The main problem which i am facing is the precision issue, if i apply the conventional DC offset removal techniques they cause some fluctuations and that may result in unnecessary tripping of the device.