Licensing#
License Certificate#
- class mhi.pscad.Certificate(row_id, node, features)#
PSCAD License Certificate
Identification#
Features#
Requirements#
- Certificate.meets(requirements: List[str | int | Tuple[str | int, int]]) bool#
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: str | int, req: str | int | bool | Tuple[int, int]) bool#
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.meet("Blackboxing", False)
- Certificate.cost() float#
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.cost() float#
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.