CableData

class CableData(dll: SofDll)

Bases: object

This class provides methods and a data structure to:

  • access keys 160/00 of the CDB file;

  • store the retrieved data in a convenient format;

  • provide access to the data after the CDB is closed.

The underlying data structure is a pandas.DataFrame with the following columns:

  • GROUP element group

  • ELEM_ID element number

  • N1 id of the first node

  • N2: id of the second node

  • L0: initial length [m]

  • PROPERTY: property number (cross-section)

The DataFrame uses a MultiIndex with level ELEM_ID to enable fast lookups via the get method. The index column is not dropped from the DataFrame.

Note

Not all available quantities are retrieved and stored. In particular:

  • normal direction

  • prestress

  • element slip

  • maximum tension force

  • yielding load

  • reference axis

are currently not included.

This is a deliberate design choice and may be changed in the future without breaking the existing API.

clear() None

Clear all the loaded data.

get(element_id: int, quantity: str, default: float | int | None = None) float | int

Retrieve the requested cable quantity.

Parameters:
  • element_id (int) – Cable element number

  • quantity (str) –

    Quantity to retrieve. Must be one of:

    • "N1"

    • "N2"

    • "L0"

    • "PROPERTY"

  • default (float or int or None, default None) – Value to return if the requested quantity is not found

Returns:

value – The requested quantity if found. Otherwise, returns default when it is not None.

Return type:

float or int

Raises:

LookupError – If the requested quantity is not found and default is None.

get_data(deep: bool = True) DataFrame

Return the pandas.DataFrame containing the loaded key 160/00.

Parameters:

deep (bool, default True) – When deep=True, a new object will be created with a copy of the calling object’s data and indices. Modifications to the data or indices of the copy will not be reflected in the original object (refer to pandas.DataFrame.copy() documentation for details).

load() None

Retrieve all cable data. If the key does not exist or it is empty, a warning is raised only if echo_level > 0.