function [reserveopcosts]=v25_calcreserveopcosts(XSIM)
%Function

%Calculate revenues from reserve:
for i=1:size(XSIM,2) 
    oldreservelevel=max(XSIM(i).x(:,1,:,:),[],3);
    oldreservelevel(:,:,2:size(XSIM(i).x(:,1,:,:),3),:)=XSIM(i).x(:,1,1:end-1,:);

    reserveopcosts(i,:)=squeeze(sum(sum((XSIM(i).x(:,1,:,:)-oldreservelevel(:,:,:,:)) ...
        .*XSIM(i).x(:,7,:,:))))/(size(XSIM(i).x,1)*size(XSIM(i).x,3));
end;