Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
ROEdge.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2002-2023 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
23// A basic edge for routing applications
24/****************************************************************************/
25#pragma once
26#include <config.h>
27
28#include <string>
29#include <map>
30#include <vector>
31#include <algorithm>
32#include <utils/common/Named.h>
38#include <utils/geom/Boundary.h>
39#ifdef HAVE_FOX
41#endif
43#include "RONode.h"
44#include "ROVehicle.h"
45
46
47// ===========================================================================
48// class declarations
49// ===========================================================================
50class ROLane;
51class ROEdge;
52
53typedef std::vector<ROEdge*> ROEdgeVector;
54typedef std::vector<const ROEdge*> ConstROEdgeVector;
55typedef std::vector<std::pair<const ROEdge*, const ROEdge*> > ROConstEdgePairVector;
56
57
58// ===========================================================================
59// class definitions
60// ===========================================================================
70class ROEdge : public Named, public Parameterised {
71public:
79 ROEdge(const std::string& id, RONode* from, RONode* to, int index, const int priority);
80
81
83 virtual ~ROEdge();
84
85
87
88
97 virtual void addLane(ROLane* lane);
98
99
106 virtual void addSuccessor(ROEdge* s, ROEdge* via = nullptr, std::string dir = "");
107
108
112 inline void setFunction(SumoXMLEdgeFunc func) {
113 myFunction = func;
114 }
115
116
120 inline void setSource(const bool isSource = true) {
121 myAmSource = isSource;
122 }
123
124
128 inline void setSink(const bool isSink = true) {
130 }
131
132
136 inline void setRestrictions(const std::map<SUMOVehicleClass, double>* restrictions) {
137 myRestrictions = restrictions;
138 }
139
140 inline void setTimePenalty(double value) {
141 myTimePenalty = value;
142 }
143
145 inline bool isNormal() const {
147 }
148
150 inline bool isInternal() const {
152 }
153
155 inline bool isCrossing() const {
157 }
158
160 inline bool isWalkingArea() const {
162 }
163
164 inline bool isTazConnector() const {
166 }
167
168 void setOtherTazConnector(const ROEdge* edge) {
169 myOtherTazConnector = edge;
170 }
171
173 return myOtherTazConnector;
174 }
175
185 void buildTimeLines(const std::string& measure, const bool boundariesOverride);
186
187 void cacheParamRestrictions(const std::vector<std::string>& restrictionKeys);
189
190
191
193
194
200 return myFunction;
201 }
202
203
207 inline bool isSink() const {
208 return myAmSink;
209 }
210
211
215 double getLength() const {
216 return myLength;
217 }
218
222 int getNumericalID() const {
223 return myIndex;
224 }
225
226
230 double getSpeedLimit() const {
231 return mySpeed;
232 }
233
235 // sufficient for the astar air-distance heuristic
236 double getLengthGeometryFactor() const;
237
242 inline double getVClassMaxSpeed(SUMOVehicleClass vclass) const {
243 if (myRestrictions != 0) {
244 std::map<SUMOVehicleClass, double>::const_iterator r = myRestrictions->find(vclass);
245 if (r != myRestrictions->end()) {
246 return r->second;
247 }
248 }
249 return mySpeed;
250 }
251
252
256 int getNumLanes() const {
257 return (int) myLanes.size();
258 }
259
260
267 bool isConnectedTo(const ROEdge& e, const SUMOVehicleClass vClass) const;
268
269
274 inline bool prohibits(const ROVehicle* const vehicle) const {
275 const SUMOVehicleClass vclass = vehicle->getVClass();
276 return (myCombinedPermissions & vclass) != vclass;
277 }
278
281 }
282
287 inline bool restricts(const ROVehicle* const vehicle) const {
288 const std::vector<double>& vTypeRestrictions = vehicle->getType()->paramRestrictions;
289 assert(vTypeRestrictions.size() == myParamRestrictions.size());
290 for (int i = 0; i < (int)vTypeRestrictions.size(); i++) {
291 if (vTypeRestrictions[i] > myParamRestrictions[i]) {
292 return true;
293 }
294 }
295 return false;
296 }
297
298
303 bool allFollowersProhibit(const ROVehicle* const vehicle) const;
305
306
307
309
310
317 void addEffort(double value, double timeBegin, double timeEnd);
318
319
326 void addTravelTime(double value, double timeBegin, double timeEnd);
327
328
336 int getNumSuccessors() const;
337
338
344
350
351
359 int getNumPredecessors() const;
360
361
367 return myApproachingEdges;
368 }
369
371 const ROEdge* getNormalBefore() const;
372
374 const ROEdge* getNormalAfter() const;
375
383 double getEffort(const ROVehicle* const veh, double time) const;
384
385
391 bool hasLoadedTravelTime(double time) const;
392
393
400 double getTravelTime(const ROVehicle* const veh, double time) const;
401
402
411 static inline double getEffortStatic(const ROEdge* const edge, const ROVehicle* const veh, double time) {
412 return edge->getEffort(veh, time);
413 }
414
415
423 static inline double getTravelTimeStatic(const ROEdge* const edge, const ROVehicle* const veh, double time) {
424 return edge->getTravelTime(veh, time);
425 }
426
427 static inline double getTravelTimeStaticRandomized(const ROEdge* const edge, const ROVehicle* const veh, double time) {
428 return edge->getTravelTime(veh, time) * RandHelper::rand(1., gWeightsRandomFactor);
429 }
430
432 static inline double getTravelTimeAggregated(const ROEdge* const edge, const ROVehicle* const veh, double time) {
433 return edge->getTravelTime(veh, time);
434 }
435
437 static inline double getTravelTimeStaticPriorityFactor(const ROEdge* const edge, const ROVehicle* const veh, double time) {
438 double result = edge->getTravelTime(veh, time);
439 // lower priority should result in higher effort (and the edge with
440 // minimum priority receives a factor of myPriorityFactor
441 const double relativeInversePrio = 1 - ((edge->getPriority() - myMinEdgePriority) / myEdgePriorityRange);
442 result *= 1 + relativeInversePrio * myPriorityFactor;
443 return result;
444 }
445
451 inline double getMinimumTravelTime(const ROVehicle* const veh) const {
452 if (isTazConnector()) {
453 return 0;
454 } else if (veh != 0) {
455 return myLength / MIN2(veh->getType()->maxSpeed, veh->getChosenSpeedFactor() * mySpeed);
456 } else {
457 return myLength / mySpeed;
458 }
459 }
460
461
462 template<PollutantsInterface::EmissionType ET>
463 static double getEmissionEffort(const ROEdge* const edge, const ROVehicle* const veh, double time) {
464 double ret = 0;
465 if (!edge->getStoredEffort(time, ret)) {
466 const SUMOVTypeParameter* const type = veh->getType();
467 const double vMax = MIN2(type->maxSpeed, edge->mySpeed);
469 ret = PollutantsInterface::computeDefault(type->emissionClass, ET, vMax, accel, 0, edge->getTravelTime(veh, time), nullptr); // @todo: give correct slope
470 }
471 return ret;
472 }
473
474
475 static double getNoiseEffort(const ROEdge* const edge, const ROVehicle* const veh, double time);
476
477 static double getStoredEffort(const ROEdge* const edge, const ROVehicle* const /*veh*/, double time) {
478 double ret = 0;
479 edge->getStoredEffort(time, ret);
480 return ret;
481 }
483
484
486 double getDistanceTo(const ROEdge* other, const bool doBoundaryEstimate = false) const;
487
488
490 static const ROEdgeVector& getAllEdges();
491
492 static void setGlobalOptions(const bool interpolate) {
493 myInterpolate = interpolate;
494 }
495
497 myHaveTTWarned = true;
498 }
499
501 static const Position getStopPosition(const SUMOVehicleParameter::Stop& stop);
502
504 int getPriority() const {
505 return myPriority;
506 }
507
508 const RONode* getFromJunction() const {
509 return myFromJunction;
510 }
511
512 const RONode* getToJunction() const {
513 return myToJunction;
514 }
515
520 const std::vector<ROLane*>& getLanes() const {
521 return myLanes;
522 }
523
525 inline const ROEdge* getBidiEdge() const {
526 return myBidiEdge;
527 }
528
530 inline void setBidiEdge(const ROEdge* bidiEdge) {
531 myBidiEdge = bidiEdge;
532 }
533
540
547
549 bool hasStoredEffort() const {
550 return myUsingETimeLine;
551 }
552
554 static bool initPriorityFactor(double priorityFactor);
555
556protected:
563 bool getStoredEffort(double time, double& ret) const;
564
565
566
567protected:
571
573 const int myIndex;
574
576 const int myPriority;
577
579 double mySpeed;
580
582 double myLength;
583
590
595
597 static bool myInterpolate;
598
600 static bool myHaveEWarned;
602 static bool myHaveTTWarned;
603
606
608
611
614
616 const std::map<SUMOVehicleClass, double>* myRestrictions;
617
619 std::vector<ROLane*> myLanes;
620
623
626
629
632
635
637 std::vector<double> myParamRestrictions;
638
640
642 static double myPriorityFactor;
644 static double myMinEdgePriority;
646 static double myEdgePriorityRange;
647
649 mutable std::map<SUMOVehicleClass, ROEdgeVector> myClassesSuccessorMap;
650
652 mutable std::map<SUMOVehicleClass, ROConstEdgePairVector> myClassesViaSuccessorMap;
653
657
658#ifdef HAVE_FOX
660 mutable FXMutex myLock;
661#endif
662
663private:
665 ROEdge(const ROEdge& src);
666
668 ROEdge& operator=(const ROEdge& src);
669
670};
std::vector< ROEdge * > ROEdgeVector
std::vector< std::pair< const ROEdge *, const ROEdge * > > ROConstEdgePairVector
Definition ROEdge.h:55
std::vector< const ROEdge * > ConstROEdgeVector
Definition ROEdge.h:54
std::vector< ROEdge * > ROEdgeVector
Definition ROEdge.h:53
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
@ SUMO_ATTR_ACCEL
@ SUMO_ATTR_SIGMA
double gWeightsRandomFactor
Definition StdDefs.cpp:31
T MIN2(T a, T b)
Definition StdDefs.h:76
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
Base class for objects which have an id.
Definition Named.h:54
An upper class for objects with additional parameters.
static double computeDefault(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const double tt, const EnergyParams *param)
Returns the amount of emitted pollutant given the vehicle type and default values for the state (in m...
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A basic edge for routing applications.
Definition ROEdge.h:70
bool allFollowersProhibit(const ROVehicle *const vehicle) const
Returns whether this edge succeeding edges prohibit the given vehicle to pass them.
Definition ROEdge.cpp:341
static double myPriorityFactor
Coefficient for factoring edge priority into routing weight.
Definition ROEdge.h:642
RailEdge< ROEdge, ROVehicle > * getRailwayRoutingEdge() const
Definition ROEdge.h:541
double getVClassMaxSpeed(SUMOVehicleClass vclass) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition ROEdge.h:242
bool hasStoredEffort() const
whether effort data was loaded for this edge
Definition ROEdge.h:549
const ROEdge * getBidiEdge() const
return opposite superposable/congruent edge, if it exist and 0 else
Definition ROEdge.h:525
int getNumericalID() const
Returns the index (numeric id) of the edge.
Definition ROEdge.h:222
const ROEdge * getNormalBefore() const
if this edge is an internal edge, return its first normal predecessor, otherwise the edge itself
Definition ROEdge.cpp:269
double getDistanceTo(const ROEdge *other, const bool doBoundaryEstimate=false) const
optimistic distance heuristic for use in routing
Definition ROEdge.cpp:164
void setFunction(SumoXMLEdgeFunc func)
Sets the function of the edge.
Definition ROEdge.h:112
const ROEdge * getNormalAfter() const
if this edge is an internal edge, return its first normal successor, otherwise the edge itself
Definition ROEdge.cpp:281
void addEffort(double value, double timeBegin, double timeEnd)
Adds a weight value.
Definition ROEdge.cpp:140
bool hasLoadedTravelTime(double time) const
Returns whether a travel time for this edge was loaded.
Definition ROEdge.cpp:184
static double getStoredEffort(const ROEdge *const edge, const ROVehicle *const, double time)
Definition ROEdge.h:477
ReversedEdge< ROEdge, ROVehicle > * myReversedRoutingEdge
a reversed version for backward routing
Definition ROEdge.h:655
bool restricts(const ROVehicle *const vehicle) const
Returns whether this edge has restriction parameters forbidding the given vehicle to pass it.
Definition ROEdge.h:287
void buildTimeLines(const std::string &measure, const bool boundariesOverride)
Builds the internal representation of the travel time/effort.
Definition ROEdge.cpp:292
int getNumLanes() const
Returns the number of lanes this edge has.
Definition ROEdge.h:256
std::vector< ROLane * > myLanes
This edge's lanes.
Definition ROEdge.h:619
void setRestrictions(const std::map< SUMOVehicleClass, double > *restrictions)
Sets the vehicle class specific speed limits of the edge.
Definition ROEdge.h:136
static bool initPriorityFactor(double priorityFactor)
initialize priority factor range
Definition ROEdge.cpp:444
int getPriority() const
get edge priority (road class)
Definition ROEdge.h:504
static ROEdgeVector myEdges
Definition ROEdge.h:639
bool myAmSource
Definition ROEdge.h:585
RailEdge< ROEdge, ROVehicle > * myRailwayRoutingEdge
Definition ROEdge.h:656
static double getTravelTimeStaticPriorityFactor(const ROEdge *const edge, const ROVehicle *const veh, double time)
Return traveltime weighted by edge priority (scaled penalty for low-priority edges)
Definition ROEdge.h:437
const RONode * getToJunction() const
Definition ROEdge.h:512
const int myIndex
The index (numeric id) of the edge.
Definition ROEdge.h:573
SumoXMLEdgeFunc myFunction
The function of the edge.
Definition ROEdge.h:613
bool myUsingTTTimeLine
Information whether the time line shall be used instead of the length value.
Definition ROEdge.h:589
void setSource(const bool isSource=true)
Sets whether the edge is a source.
Definition ROEdge.h:120
std::map< SUMOVehicleClass, ROEdgeVector > myClassesSuccessorMap
The successors available for a given vClass.
Definition ROEdge.h:649
bool isNormal() const
return whether this edge is a normal edge
Definition ROEdge.h:145
bool isTazConnector() const
Definition ROEdge.h:164
std::map< SUMOVehicleClass, ROConstEdgePairVector > myClassesViaSuccessorMap
The successors with vias available for a given vClass.
Definition ROEdge.h:652
void setBidiEdge(const ROEdge *bidiEdge)
set opposite superposable/congruent edge
Definition ROEdge.h:530
std::vector< double > myParamRestrictions
cached value of parameters which may restrict access
Definition ROEdge.h:637
const ROEdge * getOtherTazConnector() const
Definition ROEdge.h:172
bool myUsingETimeLine
Information whether the time line shall be used instead of the length value.
Definition ROEdge.h:594
bool prohibits(const ROVehicle *const vehicle) const
Returns whether this edge prohibits the given vehicle to pass it.
Definition ROEdge.h:274
const RONode * getFromJunction() const
Definition ROEdge.h:508
double getSpeedLimit() const
Returns the speed allowed on this edge.
Definition ROEdge.h:230
const ROEdge * myOtherTazConnector
the other taz-connector if this edge isTazConnector, otherwise nullptr
Definition ROEdge.h:625
bool isSink() const
Returns whether the edge acts as a sink.
Definition ROEdge.h:207
virtual void addLane(ROLane *lane)
Adds a lane to the edge while loading.
Definition ROEdge.cpp:96
ValueTimeLine< double > myEfforts
Container storing passing time varying over time for the edge.
Definition ROEdge.h:592
bool isInternal() const
return whether this edge is an internal edge
Definition ROEdge.h:150
virtual ~ROEdge()
Destructor.
Definition ROEdge.cpp:86
void setSink(const bool isSink=true)
Sets whether the edge is a sink.
Definition ROEdge.h:128
const ROConstEdgePairVector & getViaSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges including vias, restricted by vClass.
Definition ROEdge.cpp:402
static double getTravelTimeAggregated(const ROEdge *const edge, const ROVehicle *const veh, double time)
Alias for getTravelTimeStatic (there is no routing device to provide aggregated travel times)
Definition ROEdge.h:432
ROEdge(const ROEdge &src)
Invalidated copy constructor.
static double getEmissionEffort(const ROEdge *const edge, const ROVehicle *const veh, double time)
Definition ROEdge.h:463
int getNumSuccessors() const
Returns the number of edges this edge is connected to.
Definition ROEdge.cpp:251
const ROEdge * myBidiEdge
the bidirectional rail edge or nullpr
Definition ROEdge.h:628
Boundary myBoundary
The bounding rectangle of end nodes incoming or outgoing edges for taz connectors or of my own start ...
Definition ROEdge.h:631
static double getNoiseEffort(const ROEdge *const edge, const ROVehicle *const veh, double time)
Definition ROEdge.cpp:215
RONode * myFromJunction
the junctions for this edge
Definition ROEdge.h:569
static bool myInterpolate
Information whether to interpolate at interval boundaries.
Definition ROEdge.h:597
ROEdge & operator=(const ROEdge &src)
Invalidated assignment operator.
const ROEdgeVector & getPredecessors() const
Returns the edge at the given position from the list of incoming edges.
Definition ROEdge.h:366
static void disableTimelineWarning()
Definition ROEdge.h:496
SumoXMLEdgeFunc getFunction() const
Returns the function of the edge.
Definition ROEdge.h:199
double getTravelTime(const ROVehicle *const veh, double time) const
Returns the travel time for this edge.
Definition ROEdge.cpp:190
double getMinimumTravelTime(const ROVehicle *const veh) const
Returns a lower bound for the travel time on this edge without using any stored timeLine.
Definition ROEdge.h:451
double myLength
The length of the edge.
Definition ROEdge.h:582
bool myAmSink
whether the edge is a source or a sink
Definition ROEdge.h:585
SVCPermissions getPermissions() const
Definition ROEdge.h:279
void setOtherTazConnector(const ROEdge *edge)
Definition ROEdge.h:168
const ROEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition ROEdge.cpp:366
void addTravelTime(double value, double timeBegin, double timeEnd)
Adds a travel time value.
Definition ROEdge.cpp:147
void cacheParamRestrictions(const std::vector< std::string > &restrictionKeys)
Definition ROEdge.cpp:326
int getNumPredecessors() const
Returns the number of edges connected to this edge.
Definition ROEdge.cpp:260
static double getTravelTimeStaticRandomized(const ROEdge *const edge, const ROVehicle *const veh, double time)
Definition ROEdge.h:427
static double myEdgePriorityRange
the difference between maximum and minimum priority for all edges
Definition ROEdge.h:646
double myTimePenalty
flat penalty when computing traveltime
Definition ROEdge.h:634
const std::map< SUMOVehicleClass, double > * myRestrictions
The vClass speed restrictions for this edge.
Definition ROEdge.h:616
SVCPermissions myCombinedPermissions
The list of allowed vehicle classes combined across lanes.
Definition ROEdge.h:622
static const Position getStopPosition(const SUMOVehicleParameter::Stop &stop)
return the coordinates of the center of the given stop
Definition ROEdge.cpp:358
static bool myHaveTTWarned
Information whether the edge has reported missing weights.
Definition ROEdge.h:602
double getEffort(const ROVehicle *const veh, double time) const
Returns the effort for this edge.
Definition ROEdge.cpp:154
const std::vector< ROLane * > & getLanes() const
Returns this edge's lanes.
Definition ROEdge.h:520
static double getEffortStatic(const ROEdge *const edge, const ROVehicle *const veh, double time)
Returns the effort for the given edge.
Definition ROEdge.h:411
bool isWalkingArea() const
return whether this edge is walking area
Definition ROEdge.h:160
double getLengthGeometryFactor() const
return a lower bound on shape.length() / myLength that is
Definition ROEdge.cpp:335
double getLength() const
Returns the length of the edge.
Definition ROEdge.h:215
ROEdgeVector myFollowingEdges
List of edges that may be approached from this edge.
Definition ROEdge.h:605
ROConstEdgePairVector myFollowingViaEdges
Definition ROEdge.h:607
ValueTimeLine< double > myTravelTimes
Container storing passing time varying over time for the edge.
Definition ROEdge.h:587
static void setGlobalOptions(const bool interpolate)
Definition ROEdge.h:492
bool isCrossing() const
return whether this edge is a pedestrian crossing
Definition ROEdge.h:155
static double getTravelTimeStatic(const ROEdge *const edge, const ROVehicle *const veh, double time)
Returns the travel time for the given edge.
Definition ROEdge.h:423
virtual void addSuccessor(ROEdge *s, ROEdge *via=nullptr, std::string dir="")
Adds information about a connected edge.
Definition ROEdge.cpp:111
const int myPriority
The edge priority (road class)
Definition ROEdge.h:576
static double myMinEdgePriority
Minimum priority for all edges.
Definition ROEdge.h:644
bool isConnectedTo(const ROEdge &e, const SUMOVehicleClass vClass) const
returns the information whether this edge is directly connected to the given
Definition ROEdge.cpp:438
static bool myHaveEWarned
Information whether the edge has reported missing weights.
Definition ROEdge.h:600
ReversedEdge< ROEdge, ROVehicle > * getReversedRoutingEdge() const
Definition ROEdge.h:534
static const ROEdgeVector & getAllEdges()
Returns all ROEdges.
Definition ROEdge.cpp:352
RONode * myToJunction
Definition ROEdge.h:570
ROEdgeVector myApproachingEdges
List of edges that approached this edge.
Definition ROEdge.h:610
double mySpeed
The maximum speed allowed on this edge.
Definition ROEdge.h:579
void setTimePenalty(double value)
Definition ROEdge.h:140
A single lane the router may use.
Definition ROLane.h:48
Base class for nodes used by the router.
Definition RONode.h:43
SUMOVehicleClass getVClass() const
Definition RORoutable.h:109
const SUMOVTypeParameter * getType() const
Returns the type of the routable.
Definition RORoutable.h:82
A vehicle as used by router.
Definition ROVehicle.h:50
double getChosenSpeedFactor() const
Returns an upper bound for the speed factor of this vehicle.
Definition ROVehicle.h:109
the edge type representing backward edges
Definition RailEdge.h:38
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)
the edge type representing backward edges
Structure representing possible vehicle parameter.
SUMOEmissionClass emissionClass
The emission class of this vehicle.
std::vector< double > paramRestrictions
cached value of parameters which may restrict access to certain edges
double maxSpeed
The vehicle type's (technical) maximum speed [m/s].
double getCFParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
SUMOVehicleClass vehicleClass
The vehicle's class.
static double getDefaultImperfection(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default driver's imperfection (sigma or epsilon in Krauss' model) for the given vehicle c...
static double getDefaultAccel(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default acceleration for the given vehicle class This needs to be a function because the ...
Definition of vehicle stop (position and duration)