import { Params as GoalSeekParams } from 'goal-seek'; import LoadProfile from '../LoadProfile'; import PriceProfile from '../PriceProfile'; import RateElement from '../RateElement'; import BillingDeterminants from '../billingDeterminants/_BillingDeterminants'; import { BillingCategory, RateElementClassification, RateElementTypeEnum } from '../constants'; /** * Here's an example rate definition, with the types of the * elements shown on the right * * { : RateInterface * "name": "E-1", : string * "title": "Residential Services", : string * "rateElements": [ : * { : RateElementInterface * "rateElementType": "FixedPerDay", : RateElementType * "name": "Delivery Charge", : string * "rateComponents": [ : * { : RateComponentInterface * "name": "Delivery Charge", : string * "charge": 0.39167 : number | number[] * } : * ] : * }, : * { : RateElementInterface * "rateElementType": "FixedPerMonth", : RateElementType * "name": "California Clean Climate Credit", : string * "rateComponents": [ : * { : * "name": "California Clean Climate Credit", : string * "charge": [0, 0, 0, -38.39, 0, 0, 0, 0, 0, -38.39, 0, 0] : number | number[] * } : * ] : * } : * ] : * } : */ export interface RateCalculatorInterface { name: string; utilityName?: string; applicability?: string; minimumBillAmount?: number; rateElements: Array; loadProfile: LoadProfile; } export interface RateInterface { name: string; title: string; rateElements: Array; } interface BaseRateElementInterface { id?: string; name: string; billingCategory?: BillingCategory; } interface BaseRateComponentInterface { charge: number | Array; name: string; } type BaseRateElementType = AnnualDemandRateElementInterface | BlockedTiersInDaysRateElementInterface | BlockedTiersInMonthsRateElementInterface | DemandRateElementInterface | DemandPerDayRateElementInterface | DemandTiersInMonthsRateElementInterface | DemandTimeOfUseRateElementInterface | EnergyTimeOfUseRateElementInterface | FixedPerDayRateElementInterface | FixedPerMonthRateElementInterface | HourlyEnergyRateElementInterface | MonthlyDemandRateElementInterface | MonthlyEnergyRateElementInterface; export type RateElementInterface = BaseRateElementType | UnprocessedSurchargeAsPercentRateElementInterface; export type ProcessedRateElementInterface = BaseRateElementType | ProcessedSurchargeAsPercentRateElementInterface; export type RateComponentInterface = RateElementInterface['rateComponents'][number]; export type RateElementType = RateElementInterface['rateElementType']; export interface EnergyTimeOfUseRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.EnergyTimeOfUse; rateComponents: Array; } export interface BlockedTiersInDaysRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.BlockedTiersInDays; rateComponents: Array; } export interface BlockedTiersInMonthsRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.BlockedTiersInMonths; rateComponents: Array; } export interface FixedPerDayRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.FixedPerDay; rateComponents: Array; } export interface FixedPerMonthRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.FixedPerMonth; rateComponents: Array; } export interface MonthlyDemandRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.MonthlyDemand; rateComponents: Array; } export interface AnnualDemandRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.AnnualDemand; rateComponents: Array; } export interface MonthlyEnergyRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.MonthlyEnergy; rateComponents: Array; } export interface UnprocessedSurchargeAsPercentRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.SurchargeAsPercent; rateComponents: Array; } export interface ProcessedSurchargeAsPercentRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.SurchargeAsPercent; rateComponents: Array; } export interface HourlyEnergyRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.HourlyEnergy; priceProfile: Array | PriceProfile; rateComponents: Array; } export interface DemandTiersInMonthsRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.DemandTiersInMonths; rateComponents: Array; } export interface DemandTimeOfUseRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.DemandTimeOfUse; rateComponents: Array; } export interface DemandPerDayRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.DemandPerDay; rateComponents: Array; } export interface DemandRateElementInterface extends BaseRateElementInterface { rateElementType: RateElementTypeEnum.Demand; rateComponents: Array; } export interface RateComponentArgs { charge: number | Array; name: string; billingDeterminants: BillingDeterminants; } export interface DetailedPriceProfileHour extends ExpandedDate { price: number; } export interface PriceProfileOptions { year: number; } export type GoalSeekArgs = Partial; export interface LoadProfileScalerOptions { debug: boolean; } export interface LoadProfileFilterArgs { months?: Array; daysOfWeek?: Array; hourStarts?: Array; onlyOnDays?: Array; exceptForDays?: Array; hoursOfYear?: Array; } export interface DetailedLoadProfileHour extends ExpandedDate { load: number; } export interface LoadProfileOptions { year: number; } export interface BlockedTiersArgs extends LoadProfileFilterArgs { min: Array; max: Array; } export type DemandPerDayArgs = LoadProfileFilterArgs; export type DemandTimeOfUseArgs = LoadProfileFilterArgs; export type EnergyTimeOfUseArgs = LoadProfileFilterArgs; export interface HourlyEnergyArgs { hourOfYear: number; } export interface SurchargeAsPercentArgs { rateElement: RateElement; } export interface ExpandedDate { month: number; hourStart: number; dayOfWeek: number; date: string; hourOfYear: number; } export interface ValidatorError { english: string; type: string; data: Record; } export interface LabeledError { label: string; errors: Array; } export interface MinMaxPair { min: number; max: number; } export interface RateElementFilterArgs { ids?: Array; classifications?: Array; billingCategories?: Array; } export type DemandPeriod = 'monthly' | 'daily' | 'annual'; export type AveragingDemandPeriod = 'monthly' | undefined; export interface DemandArgs extends LoadProfileFilterArgs { demandPeriod: DemandPeriod; averagingPeriod?: AveragingDemandPeriod; averagingQty?: number; min?: number | 'Infinity'; max?: number | 'Infinity'; } /** * Export type definitions of classes so they can be referenced by clients of this package */ export type { default as RateElement } from '../RateElement'; export type { default as RateComponent } from '../RateComponent';