set
Description
set(
sets the value of the specified parameter in the ScenarioSim
,Name=Value
)ScenarioSimulation
object ScenarioSim
.
set(
replays the scenario ScenarioSim
,"SimulationCommand","Replay",FileName
) ScenarioSim
from the file FileName
when the replay command is issued.
Examples
Set Scenario Simulation Parameters
Create ss
, a ScenarioSimulation
object
rrApp = roadrunner("C:\Project\TestHighwayRoute"); openScenario(rrApp,"myScenario1"); ss = createSimulation(rrApp);
Set the simulation step size.
set(ss,StepSize=0.02)
Set the maximum simulation time.
set(ss,MaxSimulationTime=1200)
Set the simulation pacer status.
set(ss,PacerStatus="On")
Set the simulation pace.
set(ss,SimulationPace=1)
Set command to pause the simulation.
set(ss,SimulationCommand="Pause")
Turn on logging for the simulation.
set(ss,Logging="On")
Input Arguments
ScenarioSim
— RoadRunner Scenario simulation
ScenarioSimulation object
RoadRunner Scenario simulation, specified as a ScenarioSimulation
object.
Example: set(ss,MaxSimulationTime=1000)
FileName
— Name of file from which scenario is replayed
string scalar | character vector
Name of the file with .rrsimlog
extension from which a scenario
simulation is replayed, returned as a string or character vector. A simulation log can
be replayed only if the linked .rrscenario
and
.rrscene
files have not been modified after the simulation log was
saved.
If a scenario is open in theRoadRunner Scenario editor, and you then try to replay a different scenario from the corresponding simulation log, then the latter scenario also opens before its replay sequence begins.
Example:
set(ScenarioSim,"SimulationCommand","Replay","simulationLogFile1")
replays a scenario from a simulation log file named
simulationLogFile1.rrsimlog
in the current folder.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: set(ss,SimulationCommand="Start")
starts playing the
specified simulation.
StepSize
— Step size of simulation
0.02
(default) | double
Step size of the simulation in seconds, specified as a double.
MaxSimulationTime
— Maximum simulation time
1000
(default) | double
Maximum simulation time in seconds, specified as a double.
PacerStatus
— Pacer status of simulation
"On"
| "Off"
Pacer status of the simulation, specified as one of these strings.
"On"
— Pacing is turned on. You can slow down or speed up the simulation."Off"
— Pacing is turned off. You cannot slow down or speed up the simulation.
SimulationPace
— Pace of simulation
double
Pace of the simulation, specified as a double. The pace indicates speed of the simulation run.
Logging
— Logging status of the simulation
"On"
| "Off"
Logging status of the simulation, specified as one of these strings.
"On"
— Logging is turned on. You can retrieve simulation and actor information at each time step."Off"
— Logging is turned off. You cannot retrieve simulation and actor information at each time step.
SimulationCommand
— Command to control simulation
"Start"
| "Pause"
| "Continue"
| "Stop"
| "Step"
| "Replay"
Command to control simulation, specified as one of these strings.
"Start"
— Start playing an unstarted or stopped simulation."Pause"
— Pause a running simulation."Continue"
— Continue playing a paused simulation."Stop"
— Stop playing a running or paused simulation."Step"
— Move the simulation forward by one time step."Replay"
— Replay a scenario from the simulation log stored inFileName
.
Version History
Introduced in R2022aR2023a: Replay a scenario simulation from a saved file
Starting in R2023a, you can use the set
function to replay a
scenario simulation from a saved .rrsimlog
file.
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)