Logo
Telescience Resource Kit
TReK Python  5.4.0 ART
LimitAlarm Class Reference

This class checks a value for violation of defined limits. More...

Inherits NamedItem.

Public Member Functions

Initialize / Finalize

Functions handling class initialization and finalization.

def LimitAlarm ( Optional[LimitAlarm] limit_alarm=None, Optional[c_void_p] native_ptr=None, is_clone: bool=False -> def ) -> def 
 Class initializer. More...
 
def clone ( -> LimitAlarm ) -> def 
 Creates a new instance of the object with the same contents.
 
def copy (copy_from: object -> None ) -> def 
 Copies the contents of the provided 'copy_from' LimitAlarm. More...
 
def initialize ( -> None ) -> def 
 Initializes the object. More...
 
def load_file (filename: str -> None ) -> def 
 Loads the LimitAlarm definition from the specified file. More...
 
def save_file (filename: str -> None ) -> def 
 Saves the LimitAlarm definition to the specified file. More...
 
Configuration Functions

Functions handling limit configurations.

def get_limit_name (level: int -> str ) -> def 
 Gets the name of the limit level. More...
 
def get_limit_type ( -> LimitType ) -> def 
 Gets data type used. More...
 
def set_limit_name (level: int, name: str -> None ) -> def 
 Sets the name for the limit level. More...
 
def set_limit_type (limit_type: LimitType -> None ) -> def 
 Sets limit type. More...
 
Set/Get Limit

Functions handling setting/getting limit values.

def get_high_level_in_use (level: int -> bool ) -> def 
 Determines if a high limit is being used. More...
 
def get_high_limit (level: int -> Union[int, float] ) -> def 
 Gets the value of the high limit for the specified level. More...
 
def get_low_level_in_use (level: int -> bool ) -> def 
 Determines if a low limit is being used. More...
 
def get_low_limit (level: int -> Union[int, float] ) -> def 
 Gets the value of the low limit for the specified level. More...
 
def set_high_limit (level: int, Union[int, float] limit, inclusive: bool=True -> None ) -> def 
 Sets the high limit for the specified level. More...
 
def set_low_limit (level: int, Union[int, float] limit, inclusive: bool=True -> None ) -> def 
 Sets the low limit for the specified level. More...
 
def get_low_limit_inclusive (level: int -> bool ) -> def 
 Determines if low limit comparison is <= (True) or < (False). More...
 
def get_high_limit_inclusive (level: int -> bool ) -> def 
 Determines if high limit comparison is >= (True) or > (False). More...
 
Check / Clear Limit Violations

Functions handling checking and clearing limit violations.

def check ( Union[int, float] value, status: ParameterStatus -> None ) -> def 
 Checks the supplied value for violations of any limits. More...
 
def clear_high_limit (level: int -> None ) -> def 
 Clears the high limit for the specified level. More...
 
def clear_low_limit (level: int -> None ) -> def 
 Clears the low limit for the specified level. More...
 
- Public Member Functions inherited from NamedItem
def remove_all_attributes ( -> None ) -> def 
 Removes all attributes.
 
def remove_attribute (name: str -> None ) -> def 
 Removes the attribute by name. More...
 
def __eq__ (named_item: object -> bool ) -> def 
 Equality operator "==". More...
 
def add_attribute (name: str, value: str -> None ) -> def 
 Adds an attribute to the item. More...
 
def get_alias ( -> str ) -> def 
 Returns the alias of the item. More...
 
def get_attribute (name: str -> str ) -> def 
 Get the value of the specified attribute. More...
 
def get_attribute_list ( -> list[str] ) -> def 
 Gets a list of the attribute names. More...
 
def get_name ( -> str ) -> def 
 Returns the name of the item. More...
 
def get_long_description ( -> str ) -> def 
 Returns the long description of the item. More...
 
def get_short_description ( -> str ) -> def 
 Returns the short description of the item. More...
 
def get_user_description ( -> str ) -> def 
 Returns the user description of the item. More...
 
def get_owner ( -> str ) -> def 
 Returns the owner of the item. More...
 
def get_path ( -> str ) -> def 
 Returns the path for the item. More...
 
def set_name (name: str -> None ) -> def 
 Sets the name of the item. More...
 
def set_alias (alias: str -> None ) -> def 
 Sets the alias of the item. More...
 
def set_short_description (description: str -> None ) -> def 
 Sets the short description of the item. More...
 
def set_long_description (description: str -> None ) -> def 
 Sets the long description of the item. More...
 
def set_user_description (description: str -> None ) -> def 
 Sets the user description of the item. More...
 
def set_owner (owner: str -> None ) -> def 
 Sets the owner of the item. More...
 
def set_path (path: str -> None ) -> def 
 Sets the path of the item. More...
 

Detailed Description

This class checks a value for violation of defined limits.

If a limit violation occurs, the check() method updates the provided ParameterStatus instance. Currently the LimitAlarm supports 5 limit levels (1-5) for high and low and each can be named. These alarms are "nested": Level 5 contains Level 4 contains Level 3 contains Level 2 contains Level 1. Attempting to add high/low limits that cross boundaries will return TREK_DATA_LIMIT_VALUE_TOO_LARGE or TREK_DATA_LIMIT_VALUE_TO_SMALL.

Constructor & Destructor Documentation

◆ LimitAlarm()

(limit_alarm : Optional[LimitAlarm]  
native_ptr : Optional[c_void_p]  
is_clone : bool  
) -> def

Class initializer.

Parameters
[in]limit_alarm(Optional) LimitAlarm to copy.
[in]native_ptr(Optional) Internal parameter, do not provide.
[in]is_clone(Optional) Internal parameter, do not provide.

Reimplemented from NamedItem.

Member Function Documentation

◆ check()

(value : Union[int, float] 
status : ParameterStatus 
) -> None

Checks the supplied value for violations of any limits.

If any limit is violated, the parameter status is updated to reflect the violation. If no limit violations are found, the corresponding status is cleared.

Note
Type determined by set_limit_type(). By default LimitType = LimitType.DOUBLE_LIMITS.
Parameters
[in]valueThe value for which to check limits. This must match the data type set by set_limit_type() (i.e. either uint, int or float)
[in]statusThe ParameterStatus to update for any found violations.
Exceptions
TrekError15044 - TREK_DATA_INCORRECT_LIMIT_TYPE

◆ clear_high_limit()

(level : int ) -> None

Clears the high limit for the specified level.

The level is marked as not in use.

Parameters
[in]levelLevel to clear limit (1-5).
Exceptions
TrekError15048 - TREK_DATA_LIMIT_LEVEL_ERROR

◆ clear_low_limit()

(level : int ) -> None

Clears the low limit for the specified level.

The level is marked as not in use.

Parameters
[in]levelLevel to clear limit (1-5).
Exceptions
TrekError15048 - TREK_DATA_LIMIT_LEVEL_ERROR

◆ copy()

(copy_from : object ) -> None

Copies the contents of the provided 'copy_from' LimitAlarm.

Parameters
[in]copy_fromLimitAlarm to copy from.
Exceptions
TypeErrorif 'copy_from' is not a LimitAlarm.

Reimplemented from NamedItem.

◆ get_high_level_in_use()

(level : int ) -> bool

Determines if a high limit is being used.

Parameters
[in]levelThe level to query (1-5).
Returns
True if limit is in use for the high level specified. False if not in use or does not exists.

◆ get_high_limit()

(level : int ) -> Union[int, float]

Gets the value of the high limit for the specified level.

Parameters
[in]levelThe level for which to get the limit (1-5).
Note
Type determined by set_limit_type(). By default LimitType = LimitType.DOUBLE_LIMITS.
Exceptions
TrekError15044 - TREK_DATA_INCORRECT_LIMIT_TYPE,

15048 - TREK_DATA_LIMIT_LEVEL_ERROR,

15045 - TREK_DATA_LIMIT_LEVEL_NOT_IN_USE

◆ get_high_limit_inclusive()

(level : int ) -> bool

Determines if high limit comparison is >= (True) or > (False).

Parameters
[in]levelThe level for which to get inclusivity value (1-5).

◆ get_limit_name()

(level : int ) -> str

Gets the name of the limit level.

Parameters
[in]levelThe level name requested (1-5).
Returns
Name of the limit level. Blank if unused or invalid level.

◆ get_limit_type()

() -> LimitType

Gets data type used.

Returns
LimitType

◆ get_low_level_in_use()

(level : int ) -> bool

Determines if a low limit is being used.

Parameters
[in]levelThe level to query (1-5).
Returns
True if limit is in use for the low level specified. False if not in use or does not exists.

◆ get_low_limit()

(level : int ) -> Union[int, float]

Gets the value of the low limit for the specified level.

Parameters
[in]levelThe level for which to get the limit (1-5).
Note
Type determined by set_limit_type(). By default LimitType = LimitType.DOUBLE_LIMITS.
Exceptions
TrekError15044 - TREK_DATA_INCORRECT_LIMIT_TYPE,

15048 - TREK_DATA_LIMIT_LEVEL_ERROR,

15045 - TREK_DATA_LIMIT_LEVEL_NOT_IN_USE

◆ get_low_limit_inclusive()

(level : int ) -> bool

Determines if low limit comparison is <= (True) or < (False).

Parameters
[in]levelThe level for which to get inclusivity value (1-5).

◆ initialize()

() -> None

Initializes the object.

Clears any set values in the LimitAlarm. New instances do not need to be initialized.

Reimplemented from NamedItem.

◆ load_file()

(filename : str ) -> None

Loads the LimitAlarm definition from the specified file.

Reads an XML LimitAlarm.

Parameters
[in]filenameThe file from which to load the LimitAlarm object.
Exceptions
TrekError32007 - TUA_XML_PARSER_ERROR,

1 - FAIL,

etc.

◆ save_file()

(filename : str ) -> None

Saves the LimitAlarm definition to the specified file.

Writes an XML LimitAlarm.

Parameters
[in]filenameThe file to save the limit alarm object.
Exceptions
TrekError32007 - TUA_XML_PARSER_ERROR,

1 - FAIL,

etc.

◆ set_high_limit()

(level : int 
limit : Union[int, float] 
inclusive : bool  
) -> None

Sets the high limit for the specified level.

The input value is checked to ensure that it is the correct limit type and also would not violate any other limits previously set.

Note
Type determined by set_limit_type(). By default LimitType = LimitType.DOUBLE_LIMITS.
Parameters
[in]levelThe level for which to get the limit (1-5).
[in]limitThe high value for the alarm.
[in]inclusiveDetermines if comparison is >= (True) or > (False).
Exceptions
TrekError15048 - TREK_DATA_LIMIT_LEVEL_ERROR,

15044 - TREK_DATA_INCORRECT_LIMIT_TYPE,

15046 - TREK_DATA_LIMIT_VALUE_TOO_SMALL,

15047 - TREK_DATA_LIMIT_VALUE_TOO_LARGE

◆ set_limit_name()

(level : int 
name : str 
) -> None

Sets the name for the limit level.

Parameters
[in]levelThe level to name (1-5).
[in]nameThe level name.
Exceptions
TrekError15048 - TREK_DATA_LIMIT_LEVEL_ERROR

◆ set_limit_type()

(limit_type : LimitType ) -> None

Sets limit type.

Parameters
[in]limit_typeType of limit (int, double uint).

◆ set_low_limit()

(level : int 
limit : Union[int, float] 
inclusive : bool  
) -> None

Sets the low limit for the specified level.

The input value is checked to ensure that it is the correct limit type and also would not violate any other limits previously set.

Note
limit parameter type determined by set_limit_type(). By default LimitType = LimitType.DOUBLE_LIMITS. If set_limit_type().
Parameters
[in]levelThe level for which to set the limit (1-5).
[in]limitThe low value for the alarm.
[in]inclusiveDetermines if comparison is <= (True) or < (False).
Exceptions
TrekError15048 - TREK_DATA_LIMIT_LEVEL_ERROR,

15044 - TREK_DATA_INCORRECT_LIMIT_TYPE,

15046 - TREK_DATA_LIMIT_VALUE_TOO_SMALL,

15047 - TREK_DATA_LIMIT_VALUE_TOO_LARGE