yaml_parser module

This module provides functionality for creating a Fedem model based on a YAML-formatted input file. The following keywords are recognized when parsing the input file:

target_file - specifies the name of the fmm-file to be created
source_file - specifies an fmm-file to be used as template for the model.
file_exists - specified what to do if the target_file already exists:
USE_IT - opens this file for editing existing model
OVERWRITE! - ignores and overwrites any existing file
STOP! - aborts the execution
index - creates a new non-existing file name
fe_parts - imports specified FE data files as a Parts
triads - creates triads at specified global points
triads_from_fe_parts - creates triads at nodal points on specified FE Parts
beam_materials - creates Beam material objects
beam_sections - creates Beam cross section objects
beams - creates Beam element objects
joints - creates Joint objects
loads - create Load objects
virtual_sensors - creates Sensor objects for extraction of response data
functions - creates Function objects (including input functions)
spring_dampers - creates Axial spring/damper objects
edit_fe_parts - modifies the properties of FE Part objects
edit_triads - modifies the properties of Triad objects
edit_joints - modifies the properties of Joint objects
edit_settings - modifies the solver settings

Each keyword (except the first three) are followed by an arbitrary number of lines, where each line defines one object to be created (or edited). The syntax of the input can be either list-based or dictionary based.

This module can also be launched directly using the syntax

python -m fedempy.yaml_parser -f mymodel.yaml

It will then invoke the method yaml_parser.main() on the specified input file (mymodel.yaml).

class yaml_parser.ModelYAML(input_file)[source]

Bases: object

This class contains methods for parsing a YAML-formated input file and creating a Fedem model from it. It is an extension of the class modeler.FedemModeler.

Parameters:
input_filestr

Absolute path to the YAML-formated input file

Methods

build:

Loads and parses all model attributes into the model instance

save:

Saves the model to the input file specified FEDEM model file

solve:

Executes the dynamics solver on the created model.

build(dump_file=None)[source]

Loads and parses all model attributes into the model instance.

Parameters:
dump_filestr, default=None

Absolute path to dump the model data dictionary to

save(save_as=False)[source]

Saves the model with the defined file name, or save it as a new file if save_as is set.

Parameters:
save_asbool, default=False

If True, the model is stored with a new file name

solve()[source]

Executes the dynamics solver on the created model.

yaml_parser.main(input_file, dump_file=None, solve=False)[source]

Main driver.

Parameters:
input_filestr

Absolute path to the YAML-formated input file

dump_filestr, default=None

Absolute path to json-file for dumping the model data dictionary

solvebool, default=False

If True, the dynamics solver is launched on the created model