I had a load curve (30 min interval 48 values) , and two different levels of curve(red, black horizontal line in pic), Now I want to find out the area of the curve, above the red line and below the black line, for each time stamp, Condition is such that,
If load>Red line
find Redarea for each segment/time stamp (RArea1,RArea2,RArea3,RArea4,RArea5, RArea6)
untill next segment: load<black line
find Yellow area (YArea1, YArea2, ...........YArea5)
untill RArea1+RArea2+RArea3+RArea4+RArea5+RArea6-YArea1-YArea2-YArea3........= zero or near to zero
if total area not zero condition, then futher calculate Green area in each segment untill the condition meet.
(Note: Uper area of red line take +ve and below black line is -Ve , so add segment wise with sign untill total area is near to zero)
then update the curve like following,
load <blaack line
load = black line
It should be updated only that untill where zero condtion meet, lets say conditon meet at 38th time stamp then further curve not changed according to above loop.