Skip to content

interfaces

IBalanceModel

IBalanceModel(
    sagging_temperature: ndarray,
    parameter: ndarray,
    section_array: SectionArray,
    cable_array: CableArray,
    span_model: ISpan,
    deformation_model: IDeformation,
    cable_loads: CableLoads,
    find_param_solver_type: Type[
        IFindParamSolver
    ] = FindParamSolverForLoop,
)

Bases: IModelForSolver, ABC

Interface for balance models. Used by BalanceEngine to find insulator chain positions.

Source code in src/mechaphlowers/core/models/balance/interfaces.py
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
def __init__(
    self,
    sagging_temperature: np.ndarray,
    parameter: np.ndarray,
    section_array: SectionArray,
    cable_array: CableArray,
    span_model: ISpan,
    deformation_model: IDeformation,
    cable_loads: CableLoads,
    find_param_solver_type: Type[
        IFindParamSolver
    ] = FindParamSolverForLoop,
):
    self.adjustment: bool = NotImplemented
    self.sagging_temperature: np.ndarray = sagging_temperature
    self.deformation_model = deformation_model
    self.cable_loads = cable_loads
    self.span_model = span_model
    self.nodes_span_model: ISpan = copy(self.span_model)
    self.parameter: np.ndarray = parameter
    self.cable_array = cable_array
    self.a: np.ndarray
    self.b: np.ndarray
    self.Th: np.ndarray
    self.Tv_d: np.ndarray
    self.Tv_g: np.ndarray
    self.nodes: Any  # Concrete type is Nodes (defined in model_ducloux)
    self.L_ref: np.ndarray

adjustment abstractmethod property writable

adjustment: bool

Boolean indicating if the model is in adjustment mode or change of state mode.

attachment_altitude_after_solve abstractmethod property

attachment_altitude_after_solve: ndarray

Attachment altitude after considering chain displacement.

Format: [z0, z1, z2,...]

has_loads abstractmethod property

has_loads: bool

Indicates if the balance model has loads applied.

state_vector abstractmethod property writable

state_vector: ndarray

Vector of state variables to be optimized.

chain_displacement abstractmethod

chain_displacement() -> ndarray

Get the displacement vectors of the chains.

dxdydz and chain_displacement are the transpose of each other

Format: [[x0, y0, z0], [x1, y1, z1],...]

Source code in src/mechaphlowers/core/models/balance/interfaces.py
111
112
113
114
115
116
117
118
119
@abstractmethod
def chain_displacement(self) -> np.ndarray:
    """Get the displacement vectors of the chains.

    dxdydz and chain_displacement are the transpose of each other

    Format: [[x0, y0, z0], [x1, y1, z1],...]
    """
    pass

dict_to_store

dict_to_store() -> dict

Returns a dictionary of values to store after each loop iteration. Used only for debugging purposes. Can stay empty.

Source code in src/mechaphlowers/core/models/balance/interfaces.py
56
57
58
59
60
def dict_to_store(self) -> dict:
    """Returns a dictionary of values to store after each loop iteration.
    Used only for debugging purposes. Can stay empty.
    """
    return {}

get_dxdydz abstractmethod

get_dxdydz() -> ndarray

Get the dxdydz vector of the nodes.

dxdydz and chain_displacement are the transpose of each other

Format: [[x0, x1, x2,...], [y0, y1, y2,...], [z0, z1, z2,...]]

Source code in src/mechaphlowers/core/models/balance/interfaces.py
121
122
123
124
125
126
127
128
129
@abstractmethod
def get_dxdydz(self) -> np.ndarray:
    """Get the dxdydz vector of the nodes.

    dxdydz and chain_displacement are the transpose of each other

    Format: [[x0, x1, x2,...], [y0, y1, y2,...], [z0, z1, z2,...]]
    """
    pass

objective_function abstractmethod

objective_function() -> ndarray

Function to minimize that depends on state_vector.

Source code in src/mechaphlowers/core/models/balance/interfaces.py
46
47
48
49
@abstractmethod
def objective_function(self) -> np.ndarray:
    """Function to minimize that depends on state_vector."""
    pass

reset abstractmethod

Reset the model references, optionally performing a full re-initialization.

Parameters:

Name Type Description Default

cable_array

CableArray

cable data

required

span_model

ISpan

span model

required

deformation_model

IDeformation

deformation model

required

cable_loads

CableLoads

cable loads

required

full

bool

if True, re-initialize all attributes; otherwise only update model references.

False
Source code in src/mechaphlowers/core/models/balance/interfaces.py
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
@abstractmethod
def reset(
    self,
    cable_array: CableArray,
    span_model: ISpan,
    deformation_model: IDeformation,
    cable_loads: CableLoads,
    full: bool = False,
) -> None:
    """Reset the model references, optionally performing a full re-initialization.

    Args:
        cable_array (CableArray): cable data
        span_model (ISpan): span model
        deformation_model (IDeformation): deformation model
        cable_loads (CableLoads): cable loads
        full (bool): if True, re-initialize all attributes; otherwise only update model references.
    """
    pass

update abstractmethod

update() -> None

Update any variables of the model if necessary. Can stay empty.

Source code in src/mechaphlowers/core/models/balance/interfaces.py
51
52
53
54
@abstractmethod
def update(self) -> None:
    """Update any variables of the model if necessary. Can stay empty."""
    pass

update_L_ref abstractmethod

update_L_ref() -> ndarray

Update the reference length L_ref after an adjustment solve.

Source code in src/mechaphlowers/core/models/balance/interfaces.py
95
96
97
98
@abstractmethod
def update_L_ref(self) -> np.ndarray:
    """Update the reference length L_ref after an adjustment solve."""
    pass

update_nodes_span_model abstractmethod

update_nodes_span_model() -> None

Update the span model of the nodes if loads are applied.

Source code in src/mechaphlowers/core/models/balance/interfaces.py
179
180
181
182
@abstractmethod
def update_nodes_span_model(self) -> None:
    """Update the span model of the nodes if loads are applied."""
    pass

vhl_under_chain abstractmethod

vhl_under_chain() -> VhlResult

Get the VHL efforts under chain: without considering insulator_weight. Format: [[V0, H0, L0], [V1, H1, L1], ...] Default unit is daN

Source code in src/mechaphlowers/core/models/balance/interfaces.py
139
140
141
142
143
144
@abstractmethod
def vhl_under_chain(self) -> VhlResult:
    """Get the VHL efforts under chain: without considering insulator_weight.
    Format: [[V0, H0, L0], [V1, H1, L1], ...]
    Default unit is daN"""
    pass

vhl_under_chain_left abstractmethod

vhl_under_chain_left() -> VhlResult

Get the VHL efforts under chain: without considering insulator_weight.

VHL at the left of the support.

Format: [[V0, H0, L0], [V1, H1, L1], ...] Default unit is daN

Source code in src/mechaphlowers/core/models/balance/interfaces.py
146
147
148
149
150
151
152
153
154
@abstractmethod
def vhl_under_chain_left(self) -> VhlResult:
    """Get the VHL efforts under chain: without considering insulator_weight.

    VHL at the left of the support.

    Format: [[V0, H0, L0], [V1, H1, L1], ...]
    Default unit is daN"""
    pass

vhl_under_chain_right abstractmethod

vhl_under_chain_right() -> VhlResult

Get the VHL efforts under chain: without considering insulator_weight.

VHL at the right of the support.

Format: [[V0, H0, L0], [V1, H1, L1], ...] Default unit is daN

Source code in src/mechaphlowers/core/models/balance/interfaces.py
156
157
158
159
160
161
162
163
164
@abstractmethod
def vhl_under_chain_right(self) -> VhlResult:
    """Get the VHL efforts under chain: without considering insulator_weight.

    VHL at the right of the support.

    Format: [[V0, H0, L0], [V1, H1, L1], ...]
    Default unit is daN"""
    pass

vhl_under_console abstractmethod

vhl_under_console() -> VhlResult

Get the VHL efforts under console: considering insulator_weight. Format: [[V0, H0, L0], [V1, H1, L1], ...] Default unit is daN

Source code in src/mechaphlowers/core/models/balance/interfaces.py
166
167
168
169
170
171
@abstractmethod
def vhl_under_console(self) -> VhlResult:
    """Get the VHL efforts under console: considering insulator_weight.
    Format: [[V0, H0, L0], [V1, H1, L1], ...]
    Default unit is daN"""
    pass

IModelForSolver

Bases: ABC

Interface for models used by BalanceSolver. This interface defines the necessary methods and properties that a model in order to be compatible with BalanceSolver.

state_vector abstractmethod property writable

state_vector: ndarray

Vector of state variables to be optimized.

dict_to_store

dict_to_store() -> dict

Returns a dictionary of values to store after each loop iteration. Used only for debugging purposes. Can stay empty.

Source code in src/mechaphlowers/core/models/balance/interfaces.py
56
57
58
59
60
def dict_to_store(self) -> dict:
    """Returns a dictionary of values to store after each loop iteration.
    Used only for debugging purposes. Can stay empty.
    """
    return {}

objective_function abstractmethod

objective_function() -> ndarray

Function to minimize that depends on state_vector.

Source code in src/mechaphlowers/core/models/balance/interfaces.py
46
47
48
49
@abstractmethod
def objective_function(self) -> np.ndarray:
    """Function to minimize that depends on state_vector."""
    pass

update abstractmethod

update() -> None

Update any variables of the model if necessary. Can stay empty.

Source code in src/mechaphlowers/core/models/balance/interfaces.py
51
52
53
54
@abstractmethod
def update(self) -> None:
    """Update any variables of the model if necessary. Can stay empty."""
    pass