MobileCrane¶
- class py_crane.mobile_crane.MobileCrane(name: str = 'mobile_crane', description: str = 'Simple mobile crane (for FMU testing) with short pedestal, one variable-length elevation boom and a wire', author: str = 'DNV, SEACo project', version: str = '0.3', degrees: bool = True, pedestalMass: str = '10000.0 kg', pedestalCoM: tuple[float, float, float] = (0.5, -1.0, 0.8), pedestalHeight: str = '3.0 m', boomMass: str = '1000.0 kg', boomLength0: str = '8 m', boomLength1: str = '50 m', boomAngle: str = '90deg', wire_mass_range: tuple[str, str] = ('50kg', '2000 kg'), wire_mass: str | None = None, wire_length: float = 1e-6, **kwargs: Any)¶
Bases:
CraneFMUSimple mobile crane for FMU testing purposes. The crane has a short pedestal, one variable-length stiff boom and a wire. The size and weight of the various parts can be configured.
- Parameters:
name (str) – name of the crane type
description (str) – short description
author (str)
version (str)
pedestalMass (str) – mass of the pedestal - quantity and unit as string
pedestalHeight (str) – height (fixed) of the pedestal, with units
boomMass (str) – mass of the single boom, with units
boomLength0 (str) – minimum length of the boom, with units
boomLength1 (str) – maximum length of the boom, with units
- __init__(name: str = 'mobile_crane', description: str = 'Simple mobile crane (for FMU testing) with short pedestal, one variable-length elevation boom and a wire', author: str = 'DNV, SEACo project', version: str = '0.3', degrees: bool = True, pedestalMass: str = '10000.0 kg', pedestalCoM: tuple[float, float, float] = (0.5, -1.0, 0.8), pedestalHeight: str = '3.0 m', boomMass: str = '1000.0 kg', boomLength0: str = '8 m', boomLength1: str = '50 m', boomAngle: str = '90deg', wire_mass_range: tuple[str, str] = ('50kg', '2000 kg'), wire_mass: str | None = None, wire_length: float = 1e-6, **kwargs: Any)¶
Initialize the crane object.
Methods
__init__([name, description, author, ...])Initialize the crane object.
add_boom(*args, **kwargs)Add a boom to the crane.
add_derivative(dername, basename)Add the derivative of basename to the dict of virtual derivatives.
add_variable(*args, **kwargs)Add a variable, automatically including the owner model in the instantiation call.
boom_by_name(name)Retrieve a boom object by name.
booms(*[, reverse])Iterate through the booms.
build([script, project_files, dest, ...])Build the FMU, resulting in the model-name.fmu file.
calc_statics_dynamics([dt])Run calc_statics_dynamics() on all booms in reverse order, to get all Boom._c_m_sub and dynamics updated.
check_flags(flags)Check and collect provided flags dictionary and return the non-default flags.
dirty_do()Run on_set on all dirty variables.
dirty_ensure(var)Ensure that the variable var is registered in self._dirty.
do_step(current_time, step_size)Do a simulation step of size 'step_size at time 'currentTime.
ensure_boom(boom)Ensure that the boom is registered before structured variables are added to it.
ensure_requirements(existing_file, temp_file)Return the path to the component-model requirements file.
enter_initialization_mode()exit_initialization_mode()Initialize the model after initial variables are set.
get_boolean(vrs)get_integer(vrs)get_real(vrs)get_string(vrs)log(msg[, status, category, debug])Log a message to the FMU logger.
make_copyright_license([copyright, license])Prepare a copyright notice (one line) and a license text (without copyright line).
owner_hierarchy(parent)Analyse the parent of a variable down to the Model and return the owners as list.
ref_to_var(vr)Find Variable and sub-index (for compound variable), based on a value_reference value.
register_variable(var[, nested])Register a variable as FMU interface.
rot([rpy])Get/Set a new absolute rotation through an Euler angle.
rotate(rpy[, absolute])Set the orientation to a new value according to ISO 1151–2 (roll,pitch,yaw) - rotations.
set_boolean(vrs, values)set_integer(vrs, values)set_real(vrs, values)set_string(vrs, values)setup_experiment([start_time, stop_time, ...])Minimum version of setup_experiment, just setting the start_time.
terminate()to_crane_angle_default(rpy)Transform the given extrinsic euler angles into the the coordinate system used by the crane.
to_xml([model_options])Build the XML FMI2 modelDescription.xml tree.
variable_by_name(name)Return Variable object related to name, or None, if not found.
vars_iter([key])Iterate over model variables ('vars').
xml_unit_definitions()Make the xml element for the unit definitions used in the model.
Attributes
angularGet the current euler angle of the crane (internally stored as Rot).
boom0d_angularGet the current angular velocity (euler angles).
dirtyinstanceslog_categoriespositionunitsvelocityto_crane_angle- do_step(current_time: float, step_size: float)¶
Do a simulation step of size ‘step_size at time ‘currentTime. Note: this is only the generic part of this function. Models should call this first through super().do_step and then do their own stuff.