HB Temporal interpolation

Temporal interpolation for a HB/TSM computation.


Input Parameters

The following keys can be set:

  • base – (type = antares.Base ) – The Base that will be temporally interpolated

  • hb_computation – (default = in_attr, type = antares.HbComputation, can use in_attr = yes ) – The object that defines the attributes of the current HB/TSM computation

  • time – (default = 0.0, type = float or list or numpy array (1D length), can use in_attr = yes ) – Time instant at which solution is sought

  • coordinates – (type = tuple/list of variables ) – Coordinates variables that won’t be interpolated

Initialization

To initialize a temporal interpolation object:

>>> treatment = Treatment('hbinterp')

Main functions

class antares.hb.TreatmentHbinterp.TreatmentHbinterp
execute()

Execute the treatment.

Returns

the base containing the results

Return type

antares.Base

Example

"""
This example illustrates the temporal interpolation
treatment on a single frequency (TSM) computation.
"""
import os
if not os.path.isdir('OUTPUT'):
    os.makedirs('OUTPUT')

from antares import HbComputation, Reader, Treatment, Writer

# ------------------
# Reading the files
# ------------------
reader = Reader('bin_tp')
reader['filename'] = os.path.join('..', 'data', 'HARMONIC_BALANCE', 'flow_<zone>.dat')
reader['n_hbt'] = 1
ini_base = reader.read()

# -------------------------------
# Create an HbComputation object
# -------------------------------
hb_comp = HbComputation()
hb_comp['frequencies'] = [6.2344674e-04]
ini_base.attrs['hb_computation'] = hb_comp

# -------------------
# HbInterpolation
# -------------------
treatment = Treatment('hbinterp')
treatment['base'] = ini_base
treatment['time'] = 17.14957
result = treatment.execute()

# -------------------
# Writing the result
# -------------------
writer = Writer('bin_tp')
writer['filename'] = os.path.join('OUTPUT', 'ex_hbinterp.plt')
writer['base'] = result
writer.dump()