Formulas and Time Series¶
The Formula / Time Series Editor (F/TSE) lets you set a parameter with a formula, with time series data, or with both. Most numeric entries in PyGREET entities support it. Parameters depend on context and appear throughout the application.
To open it, right-click a numeric input.
Use formulas and time series to keep calculations consistent and accurate across a life cycle analysis, for example when you model resource consumption, energy use and emissions.
The figure shows the editor in its full-size mode. It holds a Piecewise formula with two flow sources, lhv_1 from Natural Gas and lhv_2 from Crude Oil. The result block and the time series are filled.

The F/TSE has three components:
- The formula editor
- The local parameters table
- The time series table
Formula Editor¶
The formula editor sets a parameter with a formula and references to variables.
- Select the Value / Formula cell and enter a formula.
- Read the Result in the result block on the left.
- Describe the formula in the Notes box if you want to.
- Read any Errors at the top of the formula editor.
Formulas You Can Enter¶
| Kind | Example |
|---|---|
| Numeric value | 100.251 |
| Numeric formula | 100 * 5 + 1 |
| Formula with local parameters | 100 * parameter_1 |
| Numeric value with registered units | pi * J/mˆ3 |
Functions You Can Use¶
The formula editor allows most mathematical operations, including these functions:
| Function | Full Name | Example or Explanation |
|---|---|---|
max |
Maximum | max(3, 7, 2) → 7 |
ceil |
Ceiling | ceil(4.2) → 5 (rounds up to nearest integer) |
min |
Minimum | min(3, 7, 2) → 2 |
avg |
Average | avg(2, 4, 6) → 4 |
abs |
Absolute Value | abs(-5) → 5 |
log |
Natural Logarithm | log(e) → 1 (base e) |
exp |
Exponential | exp(2) → e² ≈ 7.389 |
sin |
Sine | sin(π/2) → 1 |
csc |
Cosecant | csc(x) = 1/sin(x) |
cos |
Cosine | cos(0) → 1 |
sec |
Secant | sec(x) = 1/cos(x) |
tan |
Tangent | tan(π/4) → 1 |
cot |
Cotangent | cot(x) = 1/tan(x) = cos(x)/sin(x) |
asin |
Arc Sine (Inverse Sine) | asin(1) → π/2 |
acsc |
Arc Cosecant | acsc(x) = asin(1/x) |
acos |
Arc Cosine (Inverse Cosine) | acos(1) → 0 |
asec |
Arc Secant | asec(x) = acos(1/x) |
atan |
Arc Tangent (Inverse Tangent) | atan(1) → π/4 |
acot |
Arc Cotangent | acot(1) → π/4 |
atan2 |
Two-Argument Arc Tangent | atan2(y, x) → angle in radians, accounts for quadrant |
sinh |
Hyperbolic Sine | sinh(x) = (eˣ - e⁻ˣ)/2 |
cosh |
Hyperbolic Cosine | cosh(x) = (eˣ + e⁻ˣ)/2 |
tanh |
Hyperbolic Tangent | tanh(x) = sinh(x)/cosh(x) |
coth |
Hyperbolic Cotangent | coth(x) = cosh(x)/sinh(x) |
sech |
Hyperbolic Secant | sech(x) = 1/cosh(x) |
asinh |
Inverse Hyperbolic Sine | asinh(x) = ln(x + √(x² + 1)) |
atanh |
Inverse Hyperbolic Tangent | atanh(0.5) ≈ 0.549 |
acoth |
Inverse Hyperbolic Cotangent | acoth(x) = atanh(1/x) |
asech |
Inverse Hyperbolic Secant | asech(x) = acosh(1/x) |
acsch |
Inverse Hyperbolic Cosecant | acsch(x) = asinh(1/x) |
acosh |
Inverse Hyperbolic Cosine | acosh(1) → 0 |
csch |
Hyperbolic Cosecant | csch(x) = 1/sinh(x) |
Piecewise((a₁, c₁), (a₂, c₂), ...) |
Piecewise Function | Piecewise((x, x>0), (-x, x<=0)) → returns x if positive, -x otherwise (absolute value) |
Nonlinear functions, such as sin and cos, do not support values with units.
Local Parameters Table¶
The local parameters table lets you use other values in PyGREET as variables in formulas.
Add a Local Parameter¶
- Select the
+icon in the source column. - Search for a parameter. Parameters match on text found in your search.
A parameter has this form:
Note
The subsection is optional and may be missing.
Manage Local Parameters¶
For each local parameter you added, you can:
- View the value of the parameter.
- Rename it to give it a meaningful local name.
- Select the time series year of the parameter.
- Add a note, if you want to.

When you hover over a local parameter, as the figure above shows, you can also:
- Remove the local parameter.
- Select the magnifier icon to search the library for the parent object where the parameter was defined, using a filter such as
@Flow/NEW Flow 2. - Select the clipboard icon to copy the full path to where the parameter was declared in the parent object, for example
Flow: [NEW Flow 2] -> cratio.
Time Series Table¶
The time series table holds time series data for a parameter. When PyGREET uses the parameter, it takes the data of the closest year at or before the simulation year. If every year in the table is later than the simulation year, it takes the earliest one.
For example, a parameter has data for 1999, 2010 and 2020. For a simulation year of 2006, PyGREET uses the data from 1999. For 2010 to 2019 it uses the data from 2010, and for 1990 it uses the data from 1999.
Add Time Series Data¶
- Select the
+icon next to the year column. - Choose the year in the list in the new row of the table.
- To edit a year, select it in the time series data.