Licensing

License Certificate

class mhi.pscad.Certificate(row_id, node, features)

PSCAD License Certificate

Identification

Certificate.id()

Returns the ID of the Certificate

Certificate.name()

Returns the ‘Product Name’ for the Certificate

Certificate.account()

Returns the ‘Account Name’ for the Certificate

Certificate.available()

Returns the # of available Certificates

Certificate.total()

Returns the total # of Certificates

Features

Certificate.features()

Returns the list of all features associated with the Certificate. Note: This even includes Features where no instances of that feature are owned.

Certificate.feature(key)

Returns a Feature associated with the Certificate. The feature may be specified by name (such as “Freq Dep Network Equivalent”) or by an integer id (such as 17).

Requirements

Certificate.meets(requirements)

Tests if the certificate meets the given list of requirements.

Parameters:

requirements

A list of requirements. Each requirement may be given as:

  • a string or integer, in which case the certificate must own the corresponding feature,

  • a (feature_name_or_id, lower_limit) tuple, in which case the feature must have a value greater than or equal to the limit.

Example:

# Does `cert` allow black boxing and 20 or more EMTDC instances?
cert.meets(["Blackboxing", ("EMTDC Instances", 20)])
Certificate.meet(key, req)

Tests if the certificate meets the given requirement.

Parameters:
  • key – a feature name or the corresponding integer value

  • req

    one of:

    • a string: exact match of feature value

    • a boolean: exact match of feature value

    • an int: exact match of feature value

    • a tuple: range of values [low,high] that can match the feature

Example:

# Does `cert` disallow black boxing?
cert.meets("Blackboxing", False)
Certificate.cost()

The certificate cost may be used by the license selection logic to determine which license to acquire from the set of all licenses which meet the list of requested features. The ‘cheapest’ license would be choosen.

This function returns a cost using a default heuristic. The method may be overridden by setting the class member Certificate.COST.

License Features

class mhi.pscad.Feature

A feature of a license Certificate.

Identification

Feature.id()

Returns the Feature’s ID.

Feature.name()

Returns the Feature’s name.

Feature.value()

Returns the Feature’s value.

Feature.cost()

Computes the ‘cost’ of a feature.

Feature.COSTS is a dictionary, indexed by feature name, of tuples containing the fixed and variable cost for a feature:

fixed, variable = COSTS[feature.name()]
cost = fixed + variable * feature.value()

The certificate cost is used by the license selection logic to determine which license to acquire from the set of all licenses which meet the list of requested features. The ‘cheapest’ license is choosen.

The fixed and variable costs specified here are arbitrary, and may be changed to alter the license selection.