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.
输入参数initmodelmax_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.
无需输入参数。
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).
无需输入参数。
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').
输入参数name必填force
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.
输入参数savespeedsave_logsstart_timeout_s
cm_stop_sim
Stop the simulation
Stop the running simulation. With wait_s > 0 it returns what cm_wait_end returns.
输入参数wait_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.
输入参数poll_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.
输入参数levellines
cm_live
Read live quantities
Current values of CarMaker quantities during a run (or the last values after it).
输入参数quantities必填
cm_dva_write
Overwrite a quantity (DVA)
Overwrite a quantity during a run via Direct Variable Access.
输入参数modename必填value必填duration_ms
cm_dva_release
Release DVA overrides
Release all quantities from DVA control.
无需输入参数。
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.
输入参数limit
cm_results_summary
Summarise a result file
First / last / min / max / mean and unit of quantities in a result file, plus rows and duration.
输入参数erg必填searchquantities
cm_results_read
Read time series from a result file
Time series from a result file, decimated to at most max_points samples.
输入参数erg必填t_maxt_minmax_pointsquantities必填
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.
输入参数erg必填filet_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.
输入参数xergs必填picturequantities必填
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.
输入参数kindmodesaveaction必填testrunknowledgetimeout_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).
输入参数topic
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).
输入参数aterg必填values必填quantity必填direction
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='*').
无需输入参数。
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.
输入参数addratepresetremove
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).
输入参数restart
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.
输入参数ergwidthcameraheighttime_s
cm_list
List project data files
Names of project data files of one kind (test runs, vehicles, drivers, tyres...).
输入参数kind必填patterninclude_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).
输入参数keyskind必填name必填offsetprefixsearch
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.
输入参数a必填b必填kind必填prefix
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.
输入参数kind必填name必填overrides必填
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.
输入参数base必填kind必填new_name必填
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.
输入参数kind必填name必填content必填
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.
输入参数scopepattern
cm_get_workspace_var
Read a workspace variable
Value of a variable or field. MATLAB objects are described, not converted: read their fields.
输入参数name必填scope
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.
输入参数name必填scopevalue必填
cm_model_get
Read a Simulink parameter
get_param on a loaded Simulink model or block.
输入参数path必填param必填
cm_model_set
Set a Simulink parameter
set_param on a loaded Simulink model or block. Logged; cm_revert_all restores the old value.
输入参数path必填saveparam必填value必填
cm_model_save
Save a Simulink model
Save a loaded Simulink model. The file must be inside the project; it is backed up first.
输入参数model必填
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.
输入参数filelogsmodelformatoverwritetimeout_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.
无需输入参数。
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).
输入参数moviespeedstartdrivertestrun必填overridesexecutablequantitiesstop_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.
输入参数pid必填speedstarttestrunoverridesquantitiesstop_after_s
cm_standalone_status
Standalone instance status
State of a standalone instance plus live values.
输入参数instancequantities
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.
输入参数action必填instance
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.
输入参数instancetimeout_s
cm_standalone_dva_write
Overwrite a quantity in a standalone run (DVA)
Overwrite a quantity in a running standalone simulation (Direct Variable Access).
输入参数name必填value必填instanceduration_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).
输入参数instance
cm_standalone_close
Close a standalone instance
Disconnect; for instances this server launched, also stop the CarMaker process.
输入参数instance
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.
输入参数gridkeysmodegatesmoviererunscopespeedtestrunkeep_openmax_run_ssave_logs另有 3 个
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.
输入参数topstudydetaillabelsrank_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.
输入参数studydetailtimeout_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.
输入参数study必填
Recorded changes (file keys, workspace variables, model parameters, GUI settings) with old and
new values.
输入参数limitsession
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.
无需输入参数。
cm_restore
Restore files of an earlier session
Restore project files from the backups of an earlier session. Files only.
输入参数session必填