37#define DYN_HYPERBOLIC_FIXED_POINT_SINK 100
41#define DYN_HYPERBOLIC_FIXED_POINT_SOURCE 101
45#define DYN_HYPERBOLIC_FIXED_POINT_SADDLE 102
49#define DYN_NONHYPERBOLIC_FIXED_POINT_UNSTABLE 103
53#define DYN_NONHYPERBOLIC_FIXED_POINT_NEUTRALLY_STABLE 104
57#define DYN_NONHYPERBOLIC_FIXED_POINT_CENTER 105
62#define DYN_REVOLUTE_JOINT 0
66#define DYN_PRISMATIC_JOINT 1
70#define DYN_FIXED_JOINT 2
74#define DYN_CYLINDRICAL_JOINT 3
78#define DYN_UNIVERSAL_JOINT 4
82#define DYN_SPHERICAL_JOINT 5
87#define DYN_FRF_ACCELERANCE_MODEL 1
91#define DYN_FRF_RECEPTANCE_MODEL 2
96#define DYN_RUNGE_KUTTA_23 10
100#define DYN_RUNGE_KUTTA_45 11
104#define DYN_RUNGE_KUTTA_853 12
108#define DYN_ROSENBROCK 13
120#define DYN_KENNEDY_CARPENTER_4 16
124#define DYN_KENNEDY_CARPENTER_5 17
128#define DYN_TSITOURAS_5 18
133#define DYN_ACCELERANCE_MODEL 1
137#define DYN_RECEPTANCE_MODEL 2
151#define DYN_LEVENBERG_MARQUARDT_UPDATE 1
155#define DYN_QUADRATIC_UPDATE 2
159#define DYN_NIELSEN_UPDATE 3
164#define DYN_POINCARE_TWO_SIDED 0
168#define DYN_POINCARE_ONE_SIDED_FROM_FRONT 1
172#define DYN_POINCARE_ONE_SIDED_FROM_BACK 2
177#define DYN_ONE_POINT_INTEGRATION_RULE 1
181#define DYN_TWO_POINT_INTEGRATION_RULE 2
185#define DYN_THREE_POINT_INTEGRATION_RULE 3
189#define DYN_FOUR_POINT_INTEGRATION_RULE 4
191#define DYN_VI_DENSE_SOLVER 1
193#define DYN_VI_GRAPH_FACTORIZED_SOLVER 2
195#define DYN_VI_FORCE_LEFT_ENDPOINT 1
197#define DYN_VI_FORCE_IMPLICIT_ENDPOINT 2
199#define DYN_VI_FORCE_MIDPOINT 3
202#define DYN_NO_ERROR 0
204#define DYN_MEMORY_ERROR 10000
206#define DYN_NULL_POINTER_ERROR 10001
208#define DYN_INVALID_INPUT_ERROR 10004
210#define DYN_MATRIX_SIZE_ERROR 100100
212#define DYN_ARRAY_SIZE_ERROR 100105
233typedef void (*
c_vecfcn)(
int nvar,
int neqn,
const double *x,
double *f,
254 double *dxdt,
void *user_data);
276 const double *xg,
const double *fg,
const double *xc,
const double *p,
277 double *fc,
void *user_data);
289typedef void (*
c_ode_fit)(
int n,
int nparam,
const double *mdl,
double t,
290 const double *x,
double F,
double *dxdt,
void *user_data);
310 double *dxdt,
void *user_data);
322 double coordinates[3],
void *user_data);
336 double *force,
double *torque,
void *user_data);
346 int nconstraint,
double *value,
void *user_data);
360 int ldj,
void *user_data);
1087 double orientation_point[3];
1160 double direction[2];
1191 double direction[3];
1222 double direction[2];
1253 double direction[3];
1348void c_matmul(
int m,
int n,
int k,
double alpha,
const double *a,
int lda,
1349 const double *b,
int ldb,
double beta,
double *c,
int ldc);
1393 double s,
int np,
double *delta,
double *fn,
double *x1,
double *x2,
1394 double *t1,
double *t2);
1426 const double *t,
double *x);
1457void c_rotate(
const double i[3],
const double j[3],
const double k[3],
double *r,
1469 const double a[3],
const double x[3],
double *r,
int ldr);
1479 const double x[3],
double *r,
int ldr);
1490 double complex *ev,
int *flag);
1510 const double *theta,
const double *d,
double *T,
int ldt);
1521 int ldt2,
double *T,
int ldt);
1534 int ldt2,
const double *T3,
int ldt3,
double *T,
int ldt);
1540 int ldt2,
const double *T3,
int ldt3,
const double *T4,
double *T,
int ldt);
1546 int ldt2,
const double *T3,
int ldt3,
const double *T4,
int ldt4,
1547 const double *T5,
int ldt5,
double *T,
int ldt);
1553 int ldt2,
const double *T3,
int ldt3,
const double *T4,
int ldt4,
1554 const double *T5,
int ldt5,
const double *T6,
int ldt6,
double *T,
int ldt);
1560 int ldt2,
const double *T3,
int ldt3,
const double *T4,
int ldt4,
1561 const double *T5,
int ldt5,
const double *T6,
int ldt6,
const double *T7,
1562 int ldt7,
double *T,
int ldt);
1568 int ldt2,
const double *T3,
int ldt3,
const double *T4,
int ldt4,
1569 const double *T5,
int ldt5,
const double *T6,
int ldt6,
const double *T7,
1570 int ldt7,
const double *T8,
int ldt8,
double *T,
int ldt);
1583 const double *theta,
const double *d,
const int *jtypes,
double *jac,
1594void c_dh_matrix(
double alpha,
double a,
double theta,
double d,
double *T,
1634 const double *R,
int ldr,
int jtype,
double jvec[6]);
1650 const double *qo,
const double *constraints,
const double *qmax,
1651 const double *qmin,
double *jvar,
double *resid,
1689 const double *stiff,
int ldk,
double alpha,
double beta,
const double *freq,
1690 const c_modal_excite frc,
double *modes,
double *modeshapes,
int ldms,
1691 double complex *rsp,
int ldr,
void *user_data);
1707 const double *damp,
int ldc,
const double *stiff,
int ldk,
1708 double complex *dyn_stiff,
int ldd);
1728 const double *damp,
int ldc,
const double *stiff,
int ldk,
1729 const double *freq,
const c_modal_excite frc,
double complex *rsp,
int ldr,
1730 int *ranks,
void *user_data);
1751 const double *mass,
int ldm,
const double *damp,
int ldc,
1752 const double *stiff,
int ldk,
const c_modal_excite frc,
double complex *rsp,
1753 int ldr,
int *ranks,
void *user_data);
1771double c_chirp(
double t,
double amp,
double span,
double f1Hz,
double f2Hz);
1784 int ldk,
double *freqs,
double *modeshapes,
int ldms);
1806 const double *iv,
int solver,
double complex *rsp,
int ldr,
1822 const double *omega,
double complex *h);
1832 const double *omega,
double complex *h);
1851void c_fit_frf(
int n,
int norder,
int method,
const double *freq,
1852 const double complex *rsp,
const double *maxp,
const double *minp,
1871 double complex *rsp,
void *user_data);
1966 const double *ic,
double *p,
int integrator,
int ind,
const double *maxp,
2150 double *pitch,
double *yaw);
2174 const double pt3[3],
c_plane *pln);
2362 double *t1,
double *t2,
double tol);
2387 const c_plane *pln,
int side,
int nbuffer,
double *xbuffer,
double *ybuffer,
2388 double *zbuffer,
int *nactual);
2413 const double *iv,
int sample_count,
const c_plane *pln,
int side,
2415 double *xbuffer,
double *ybuffer,
double *zbuffer,
int *nactual,
2447 const double zi[3],
const double rim1[3],
const double ri[3],
2496 const double *q,
double *T,
int ldt);
2506 const double *q,
double *jac,
int ldj);
2518 const double *qo,
const double *trg,
int ldt,
double *q,
2553 int njoints,
const c_joint *joints,
int base,
int effector,
2554 const double *tool,
int ldt);
2568 int njoints,
const c_joint *joints,
int base,
int effector,
2569 const double *tool,
int ldt);
2663 double *T,
int ldt);
2673 const double *q,
double *T,
int ldt);
2693 double *jac,
int ldj);
2725 double *jac,
int ldj);
2805 int ntime,
double dt,
const double *initial_position,
2806 const c_quaternion *initial_orientation,
const double *initial_velocity,
2807 const double *initial_angular_velocity,
int nconstraint,
2812 c_quaternion *orientation,
double *velocity,
double *angular_velocity,
2813 double *multipliers,
int *converged,
int *iterations,
2814 int *jacobian_singular,
int *completed_steps);
2842 int nq,
const double *q);
2912 int nbody,
double time,
const double *position,
2913 const c_quaternion *orientation,
const double *velocity,
2928 int nbody,
double time,
const double *position,
2929 const c_quaternion *orientation,
const double *velocity,
2973 int ntime,
double dt,
const double gravity[3],
const double *body_force,
2974 const double *body_torque,
int prescribed_body,
2976 double *position,
c_quaternion *orientation,
double *velocity,
2977 double *angular_velocity,
double *multipliers,
int *converged,
2978 int *iterations,
int *jacobian_singular,
int *completed_steps);
2998 int nconstraint,
double time,
const double *position,
2999 const c_quaternion *orientation,
const double *velocity,
3000 const double *angular_velocity,
const double *multipliers,
3057 const double complex *s,
double complex *z);
3099 const double *b,
int ldb,
const double *k,
int ldk,
3143 int n,
const double *t,
int ndof,
const double *ic,
int solver,
3144 int nout,
double *y,
int ldy,
void *user_data);
3161 double complex *z,
int *nz);
3173 int nout,
int n,
const double complex *s,
double complex *z,
int ldz);
3196 int rule,
double *k,
int ldk);
3205 double *m,
int ldm);
3213 double *r,
int ldr);
3222 const double displacement[6],
double s,
double strain[2]);
3231 const double displacement[6],
double s,
double stress[2]);
3240 const double displacement[6],
double s);
3250 const double displacement[6],
double s);
3260 const double q[2],
int rule,
double f[6]);
3275 int rule,
double *k,
int ldk);
3284 double *m,
int ldm);
3292 double *r,
int ldr);
3301 const double displacement[12],
double s,
double strain[4]);
3310 const double displacement[12],
double s,
double stress[4]);
3320 const double displacement[12],
double s,
double force[2]);
3330 const double displacement[12],
double s,
double moment[3]);
3340 const double q[4],
int rule,
double f[12]);
3354 double *k,
int ldk);
3370 double *m,
int ldm,
double *k,
int ldk);
3384 double *k,
int ldk);
3400 double *m,
int ldm,
double *k,
int ldk);
3413 const double *x,
int ldx,
double *rst,
int ldr);
3424 const double *x,
double *rst);
3435 const double *x,
double *rst);
3446 double *k,
int ldk,
double *f);
3456 const double *f,
double *u);
3470 double *k,
int ldk);
3479 double *m,
int ldm);
3487 double *r,
int ldr);
3495 const double displacement[4]);
3503 const double displacement[4]);
3514 const double q[2],
int rule,
double f[4]);
3528 double *k,
int ldk);
3537 double *m,
int ldm);
3545 double *r,
int ldr);
3553 const double displacement[6]);
3561 const double displacement[6]);
3572 const double q[3],
int rule,
double f[6]);
3585 double *k,
int ldk);
3601 double *m,
int ldm,
double *k,
int ldk);
3614 double *k,
int ldk);
3630 double *m,
int ldm,
double *k,
int ldk);
3638 double *k,
int ldk);
3646 const double displacement[4]);
3654 double *k,
int ldk);
3662 const double displacement[6]);
3670 double *c,
int ldc);
3678 const double velocity[4]);
3686 double *c,
int ldc);
3694 const double velocity[6]);
3734 double *m,
int ldm,
double *c,
int ldc,
double *k,
int ldk);
3758 double *m,
int ldm,
double *c,
int ldc,
double *k,
int ldk);
3782 const double *m,
int ldm,
const double *c,
int ldc,
const double *k,
3783 int ldk,
double rho_infinity);
3802 const double *force_current,
const double *force_next,
double dt,
3803 double *displacement,
double *velocity,
double *acceleration);
3822 int npts,
const double *forces,
int ldf,
double dt,
double *displacement,
3823 double *velocity,
double *acceleration);
void(* c_variational_force)(const c_variational_state *state, double *force, double *torque, void *user_data)
External force and torque callback for variational integration.
Definition dynamics.h:335
double(* c_window_function)(int n, int bin, void *user_data)
Window function callback used by SISO frequency analysis.
Definition dynamics.h:262
void(* c_variational_constraint_jacobian)(const c_variational_state *state, int nconstraint, double *jacobian, int ldj, void *user_data)
Reduced constraint-Jacobian callback.
Definition dynamics.h:358
void(* c_ss_excitation)(int n, double t, double *u, void *user_data)
State-space input callback used by c_lti_solve.
Definition dynamics.h:299
void * c_linkage_dynamic_model
Opaque linkage dynamic-model handle.
Definition dynamics.h:896
void * c_mechanism
Opaque handle to a closed-loop mechanism.
Definition dynamics.h:890
void(* c_ode_fit)(int n, int nparam, const double *mdl, double t, const double *x, double F, double *dxdt, void *user_data)
ODE model callback used by system identification.
Definition dynamics.h:289
void(* c_variational_constraint)(const c_variational_state *state, int nconstraint, double *value, void *user_data)
Holonomic constraint callback for variational integration.
Definition dynamics.h:345
void(* c_ode_equations)(int n, double t, const double *x, double *dxdt, void *user_data)
Ordinary-differential-equation callback.
Definition dynamics.h:309
void(* c_modal_excite)(int n, double freq, double complex *f, void *user_data)
Modal force callback used by frequency-response routines.
Definition dynamics.h:242
void(* c_constraint_equations)(int n, int neqn, int nparam, const double *xg, const double *fg, const double *xc, const double *p, double *fc, void *user_data)
Constraint callback used by least-squares system identification.
Definition dynamics.h:275
void(* c_vecfcn)(int nvar, int neqn, const double *x, double *f, void *user_data)
Nonlinear vector function callback.
Definition dynamics.h:233
void(* c_poincare_coordinates)(int n, double t, const double *x, double coordinates[3], void *user_data)
Poincare section coordinate callback.
Definition dynamics.h:321
double(* c_linkage_prescribed_motion)(double t, void *user_data)
Prescribed planar-link angular motion callback.
Definition dynamics.h:367
void(* c_error_handler)(int code, const char *message, void *user_data)
Error handler callback.
Definition dynamics.h:223
void(* c_harmonic_ode)(int n, double freq, double t, const double *x, double *dxdt, void *user_data)
Harmonic ordinary-differential-equation callback.
Definition dynamics.h:253
void * c_structural_integrator
Opaque linear structural time-integrator handle.
Definition dynamics.h:902
int c_get_last_error_message(int n, char *buffer)
Copy the message for the most recent error on the calling thread.
int c_get_last_error(void)
Get the most recent error recorded on the calling thread.
void c_set_error_handler(c_error_handler fcn, void *user_data)
Register a handler invoked whenever the C interface records an error on the calling thread.
void c_clear_error(void)
Clear the error recorded on the calling thread.
void c_vector_projection(const double x[3], const double y[3], double z[3])
Project one vector onto another.
double c_scalar_projection(const double x[3], const double y[3])
Compute the scalar projection of one vector onto another.
void c_cross_product(const double x[3], const double y[3], double z[3])
Compute the cross product of two three-vectors.
void c_normalize_mode_shapes(int n, double *x, int ldx)
Normalize mode-shape columns.
bool c_is_symmetric(int m, int n, const double *a, int lda)
Test whether a matrix is symmetric to within a small relative tolerance.
void c_siso_model_fit_least_squares(int nsets, int nparams, int neqns, const c_ode_fit fcn, const c_dynamic_system_measurement *x, const double *ic, double *p, int integrator, int ind, const double *maxp, const double *minp, const c_iteration_controls *controls, const c_lm_solver_options *opts, int nconstraints, const double *xc, const double *yc, const c_constraint_equations constraints, int nweights, const double *weights, c_regression_statistics *stats, c_iteration_behavior *info, void *user_data)
Fit an ODE model to dynamic-system measurements by constrained least squares.
c_dynamic_system_measurement * c_alloc_dynamic_system_measurement_array(int n, const int *ptsper)
Allocate an array of measurement records.
void c_evaluate_accelerance_frf_model(int n, int norder, const double *mdl, const double *omega, double complex *h)
Evaluate an accelerance rational FRF model.
void c_set_frequency_sweep_defaults(c_frequency_sweep_controls *x)
Fill frequency-sweep controls with defaults.
int c_alloc_dynamic_system_measurement(int n, c_dynamic_system_measurement *x)
Allocate one dynamic-system measurement record.
double c_vector_magnitude(int n, const double *x)
Compute a vector magnitude.
void c_to_skew_symmetric(const double x[3], double *y, int ldy)
Form a skew-symmetric matrix from a three-vector.
void c_frequency_response(int n, int nfreq, const double *mass, int ldm, const double *stiff, int ldk, double alpha, double beta, const double *freq, const c_modal_excite frc, double *modes, double *modeshapes, int ldms, double complex *rsp, int ldr, void *user_data)
Compute a modal frequency response for a second-order system.
void c_siso_frequency_response(int n, int nf, const double *x, const double *y, double fs, int winsize, c_window_function winfun, int method, double *freq, double complex *rsp, void *user_data)
Estimate a SISO frequency response from input and output records.
void c_free_dynamic_system_measurement(c_dynamic_system_measurement *x)
Release one dynamic-system measurement record.
double c_chirp(double t, double amp, double span, double f1Hz, double f2Hz)
Evaluate a swept-frequency chirp signal.
void c_evaluate_receptance_frf_model(int n, int norder, const double *mdl, const double *omega, double complex *h)
Evaluate a receptance rational FRF model.
void c_fit_frf(int n, int norder, int method, const double *freq, const double complex *rsp, const double *maxp, const double *minp, const c_iteration_controls *controls, double *mdl, c_regression_statistics *stats)
Fit an FRF model to measured data.
void c_dynamic_stiffness_dense(int n, double omega, const double *mass, int ldm, const double *damp, int ldc, const double *stiff, int ldk, double complex *dyn_stiff, int ldd)
Compute dense dynamic stiffness, K - omega^2 M + i omega C.
double c_compute_modal_damping(double lambda, double alpha, double beta)
Compute modal damping from Rayleigh coefficients.
void c_set_lm_solver_options_defaults(c_lm_solver_options *x)
Fill Levenberg-Marquardt options with defaults.
void c_frf_general_damp_2(int n, int nfreq, double freq1, double freq2, const double *mass, int ldm, const double *damp, int ldc, const double *stiff, int ldk, const c_modal_excite frc, double complex *rsp, int ldr, int *ranks, void *user_data)
Compute a general-damping frequency response over an evenly spaced interval.
void c_set_iteration_controls_defaults(c_iteration_controls *x)
Fill nonlinear iteration controls with defaults.
void c_free_dynamic_system_measurement_array(int n, c_dynamic_system_measurement *x)
Release an array of measurement records.
double c_vector_angle(const double x[3], const double y[3])
Compute the angle between two vectors.
void c_frf_general_damp_1(int n, int nfreq, const double *mass, int ldm, const double *damp, int ldc, const double *stiff, int ldk, const double *freq, const c_modal_excite frc, double complex *rsp, int ldr, int *ranks, void *user_data)
Compute a general-damping frequency response at explicit frequencies.
void c_modal_response(int n, const double *mass, int ldm, const double *stiff, int ldk, double *freqs, double *modeshapes, int ldms)
Compute modal frequencies and mass-normalized mode shapes.
double c_dot_product(int n, const double *x, const double *y)
Compute a dot product.
void c_vector_normalize(int n, double *x)
Normalize a vector in place.
void c_frf_sweep(int n, int nfreq, c_harmonic_ode fcn, const double *freq, const double *iv, int solver, double complex *rsp, int ldr, const c_frequency_sweep_controls *opts, void *user_data)
Perform a nonlinear harmonic frequency sweep.
void c_plucker_line_from_2_points(const double pt1[3], const double pt2[3], c_plucker_line *ln)
Construct a Pluecker line through two points.
double c_point_to_plane_distance(const double pt[3], const c_plane *pln)
Compute the distance from a point to a plane.
void c_point_plane_projection(const double pt[3], const c_plane *pln, double ppt[3])
Project a point onto a plane.
void c_evaluate_line_position(const c_line *ln, double t, double x[3])
Evaluate a point on a line.
void c_do_lines_intersect(const c_line *ln1, const c_line *ln2, bool *intersect, double *t1, double *t2, double tol)
Determine whether two lines intersect and return their parameters.
void c_line_from_point_and_vector(const double pt[3], const double v[3], c_line *ln)
Construct a line from a point and direction.
void c_plucker_line_from_array(const double x[6], c_plucker_line *ln)
Construct a Pluecker line from six coordinates.
void c_plucker_line_from_2_planes(const c_plane *p1, const c_plane *p2, c_plucker_line *ln)
Construct a Pluecker line from two planes.
void c_plucker_line_mtx_mult(int n, const double *x, int ldx, const c_plucker_line *ln, double *y)
Apply a matrix to a Pluecker line.
void c_line_from_points(int n, const double *pts, int ldp, c_line *ln)
Fit a line to point data.
double c_point_to_line_distance(const double pt[3], const c_line *ln)
Compute the distance from a point to a line.
void c_plane_from_point_and_normal(const double pt[3], const double nrm[3], c_plane *pln)
Construct a plane from a point and normal.
void c_vector_plane_projection(const double x[3], const c_plane *pln, double px[3])
Project a vector onto a plane.
void c_line_common_normal(const c_line *ln1, const c_line *ln2, c_line *ln)
Compute the common normal of two lines.
bool c_is_parallel_lines(const c_line *x, const c_line *y, double tol)
Test whether two lines are parallel.
void c_plane_from_3_points(const double pt1[3], const double pt2[3], const double pt3[3], c_plane *pln)
Construct a plane through three points.
void c_flip_plane_normal(c_plane *pln)
Reverse a plane normal and its equation.
bool c_is_parallel_vectors(int n, const double *x, const double *y, double tol)
Test whether two vectors are parallel within a tolerance.
void c_poincare_map(int n, const double *x, const double *y, const double *z, const c_plane *pln, int side, int nbuffer, double *xbuffer, double *ybuffer, double *zbuffer, int *nactual)
Compute a Poincare section map from sampled trajectories.
void c_poincare_map_ode(c_ode_equations fcn, const double tspan[2], int n, const double *iv, int sample_count, const c_plane *pln, int side, int solver, c_poincare_coordinates coordinates, int nbuffer, double *xbuffer, double *ybuffer, double *zbuffer, int *nactual, void *user_data)
Compute a Poincare section map by integrating an ODE and intersecting uniformly spaced solution sampl...
void c_plane_normal(const c_plane *pln, double nrm[3])
Extract a plane normal.
bool c_is_point_on_line(const double pt[3], const c_line *ln, double tol)
Test whether a point lies on a line.
void c_line_from_2_planes(const c_plane *p1, const c_plane *p2, c_line *ln)
Construct the intersection line of two planes.
void c_plane_from_points(int n, const double *pts, int ldp, c_plane *pln)
Fit a plane to point data.
double c_nearest_point_on_line(const double pt[3], const c_line *ln)
Find the parameter of the nearest point on a line.
bool c_is_parallel_planes(const c_plane *x, const c_plane *y, double tol)
Test whether two planes are parallel.
bool c_is_point_on_plane(const double pt[3], const c_plane *pln, double tol)
Test whether a point lies on a plane.
void c_line_from_2_points(const double pt1[3], const double pt2[3], c_line *ln)
Construct a line through two points.
void c_plucker_line_to_array(const c_plucker_line *ln, double x[6])
Convert a Pluecker line to six coordinates.
void c_plucker_line_from_line(const c_line *src, c_plucker_line *ln)
Convert a line to Pluecker coordinates.
void c_solve_inverse_kinematics(int njoints, int neqn, const c_vecfcn mdl, const double *qo, const double *constraints, const double *qmax, const double *qmin, double *jvar, double *resid, c_iteration_behavior *ib, void *user_data)
Solve a nonlinear inverse-kinematics problem.
void c_dh_forward_kinematics_6(const double *T1, int ldt1, const double *T2, int ldt2, const double *T3, int ldt3, const double *T4, int ldt4, const double *T5, int ldt5, const double *T6, int ldt6, double *T, int ldt)
Multiply six homogeneous transforms.
void c_evaluate_step_response(int n, double wn, double zeta, double xs, const double *t, double *x)
Evaluate a second-order step response.
void c_dh_forward_kinematics_4(const double *T1, int ldt1, const double *T2, int ldt2, const double *T3, int ldt3, const double *T4, double *T, int ldt)
Multiply four homogeneous transforms.
void c_determine_local_stability(int n, const double *a, int lda, double complex *ev, int *flag)
Classify the eigenvalues of a linearized system for local stability.
void c_dh_forward_kinematics_7(const double *T1, int ldt1, const double *T2, int ldt2, const double *T3, int ldt3, const double *T4, int ldt4, const double *T5, int ldt5, const double *T6, int ldt6, const double *T7, int ldt7, double *T, int ldt)
Multiply seven homogeneous transforms.
void c_rotate_y(double angle, double *r, int ldr)
Build a rotation matrix about the y axis.
void c_dh_translate_z(double d, double *T, int ldt)
Build the Denavit-Hartenberg z translation matrix.
double c_find_settling_amplitude(int n, const double *x)
Find the settled response amplitude.
void c_dh_matrix(double alpha, double a, double theta, double d, double *T, int ldt)
Build one Denavit-Hartenberg homogeneous transform.
void c_dh_forward_kinematics_2(const double *T1, int ldt1, const double *T2, int ldt2, double *T, int ldt)
Multiply two homogeneous transforms.
double c_estimate_bandwidth(double fn, double zeta)
Estimate the half-power bandwidth.
double c_damping_from_log_decrement(double delta)
Convert logarithmic decrement to damping ratio.
void c_jacobian_generating_vector(const double *d, const double *k, const double *R, int ldr, int jtype, double jvec[6])
Generate one joint Jacobian column.
void c_velocity_transform(const double omega[3], const double v[3], const double x[3], double *r, int ldr)
Build a velocity transformation matrix.
void c_dh_jacobian(int n, const double *alpha, const double *a, const double *theta, const double *d, const int *jtypes, double *jac, int ldjac)
Compute a Denavit-Hartenberg linkage Jacobian.
void c_acceleration_transform(const double alpha[3], const double omega[3], const double a[3], const double x[3], double *r, int ldr)
Build an acceleration transformation matrix.
void c_matmul(int m, int n, int k, double alpha, const double *a, int lda, const double *b, int ldb, double beta, double *c, int ldc)
Multiply two column-major matrices: c = alpha*a*b + beta*c.
void c_find_free_response_properties(int n, const double *t, const double *x, double s, int np, double *delta, double *fn, double *x1, double *x2, double *t1, double *t2)
Extract damping and frequency properties from a free response.
void c_dh_forward_kinematics_3(const double *T1, int ldt1, const double *T2, int ldt2, const double *T3, int ldt3, double *T, int ldt)
Multiply three homogeneous transforms.
void c_dh_rotate_z(double theta, double *T, int ldt)
Build the Denavit-Hartenberg z-axis rotation matrix.
void c_dh_forward_kinematics_8(const double *T1, int ldt1, const double *T2, int ldt2, const double *T3, int ldt3, const double *T4, int ldt4, const double *T5, int ldt5, const double *T6, int ldt6, const double *T7, int ldt7, const double *T8, int ldt8, double *T, int ldt)
Multiply eight homogeneous transforms.
void c_rotate_z(double angle, double *r, int ldr)
Build a rotation matrix about the z axis.
void c_to_angle_axis(const double *r, int ldr, double *angle, double axis[3])
Convert a rotation matrix to angle-axis form.
void c_dh_rotate_x(double alpha, double *T, int ldt)
Build the Denavit-Hartenberg x-axis rotation matrix.
double c_q_factor(double zeta)
Compute the Q factor from a damping ratio.
void c_dh_forward_kinematics_5(const double *T1, int ldt1, const double *T2, int ldt2, const double *T3, int ldt3, const double *T4, int ldt4, const double *T5, int ldt5, double *T, int ldt)
Multiply five homogeneous transforms.
void c_dh_forward_kinematics(int n, const double *alpha, const double *a, const double *theta, const double *d, double *T, int ldt)
Compute serial Denavit-Hartenberg forward kinematics.
void c_dh_translate_x(double a, double *T, int ldt)
Build the Denavit-Hartenberg x translation matrix.
double c_logarithmic_decrement(double x1, double x2, int n)
Compute logarithmic decrement from two peaks.
double c_rise_time(double wn, double zeta)
Compute the 10-to-90 percent rise time.
void c_rotate_x(double angle, double *r, int ldr)
Build a rotation matrix about the x axis.
double c_damping_from_fractional_overshoot(int n, const double *x)
Estimate damping from fractional overshoot.
void c_rotate(const double i[3], const double j[3], const double k[3], double *r, int ldr)
Build a rotation matrix from three basis vectors.
void c_dh_forward_kinematics_table(const c_dh_table *tbl, double *T, int ldt)
Compute forward kinematics from a Denavit-Hartenberg table.
void c_mechanism_get_configuration(c_mechanism obj, int n, double *q)
Get the current mechanism configuration.
int c_mechanism_variable_count(c_mechanism obj)
Return the number of mechanism variables.
void c_free_mechanism(c_mechanism obj)
Release a mechanism handle.
c_mechanism c_create_parallel_linkage(int nlinks, const c_mechanism_link *links, int njoints, const c_joint *joints, int base, int effector, const double *tool, int ldt)
Create a spatial parallel linkage mechanism.
void c_mechanism_jacobian(c_mechanism obj, int na, const double *qa, double *jac, int ldj)
Evaluate a mechanism Jacobian.
int c_mechanism_link_count(c_mechanism obj)
Return the number of links in a mechanism.
int c_mechanism_space_dimension(c_mechanism obj)
Return the mechanism spatial dimension.
void c_mechanism_link_frame(c_mechanism obj, int i, int k, double *T, int ldt)
Return a link-frame transform.
int c_mechanism_actuated_variable_count(c_mechanism obj)
Return the number of actuated variables.
void c_mechanism_constraint_jacobian(c_mechanism obj, int n, const double *q, double *jac, int ldj)
Evaluate the mechanism constraint Jacobian.
int c_mechanism_constraint_count(c_mechanism obj)
Return the number of constraint equations.
void c_mechanism_forward_kinematics(c_mechanism obj, int na, const double *qa, double *T, int ldt, c_iteration_behavior *ib)
Evaluate forward kinematics for a mechanism.
void c_free_mechanism_link(c_mechanism_link *lnk)
Release a multi-frame mechanism link.
int c_mechanism_degrees_of_freedom(c_mechanism obj)
Return mechanism degrees of freedom.
int c_alloc_mechanism_link(int nframes, c_mechanism_link *lnk)
Allocate a multi-frame mechanism link.
int c_mechanism_link_frame_count(c_mechanism obj, int i)
Return the frame count for a link.
void c_mechanism_solve_configuration(c_mechanism obj, int na, const double *qa, int n, double *q, c_iteration_behavior *ib)
Solve for a complete mechanism configuration.
void c_mechanism_set_configuration(c_mechanism obj, int n, const double *q)
Set the mechanism configuration.
void c_mechanism_body_transform(c_mechanism obj, int i, int n, const double *q, double *T, int ldt)
Evaluate a body transform at a configuration.
void c_mechanism_inverse_kinematics(c_mechanism obj, const double *trg, int ldt, int na, double *qa, c_iteration_behavior *ib)
Solve mechanism inverse kinematics.
void c_mechanism_constraints(c_mechanism obj, int n, const double *q, int nc, double *f)
Evaluate mechanism constraint equations.
void c_mechanism_end_effector_transform(c_mechanism obj, int n, const double *q, double *T, int ldt)
Evaluate the end-effector transform.
int c_mechanism_loop_count(c_mechanism obj)
Return the number of independent loops.
c_mechanism c_create_planar_linkage(int nlinks, const c_mechanism_link *links, int njoints, const c_joint *joints, int base, int effector, const double *tool, int ldt)
Create a planar parallel linkage mechanism.
int c_mechanism_joint_count(c_mechanism obj)
Return the number of joints in a mechanism.
void c_quaternion_add(const c_quaternion *x, const c_quaternion *y, c_quaternion *q)
Add two quaternions.
void c_quaternion_divide(const c_quaternion *x, const c_quaternion *y, c_quaternion *q)
Divide two quaternions.
void c_quaternion_from_matrix(const double *x, int ldx, c_quaternion *q)
Construct a quaternion from a rotation matrix.
double c_quaternion_abs(const c_quaternion *q)
Compute the quaternion norm.
void c_quaternion_to_matrix(const c_quaternion *q, double *r, int ldr)
Convert a quaternion to a rotation matrix.
void c_quaternion_from_array(const double x[4], c_quaternion *q)
Construct a quaternion from four scalar components.
void c_quaternion_multiply(const c_quaternion *x, const c_quaternion *y, c_quaternion *q)
Multiply two quaternions.
void c_quaternion_to_roll_pitch_yaw(const c_quaternion *q, double *roll, double *pitch, double *yaw)
Convert a quaternion to roll, pitch, and yaw angles.
void c_quaternion_exp(const c_quaternion *q, c_quaternion *rst)
Compute the quaternion exponential.
void c_quaternion_inverse(const c_quaternion *q, c_quaternion *qinv)
Compute a quaternion inverse.
void c_quaternion_subtract(const c_quaternion *x, const c_quaternion *y, c_quaternion *q)
Subtract two quaternions.
void c_quaternion_log(const c_quaternion *q, c_quaternion *rst)
Compute the quaternion logarithm.
double c_quaternion_dot_product(const c_quaternion *x, const c_quaternion *y)
Compute the quaternion dot product.
void c_quaternion_scale(double x, const c_quaternion *y, c_quaternion *q)
Scale a quaternion.
void c_quaternion_normalize(c_quaternion *q)
Normalize a quaternion in place.
void c_quaternion_conjugate(const c_quaternion *q, c_quaternion *qc)
Compute a quaternion conjugate.
void c_quaternion_rotate(const c_quaternion *q, const double r[3], double rp[3])
Rotate a vector using a quaternion.
void c_quaternion_pow(const c_quaternion *q, double exponent, c_quaternion *rst)
Raise a quaternion to a real power.
void c_quaternion_to_angle_axis(const c_quaternion *q, double *angle, double axis[3])
Convert a quaternion to angle-axis data.
void c_quaternion_from_angle_axis(double angle, const double axis[3], c_quaternion *q)
Construct a quaternion from angle-axis data.
void c_serial_linkage_jacobian(int n, const c_serial_linkage *lnk, const double *q, double *jac, int ldj)
Evaluate the serial-link Jacobian.
void c_serial_linkage_forward_kinematics(int n, const c_serial_linkage *lnk, const double *q, double *T, int ldt)
Evaluate serial-link forward kinematics.
void c_define_link_csys(const double xim1[3], const double zim1[3], const double zi[3], const double rim1[3], const double ri[3], c_coordinate_system *csys)
Define a link coordinate system from adjacent geometry.
int c_alloc_serial_linkage(int n, c_serial_linkage *lnk)
Allocate a serial linkage.
void c_free_dh_table(c_dh_table *tbl)
Release a Denavit-Hartenberg table.
int c_alloc_dh_table(int n, c_dh_table *tbl)
Allocate a Denavit-Hartenberg table.
void c_build_dh_table(int n, const c_coordinate_system *csys, c_dh_table *tbl)
Build Denavit-Hartenberg parameters from coordinate systems.
void c_build_serial_linkage(int n, const c_binary_link *links, c_serial_linkage *linkage)
Build a serial linkage from link definitions.
void c_free_serial_linkage(c_serial_linkage *lnk)
Release a serial linkage.
void c_define_csys(const double i[3], const double j[3], const double k[3], const double o[3], c_coordinate_system *csys)
Define a coordinate system from basis vectors and origin.
void c_serial_linkage_inverse_kinematics(int n, const c_serial_linkage *lnk, const double *qo, const double *trg, int ldt, double *q, c_iteration_behavior *ib)
Solve serial-link inverse kinematics.
void c_free_state_space_model(c_state_space_model *mdl)
Release a state-space model.
void c_transfer_function_multiply(const c_transfer_function *tf1, const c_transfer_function *tf2, c_transfer_function *tf)
Multiply two transfer functions.
void c_scale_transfer_function(double x, const c_transfer_function *tf1, c_transfer_function *tf)
Scale a transfer function.
void c_state_space_poles(const c_state_space_model *mdl, int n, double complex *p)
Compute state-space poles.
int c_alloc_transfer_function(int numer_order, int denom_order, c_transfer_function *tf)
Allocate a transfer function.
void c_state_space_transfer_function(const c_state_space_model *mdl, int nin, int nout, int n, const double complex *s, double complex *z, int ldz)
Evaluate the state-space transfer matrix.
void c_state_space_zeros(const c_state_space_model *mdl, int n, double complex *z, int *nz)
Compute state-space zeros.
void c_transfer_function_poles(const c_transfer_function *tf, int n, double complex *p)
Compute transfer-function poles.
void c_to_ocf_state_space(const c_transfer_function *tf, c_state_space_model *ss)
Convert a transfer function to observable canonical state space.
void c_to_ccf_state_space(const c_transfer_function *tf, c_state_space_model *ss)
Convert a transfer function to controllable canonical state space.
int c_alloc_polynomial(int order, c_polynomial *p)
Allocate a polynomial.
void c_free_polynomial(c_polynomial *p)
Release a polynomial.
void c_create_pid_state_space_model(double kp, double ki, double kd, double tau, const c_state_space_model *plant, c_state_space_model *mdl)
Create a PID-controlled plant state-space model.
void c_create_state_space_model(int n, int n_out, const double *m, int ldm, const double *b, int ldb, const double *k, int ldk, c_state_space_model *mdl)
Create a state-space model from mass, damping, and stiffness matrices.
void c_transfer_function_zeros(const c_transfer_function *tf, int n, double complex *z)
Compute transfer-function zeros.
void c_evaluate_transfer_function(const c_transfer_function *tf, int n, const double complex *s, double complex *z)
Evaluate a transfer function at complex points.
void c_free_transfer_function(c_transfer_function *tf)
Release a transfer function.
int c_alloc_state_space_model(int dimension, int n_inputs, int n_outputs, c_state_space_model *mdl)
Allocate a continuous state-space model.
void c_lti_solve(const c_state_space_model *mdl, const c_ss_excitation u, int n, const double *t, int ndof, const double *ic, int solver, int nout, double *y, int ldy, void *user_data)
Integrate a continuous state-space model.
c_structural_integrator c_create_dense_generalized_alpha_integrator(int n, const double *m, int ldm, const double *c, int ldc, const double *k, int ldk, double rho_infinity)
Create a dense generalized-alpha integrator for M*a + C*v + K*u = f.
void c_structural_integrator_step(c_structural_integrator obj, int n, const double *force_current, const double *force_next, double dt, double *displacement, double *velocity, double *acceleration)
Advance the state by one time step.
void c_structural_integrator_solve(c_structural_integrator obj, int n, int npts, const double *forces, int ldf, double dt, double *displacement, double *velocity, double *acceleration)
Advance the state through a force history using npts - 1 constant steps.
void c_free_structural_integrator(c_structural_integrator obj)
Release a structural integrator handle.
void c_beam_element_2d_mass_matrix(const c_beam_element_2d *elem, int rule, double *m, int ldm)
Compute the 6-by-6 mass matrix of a 2D beam element.
void c_truss_element_2d_stiffness_matrix(const c_truss_element_2d *elem, double *k, int ldk)
Compute the 4-by-4 global stiffness matrix of a 2D truss element.
double c_truss_element_2d_length(const c_truss_element_2d *elem)
Compute the length of a 2D truss element.
void c_truss_element_3d_mass_matrix(const c_truss_element_3d *elem, int rule, double *m, int ldm)
Compute the 6-by-6 consistent mass matrix of a 3D truss element.
void c_mass_element_3d_mass_matrix(const c_mass_element_3d *elem, double *m, int ldm)
Compute the 3-by-3 mass matrix of a 3D point mass element.
void c_beam_element_2d_rotation_matrix(const c_beam_element_2d *elem, double *r, int ldr)
Compute the 6-by-6 rotation matrix of a 2D beam element.
double c_damper_element_3d_force(const c_damper_element_3d *elem, const double velocity[6])
Compute the damper force (positive in tension) in a 3D damper element.
void c_assemble_discrete_system_3d(int gdof, int nm, const c_mass_element_3d *masses, int nd, const c_damper_element_3d *dampers, int ns, const c_spring_element_3d *springs, int nn, const c_node *nodes, double *m, int ldm, double *c, int ldc, double *k, int ldk)
Assemble dense global mass, damping, and stiffness matrices for a 3D system composed of discrete elem...
double c_beam_element_2d_shear_force(const c_beam_element_2d *elem, const double displacement[6], double s)
Compute the local shear force in a 2D beam element at a natural coordinate.
void c_beam_element_3d_stress(const c_beam_element_3d *elem, const double displacement[12], double s, double stress[4])
Compute the stress in a 3D beam element at a natural coordinate.
void c_beam_element_2d_external_force_vector(const c_beam_element_2d *elem, const double q[2], int rule, double f[6])
Compute the equivalent nodal force vector for a distributed load on a 2D beam element.
void c_assemble_static_system_truss_2d(int gdof, int n, const c_truss_element_2d *elements, int nn, const c_node *nodes, double *k, int ldk)
Assemble a dense global stiffness matrix from 2D truss elements.
void c_beam_element_2d_stiffness_matrix(const c_beam_element_2d *elem, int rule, double *k, int ldk)
Compute the 6-by-6 stiffness matrix of a 2D beam element.
double c_truss_element_3d_strain(const c_truss_element_3d *elem, const double displacement[6])
Compute the axial strain in a 3D truss element.
double c_beam_element_2d_bending_moment(const c_beam_element_2d *elem, const double displacement[6], double s)
Compute the local bending moment in a 2D beam element at a natural coordinate.
double c_spring_element_3d_force(const c_spring_element_3d *elem, const double displacement[6])
Compute the spring force (positive in tension) in a 3D spring element.
double c_truss_element_3d_axial_force(const c_truss_element_3d *elem, const double displacement[6])
Compute the axial force (positive in tension) in a 3D truss element.
void c_truss_element_2d_external_force_vector(const c_truss_element_2d *elem, const double q[2], int rule, double f[4])
Compute the equivalent nodal force vector for a distributed load on a 2D truss element.
void c_beam_element_3d_bending_moment(const c_beam_element_3d *elem, const double displacement[12], double s, double moment[3])
Compute the local moment vector in a 3D beam element at a natural coordinate.
void c_assemble_static_system_beam_2d(int gdof, int n, const c_beam_element_2d *elements, int nn, const c_node *nodes, int rule, double *k, int ldk)
Assemble a dense global stiffness matrix from 2D beam elements.
void c_truss_element_3d_stiffness_matrix(const c_truss_element_3d *elem, double *k, int ldk)
Compute the 6-by-6 global stiffness matrix of a 3D truss element.
void c_damper_element_3d_damping_matrix(const c_damper_element_3d *elem, double *c, int ldc)
Compute the 6-by-6 global damping matrix of a 3D damper element.
void c_solve_static_system_dense(int n, const double *k, int ldk, const double *f, double *u)
Solve the static system K*u = f for a dense stiffness matrix.
void c_beam_element_3d_rotation_matrix(const c_beam_element_3d *elem, double *r, int ldr)
Compute the 12-by-12 rotation matrix of a 3D beam element.
double c_truss_element_3d_length(const c_truss_element_3d *elem)
Compute the length of a 3D truss element.
void c_beam_element_3d_stiffness_matrix(const c_beam_element_3d *elem, int rule, double *k, int ldk)
Compute the 12-by-12 stiffness matrix of a 3D beam element.
void c_assemble_dynamic_system_truss_2d(int gdof, int n, const c_truss_element_2d *elements, int nn, const c_node *nodes, int rule, double *m, int ldm, double *k, int ldk)
Assemble dense global mass and stiffness matrices from 2D truss elements.
void c_beam_element_3d_shear_force(const c_beam_element_3d *elem, const double displacement[12], double s, double force[2])
Compute the local shear-force vector in a 3D beam element at a natural coordinate.
void c_beam_element_3d_external_force_vector(const c_beam_element_3d *elem, const double q[4], int rule, double f[12])
Compute the equivalent nodal force vector for a distributed load on a 3D beam element.
double c_damper_element_2d_force(const c_damper_element_2d *elem, const double velocity[4])
Compute the damper force (positive in tension) in a 2D damper element.
void c_damper_element_2d_damping_matrix(const c_damper_element_2d *elem, double *c, int ldc)
Compute the 4-by-4 global damping matrix of a 2D damper element.
void c_restore_constrained_values_dense(int nred, int nbc, int *gdof, const double *x, double *rst)
Restore the constrained degrees of freedom removed by c_apply_boundary_conditions_vec.
void c_truss_element_2d_mass_matrix(const c_truss_element_2d *elem, int rule, double *m, int ldm)
Compute the 4-by-4 consistent mass matrix of a 2D truss element.
double c_beam_element_2d_length(const c_beam_element_2d *elem)
Compute the length of a 2D beam element.
void c_assemble_static_system_beam_3d(int gdof, int n, const c_beam_element_3d *elements, int nn, const c_node *nodes, int rule, double *k, int ldk)
Assemble a dense global stiffness matrix from 3D beam elements.
double c_truss_element_2d_strain(const c_truss_element_2d *elem, const double displacement[4])
Compute the axial strain in a 2D truss element.
void c_beam_element_3d_mass_matrix(const c_beam_element_3d *elem, int rule, double *m, int ldm)
Compute the 12-by-12 mass matrix of a 3D beam element.
void c_assemble_dynamic_system_truss_3d(int gdof, int n, const c_truss_element_3d *elements, int nn, const c_node *nodes, int rule, double *m, int ldm, double *k, int ldk)
Assemble dense global mass and stiffness matrices from 3D truss elements.
double c_truss_element_2d_axial_force(const c_truss_element_2d *elem, const double displacement[4])
Compute the axial force (positive in tension) in a 2D truss element.
void c_beam_element_3d_strain(const c_beam_element_3d *elem, const double displacement[12], double s, double strain[4])
Compute the strain in a 3D beam element at a natural coordinate.
void c_spring_element_3d_stiffness_matrix(const c_spring_element_3d *elem, double *k, int ldk)
Compute the 6-by-6 global stiffness matrix of a 3D spring element.
void c_assemble_dynamic_system_beam_2d(int gdof, int n, const c_beam_element_2d *elements, int nn, const c_node *nodes, int rule, double *m, int ldm, double *k, int ldk)
Assemble dense global mass and stiffness matrices from 2D beam elements.
void c_mass_element_2d_mass_matrix(const c_mass_element_2d *elem, double *m, int ldm)
Compute the 2-by-2 mass matrix of a 2D point mass element.
void c_truss_element_3d_external_force_vector(const c_truss_element_3d *elem, const double q[3], int rule, double f[6])
Compute the equivalent nodal force vector for a distributed load on a 3D truss element.
void c_beam_element_2d_strain(const c_beam_element_2d *elem, const double displacement[6], double s, double strain[2])
Compute the strain in a 2D beam element at a natural coordinate.
void c_assemble_dynamic_system_beam_3d(int gdof, int n, const c_beam_element_3d *elements, int nn, const c_node *nodes, int rule, double *m, int ldm, double *k, int ldk)
Assemble dense global mass and stiffness matrices from 3D beam elements.
void c_assemble_discrete_system_2d(int gdof, int nm, const c_mass_element_2d *masses, int nd, const c_damper_element_2d *dampers, int ns, const c_spring_element_2d *springs, int nn, const c_node *nodes, double *m, int ldm, double *c, int ldc, double *k, int ldk)
Assemble dense global mass, damping, and stiffness matrices for a 2D system composed of discrete elem...
void c_truss_element_3d_rotation_matrix(const c_truss_element_3d *elem, double *r, int ldr)
Compute the 6-by-6 rotation matrix of a 3D truss element.
void c_spring_element_2d_stiffness_matrix(const c_spring_element_2d *elem, double *k, int ldk)
Compute the 4-by-4 global stiffness matrix of a 2D spring element.
double c_beam_element_3d_length(const c_beam_element_3d *elem)
Compute the length of a 3D beam element.
void c_beam_element_2d_stress(const c_beam_element_2d *elem, const double displacement[6], double s, double stress[2])
Compute the stress in a 2D beam element at a natural coordinate.
void c_apply_displacement_constraint_dense(int dof, double val, int n, double *k, int ldk, double *f)
Apply a displacement constraint to a single degree of freedom.
void c_apply_boundary_conditions_mtx(int n, int nbc, int *gdof, const double *x, int ldx, double *rst, int ldr)
Apply boundary conditions to a dense matrix by removing the constrained rows and columns.
void c_apply_boundary_conditions_vec(int n, int nbc, int *gdof, const double *x, double *rst)
Apply boundary conditions to a dense vector by removing the constrained entries.
void c_truss_element_2d_rotation_matrix(const c_truss_element_2d *elem, double *r, int ldr)
Compute the 4-by-4 rotation matrix of a 2D truss element.
double c_spring_element_2d_force(const c_spring_element_2d *elem, const double displacement[4])
Compute the spring force (positive in tension) in a 2D spring element.
void c_assemble_static_system_truss_3d(int gdof, int n, const c_truss_element_3d *elements, int nn, const c_node *nodes, double *k, int ldk)
Assemble a dense global stiffness matrix from 3D truss elements.
void c_linkage_dynamic_axial_element_results(c_linkage_dynamic_model obj, int nbody, double time, const double *position, const c_quaternion *orientation, const double *velocity, const double *angular_velocity, c_axial_element_result *results)
Query all axial elements at one state.
void c_linkage_dynamic_add_linear_spring(c_linkage_dynamic_model obj, const c_linear_spring *element)
Add a tension/compression linear spring.
void c_linkage_dynamic_add_linear_damper(c_linkage_dynamic_model obj, const c_linear_damper *element)
Add an axis-only linear viscous damper.
int c_linkage_dynamic_constraint_count(c_linkage_dynamic_model obj)
Return the linkage constraint count before any prescribed-motion constraint is added.
void c_free_linkage_dynamic_model(c_linkage_dynamic_model obj)
Release a linkage dynamic-model handle.
void c_linkage_dynamic_add_torsional_damper(c_linkage_dynamic_model obj, const c_torsional_damper *element)
Add a twist-rate damper to a revolute joint.
void c_default_variational_integrator_settings(c_variational_integrator_settings *settings)
Fill variational-integrator settings with library defaults.
void c_linkage_dynamic_solve(c_linkage_dynamic_model obj, int nbody, int nconstraint, const c_variational_integrator_settings *settings, int ntime, double dt, const double gravity[3], const double *body_force, const double *body_torque, int prescribed_body, c_linkage_prescribed_motion prescribed_motion, void *user_data, double *position, c_quaternion *orientation, double *velocity, double *angular_velocity, double *multipliers, int *converged, int *iterations, int *jacobian_singular, int *completed_steps)
Solve linkage dynamics.
int c_linkage_dynamic_torsional_element_count(c_linkage_dynamic_model obj)
void c_linkage_dynamic_add_torsional_spring(c_linkage_dynamic_model obj, const c_torsional_spring *element)
Add a linear torsional spring to a revolute joint.
void c_variational_integrator_solve(int nbody, const c_rigid_body *bodies, int ntime, double dt, const double *initial_position, const c_quaternion *initial_orientation, const double *initial_velocity, const double *initial_angular_velocity, int nconstraint, c_variational_force force_callback, c_variational_constraint constraint_callback, c_variational_constraint_jacobian jacobian_callback, void *user_data, const c_variational_integrator_settings *settings, double *position, c_quaternion *orientation, double *velocity, double *angular_velocity, double *multipliers, int *converged, int *iterations, int *jacobian_singular, int *completed_steps)
Integrate rigid bodies directly in maximal coordinates.
int c_linkage_dynamic_axial_element_count(c_linkage_dynamic_model obj)
int c_linkage_dynamic_body_count(c_linkage_dynamic_model obj)
Return the number of moving rigid bodies in a dynamic model.
c_linkage_dynamic_model c_create_linkage_dynamic_model(bool planar, int nlinks, const c_mechanism_link *links, int njoints, const c_joint *joints, int base, int nq, const double *q)
Create a dynamic model directly from parallel/planar linkage descriptors.
c_linkage_dynamic_model c_create_serial_linkage_dynamic_model(const c_serial_linkage *linkage, int n, const double *q)
Create a dynamic model from a serial linkage value.
void c_linkage_dynamic_joint_reactions(c_linkage_dynamic_model obj, int nbody, int nconstraint, double time, const double *position, const c_quaternion *orientation, const double *velocity, const double *angular_velocity, const double *multipliers, c_joint_reaction *reactions)
Convert one state's linkage multipliers into joint reaction wrenches.
void c_linkage_dynamic_torsional_element_results(c_linkage_dynamic_model obj, int nbody, double time, const double *position, const c_quaternion *orientation, const double *velocity, const double *angular_velocity, c_torsional_element_result *results)
Query all torsional elements at one state.
int c_linkage_dynamic_joint_count(c_linkage_dynamic_model obj)
Return the number of joints represented by a dynamic model.
Instantaneous scalar result for an axial force element.
Definition dynamics.h:872
double force
Signed force acting on body 1 toward body 2.
Definition dynamics.h:875
double length
Current attachment distance.
Definition dynamics.h:873
double length_rate
Relative velocity along the element axis.
Definition dynamics.h:874
A two-dimensional Bernoulli-Euler beam element.
Definition dynamics.h:1021
c_material material
The material.
Definition dynamics.h:1025
c_node node_1
The first node of the element (s = -1).
Definition dynamics.h:1037
double moment_of_inertia
The moment of inertia (second moment of area).
Definition dynamics.h:1033
double area
The cross-sectional area.
Definition dynamics.h:1029
c_node node_2
The second node of the element (s = 1).
Definition dynamics.h:1041
A three-dimensional Bernoulli-Euler beam element.
Definition dynamics.h:1050
double Iyy
The moment of inertia about the element y-axis.
Definition dynamics.h:1066
c_node node_1
The first node of the element (s = -1).
Definition dynamics.h:1078
double Iyz
The cross-sectional product of inertia.
Definition dynamics.h:1074
double area
The cross-sectional area.
Definition dynamics.h:1058
double Ixx
The moment of inertia about the element x-axis (torsional).
Definition dynamics.h:1062
double Izz
The moment of inertia about the element z-axis.
Definition dynamics.h:1070
c_material material
The material.
Definition dynamics.h:1054
c_node node_2
The second node of the element (s = 1).
Definition dynamics.h:1082
One link in a serial Denavit-Hartenberg linkage.
Definition dynamics.h:669
double link_offset
Link offset.
Definition dynamics.h:681
double joint_angle
Joint angle or displacement.
Definition dynamics.h:685
int joint_type
Joint type, for example DYN_REVOLUTE_JOINT.
Definition dynamics.h:689
double link_length
Link length.
Definition dynamics.h:673
double link_twist
Link twist.
Definition dynamics.h:677
double mass
Link mass.
Definition dynamics.h:693
An orthonormal coordinate system.
Definition dynamics.h:606
A two-dimensional linear, axial viscous damper element with x and y translations at each node.
Definition dynamics.h:1205
bool use_direction
True to define the damper axis by direction; false to define it by the vector from node_1 to node_2,...
Definition dynamics.h:1228
c_node node_1
The first node of the element.
Definition dynamics.h:1213
c_node node_2
The second node of the element.
Definition dynamics.h:1217
double damping_coefficient
The viscous damping coefficient.
Definition dynamics.h:1209
A three-dimensional linear, axial viscous damper element with x, y, and z translations at each node.
Definition dynamics.h:1236
double damping_coefficient
The viscous damping coefficient.
Definition dynamics.h:1240
c_node node_1
The first node of the element.
Definition dynamics.h:1244
c_node node_2
The second node of the element.
Definition dynamics.h:1248
bool use_direction
True to define the damper axis by direction; false to define it by the vector from node_1 to node_2,...
Definition dynamics.h:1259
One Denavit-Hartenberg parameter set.
Definition dynamics.h:631
double link_length
Link length parameter.
Definition dynamics.h:635
double joint_angle
Joint angle parameter.
Definition dynamics.h:647
double link_twist
Link twist parameter.
Definition dynamics.h:639
double link_offset
Link offset parameter.
Definition dynamics.h:643
A dynamically allocated Denavit-Hartenberg table.
Definition dynamics.h:654
int count
Number of parameter sets in the table.
Definition dynamics.h:658
c_dh_parameter_set * parameters
Dynamically allocated parameter-set array.
Definition dynamics.h:662
A single dynamic-system input/output measurement record.
Definition dynamics.h:484
int npts
Number of samples in the record.
Definition dynamics.h:488
double * output
Output samples.
Definition dynamics.h:496
double * input
Input samples.
Definition dynamics.h:492
double * t
Sample times.
Definition dynamics.h:500
Controls for a frequency sweep.
Definition dynamics.h:406
int cycle_count
Number of cycles in the frequency sweep.
Definition dynamics.h:410
bool frequency_in_hz
True when sweep frequencies are specified in hertz.
Definition dynamics.h:422
int points_per_cycle
Number of frequency points evaluated per cycle.
Definition dynamics.h:418
int transient_cycles
Number of initial cycles discarded as transients.
Definition dynamics.h:414
Iteration statistics returned by nonlinear solver routines.
Definition dynamics.h:372
int jacobian_count
Number of Jacobian evaluations.
Definition dynamics.h:400
int iter_count
Number of nonlinear iterations.
Definition dynamics.h:396
bool converge_on_chng
True when convergence was detected from solution changes.
Definition dynamics.h:376
bool converge_on_fcn
True when convergence was detected from the function value.
Definition dynamics.h:380
int gradient_count
Number of gradient evaluations.
Definition dynamics.h:392
bool converge_on_zero_diff
True when convergence was detected from a zero difference.
Definition dynamics.h:384
int fcn_count
Number of function evaluations.
Definition dynamics.h:388
Controls for nonlinear iteration routines.
Definition dynamics.h:428
double iteration_improvement_tolerance
Minimum improvement required between iterations.
Definition dynamics.h:440
int max_function_evaluations
Maximum number of function evaluations.
Definition dynamics.h:448
double residual_tolerance
Convergence tolerance for the residual.
Definition dynamics.h:444
int max_iteration_between_updates
Maximum iterations between Jacobian or gradient updates.
Definition dynamics.h:452
double change_in_solution_tolerance
Convergence tolerance for changes in the solution.
Definition dynamics.h:432
double gradient_tolerance
Convergence tolerance for the gradient.
Definition dynamics.h:436
int max_iteration_count
Maximum total number of iterations.
Definition dynamics.h:456
World-frame joint reaction exerted on the joint's child link.
Definition dynamics.h:826
A joint connecting two mechanism link frames.
Definition dynamics.h:750
bool actuated
Whether the joint variable is actuated.
Definition dynamics.h:774
int child_frame
One-based child-frame index.
Definition dynamics.h:770
int parent_link
One-based parent link index.
Definition dynamics.h:758
int parent_frame
One-based parent-frame index.
Definition dynamics.h:762
int child_link
One-based child link index.
Definition dynamics.h:766
int joint_type
Joint type, such as DYN_REVOLUTE_JOINT or DYN_FIXED_JOINT.
Definition dynamics.h:754
A line represented by a point and direction vector.
Definition dynamics.h:576
Axial linear viscous damper between body-fixed points.
Definition dynamics.h:850
int body_2
Second moving-body index, or zero for ground.
Definition dynamics.h:852
int body_1
First moving-body index, or zero for ground.
Definition dynamics.h:851
double damping
Axial damping coefficient.
Definition dynamics.h:855
Linear spring between body-fixed points; body zero denotes ground.
Definition dynamics.h:834
double free_length
Zero-force length; values below/above this produce compression/tension.
Definition dynamics.h:846
int body_2
Second moving-body index, or zero for ground.
Definition dynamics.h:838
int body_1
First moving-body index, or zero for ground.
Definition dynamics.h:836
double stiffness
Linear stiffness.
Definition dynamics.h:844
Options for the Levenberg-Marquardt solver.
Definition dynamics.h:507
double finite_difference_step_size
Relative step used for finite-difference derivatives.
Definition dynamics.h:519
double damping_increase_factor
Factor by which damping is increased after an unsuccessful step.
Definition dynamics.h:515
double damping_decrease_factor
Factor by which damping is decreased after a successful step.
Definition dynamics.h:511
int method
Damping update method, such as DYN_LEVENBERG_MARQUARDT_UPDATE.
Definition dynamics.h:523
A two-dimensional translational point mass element.
Definition dynamics.h:1266
double mass
The mass.
Definition dynamics.h:1270
c_node node_1
The node to which the mass is attached.
Definition dynamics.h:1274
A three-dimensional translational point mass element.
Definition dynamics.h:1281
double mass
The mass.
Definition dynamics.h:1285
c_node node_1
The node to which the mass is attached.
Definition dynamics.h:1289
A linear-elastic-isotropic material.
Definition dynamics.h:973
double poissons_ratio
The Poisson's ratio.
Definition dynamics.h:985
double density
The material density.
Definition dynamics.h:977
double modulus
The modulus of elasticity.
Definition dynamics.h:981
A multi-frame link used by a closed-loop mechanism.
Definition dynamics.h:723
double mass
Link mass.
Definition dynamics.h:735
double * frames
4-by-4-by-frame_count frame transforms in column-major storage.
Definition dynamics.h:731
int frame_count
Number of frames attached to the link.
Definition dynamics.h:727
A structural node with position and degrees of freedom.
Definition dynamics.h:992
int index
The global index of the node.
Definition dynamics.h:996
int dof
The number of degrees of freedom associated with the node.
Definition dynamics.h:1000
double x
The x-coordinate.
Definition dynamics.h:1004
double y
The y-coordinate.
Definition dynamics.h:1008
double z
The z-coordinate.
Definition dynamics.h:1012
Plane coefficients satisfying a*x + b*y + c*z + d = 0.
Definition dynamics.h:553
double a
Coefficient of x in the plane equation.
Definition dynamics.h:557
double d
Constant plane coefficient.
Definition dynamics.h:569
double c
Coefficient of z in the plane equation.
Definition dynamics.h:565
double b
Coefficient of y in the plane equation.
Definition dynamics.h:561
A Pluecker line represented by direction and moment vectors.
Definition dynamics.h:591
A polynomial with dynamically allocated coefficients.
Definition dynamics.h:908
int order
Polynomial order.
Definition dynamics.h:912
double * coefficients
Coefficients in ascending order of power.
Definition dynamics.h:916
A quaternion stored as scalar component followed by vector terms.
Definition dynamics.h:530
double x
First vector quaternion component.
Definition dynamics.h:538
double y
Second vector quaternion component.
Definition dynamics.h:542
double z
Third vector quaternion component.
Definition dynamics.h:546
double w
Scalar quaternion component.
Definition dynamics.h:534
Regression statistics returned by fitting routines.
Definition dynamics.h:462
double standard_error
Standard error of the fitted parameter.
Definition dynamics.h:474
double t_statistic
Student t statistic for the fitted parameter.
Definition dynamics.h:478
double probability
Probability associated with the fitted parameter statistic.
Definition dynamics.h:470
double confidence_interval
Width of the confidence interval for a fitted parameter.
Definition dynamics.h:466
Rigid-body mass properties for direct variational integration.
Definition dynamics.h:778
double mass
Body mass.
Definition dynamics.h:780
A serial linkage and its link array.
Definition dynamics.h:708
int link_count
Number of links.
Definition dynamics.h:712
c_binary_link * links
Link array.
Definition dynamics.h:716
A two-dimensional linear, axial spring element with x and y translations at each node.
Definition dynamics.h:1143
c_node node_1
The first node of the element.
Definition dynamics.h:1151
double stiffness
The spring stiffness.
Definition dynamics.h:1147
c_node node_2
The second node of the element.
Definition dynamics.h:1155
bool use_direction
True to define the spring axis by direction; false to define it by the vector from node_1 to node_2,...
Definition dynamics.h:1166
A three-dimensional linear, axial spring element with x, y, and z translations at each node.
Definition dynamics.h:1174
c_node node_2
The second node of the element.
Definition dynamics.h:1186
c_node node_1
The first node of the element.
Definition dynamics.h:1182
double stiffness
The spring stiffness.
Definition dynamics.h:1178
bool use_direction
True to define the spring axis by direction; false to define it by the vector from node_1 to node_2,...
Definition dynamics.h:1197
A continuous state-space model with column-major matrices.
Definition dynamics.h:938
double * A
State matrix, dimension by dimension.
Definition dynamics.h:954
int n_outputs
Number of outputs.
Definition dynamics.h:950
int dimension
Number of state variables.
Definition dynamics.h:942
double * D
Feedthrough matrix, n_outputs by n_inputs.
Definition dynamics.h:966
double * B
Input matrix, dimension by n_inputs.
Definition dynamics.h:958
int n_inputs
Number of inputs.
Definition dynamics.h:946
double * C
Output matrix, n_outputs by dimension.
Definition dynamics.h:962
Twist-rate damper bound to a revolute-joint axis.
Definition dynamics.h:866
int joint_index
One-based revolute-joint index.
Definition dynamics.h:867
double damping
Torque per unit relative angular velocity.
Definition dynamics.h:868
Instantaneous scalar result for a torsional force element.
Definition dynamics.h:879
double torque
Signed torque acting on the child link.
Definition dynamics.h:882
double angle
Signed relative revolute-joint angle in radians.
Definition dynamics.h:880
double angle_rate
Relative twist rate about the joint axis.
Definition dynamics.h:881
Linear torsional spring bound to a revolute-joint axis.
Definition dynamics.h:859
int joint_index
One-based revolute-joint index.
Definition dynamics.h:860
double stiffness
Torque per radian.
Definition dynamics.h:861
double free_angle
Zero-torque relative joint angle in radians.
Definition dynamics.h:862
A numerator/denominator transfer-function pair.
Definition dynamics.h:923
c_polynomial denominator
Denominator polynomial.
Definition dynamics.h:931
c_polynomial numerator
Numerator polynomial.
Definition dynamics.h:927
A two-dimensional, pin-jointed, axial-only truss element with x and y translations at each node.
Definition dynamics.h:1095
double area
The cross-sectional area.
Definition dynamics.h:1103
c_node node_2
The second node of the element (s = 1).
Definition dynamics.h:1111
c_node node_1
The first node of the element (s = -1).
Definition dynamics.h:1107
c_material material
The material.
Definition dynamics.h:1099
A three-dimensional, pin-jointed, axial-only truss element with x, y, and z translations at each node...
Definition dynamics.h:1119
c_material material
The material.
Definition dynamics.h:1123
c_node node_1
The first node of the element (s = -1).
Definition dynamics.h:1131
double area
The cross-sectional area.
Definition dynamics.h:1127
c_node node_2
The second node of the element (s = 1).
Definition dynamics.h:1135
Numerical controls for the maximal-coordinate variational integrator.
Definition dynamics.h:804
double tolerance
Euclidean nonlinear-residual convergence tolerance.
Definition dynamics.h:806
double finite_difference_step
Relative forward-difference step used for numerical Jacobians.
Definition dynamics.h:808
int maximum_line_search_iterations
Maximum residual line-search step halvings per Newton iteration.
Definition dynamics.h:816
double constraint_rotation_scale
Dimensionless quaternion-tangent finite-difference scale.
Definition dynamics.h:812
int maximum_iterations
Maximum Newton iterations allowed per time step.
Definition dynamics.h:814
int linear_solver
DYN_VI_DENSE_SOLVER or DYN_VI_GRAPH_FACTORIZED_SOLVER.
Definition dynamics.h:818
double constraint_translation_scale
Translation scale used as the absolute finite-difference floor.
Definition dynamics.h:810
int force_evaluation
One of DYN_VI_FORCE_LEFT_ENDPOINT, DYN_VI_FORCE_IMPLICIT_ENDPOINT, or DYN_VI_FORCE_MIDPOINT.
Definition dynamics.h:822
A non-owning view of one maximal-coordinate callback state.
Definition dynamics.h:788
double time
Simulation time associated with the state.
Definition dynamics.h:792
const double * position
World-frame center-of-mass positions, shape 3-by-body_count.
Definition dynamics.h:794
const c_quaternion * orientation
Body-to-world unit quaternions, length body_count.
Definition dynamics.h:796
const double * velocity
World-frame center-of-mass velocities, shape 3-by-body_count.
Definition dynamics.h:798
const double * angular_velocity
Body-frame angular velocities, shape 3-by-body_count.
Definition dynamics.h:800
int body_count
Number of rigid bodies represented by the state.
Definition dynamics.h:790