ReferenceData#

This module provides a comprehensive collection of reference data objects for multibody simulations.

In multibody simulation, reference data elements enable modularity, reuse, and consistency across model components. This module defines reference data structures such as curves, arrays, and matrices, along with state variable references.

For a complete overview of all the modeling entities and how components integrate, refer back to the msolve.Model module.

class Array(**kwds)#

Specifies a list of instances of type Variable (used by other MotionSolve modeling elements) or numerical constants.

Name

Type

Required

Default

Modifiable

Designable

function

Function

id

Int

Auto

label

Str

name

Str

numbers

Double [0]

0.0

\(\checkmark\)

\(\checkmark\)

routine

Routine

script

Script

size

Int

0

type

Enum

variables

Reference - Variable [0]

Usage

To specify a list of variables, choose type as:

  • X: to store state vector corresponding to the Gse and Tfsiso elements.

  • Y: to store the output vector corresponding to the Gse and Tfsiso elements.

  • U: to store the input vector corresponding to the Gse, Tfsiso and Pinput elements.

To specify a list of constants, choose type as:

  • IC: to store a set of numbers used primarily to specify initial conditions for Gse and Tfsiso elements or to define a set of numbers in the model file and access them from user-written subroutines.

Example

Define Array objects.#
from msolve import *

model = Model(output="array")

ground = Part(ground=True)
global_frame = Marker(part=ground)
Units(system="MKS")

part = Part(mass=1,ip=[1,1,2])
part.cm = Marker(qp=[0,0,0],zp=[0,0,1],xp=[1,0,0])

rev_joint = Joint(type="REVOLUTE")
rev_joint.i = Marker(part=part,qp=[0,0,1],zp=[0,0,101])
rev_joint.j = Marker(part=ground,qp=[0,0,1],zp=[0,0,101])

spring = SpringDamper(type="ROTATION",i=rev_joint.i,j=rev_joint.j,ct=0.5,kt=0)

var = Variable()
var.function = f"-WZ({part.cm.id})+VARVAL({var.id})"

x = Array(type="X",size=2)

u = Array(type="U",size=1,variables=[var])

ic = Array(type="IC",size=2,numbers=[0,1])

See also

For more details, see also Reference: Array.

User Subroutine

The following user subroutine template expects the function signature and return value(s) as shown. Note that this is a placeholder implementation for reference purposes only.

def ARYSUB(id, time, par, npar, dflag, iflag, nvalue):
  value = nvalue*[0.0]  # calculate the values for a user defined array element
  return value

For more information, see MotionSolve Subroutines.

function#

Parameters passed to user defined subroutine.

Info

This attribute can only be used when type = U.

Type=Function

numbers#

List of numerical values when type = IC.

Info

This attribute can only be used when type = IC.

Type=Double [0], Default=0.0, Modifiable, Designable

routine#

The value can be a callable Python function, a Matlab/OML script, or a string that includes the name of a DLL/SO file and the corresponding function name, separated by ‘::’.

Type=Routine

script#

Path and name of the script that contains the routine.

Type=Script

size#

Number of elements in Array.

Type=Int, Default=0

type#

Specifies the type of Array being created.

Type=Enum

Permitted values are:

  • IC

  • U

  • X

  • Y

variables#

List of Variable when type = U.

Info

This attribute can only be used when type = U.

Type=Reference (Variable) [0]

class Curve(**kwds)#
Defines a parametric curve in 3D space.

You can reference this element using Ptcv, Cvcv, Graphics, and function expressions. Curves can be defined via matrix, function or xyz points.

Name

Type

Required

Default

Modifiable

Designable

closed

Bool

False

\(\checkmark\)

curve_points

Bool

False

\(\checkmark\)

function

Function

\(\checkmark\)

id

Int

Auto

is_smooth_linear

Bool

False

label

Str

matrix

Reference - Matrix

\(\checkmark\)

maxpar

Double

1.0

minpar

Double

-1.0

name

Str

routine

Routine

script

Script

smoothing_distance

Double

0.1

xyz

Nodes [0]

Example

Create a circle Curve.#
from msolve import *
import numpy as np

model = Model(output='curve')

units = Units(system="MKS")

ground = Part(ground=True)
global_ref = Marker(part=ground)

part = Part(mass=10, ip=[1]*3, cm=Marker())

seg = np.linspace(0, 1, 101)
radius = 50
curve_points = []

for i, point in enumerate(seg):
  curve_points.append([radius*np.sin(2*np.pi*point),
                       radius*np.sin(2*np.pi*point),
                       0])

curve_points[-1] = curve_points[0] # last and first point must coincide in closed curve

curve = Curve(xyz=list(curve_points), closed=True, curve_points=True)

curve.graphic = CurveGraphic(curve=curve, rm=global_ref, seg=20)

H3dOutput(save=True)

See also

For more details, see also Reference: Parametric Curve.

User Subroutine

The following user subroutine template expects the function signature and return value(s) as shown. Note that this is a placeholder implementation for reference purposes only.

def CURSUB(id, par, npar, alpha, iord, iflag):
  # calculate the values for a user defined curve element and
  # its first and second derivatives with respect to `alpha`
  values =3*[0.0]
  return values

For more information, see MotionSolve Subroutines.

closed#

True if Curve closed in the U parametric space.

Type=Bool, Default=False, Modifiable

curve_points#

True if curve passes through the points.

Type=Bool, Default=False, Modifiable

function#

Parameters passed to user defined subroutine.

Info

This attribute is mutually exclusive with xyz, matrix.

Type=Function, Modifiable

is_smooth_linear#

Enables piece-wise linear interpolation with smoothing of the edges between the individual segments.

Type=Bool, Default=False

makeDesignable(nknots=0, axis='xyz', xbound=None, ybound=None, zbound=None, tol=0.001, periodic=False)#

Make the 3D Curve Designable. The number of Dvs is n*knots, where n is the number of designable axes. If curve.matrix is already designable, then a warning is raised.

This is a method of the Curve class.

matrix#

Matrix element that contains the curve data.

Info

This attribute is mutually exclusive with xyz, function.

Type=Reference (Matrix), Modifiable

maxpar#

The maximum value of U.

Type=Double, Default=1.0

minpar#

The minimum value of U.

Type=Double, Default=-1.0

readyForDesignable()#

Check if the given Curve is ready to be made designable.

This is a method of the Curve class.

routine#

The value can be a callable Python function, a Matlab/OML script, or a string that includes the name of a DLL/SO file and the corresponding function name, separated by ‘::’.

Type=Routine

script#

Path and name of the script that contains the routine.

Type=Script

smoothing_distance#

Controls the smoothing radius of the edges when is_smooth_linear is set

Type=Double, Default=0.1

xyz#

List of [x,y,z] points used by the curve.

Info

This attribute is mutually exclusive with matrix, function.

Type=Nodes [0]

Dcurve#

alias of DeformableCurve

class DeformableCurve(**kwds)#
Specifies a deformable curve that is made to pass through the origins of a specified set of markers, using CUBIC spline interpolation.

These markers may be on separate bodies. As the markers move in space, the curve shape is recalculated using CUBIC spline interpolation, thereby allowing the curve to deform. The curve can be opened or closed.

Name

Type

Required

Default

Modifiable

Designable

end_type_left

Enum

NATURAL

end_type_right

Enum

NATURAL

id

Int

Auto

label

Str

lambda_left

Double

0.0

lambda_right

Double

0.0

markers

Reference - Marker [0]

mrk_id_vec

Alias

name

Str

u_closed

Bool

False

u_span

Double

1.0

\(\checkmark\)

uclosed

Alias

Example

Create a DeformableCurve and its graphic.#
from msolve import *

model = Model(output="def_curve")

ground = Part(ground=True)
global_ref = Marker(body=ground)

body=Part(mass=1, cm=Marker(qp=[100,0,0]), ip=[1e3,1e3,1e3])

mar1 = Marker(body=body, qp=[100,0,0])
mar2 = Marker(body=body, qp=[500,100,200])
mar3 = Marker(body=body, qp=[-100,-200,0])
mar4 = Marker(body=body, qp=[0,300,100])

curve = DeformableCurve(end_type_left  = "NATURAL",
                        end_type_right = "NATURAL",
                        markers        = [mar1, mar2, mar3, mar4],
                        u_span         = 1.
                        )

graphic = DeformableCurveGraphic(dcurve=curve, seg=50)

H3dOutput(save=True)
model.simulate(type="TRANSIENT", end=1, steps=300)
model.generateOutput(visualize=True)

See also

For more details, see also Reference: Deformable Curve.

end_type_left#

Specifies the 2nd derivative condition met at the left end.

Type=Enum, Default=NATURAL

Permitted values are:

  • CANTILEVER

  • NATURAL

  • PARABOLIC

  • PERIODIC

end_type_right#

Specifies the 2nd derivative condition met at the right end.

Type=Enum, Default=NATURAL

Permitted values are:

  • CANTILEVER

  • NATURAL

  • PARABOLIC

  • PERIODIC

lambda_left#

Parameter that controls the left end condition for CUBIC spline interpolation.

Type=Double, Default=0.0

lambda_right#

Parameter that controls the right end condition for CUBIC spline interpolation.

Type=Double, Default=0.0

makeDesignable(nknots=0, axis='xyz', rm=None, xbound=None, ybound=None, zbound=None, tol=0.001, periodic=False)#

Make the DeformableCurve Designable. The number of Dvs is n*knots, where n is the number of designable axes. If dcurve.markers are already designable, then a warning is raised.

This is a method of the DeformableCurve class.

markers#

List of marker that defines this deformed curve.

Type=Reference (Marker) [0]

mrk_id_vec#

Alias of markers.

Type=Alias

readyForDesignable(rm=None)#

Check if the given DeformableCurve is ready to be made Designable.

This is a method of the DeformableCurve class.

u_closed#

True if the Curve is unclosed.

Type=Bool, Default=False

u_span#

Specifies the parametric span of the curve.

Type=Double, Default=1.0, Modifiable

uclosed#

Alias of u_closed.

Type=Alias

class DeformableSurface(**kwds)#
Specifies a deformable surface that is made to pass through the origins of a specified set of markers, using CUBIC spline interpolation.

These markers may be on separate bodies or on a flexible body. As the markers move in space, the surface is recalculated using CUBIC spline interpolation thereby allowing the surface to deform. The surface can be open or closed.

Name

Type

Required

Default

Modifiable

Designable

end_type

Enum

NATURAL

id

Int

Auto

label

Str

markers

Reference - Marker [0]

mrk_id_mtx

Alias

name

Str

u_closed

Bool

False

u_span

Double

1.0

\(\checkmark\)

uclosed

Alias

v_closed

Bool

False

v_span

Double

1.0

\(\checkmark\)

vclosed

Alias

Example

Create a DeformableSurface and its graphic.#
from msolve import *

model = Model(output="def_surface")

ground = Part(ground=True)
global_ref = Marker(body=ground)
Units(length="MILLIMETER")

body=Part(mass=1, ip=[1e3,1e3,1e3], cm=Marker(qp=[100,0,0], zv=[0,0,1]))

mar1 = Marker(body=body, qp=[100,0,0])
mar2 = Marker(body=body, qp=[0,200,0])
mar3 = Marker(body=body, qp=[-100,0,0])
mar4 = Marker(body=body, qp=[0,-200,0])

mar10 = Marker(body=body, qp=[100,0,60])
mar20 = Marker(body=body, qp=[0,200,60])
mar30 = Marker(body=body, qp=[-100,0,60])
mar40 = Marker(body=body, qp=[0,-200,60])

surf = DeformableSurface(end_type  = "NATURAL",
                         markers   = [[mar1,mar2,mar3,mar4],
                                      [mar10,mar20,mar30,mar40],
                                      [mar1,mar2,mar3,mar4]],
                         u_tension = 1.0,
                         v_tension = 1.0,
                         u_closed  = True
                         )

graphic = DeformableSurfaceGraphic(dsurface=surf, u_seg=10, v_seg=50)

H3dOutput(save=True)
model.simulate(type="TRANSIENT", end=1, steps=300)
model.generateOutput(visualize=True)

See also

For more details, see also Reference: Deformable Surface.

end_type#

Define the end type of this deformed surface.

Type=Enum, Default=NATURAL

Permitted values are:

  • NATURAL

  • PARABOLIC

  • PERIODIC

markers#

Markers that define the deformed surface.

Type=Reference (Marker) [0]

mrk_id_mtx#

Alias of markers.

Type=Alias

u_closed#

True if the surface is closed in U direction.

Type=Bool, Default=False

u_span#

Specifies the parametric span of the surface in the U direction.

Type=Double, Default=1.0, Modifiable

uclosed#

Alias of u_closed.

Type=Alias

v_closed#

True if the surface is closed in V direction.

Type=Bool, Default=False

v_span#

Specifies the parametric span of the surface in the V direction.

Type=Double, Default=1.0, Modifiable

vclosed#

Alias of v_closed.

Type=Alias

Dsurface#

alias of DeformableSurface

class FrequencyInput(**kwds)#
Defines a frequency excitation.

It will be applied to the specified marker along a set of degrees of freedom and expressed with respect to the rm marker. It is used if the analysis type is ‘FrequencyResponse’ in simulate or by executing a simulate_frequencyResponse

Name

Type

Required

Default

Modifiable

Designable

amplitude

Function

1.0

\(\checkmark\)

dof

Str

1

\(\checkmark\)

id

Int

Auto

label

Str

marker

Reference - Marker

\(\checkmark\)

name

Str

phase

Function

0.0

\(\checkmark\)

rm

Reference - Marker

\(\checkmark\)

type

Enum

FORCE

\(\checkmark\)

Example

Create a FrequencyInput.#
from msolve import *

model = Model(output="frequency_excitation")

ground = Part(ground=True)
global_ref = Marker(body=ground)

body=Part(mass=5, cm=Marker(qp=[0,0,40], zv=[0,0,1]), ip=[1,1,1])

Units(force="NEWTON",mass="KILOGRAM",length="METER",time="SECOND")
Accgrav(igrav=0,jgrav=0,kgrav=-9.810)
H3dOutput(save=True)

spdp = SpringDamper(type='TRANSLATION', i=body.cm,
  j=global_ref, k=10, c=0.1, length=40)
spdp.geo = SpringDamperGraphic(i=spdp.i, j=spdp.j,
  da=8, db=5, dc=3, lc=25, ld=25, coils=6)

body.geo = Box(cm=body.cm, x=15,y=15,z=15)
ground.geo = Plane(rm=global_ref, xmin=-20,
  xmax=+20, ymin=-20, ymax=+20)

freq = FrequencyInput(
  label      = "frf input",
  type       = "force",
  marker     = body.cm,
  amplitude  = 100,
  dof        = "3",
)

model.simulate_frequencyResponse(
  end               = 10,
  increment_type    = "LOG",
  start             = 0.1,
  steps             = 1000,
  frequency_input   = freq)
amplitude#

The amplitude of FrequencyInput excitation for the selected type expressed in model units.

Type=Function, Default=1.0, Modifiable

dof#

A list of digits from 1 to 6 indicating the degree of freedom subjected to the frequency excitation.

Type=Str, Default=1, Modifiable

classmethod getMsolveType()#

Return the ‘type’ strings that are passed to the API calls ie API_SendOffCommandDeactivateFlag, py_get_post_states

marker#

The Marker where frequency excitation is applied.

Type=Reference (Marker), Modifiable

phase#

The phase of FrequencyInput excitation expressed in [rad].

Type=Function, Default=0.0, Modifiable

rm#

The optional reference Marker in which excitation is specified. Defaults to global frame.

Type=Reference (Marker), Modifiable

type#

Specifies the type of excitation.

Type=Enum, Default=FORCE, Modifiable

Permitted values are:

  • ACCELERATION

  • DISPLACEMENT

  • FORCE

  • VELOCITY

class Matrix(**kwds)#

Defines a general, real-valued, M x N matrix for use in MotionSolve.

Name

Type

Required

Default

Modifiable

Designable

columns

Int

0

\(\checkmark\)

full

Enum

\(\checkmark\)

function

Function

\(\checkmark\)

i

Int [0]

id

Int

Auto

j

Int [0]

label

Str

name

Str

routine

Routine

rows

Int

0

\(\checkmark\)

script

Script

sparse

Bool

False

\(\checkmark\)

values

Double [0]

\(\checkmark\)

Example

For an example, see Lse.

See also

For more details, see also Reference: Matrix.

User Subroutine

The following user subroutine template expects the function signature and return value(s) as shown. Note that this is a placeholder implementation for reference purposes only.

def MATRIX_READ(id, par, npar):
  errflg = py_put_matrix(matrix_id, num_rows, num_cols, row_indices, col_indices, values)
  return errflg

For more information, see MotionSolve Subroutines.

columns#

The number of columns in the matrix.

Type=Int, Default=0, Modifiable

full#

Set to ‘RORDER’ if the matrix is specified in row order.

Info

This attribute is mutually exclusive with sparse, function.

Type=Enum, Modifiable

Permitted values are:

  • CORDER

  • RORDER

function#

Parameters passed to user defined subroutine.

Info

This attribute is mutually exclusive with full, sparse.

Type=Function, Modifiable

i#

Row position of each element.

Type=Int [0]

j#

Column position of each element.

Type=Int [0]

routine#

The value can be a callable Python function, a Matlab/OML script, or a string that includes the name of a DLL/SO file and the corresponding function name, separated by ‘::’.

Type=Routine

rows#

The number of rows in the matrix.

Type=Int, Default=0, Modifiable

script#

Path and name of the script that contains the routine.

Type=Script

sparse#

Set to True for sparse matrices.

Info

This attribute is mutually exclusive with full, function.

Type=Bool, Default=False, Modifiable

values#

Specifies the elements of the matrix.

Type=Double [0], Designable

class ReferenceData#

Base class for reference data objects.

The objects derived from ReferenceData are:

active#

Defines the state of this object.

Type=Bool, Default=True

class Spline(**kwds)#
Defines a 2D or 3D spline for use in MotionSolve.

Splines have many varied applications in MotionSolve, for example they can be used to define non-linear characteristics of a Force or a Motion. Once constructed, a Spline may be plotted directly via plot function to produce a 2D curve or a 3D surface without any further data wrangling.

Examples

from msolve import *

spl2 = Spline(x=[0, 1, 2, 3], y=[0, 1, 4, 9])
plot(spline=spl2)  # renders a parabola

spl3 = Spline(file="data.csv", block="Block1")
plot(spline=spl3)  # renders a surface

Name

Type

Required

Default

Modifiable

Designable

block

Str

\(\checkmark\)

file

FileName

\(\checkmark\)

id

Int

Auto

label

Str

linear_extrapolate

Bool

False

\(\checkmark\)

name

Str

routine

Routine

script

Script

x

Double [0]

0.0

\(\checkmark\)

\(\checkmark\)

y

Double [0]

0.0

\(\checkmark\)

\(\checkmark\)

Method Name

Method Description

plot (self, plot_kwds=None, curve_kwds=None)

Plot this Spline as a 2D curve or 3D surface/trajectory.

Method Details

plot(plot_kwds=None, curve_kwds=None)
Plot this Spline as a 2D curve or 3D surface/trajectory.

Visualizing your spline, either as a 2D curve or a 3D surface, makes it easy to indentify and correct issues. A visual inspection can help ensuring the quality of the spline and verify that adequate number of control points are provided, noise is negligible and sharp corners are not present before submitting the model to MotionSolve.

Parameters:
  • plot_kwds (dict, optional) –

    • name (str): title of the plot.

    • legend (str): legend title.

    • grid (bool): whether to show grid.

    • xlabel, ylabel, zlabel (str): axis labels.

  • curve_kwds (dict, optional) –

    • color (str): line or surface color.

    • name (str): curve legend entry.

    • alpha (float): opacity of the plotted element (0-1).

    • lineStyle, lineThickness, marker, etc.

Returns:

Generated Plot object (MatplotlibPlot or Plotly figure wrapper), which you can further inspect.

Raises:

ValueError – If spline data are invalid or plotting fails.

Note

3D surface plots ignore flat colors and line‐style keywords (e.g. marker, linestyle, linewidth); only the colormap (specified via curve_kwds[‘color’]) and alpha are applied. Some valid color for 3D surface are:

  • viridis

  • plasma

  • inferno

  • magma

  • hot

  • cool

  • coolwarm

  • RdBu

Example

Create a Spline.#
from msolve import *

model = Model(output="spline")

ground = Part(ground=True)
Units(system="MKS")
Accgrav(jgrav=-9.81)

global_frame = Marker(body=ground)

part = Part (mass=1, ip=[1e3,1e3,1e3],cm=Marker())

spline = Spline(x        = [-10,-8,-6,-4,-2,0,2,4,6,8,10],
                y        = [-400,-320,-240,-160,-80,0,80,160,240,320,400],
                linear_extrapolate = True
                )

See also

For more details, see also Reference: Spline.

User Subroutine

The following user subroutine template expects the function signature and return value(s) as shown. Note that this is a placeholder implementation for reference purposes only.

def SPLINE_READ(id, file_name, block_name):
  # compute and update the spline values by calling py_put_spline utility
  id = 1 # id of the spline
  x = [1, 2, 3]
  y = [10, 20, 30]
  z = 0  # for 2D spline
  errflg = py_put_spline(id, x, y, z)
  return errflg

For more information, see MotionSolve Subroutines.

block#

The optional block string in the file.

Type=Str, Modifiable

file#

CSV file containing the data for the spline.

Type=FileName, Modifiable

linear_extrapolate#

Specifies if MotionSolve is to linearly extrapolate the spline.

Type=Bool, Default=False, Modifiable

plot(plot_kwds=None, curve_kwds=None)#
Plot this Spline as a 2D curve or 3D surface/trajectory.

Visualizing your spline, either as a 2D curve or a 3D surface, makes it easy to indentify and correct issues. A visual inspection can help ensuring the quality of the spline and verify that adequate number of control points are provided, noise is negligible and sharp corners are not present before submitting the model to MotionSolve.

Parameters:
  • plot_kwds (dict, optional) –

    • name (str): title of the plot.

    • legend (str): legend title.

    • grid (bool): whether to show grid.

    • xlabel, ylabel, zlabel (str): axis labels.

  • curve_kwds (dict, optional) –

    • color (str): line or surface color.

    • name (str): curve legend entry.

    • alpha (float): opacity of the plotted element (0-1).

    • lineStyle, lineThickness, marker, etc.

Returns:

Generated Plot object (MatplotlibPlot or Plotly figure wrapper), which you can further inspect.

Raises:

ValueError – If spline data are invalid or plotting fails.

Note

3D surface plots ignore flat colors and line‐style keywords (e.g. marker, linestyle, linewidth); only the colormap (specified via curve_kwds[‘color’]) and alpha are applied. Some valid color for 3D surface are:

  • viridis

  • plasma

  • inferno

  • magma

  • hot

  • cool

  • coolwarm

  • RdBu

routine#

The value can be a callable Python function, a Matlab/OML script, or a string that includes the name of a DLL/SO file and the corresponding function name, separated by ‘::’.

Type=Routine

script#

Path and name of the script that contains the routine.

Type=Script

x#

A list of x values.

Type=Double [0], Default=0.0, Modifiable, Designable

y#

A list of y values.

Type=Double [0], Default=0.0, Modifiable, Designable

class String(**kwds)#
Defines a user defined text string in MotionSolve.

The string may be of any length. It must contain only printable ASCII characters. String is primarily used within user defined subroutines. They are commonly used to pass filenames, messages, block names and DLL names to user defined subroutines.

Name

Type

Required

Default

Modifiable

Designable

function

Function

id

Int

Auto

label

Str

name

Str

routine

Routine

script

Script

string

Str

\(\checkmark\)

See also

For more details, see also Reference: String.

User Subroutine

The following user subroutine template expects the function signature and return value(s) as shown. Note that this is a placeholder implementation for reference purposes only.

def STRING_READ(id, par, npar):
  iname = py_gtinam()  # get the model input name
  [string, istate] = py_gtstrg (int(par[1]))
  errflg = py_put_string(id, string)
  return errflg

For more information, see MotionSolve Subroutines.

function#

Parameters passed to user defined subroutine.

Type=Function

routine#

The value can be a callable Python function, a Matlab/OML script, or a string that includes the name of a DLL/SO file and the corresponding function name, separated by ‘::’.

Type=Routine

script#

Path and name of the script that contains the routine.

Type=Script

string#

Specifies the character string to be stored.

Type=Str, Modifiable

class Surface(**kwds)#
Defines a parametric surface element in 3D space.

A parametric surface is defined in terms of two free parameters: u and v. This means that the 3 coordinates (x,y,z) of any point P on the surface is a function of the two free parameters u and v.

Name

Type

Required

Default

Modifiable

Designable

function

Function

id

Int

Auto

label

Str

maxpar

Double [2]

[1, 1]

\(\checkmark\)

minpar

Double [2]

[-1, -1]

\(\checkmark\)

name

Str

routine

Routine

script

Script

uclosed

Bool

False

\(\checkmark\)

vclosed

Bool

False

\(\checkmark\)

Example

Create a Surface.#
from msolve import *

model = Model(output="surface")

Units(system="MKS")

ground = Part(ground=True)
global_frame = Marker(body=ground)

part = Part (mass=1, ip=[1e3,1e3,1e3],cm=Marker())

sf = Surface(uclosed   = True,
             vclosed   = True,
             minpar    = [-1,-1],
             maxpar    = [1,1],
             function  = "USER(2,100)",
             routine   = "ms_csubdll::SURSUB")

sf.geometry = SurfaceGraphic(surface=sf, rm=global_frame, u_seg=20, v_seg=20)

H3dOutput(save=True)

See also

For more details, see also Reference: Parametric Surface.

User Subroutine

The following user subroutine template expects the function signature and return value(s) as shown. Note that this is a placeholder implementation for reference purposes only.

def SURSUB(id, par, npar, alpha, beta, iord, iflag):
  # specify a user-defined surface element and its derivatives
  # The output values array contains the computed surface coordinates and
  # first and second derivatives.
  # In particular, if `iord` is zero, then the `value` is an array of
  # dimension 3 that contains X, Y, and Z coordinates as a function of u and v
  values = 3*[0.0]
  return values

For more information, see MotionSolve Subroutines.

function#

Parameters passed to user defined subroutine.

Type=Function

maxpar#

Specifies the list of maximum value of u and v.

Type=Double [2], Default=[1, 1], Modifiable

minpar#

Specifies the list of minimum value of u and v.

Type=Double [2], Default=[-1, -1], Modifiable

routine#

The value can be a callable Python function, a Matlab/OML script, or a string that includes the name of a DLL/SO file and the corresponding function name, separated by ‘::’.

Type=Routine

script#

Path and name of the script that contains the routine.

Type=Script

uclosed#

True if the surface is closed in the u parametric space.

Type=Bool, Default=False, Modifiable

vclosed#

True if the surface is closed in the v parametric space.

Type=Bool, Default=False, Modifiable

class Variable(**kwds)#
Defines a variable in terms of a scalar algebraic equation in MotionSolve.

The variable may be defined in four different ways:

  • Directly as an explicit function of system state and time.

  • Directly as an implicit function of system state and time.

  • Indirectly through an algebraic equation applied as a constraint or a penalty.

  • As the integral of an expression.

Name

Type

Required

Default

Modifiable

Designable

auto_balance

Enum

DEFAULT

function

Function

\(\checkmark\)

\(\checkmark\)

ic

Double

0.0

\(\checkmark\)

id

Int

Auto

implicit

Bool

False

label

Str

name

Str

penalty

Double

\(\checkmark\)

\(\checkmark\)

penalty1

Double

\(\checkmark\)

\(\checkmark\)

pstate

Bool

False

routine

Routine

script

Script

See also

For more details, see also Reference: Solver Variable.

User Subroutine

The following user subroutine template expects the function signature and return value(s) as shown. Note that this is a placeholder implementation for reference purposes only.

def VARSUB(id, time, par, npar, dflag, iflag):
  # compute the value of the variable
  value = 0.0
  return value

For more information, see MotionSolve Subroutines.

auto_balance#

Type of soft constraint method.

Type=Enum, Default=DEFAULT

Permitted values are:

  • DEFAULT

  • DISABLED

  • PENALTY

  • UNCONDITIONAL

function#

Parameters passed to user defined subroutine or a legal MotionSolve expression that defines the variable.

Type=Function, Required, Modifiable

ic#

Initial value.

Type=Double, Default=0.0, Modifiable

implicit#

The variable is defined implicitly.

Type=Bool, Default=False

penalty#

Stiffness factor used in soft constraint.

Type=Double, Modifiable, Designable

penalty1#

Damping factor used in soft constraint.

Type=Double, Modifiable, Designable

pstate#

Specifies if this variable is to be used in eigenvalue analysis and state-space matrix system representation.

Type=Bool, Default=False

routine#

The value can be a callable Python function, a Matlab/OML script, or a string that includes the name of a DLL/SO file and the corresponding function name, separated by ‘::’.

Type=Routine

script#

Path and name of the script that contains the routine.

Type=Script