@Domain(fields={"tariffId","weeklyBegin","weeklyEnd","dailyBegin","dailyEnd","tierThreshold","fixed","minValue","maxValue","noticeInterval","expectedMean","maxCurtailment"}) public class Rate extends RateCore
Each TariffSpecification
must include at least one Rate
.
Rates can be fixed (the default) or variable. A fixed rate has a single
value
attribute that represents the customer payment for a kWh of energy.
This value is typically negative for a consumption tariff (customer pays
to receive energy) and positive for a production tariff. A variable rate
must specify a minValue
, a maxValue
, and an
expectedMean
. To be valid, a
Rate for a consumption tariff must have
minValue >= expectedMean >= maxValue
.
For a production tariff, these relationships are reversed. These ranges
constrain the HourlyCharge values that may be applied to the Rate.
The maxCurtailment
parameter can be between 0.0 and 1.0 when
applied to an interruptible PowerType. If greater than zero, then the
production or consumption associated with the tariff can be shut off remotely
for economic or balancing purposes, using an EconomicControlEvent
or by issuing a BalancingOrder
to the DU. The curtailment
cannot exceed the product of maxCurtailment
and the amount \
that would have been produced or consumed in the absence of the external
control.
If a non-zero tierThreshold
is given, then the rate applies only after
daily consumption/production exceeds the threshold; to achieve a tiered
structure, there needs to be at least one Rate
with a
tierThreshold
of zero, and one
for each threshold beyond zero. Tier thresholds must be positive for
consumption tariffs, negative for production tariffs. For the purpose of
determining tier applicability, production and consumption tracking is
reset at midnight every day, in the TariffSubscription.
Time-of-use and day-of-week Rates can be specified with
dailyBegin
/ dailyEnd
and
weeklyBegin
/ weeklyEnd
specifications.
For dailyBegin
/ dailyEnd
, the values
are integer hours in the range 0:23. A Rate
that applies from
22:00 in the evening until 6:00 the next morning would have
dailyBegin=22
and dailyEnd=5
.
Weekly begin/end specifications are integers in the range 1:7, with 1=Monday.
It is possible for multiple rates to be applicable at any given combination of time/usage. If this is the case, the most specific rate applies. So if there is a fixed rate that applies all the time, it will be overridden by a time-of-use rate during its period of applibility. Also, if the times for time-of-use rates overlap, they are sorted by start-time, and the applicable rate with the latest start time will apply. This logic is implemented in Tariff.
State log fields for readResolve():
new(long tariffId, int weeklyBegin, int weeklyEnd,
int dailyBegin, int dailyEnd, double tierThreshold,
boolean fixed, double minValue, double maxValue,
long noticeInterval, double expectedMean, double maxCurtailment)
Modifier and Type | Field and Description |
---|---|
static int |
NO_TIME |
Constructor and Description |
---|
Rate()
Default constructor only.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addHourlyCharge(HourlyCharge newCharge)
Adds a new HourlyCharge to a variable rate.
|
boolean |
addHourlyCharge(HourlyCharge newCharge,
boolean publish)
Allows initial publication of HourlyCharge instances within the notification interval.
|
boolean |
applies()
True just in case this Rate applies at this moment, ignoring the
tier.
|
boolean |
applies(org.joda.time.base.AbstractInstant when)
True just in case this Rate applies at the given DateTime, ignoring the
tier.
|
boolean |
applies(double usage)
True just in case this Rate applies at this moment, for the
indicated usage tier.
|
boolean |
applies(double usage,
org.joda.time.base.AbstractInstant when)
True just in case this Rate applies at the specified
time, for the indicated usage tier.
|
int |
getDailyBegin() |
int |
getDailyEnd() |
double |
getExpectedMean() |
double |
getMaxCurtailment()
Returns the maximum proportion of offered load or supply that can be
curtailed in a given timeslot.
|
double |
getMaxValue() |
double |
getMinValue() |
long |
getNoticeInterval() |
TreeSet<HourlyCharge> |
getRateHistory()
Returns the sequence of HourlyCharge instances for this Rate.
|
double |
getTierThreshold() |
double |
getValue()
Returns the rate for the current time.
|
double |
getValue(org.joda.time.base.AbstractInstant when)
Shortcut to get value at an instant without a TEH.
|
double |
getValue(org.joda.time.base.AbstractInstant when,
TariffEvaluationHelper helper)
Returns the rate for some time in the past or future, regardless of
whether the Rate applies at that time, and regardless of whether
the requested time is beyond the notification interval of a
variable rate.
|
int |
getWeeklyBegin() |
int |
getWeeklyEnd() |
boolean |
isFixed() |
boolean |
isTimeOfUse()
True just in case this Rate does not apply everywhen
|
boolean |
isValid(PowerType powerType) |
boolean |
isValid(TariffSpecification spec)
Returns true just in case this Rate is internally valid, and valid
with respect to the given TariffSpecification.
|
String |
toString() |
Rate |
withDailyBegin(org.joda.time.base.AbstractDateTime begin)
Sets the time of day when this Rate comes into effect.
|
Rate |
withDailyBegin(int begin) |
Rate |
withDailyBegin(org.joda.time.ReadablePartial begin)
Sets the time of day when this Rate comes into effect.
|
Rate |
withDailyEnd(org.joda.time.base.AbstractDateTime end)
Sets the time of day when this Rate is no longer in effect.
|
Rate |
withDailyEnd(int end)
Sets the time of day when this Rate is no longer in effect, given
as hours since midnight.
|
Rate |
withDailyEnd(org.joda.time.ReadablePartial end)
Sets the time of day when this Rate is no longer in effect.
|
Rate |
withExpectedMean(double value)
Specifies the expected mean charge/kWh, excluding periodic charges,
for this Rate.
|
Rate |
withFixed(boolean fixed)
Specifies whether this Rate is fixed (true) or variable (false).
|
Rate |
withMaxCurtailment(double value)
Sets the maximum proportion of offered load or supply that can be
curtailed.
|
Rate |
withMaxValue(double maxValue)
Specifies the maximum charge (furthest from zero) for variable Rates.
|
Rate |
withMinValue(double minValue)
Specifies the minimum charge (closest to zero) for variable Rates.
|
Rate |
withNoticeInterval(org.joda.time.Duration interval)
Specifies the minimum interval for rate change notifications for a
variable Rate.
|
Rate |
withNoticeInterval(long hours)
Specifies the minimum interval in hours for rate change notifications
for a variable Rate.
|
Rate |
withTierThreshold(double tierThreshold)
Sets the usage threshold for applicability of this Rate.
|
Rate |
withValue(double value)
Specifies the charge/kWh for a fixed rate, from the customer's viewpoint.
|
Rate |
withWeeklyBegin(org.joda.time.base.AbstractDateTime begin)
Sets the day of the week on which this Rate comes into effect.
|
Rate |
withWeeklyBegin(int begin) |
Rate |
withWeeklyBegin(org.joda.time.ReadablePartial begin)
Sets the day of the week on which this Rate comes into effect.
|
Rate |
withWeeklyEnd(org.joda.time.base.AbstractDateTime end)
Sets the weekly end of applicability for this Rate,
by processing end spec to extract dayOfWeek field.
|
Rate |
withWeeklyEnd(int end)
Sets the weekly end of applicability for this Rate.
|
Rate |
withWeeklyEnd(org.joda.time.ReadablePartial end)
Sets the weekly end of applicability for this Rate,
by processing end spec to extract dayOfWeek field.
|
getId, getTariffId, setTariffId
readResolve
public static final int NO_TIME
public Rate()
public Rate withWeeklyBegin(org.joda.time.base.AbstractDateTime begin)
begin
parameter is processed to extract the dayOfWeek field.public Rate withWeeklyBegin(org.joda.time.ReadablePartial begin)
@StateChange public Rate withWeeklyBegin(int begin)
public int getWeeklyBegin()
public Rate withWeeklyEnd(org.joda.time.base.AbstractDateTime end)
public Rate withWeeklyEnd(org.joda.time.ReadablePartial end)
@StateChange public Rate withWeeklyEnd(int end)
public int getWeeklyEnd()
public Rate withDailyBegin(org.joda.time.base.AbstractDateTime begin)
public Rate withDailyBegin(org.joda.time.ReadablePartial begin)
@StateChange public Rate withDailyBegin(int begin)
public int getDailyBegin()
public Rate withDailyEnd(org.joda.time.base.AbstractDateTime end)
public Rate withDailyEnd(org.joda.time.ReadablePartial end)
@StateChange public Rate withDailyEnd(int end)
public int getDailyEnd()
public Rate withNoticeInterval(org.joda.time.Duration interval)
@StateChange public Rate withNoticeInterval(long hours)
public long getNoticeInterval()
public boolean addHourlyCharge(HourlyCharge newCharge)
@StateChange public boolean addHourlyCharge(HourlyCharge newCharge, boolean publish)
public double getTierThreshold()
@StateChange public Rate withTierThreshold(double tierThreshold)
public double getMinValue()
@StateChange public Rate withMinValue(double minValue)
public double getMaxValue()
@StateChange public Rate withMaxValue(double maxValue)
public double getMaxCurtailment()
@StateChange public Rate withMaxCurtailment(double value)
public boolean isFixed()
@StateChange public Rate withFixed(boolean fixed)
public boolean isTimeOfUse()
public double getExpectedMean()
@StateChange public Rate withExpectedMean(double value)
public TreeSet<HourlyCharge> getRateHistory()
public boolean applies()
public boolean applies(org.joda.time.base.AbstractInstant when)
public boolean applies(double usage)
public boolean applies(double usage, org.joda.time.base.AbstractInstant when)
@StateChange public Rate withValue(double value)
public double getValue()
public double getValue(org.joda.time.base.AbstractInstant when)
public double getValue(org.joda.time.base.AbstractInstant when, TariffEvaluationHelper helper)
public boolean isValid(TariffSpecification spec)
public boolean isValid(PowerType powerType)
Copyright © 2019 Power TAC. All rights reserved.