Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions RFEM/LoadCasesAndCombinations/loadCombination.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
from RFEM.initModel import Model, clearAtributes
from RFEM.enums import AnalysisType

class LoadCombination():
def __init__(self,
no: int = 1,
analysis_type = AnalysisType.ANALYSIS_TYPE_STATIC,
design_situation: int = 1,
user_defined_name = [False],
static_analysis_settings: int = 1,
consider_imperfection: bool = False,
consider_initial_state: bool = False,
structure_modification: bool = False,
to_solve: bool = True,
combination_items = [[1.5, 1, 0, False]],
comment: str = '',
params: dict = {}):

# Client model | Load Combination
clientObject = Model.clientModel.factory.create('ns0:load_combination')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)

# Load Combination No.
clientObject.no = no

# Analysis Type
clientObject.analysis_type = analysis_type.name

# Design Situation Assignment
clientObject.design_situation = design_situation

# Combination Name
clientObject.user_defined_name_enabled = user_defined_name[0]
if user_defined_name[0]:
clientObject.name = user_defined_name[1]

# Analysis Settings Assignment
clientObject.static_analysis_settings = static_analysis_settings

# Consider Imperfection Options
clientObject.consider_imperfection = consider_imperfection

# Consider Initial State
clientObject.consider_initial_state = consider_initial_state

# Structure Modification Enable
clientObject.structure_modification_enabled = structure_modification

# Decide to Solve
clientObject.to_solve = to_solve

# Comment
clientObject.comment = comment

# Adding optional parameters via dictionary
for key in params:
clientObject[key] = params[key]

# Items
clientObject.items = Model.clientModel.factory.create('ns0:load_combination.items')

for i,j in enumerate(combination_items):
mlvlp = Model.clientModel.factory.create('ns0:load_combination_items')
mlvlp.no = i+1
mlvlp.factor = combination_items[i][0]
mlvlp.load_case = combination_items[i][1]
mlvlp.action = combination_items[i][2]
mlvlp.is_leading = combination_items[i][3]
mlvlp.gamma=0
mlvlp.psi=0
mlvlp.xi=0
mlvlp.k_fi=0
mlvlp.c_esl=0
mlvlp.k_def=0
mlvlp.psi_0=0
mlvlp.psi_1=0
mlvlp.psi_2=0
mlvlp.fi=0
mlvlp.gamma_0=0
mlvlp.alfa=0
mlvlp.k_f=0
mlvlp.phi=0
mlvlp.rho=0
mlvlp.omega_0=0
mlvlp.gamma_l_1=0
mlvlp.k_creep=0
mlvlp.shift=0
mlvlp.amplitude_function_type = "CONSTANT"


clientObject.items.load_combination_items.append(mlvlp)

# Add Load Combination to client model
Model.clientModel.service.set_load_combination(clientObject)
6 changes: 6 additions & 0 deletions RFEM/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,12 @@ class CqsDampingRule(Enum):
'''
CONSTANT_FOR_EACH_MODE, DIFFERENT_FOR_EACH_MODE = range(2)

class AmplitudeFunctionType(Enum):
'''
Amplitude Function Type
'''
CONSTANT, LINEAR, QUADRATIC = range(3)

class PlausibilityCheckResult(Enum):
'''
Plausibility Check Result
Expand Down
36 changes: 36 additions & 0 deletions UnitTests/test_loadCombination.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import os
import sys
PROJECT_ROOT = os.path.abspath(os.path.join(
os.path.dirname(__file__),
os.pardir)
)
sys.path.append(PROJECT_ROOT)

from RFEM.initModel import Model
from RFEM.LoadCasesAndCombinations.staticAnalysisSettings import StaticAnalysisSettings
from RFEM.LoadCasesAndCombinations.loadCase import LoadCase
from RFEM.LoadCasesAndCombinations.loadCombination import *


if Model.clientModel is None:
Model()

def test_loadCombination():

Model.clientModel.service.delete_all()
Model.clientModel.service.begin_modification()

StaticAnalysisSettings.GeometricallyLinear(0, 1, "Linear")

LoadCase(1, 'DEAD', [True, 0.0, 0.0, 1.0])
LoadCase(2, 'LIVE', [False])

LoadCombination(1, AnalysisType.ANALYSIS_TYPE_STATIC, 1, [False], 1, combination_items=[[1.2, 1, 0, True], [1.6, 1, 0, False]])

Model.clientModel.service.finish_modification()

combination = Model.clientModel.service.get_load_combination(1)

assert round(combination.items[0][0][1], 2) == 1.20
assert not combination.items[0][0][4]