private double forecastCost (Tariff tariff)
{
CapacityProfile profile = accessor.getCapacityProfile(tariff);
if (0 == profile.getProfile().length) {
log.error("Zero-length profile for " + customerInfo.getName());
return 0.0;
}
setProfileLength(profile.getProfile().length);
double inconv = accessor.getShiftingInconvenienceFactor(tariff);
double profileCost = helper.estimateCost(tariff,
profile.getProfile(),
profile.getStart());
if (Double.isNaN(profileCost)) {
log.error(getName() + ": profile cost NaN for tariff "
+ tariff.getId());
}
double scale = stdDuration * 24.0 / getProfileLength();
if (Double.isNaN(scale)) {
log.error(getName() + ": scale NaN for tariff " + tariff.getId());
}
log.debug("tariff {}: profileCost={}, inconv={}, scaled-charge={}, scaled (cost+inconv)={}",
tariff.getId(), profileCost, inconv, profileCost * scale, (profileCost + inconv) * scale,
(profileCost + inconv) * scale / (profileCost * scale));
return (profileCost + inconv) * scale;
}