op_ima_traj_speed_set()
Abstract
Sets the speed at which a specified object follows its trajectory.
Syntax
op_ima_traj_speed_set (objid, speed_m_s, for_current_segment_only)
| Argument | Type | Description |
|---|---|---|
objid |
Objid |
object ID of the site of interest; must be a mobile node or mobile subnet |
speed_m_s |
double |
speed, in meters per second |
for_current_segment_only |
int |
whether the speed applies to the current segment (TRUE) or all of the trajectory (FALSE) |
Return Type
Compcode
OPC_COMPCODE_SUCCESS if the speed is set; OPC_COMPCODE_FAILURE otherwise.
Example
double duration = op_ima_traj_remaining_duration_get (subnet_objid);
if (duration == 0)
{
op_ima_traj_set (subnet_objid, "NE_zig_zag", 0.0);
op_ima_traj_speed_set (subnet_objid, op_dist_uniform (100.0) + 10.0, VOSC_FALSE);
}
Details
None.
Purpose
Provides a way to override the speed specified by a trajectory. You can specify a speed for the current segment or all of the remaining trajectory.
This KP lets you override the speed at any time during a simulation. You can also set the trajectory speed prior to running the simulation by setting the “trajectory_speed_override“ attribute on a specific mobile site.
Errors
- Recoverable Error: Object ID (
<objid>) is out-of-range. - Recoverable Error: Object ID (
<objid>) refers to a restricted object. - Recoverable Error: Object (
<objid>) has incorrect type (<type>); mobile sites are expected.
Reference
- Use the KP op_ima_traj_info_get() to get the current speed and ascent rate of a site and the time until one of these changes
- Use the KP op_ima_traj_remaining_duration_get() to get the time remaining until a site reaches the end of its trajectory
- Use the KP op_ima_traj_set() to assign a new trajectory to a site