cm_session_start
Start the CarMaker for Simulink session
Bring up a CarMaker for Simulink session as far as it is missing: start MATLAB (visible, in the
project's src_cm4sl folder, engine shared), run cmenv, open the Simulink model and open the CarMaker
GUI. Nothing is restarted or closed. Returns ready=true, or ready=false with what it is waiting
for: call again until ready. Without a model it opens none and lists models_loaded and
models_found to choose from. Many projects need their own setup script before the model compiles:
if init_scripts_found lists one, pass it as init.
Parametersinitmodelmax_wait_s
Check the setup: CarMaker install, Python version, MATLAB release and engine, shared MATLAB
session, GUI, project folder. Each failed check comes with its fix. ok: at least one mode is ready
(see ready); all_checks_passed: everything, the MATLAB session included.
Takes no parameters.
cm_status
Simulation status
The MATLAB session (CarMaker for Simulink) only; standalone work needs none of it (cm_doctor).
Simulation state (sim_status; sim_status_code is CarMaker's raw value, -2 idle, 0 or more running),
matlab_simstate (Simulink's model state: 'terminated' is normal when idle), active model, project
directory, last end status, the GUI's storage mode (save_mode) and gui_all_saved (false: the GUI
holds unsaved data and will ask before a load; true is no guarantee).
Takes no parameters.
cm_load_testrun
Load a test run
Load a test run into the CarMaker GUI. Requires an idle simulation. Find names with
cm_list('testrun').
Parametersnamerequiredforce
cm_start_sim
Start the simulation
Start the loaded test run. Returns once it is running; fails at once, with Simulink's error,
if the model does not compile. Then call cm_wait_end until it reports finished.
Parameterssavespeedsave_logsstart_timeout_s
cm_stop_sim
Stop the simulation
Stop the running simulation. With wait_s > 0 it returns what cm_wait_end returns.
Parameterswait_s
cm_wait_end
Wait for the simulation to end
Wait until the simulation is idle again. finished=true: end status, simulation time and
distance, result_file, new log errors and warnings (settings CarMaker ignored show up there) and
pop-ups. finished=false: current state and live values;
call again to keep waiting.
Parameterspoll_stimeout_s
cm_log
Read the CarMaker session log
Last lines of the newest CarMaker session log of the project. Use it when a run aborts or does
not start.
Parameterslevellines
cm_live
Read live quantities
Current values of CarMaker quantities during a run (or the last values after it).
Parametersquantitiesrequired
cm_dva_write
Overwrite a quantity (DVA)
Overwrite a quantity during a run via Direct Variable Access.
Parametersmodenamerequiredvaluerequiredduration_ms
cm_dva_release
Release DVA overrides
Release all quantities from DVA control.
Takes no parameters.
cm_results_list
List result files
Newest .erg result files under the project's SimOutput folder, CM_RESULT_DIRS and the folders
this session's runs wrote to.
Parameterslimit
cm_results_summary
Summarise a result file
First / last / min / max / mean and unit of quantities in a result file, plus rows and duration.
Parametersergrequiredsearchquantities
cm_results_read
Read time series from a result file
Time series from a result file, decimated to at most max_points samples.
Parametersergrequiredt_maxt_minmax_pointsquantitiesrequired
cm_results_export
Export a result file
Write quantities of a result file at full resolution (no thinning) to a MAT file (one double
variable per quantity, dots as underscores, plus quantity_names and units) or a CSV file (header
'Time [s],Car.v [m/s],...': name and unit), in any folder of this computer. Never overwrites.
Parametersergrequiredfilet_maxt_minformatquantities
cm_results_plot
Plot result files in IPGControl
Plot quantities of result files in IPGControl, IPG's plotting program; needs no MATLAB. The window
stays open for the user (the next plot replaces it) and a picture comes back as an image. This
server has no MATLAB evaluation: for MATLAB figures use a MATLAB server, or cm_results_export.
Parametersxergsrequiredpicturequantitiesrequired
cm_driver_adaption
Driver adaption
Let IPGDriver learn the car (basic) or the car on this circuit (race), and save the knowledge.
It takes minutes (basic about 2 standalone, 5 to 20 with MATLAB; race as long as the test run allows):
run it only when the car changed noticeably, the race driver lacks knowledge, or the user asks, and
tell the user the duration first. Start returns at once; then 'wait' until state is done/failed.
Parameterskindmodesaveactionrequiredtestrunknowledgetimeout_slearning_rate
cm_guide
Read a section of the guide
A section of this server's guide (the same text as the resource carmaker://guide).
Parameterstopic
cm_results_crossings
Times at which a quantity reaches values
Interpolated times at which a quantity crosses each value, and the time between the first
crossings of consecutive values (lap or sector times from distance gates); with `at`, the values of
other quantities there (the speed at 75 m).
Parametersatergrequiredvaluesrequiredquantityrequireddirection
cm_output_quantities
Read the output quantities
The quantities the next run writes to its result file, per storage rate (names may hold
wildcards), with the sample times. movie_replay says whether such a result file can be replayed in
IPGMovie. What a finished result file holds: cm_results_summary(erg, search='*').
Takes no parameters.
cm_output_quantities_edit
Change the output quantities
Add quantities to, or remove them from, the project's output-quantities file (backed up first,
logged, restored by cm_revert_all). Applies from the next start. Requires an idle simulation. Find
names with cm_live (it reads any quantity) or in another result file.
Parametersaddratepresetremove
cm_movie_open
Open IPGMovie
Open IPGMovie, CarMaker's 3D animation window (or take over one that is open). Open it BEFORE a
run: it records a run only while it is open, and cm_movie_snapshot can then show any moment of it.
Needs the MATLAB session; without it use cm_standalone_launch(movie=true).
Parametersrestart
cm_movie_snapshot
Take a picture in IPGMovie
A picture of IPGMovie's 3D view, returned as an image. After a run it shows any moment of the last
run (time_s), provided IPGMovie was open during that run. During a run, without time_s, it shows the
IPGMovie window as it is at that moment (in the window's own size). With erg it replays a saved
result file, which must hold the vehicle's motion (cm_output_quantities_edit(preset='movie') before
that run). Do not pass time_s during a run: that makes IPGMovie stop following the run. Needs the
MATLAB session's IPGMovie (cm_movie_open); a standalone IPGMovie (movie=true) has no pictures.
Parametersergwidthcameraheighttime_s
cm_list
List project data files
Names of project data files of one kind (test runs, vehicles, drivers, tyres...).
Parameterskindrequiredpatterninclude_hidden
cm_read
Read a project data file
Key / value pairs of a CarMaker infofile, 300 at a time: filter by keys, prefix or search, or page
with offset. For a test run first `driver` (its template or 'TestRun', knowledge, main limits) and,
also for a vehicle, `standalone`: false names the vehicle's Simulink parts (runs need the MATLAB
session).
Parameterskeyskindrequirednamerequiredoffsetprefixsearch
cm_diff
Compare two project data files
Keys only in a, only in b, and those whose values differ ([a, b]), e.g. two vehicles or a test
run and its clone.
Parametersarequiredbrequiredkindrequiredprefix
cm_edit
Edit a project data file
Change keys in a project file in place (backed up first, logged; only the edited lines change).
Requires an idle simulation; load the test run again afterwards. Driver parameters belong in the
driver template (kind 'driver', 'Template/<name>'), which other test runs share: say which changed.
Parameterskindrequirednamerequiredoverridesrequired
cm_clone
Copy a project data file
Copy a project file to a new name in the same kind's folder. Never overwrites. A copied test run
keeps the source's driver and knowledge (`driver`): check them for another vehicle.
Parametersbaserequiredkindrequirednew_namerequired
cm_create
Create a project data file
Write a new project file, for example a tyre property file that differs from an existing one.
Never overwrites; the file is logged and cm_revert_all moves it to the trash folder. To change a
file that exists use cm_edit, to copy one cm_clone.
Parameterskindrequirednamerequiredcontentrequired
cm_list_workspace_vars
List workspace variables
Variables (name, class, size) of the MATLAB base workspace or of a Simulink model's workspace.
Controller parameters usually live in the model workspace.
Parametersscopepattern
cm_get_workspace_var
Read a workspace variable
Value of a variable or field. MATLAB objects are described, not converted: read their fields.
Parametersnamerequiredscope
cm_set_workspace_var
Set a workspace variable
Set a variable or field. The old value is logged and cm_revert_all restores it. Model-workspace
changes live in memory until cm_model_save. Requires an idle simulation. overruled_by in the answer:
the model has a variable of that name in its own workspace and uses that one, so set it there.
Parametersnamerequiredscopevaluerequired
cm_model_get
Read a Simulink parameter
get_param on a loaded Simulink model or block.
Parameterspathrequiredparamrequired
cm_model_set
Set a Simulink parameter
set_param on a loaded Simulink model or block. Logged; cm_revert_all restores the old value.
Parameterspathrequiredsaveparamrequiredvaluerequired
cm_model_save
Save a Simulink model
Save a loaded Simulink model. The file must be inside the project; it is backed up first.
Parametersmodelrequired
cm_model_logs_save
Save Simulink's logged data to a MAT file
After a CarMaker for Simulink run: write what Simulink logged (signals marked for logging and
To Workspace blocks) to a MAT file, with the base workspace and the model workspace as one struct
each (variables: signals, base_workspace, model_workspace, info); the answer lists signal_names.
Requires an idle simulation. The result file (.erg) holds CarMaker's quantities, this the Simulink
side. To see whether a signal is logged, run with save_logs=true and read signal_names.
Parametersfilelogsmodelformatoverwritetimeout_sbase_workspacemodel_workspace
cm_standalone_servers
List running CarMaker programs
CarMaker simulation programs running on this machine (pid, description, whether this server
manages it). A CarMaker Office window you opened shows up once its application is started.
Takes no parameters.
cm_standalone_launch
Launch a standalone CarMaker run
Start a NEW independent CarMaker simulation program (not connected to MATLAB) and run a test run
on it. Only for test runs whose vehicle does not need a Simulink controller. Results go to the
project's SimOutput; see cm_standalone_results. start=false only opens CarMaker (and IPGMovie).
Parametersmoviespeedstartdrivertestrunrequiredoverridesexecutablequantitiesstop_after_s
cm_standalone_attach
Attach to a running CarMaker program
Attach to a CarMaker simulation program that is already running, for example one started from a
CarMaker Office window.
Parameterspidrequiredspeedstarttestrunoverridesquantitiesstop_after_s
cm_standalone_status
Standalone instance status
State of a standalone instance plus live values.
Parametersinstancequantities
cm_standalone_control
Control a standalone run
Start, pause, resume or stop the simulation of a standalone instance, or open its IPGMovie. A
study with movie=true runs on one instance: cm_standalone_status shows it.
Parametersactionrequiredinstance
cm_standalone_wait_end
Wait for a standalone run to end
Wait until the instance's simulation has finished. finished=true: simulation time and distance,
error flag and log errors. finished=false: call again to keep waiting.
Parametersinstancetimeout_s
cm_standalone_dva_write
Overwrite a quantity in a standalone run (DVA)
Overwrite a quantity in a running standalone simulation (Direct Variable Access).
Parametersnamerequiredvaluerequiredinstanceduration_ms
cm_standalone_results
Result files of a standalone run
Result .erg files of the instance's run (read them with cm_results_summary / cm_results_read).
Parametersinstance
cm_standalone_close
Close a standalone instance
Disconnect; for instances this server launched, also stop the CarMaker process.
Parametersinstance
cm_study_start
Start a parameter study
Run one test run several times with different parameter values, one after another, in the
background. Returns a study id at once; wait with cm_study_wait. Nothing is written to project files.
The answer names values that will change nothing: keys_not_found, workspace_not_found and
workspace_overruled (use scope=<model>); Driver.* keys that a driver template overrides are refused
(use 'driver'). Rows give valid and wall_s, the clock time of the run. A study stops at the first
run that finds no CarMaker licence.
Parametersgridkeysmodegatesmoviererunscopespeedtestrunkeep_openmax_run_ssave_logs+3 more
cm_study_status
Parameter study progress and results
State of a study (running, done, cancelled, failed) and one row per finished run, which also maps
every label to its result file. The ranking names each run's result file. To wait use
cm_study_wait.
Parameterstopstudydetaillabelsrank_bywith_studies
cm_study_wait
Wait for a parameter study
Wait until another run of the study has finished or the study has ended, at most timeout_s, and
return the rows no earlier call returned (cm_study_status has the whole table and rank_by). Call it
again while state is 'running'. Use this for studies instead of cm_wait_end.
Parametersstudydetailtimeout_suntil_done
cm_study_cancel
Cancel a parameter study
Stop the run in progress, skip the remaining ones and restore the changed workspace values. Only
cancel a study this conversation started.
Parametersstudyrequired
Recorded changes (file keys, workspace variables, model parameters, GUI settings) with old and
new values.
Parameterslimitsession
cm_revert_all
Undo this session's changes
Undo every change made in this server session: workspace values and model parameters in reverse
order, backed-up files put back (created files go to a trash folder), GUI settings restored.
Takes no parameters.
cm_restore
Restore files of an earlier session
Restore project files from the backups of an earlier session. Files only.
Parameterssessionrequired