Skip to main content

Constructors

Functions that create or construct variables

AnnualCalendar

A constructor to create a calendar of annual frequency.

Syntax

cal = AnnualCalendar()

BlockCalendar

A constructor to create a calendar for a period of the day.

This is usually used for electricity blocks, such as peak, off-peak, morning etc.

Syntax

cal = BlockCalendar(holiday, observed, start, end)
cal = BlockCalendar(holiday, observed, start, end, timezone)

Examples

qh = IntradayCalendar("15m")
bc = BlockCalendar(null, qh, 4, 5)

Also see: IntradayCalendar and HourlyBlockCalendar

CurveDate

A constructor to create a curve date.

A curve date consists of a date and an expiry calendar

Syntax

cd = CurveDate(date, expirycalendar)

Example

// Using the code for an Expiry Calendar 
cd = CurveDate("2023-03-15", "#REOMHENG")

// Using an actual expiry calendar
expcal = ${expiry:"#REOMHENG"}
cd = CurveDate("2023-03-15", expcal)

HourlyBlockCalendar

A constructor to create an hourly calendar for a period of the day.

This is usually used for electricity blocks, such as peak, off-peak, morning etc.

Syntax

cal = HourlyBlockCalendar(holiday, start, end)
cal = HourlyBlockCalendar(holiday, start, end, timezone)

Examples

#OP1 = HourlyBlockCalendar(DailyCalendar(), 0, 7)
#OP1.name = "Off-Peak 1"

Also see: IntradayCalendar and BlockCalendar

IntradayCalendar

A constructor to create an intraday calendar

An intraday calendar is a regular calendar with a period size of less than a day, e.g. hourly

Syntax

cal = IntradayCalendar(duration)
cal = IntradayCalendar(duration, holiday)
cal = IntradayCalendar(duration, holiday, withouthours)
cal = IntradayCalendar(duration, holiday, withouthours, timezone)
cal = IntradayCalendar(duration, holiday, withouthours, timezone, useHolidays)

Examples

// Create an hourly calendar
hourly = IntradayCalendar(1h)

// Create a half-hourly calendar
hh = IntradayCalendar(30m)

// Create an hourly calendar from 07:00 to 19:00 inclusive
peak = IntradayCalendar(1h, hcal, [0,1,2,3,4,5,6,20,21,22,23])

// Using a timezone
#NERC = ${calendar:"#NERC"}
PJMPEAK = IntradayCalendar(1h, #NERC, [0,1,2,3,4,5,22,23], "US/Central")

// Using a timezone and marking holiday days as full day
PJMOFFPEAK = IntradayCalendar(1h, #NERC, [6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21], "US/Central", true)

Also see: BlockCalendar and HourlyBlockCalendar

String

A constructor to create a String. This function is needed when you want to retain the fact that this is to be used as a string and not automatically converted to a number or boolean.

Syntax

string_var = String(text)

Example

// Retain the zeros at the start
print String("001234")

// Will be converted to a number
print "001234"
001234
1234