Skip to main content

Crate sim_cli

Crate sim_cli 

Source
Expand description

Batch front end: runs the core as fast as the CPU allows and writes CSV. Every message comes from the translation files; see cli-help-* there for the commands.

Modules§

help 🔒
The help text: one translation key per line (cli-help-<command>-<n>, see i18n/en.ftl), so that a line of the file is a line of the text, and the commands’ parts can be printed alone.
report 🔒
fit [MACHINE] --dataset DIR --report OUT: one self-contained report of a dataset folder (datasets/README.md). Every trace recording is replayed on the dataset’s machine and config (machine.simulator, machine.config, or the command line’s); the first is the one the free values are fitted on, the others are checks nothing was set from. Every frequency response’s resonance is compared with the model’s first mode. Written to OUT: report.md, summary.csv (torque and following error per recording and motor), fit.csv (the table of fit), modes.csv, bounds.csv, per recording <file>-overlay.csv and per motor <file>-torque-<motor>.svg.

Structs§

Args 🔒
Command-line arguments: positional words, and --name value options that may repeat.
Failure 🔒
A failure as a translation key and its argument.
FitRow 🔒
One value of fit that has a config counterpart and a standard error: what --within judges and --write writes.
FitTable 🔒
The table of fit as it is written: with --within two columns more, how many standard errors the fitted value is from the config’s and the result (ok, FAIL, or not judged where the row has no standard error or no config’s value).

Constants§

COMMON 🔒
Options every command takes, each with a value.
FLAGS 🔒
Options without a value.
MOTIONS 🔒
The ways to say what the machine should do: one at most.

Statics§

BOUNDED 🔒
The limit and path of the last value a shared reader refused, wherever it was read (the machine, the analyses, the verdicts), for config_help: a Failure carries key and path only.
CHECK_FAILED 🔒
Set by judged when a command that judges printed a failing row.
I18N 🔒

Functions§

accuracy 🔒
accuracy <machine> [--points N] [--repeats N] [--dwell SECONDS]: the static positioning accuracy and repeatability (sim_components::accuracy::study), N targets per axis (5), each approached N times from each side (5), resting --dwell seconds at each (0.3). One CSV line per axis and target with the mean deviations and their standard deviations from below and above; per axis the ISO 230-2 figures, at the tool the ISO 9283 ones, and the verdicts to the error stream.
analyze 🔒
analyze <machine>: peak and RMS torque, peak speed and use of the torque-speed curve per motor over one pass of the cycle, or over a trajectory or path (see poses). --points FILE also writes the operating points, --breakdown FILE the peak and RMS of each part of each motor’s torque (inertia, gravity, friction, rest, and the torque itself), --budget FILE where the energy drawn from the supply went, in joules and as a share of it.
axis_index 🔒
--axis-index N of step and bode: a whole number naming one of the machine’s axes, from 0. A float read and cast took -1 as 0 and 1.7 as 1.
before_parts 🔒
The --set assignments of a drive’s installation conditions, which are read where its part is put in (it is derated there): set before the parts are resolved, as the others are after.
bode 🔒
bode <machine>: closed-loop frequency response of the position loop of one axis.
cell 🔒
A list for one CSV cell: the names joined with “;”.
check_dataset 🔒
check-dataset DIR: what keeps a dataset folder from being published (datasets/README.md).
command_options 🔒
The options of a command beside the common ones.
compare 🔒
compare <machine> --effect NAME: the cycle run with effects.NAME on and with it off (compare_effect). Writes every signal, or those --signal ID names (it may repeat), once per millisecond of the measured pass, on and off side by side; --differences FILE the peak and the RMS of on less off per signal.
compare_kinematics 🔒
compare-kinematics TASK.toml --machines ID,ID,...: the task (search::Task: pick and place in tool space, payload, target cycle time) mapped onto each machine’s own cycle (search::task_config; a machine the task cannot be mapped onto is listed with the reason), the catalogue search run on each (with --supply, --vendor, --series, --gearboxes, --drives and --rank-by as search takes them), and per machine the best combination and its figures side by side. Machines by id, and every --machine-file FILE as well; each with its default config and --set.
config_help 🔒
What Config::hint has to add to a config error, as a suffix of its message: the nearest path (a misspelt --set path) or the value of the refused one. The config is built again for it, with the assignments that apply; an empty suffix where there is nothing to add or the config cannot be built.
dispatch 🔒
duties 🔒
The duty mix of search: with several --config FILE, each file’s config (with the parts and --set of the command line, as machine_and_config makes them) and its weight from --weights W1,W2,... (1 each without); empty for one.
estimate_row 🔒
One line of the identify table: quantity, motor, value, standard error and the 95 % interval.
fit 🔒
fit <machine>: what a measurement says the config should be, as a table of the config’s value, the fitted one and its standard error, and on the error stream what to change in the config. With --trace FILE the rigid values of each axis, or on a machine whose motors do not turn in proportion to its axes or whose inertia changes with the pose (trace::per_axis_fit: the delta, the SCARA, the arm) the payload’s factor and per motor added inertia, friction and constant torque, on an arm or SCARA per link its mass factor and first moment where the trace tells them from the motors’ values, with what each value combines, what the trace hardly excites and the pairs it cannot tell apart, and where the payload was picked or dropped during the trace (payload_step_s) its factor before and after; with --stiffness also the factor on the stiffness at --stiffness-key (the belts’ by default) from the trace’s own moves; with --sweep FILE (a frequency response as sweep writes it, taken on motor --sweep-motor with --amplitude) the load’s resonance on the belt. With --dataset DIR --report OUT the whole report of a dataset folder instead (report::run). With --within N the twin is judged: each row whose fitted value is more than N standard errors from the config’s says FAIL (columns apart and result), exit code 1. With --write FILE the config is written with the fitted values that are one key of it, and [bounds] of --sigmas standard errors (2 by default) about them.
fit_rows 🔒
The table of fit written to out, what to change in the config, the failure that came after the table, and the values the table has a config counterpart and standard error for.
fitted_band 🔒
The value factor times that of key and its band [low, high] of sigmas times error (relative) either side, or the translation key of why it is not written: the file has no such key (cli-fit-write-no-key), a named part sets it (the file’s value is not the one the fit used: cli-fit-write-by-part), or the fitted value or its error is not usable (cli-fit-write-refused). A value or bound the machine’s readers refuse (a stiffness at or below 0) is pulled in to the nearest one they take.
fmu 🔒
fmu <machine> --out FILE.fmu [--fmi 2|3]: the machine with its config as an FMI 2.0 (the default) or 3.0 Co-Simulation FMU (see sim_fmi), with the descriptions in the language of --lang. Its binaries are the files --binary names (it may repeat: for FMI 2.0 a .dll goes to win64, a .so to linux64, a .dylib to darwin64; for FMI 3.0 to <architecture>-<system>, the architecture read from the binary), or else the sim-fmi library built next to this program. A machine file (--machine-file) goes into the FMU’s resources, which builds its machine from it.
global_sensitivity 🔒
sensitivity <machine> --method morris|sobol: the global sensitivity of the cycle’s results to the values of [bounds] (only those of the tables --group names, where it is given), all moving at once (sim_components::sensitivity). Morris: --samples trajectories (10 by default), (k + 1) cycles each; one row per result and parameter with mu*, mu and sigma. Sobol: --samples base rows (64 by default), (k + 2) cycles each; S_i and S_Ti with their bootstrap 95 % intervals. Rows ranked per result, strongest first; --result NAME (repeatable) keeps only those results. --seed S (1 by default) picks other samples. The error stream says how many cycles ran and, per result, the three parameters to measure first.
identify 🔒
identify [MACHINE] --trace FILE [--map FILE]: one motor’s drive train from its own trace, with no machine config: inertia, friction (Coulomb, viscous, Stribeck, LuGre presliding stiffness), constant torque, and the lag and dead time from torque setpoint to torque (where mapped) and from position setpoint to position. --motor N picks the motor (default 0). --from HZ --to HZ also computes the frequency response torque to speed from the trace (which needs an excitation in it) and fits the two-mass model to it; --sweep FILE fits it to a measured response instead. --step-from S [--step-to S] fits the ringing of the speed after a torque step, and with --motor-inertia KGM2 (rotor and what sits on it) and the fitted total inertia the two-mass model. Every value with its standard error and 95 % interval, and how well each model reproduces the trace; --overlay FILE writes measured and modelled signals side by side. Without --map the trace is in the simulator’s columns of MACHINE.
io 🔒
judged 🔒
The result word of a judged row; a failing one makes the exit code 1.
load_trace 🔒
The trace named by --trace: through the mapping file --map (a vendor export; see docs/measurement-procedure.md), or without one in the simulator’s own columns for motors. Where a machine is replayed or fitted, the mapping’s motors have to be the machine’s, in its order. How the export was read other than it says (lines skipped, a time without unit taken as ms) goes to stderr.
machine 🔒
The machine --machine-file FILE defines (docs/machine-files.md), or else the registered one named after the command. A file’s errors name the file and the line.
machine_and_config 🔒
The machine named on the command line with its config: the default, or --config FILE, with the parts it names or --motor, --supply, --gearbox, --drive, --belt and --axis name put in from the catalogue, then every --set path=value applied on top.
main 🔒
margins 🔒
margins <machine> [--bands]: per motor the stability margins of its velocity loop (velocity_loop_margins), for the config as it is at each pose its cycle stops at (margin_poses; the start pose’s run is named “”) and with --bands with each value of [bounds] at its low and at its high bound at the start pose. With several poses each motor’s least phase margin, gain margin and margin across the play over them is named on stderr with its pose. A row whose loop is unstable, whose measurement is not valid or that hammers across its gearbox’s play (LoopMargins::stable) says FAIL; one that hammers is named on stderr with the frequency and the torque’s peak. The column before it is the describing function’s gain margin across the play (LoopMargins::play_margin_db, dB; empty where no play acts on the loop), told and not judged.
mode_shapes 🔒
modes <machine> --shapes: the modes at the start pose as the app’s mode list has them (shapes::mode_views): per mode its frequency and damping as the machine reports them, those of the linearised model’s mode its shape is of, where the shape comes from (machine or linearised), the share of its strain energy per kind of stiffness, and the shape itself, per entry of the state its real and imaginary part.
modes 🔒
modes <machine>: the modes the machine reports over the stroke of one axis (--axis-index, the first by default) at --points places (21 by default), the other axes at the start pose: position, then frequency and damping ratio of each mode, lowest first; a mode a place does not have is left empty. Where the machine’s small-amplitude modes (Machine::modes_small_amplitude, a gearbox’s hysteresis stiffness) differ, each mode has a third column with that frequency, mode<i>_small_hz.
named_config 🔒
The machine and its config with the parts the command line names in [parts], before they are resolved.
number 🔒
optimise 🔒
optimise <machine>: a shorter cycle that still passes every verdict, found by trying corner blending and higher axis limits, with input shaping where a faster setting fails on settling alone, lower lifts down to profile.min_clearance_m and lifts rounded through a via point (--runs N cycles at most, 40 by default). Prints the cycle time and what to change in the config; per changed lift its segments, height before and after, and via point. The result passes every verdict in the error bands of the config’s [bounds] too: where the fastest setting found fails there, the search’s steps are gone back to the fastest that passes (rows bands_*, and on the error stream what the bands cost). --worst judges at the worst corner of all bounds at once instead (verdict_worst, rows worst_*), judging the search’s steps from the fastest down. --nominal judges the config as written alone. --pareto FILE writes the settings that no other beats in cycle time, energy per cycle from the supply and peak motor utilisation at once, as CSV.
output 🔒
Where the CSV goes: the file named by option, or standard output.
parameters 🔒
parameters <machine>: per motor, the drive settings of the config with the SINAMICS parameter that takes each, and its value in that parameter’s unit (sim_components::parameters). The config is read as the file states it, with --set applied: the drive part is read before the parts are resolved.
path_instead 🔒
With --path FILE (and --time-optimal) of verdicts, search and optimise: the config with that path in place of the cycle (sim::with_path), so that every run they make runs the path. The path is planned once here, so that a file that cannot be read or a path that cannot be planned is said with its line before any run.
pose_text 🔒
poses 🔒
The poses at times to run: those of --trajectory FILE, or the lines and arcs of --path FILE (format: see sim_components::path; or a G-code, KRL, RAPID or robot CSV program, see sim_components::program) with their timing planned here, within the axis limits or with --time-optimal as fast as the motors allow. Where transition curves or an arc beside its stated end take the planned path off the lines and arcs of the file (profile.path_tolerance_m), the error stream says by how much (for a program of moves at one feed).
price_list 🔒
--prices FILE of search: the user’s price list (catalog::PriceList).
read 🔒
replay 🔒
replay <machine> --trace FILE: the position setpoints of a drive trace run through the simulator. Prints per motor how far simulated torque and following error are from the measured ones; --out FILE also writes measured and simulated torque, speed and following error side by side, one line per row of the trace. With --tolerance NAME=LIMIT,... (the names are the table’s columns) the twin is judged instead: one row per motor and limit, motor,quantity,value,limit,result, exit code 1 where a value is above its limit.
report 🔒
report <machine> --out FILE: the sizing report a customer signs (sim_components::report): the machine, plots of the cycle, every verdict with value, limit and margin, where each input comes from, and a sign-off block. PDF for a file ending in .pdf, HTML otherwise; --bands adds the error bands. The result goes to the error stream.
run 🔒
run <machine>: simulate a move or the cycle and write every signal as CSV. --disable-at SECONDS switches the drives off at that time, to show the axes held by the brakes, coasting or falling; --stop-at SECONDS stops them in the category of --stop-category (Command::Halt). Where the config has obstacles, the error stream says what the motion keeps from them as planned before the run, and the least clearance and first contact of the run after it.
search 🔒
search_choices 🔒
--drives paired|neighbours|all and --rank-by CRITERIA of search and compare-kinematics. With a price list (--prices of search) the default ranking is by price; price without one is refused.
search_supplies_of 🔒
search <machine>: every motor of the catalogue on the cycle of the config, each with the drive the catalogue pairs with it, the passing ones first, cheapest first (installed weight stands in for the price). --series PREFIX limits it to article numbers starting that way, --supply picks 230v or 400v (S210) or s120 (the S120 motors and Motor Modules), by default the config’s own parts.motor_supply, else 400v; or any other of catalog::SUPPLIES (another maker’s at a line voltage, or the S210 with the new 6SL5310 converters). --vendor NAME keeps the supplies of that maker (vendor_of; “all” every maker), all of them where --supply names none; the candidates of several supplies are ranked together, each with its supply. --gearboxes SERIES also tries each motor with the fitting gearboxes of that series, on a machine that has a gearbox; a motor none fits with the config’s own gearbox. SERIES is a maker (wittenstein), a maker’s series (wittenstein-sp, neugart-ple, siemens-nrk), “” for all, or a prefix of the size (NRK, as before); see catalog::gearboxes_for_motor. --axes tries every motor on every axis of the catalogue of the machine’s kind as well, the axis’s weight in the cost: belt axes, and for a screw, rack or linear motor machine the ball screws and guide sets (catalog::mech_axes; a linear motor machine’s motors are the supply’s linear motors). --motor-id ID sizes one motor of a machine with several (a machine file’s): each candidate becomes that motor’s own [parts.ID], the other motors stay as the config has them, and the cost, the tightest check, the peak torque and the winding rise are that motor’s alone (catalog::search_motor); not with --axes. Says on the error stream how many candidates could not be simulated (the reason is in the table), with --gearboxes how many motors no gearbox of the series fits, and how long the search took on how many processors.
sensitivity 🔒
sensitivity <machine>: the cycle with each parameter at its low and at its high bound of the config, or 20 % (or --delta) lower and higher where the config gives it no bounds, one at a time, as relative changes of the results, strongest first. --group NAME (repeatable) limits it to config tables; without it every table of machine and motor data is varied.
significant 🔒
A value with four significant digits and no exponent: the checks range from fractions of a millimetre to thousands of r/min, and a fixed number of decimals shows the small ones as 0.0000.
start 🔒
step 🔒
step <machine>: the answer of one axis to a small step of its position setpoint.
stop 🔒
stop <machine> [--category N] [--points N]: the stopping distance (sim_components::stop::study): the cycle, or the path of --path FILE, run once and stopped in category N (0 without it) at the moments each axis is fastest, the energy is largest, and at N moments evenly over the pass (20 without --points). One CSV line per stop, then the worst again; its moment and the verdicts on it to the error stream.
stop_category 🔒
The stop category of option (0, 1 or 2; 0 without it).
sweep 🔒
sweep <machine>: mechanical frequency response from one motor’s torque to its speed.
tell_not_finite 🔒
On the error stream, after a table of verdicts: that a result of it is not finite, and what to run to see the loop.
tell_own_unchecked 🔒
On the error stream, where the verdicts have no row “self-collision”: the machine’s own parts were not checked (it has no two parts not joined at its start pose), which is not “clear”, as “collision” is left out without obstacles.
tell_plan 🔒
On the error stream: the least clearance of a planned path to the obstacles, in mm, and its first pose in contact. Nothing without obstacles. Then, apart from it, the least clearance between the machine’s own parts that are not joined, in mm, which two and at which pose, and (when it is below the clearance or a contact) that it fails; nothing where the machine has no two parts to look at.
tell_run 🔒
On the error stream: the least clearance of the run so far to the obstacles, in mm, and its first contact with one, with effects.crash its largest contact force and its impact energy; and the drives’ first trip (effects. drive_monitoring): which monitor of which motor when, each drive’s fault reaction, and the stopping distances.
tell_start 🔒
On the error stream: how the cycle’s measured pass was started (effects.thermal_warm_start), by the largest change of a rise over it (analysis::WarmStart::change); None: from cold. Not converged, with repeat (analysis::WarmStart::repeat) beyond the tolerance, the cause: the cycle’s motion does not repeat itself.
texts 🔒
transmission 🔒
transmission <machine>: sweeps the gearbox ratio (--key gearbox.ratio, the default) or the pulley radius (--key geometry.pulley_radius_m) of the config from --from to --to in --count values (by default half to twice the config’s, 9 values), each with the velocity gain retuned and run on the cycle, and the classic optimum (the least torque per unit acceleration; for a pure inertia sqrt(J_load / J_motor)) beside them (search::transmission_sweep). Per row: the value, the torque per unit acceleration, the inertia ratio, the cycle time, and the result with its tightest check. With --gearboxes SERIES and a motor (--motor or the config’s parts.motor), the series’ gearboxes that fit it around the best ratio are run as well, as rows “catalogue”. The error stream says the classic optimum and the best value for the cycle.
tune 🔒
tune <machine> [--phase-margin DEG] [--gain-margin DB] [--no-notch]: per motor the largest velocity gain at which the least phase and gain margin over the cycle’s poses meet the targets (35 degrees and 6 dB by default), with Tn and Kv following (tune::velocity_loops). One row per key (motor, key, before, after) with the least margins over the poses before and after, each with its pose; a row of a motor whose targets are not met says FAIL (exit code 1). On stderr: what the tuning did beyond the gain (a notch, a gain lowered by the joint check) and the --set words that make the tuned config. Nothing is written to a file.
tuning 🔒
tuning <machine>: one line per axis with what the step and frequency responses say.
two_mass_rows 🔒
value_row 🔒
A value without an error (a fit quality), in the same table.
verdicts 🔒
verdicts <machine>: the cycle judged against the motor data and the [ratings] of the config, one line per check and motor. --bands adds the lowest and highest value each check takes when the parameters with [bounds] in the config are at their bounds, one at a time, and the worst-case result. --bands --samples N runs the cycle N times with all of them between their bounds at once instead (see verdict_bands_sampled; --seed S picks another set of samples, 1 by default) and adds the share of the runs in which each check passed. --bands --worst searches per check for the worst corner of the bounds instead (verdict_worst) and prints its value, its result and which parameters are at their high and which at their low bound there; the number of cycles it simulated goes to the error stream. Where the config has obstacles, the error stream first says what the cycle as planned keeps from them (collision::check_cycle), and the check “collision” judges the run.
workspace 🔒
workspace <machine>: the app’s workspace map as CSV (shapes::workspace_slice): a horizontal slice at --z (the middle of the third axis’s range by default) with --points nodes a side (61): per node x, y, the condition number (inf out of reach), whether the machine goes there (1) and the largest tool acceleration in the worst direction in m/s^2, with each motor’s peak torque.
write_fit 🔒
fit --write FILE: the config as the command line gives it, with each fitted quantity that is exactly one key of it set to the fitted value and a [bounds] entry of sigmas standard errors either side of it. Only the factor on a stiffness (--stiffness) is one key; every other quantity of the table is the trace’s value of what several keys make up (the moved mass of an axis, a friction that the motor, gearbox and guide share) or of none, and is named on the error stream with the reason, as is a key the file cannot take. The payload’s factor of a joint fit is not written either: on a cycle that picks and places, the trace holds the payload part of the time, and the factor is a share of that time as much as of the mass (the delta’s cycle with 4 kg against its 3 kg came out at 0.72 times the config’s). Comments of the written file are not kept and its keys come in alphabetical order (Config::to_text).