18 #ifndef HLIDAC_PES_ROBOTIC_LINE_H 
   19 #define HLIDAC_PES_ROBOTIC_LINE_H 
   35 #include <unordered_set> 
   37 #include "SolverConfig.h" 
   57                 virtual uint32_t id() 
const = 0;
 
   58                 virtual Activity* baseParent() 
const = 0;
 
   71                 uint32_t aid()
 const { 
return mAid; }
 
   72                 std::string name()
 const { 
return mName; }
 
   75                 std::vector<Activity*> successors()
 const { 
return mSuccessors; }
 
   76                 std::vector<Activity*> predecessors()
 const { 
return mPredecessors; }
 
   79                 virtual bool mandatory() 
const = 0;
 
   80                 virtual bool optional() 
const = 0;
 
   81                 virtual size_t numberOfModes() 
const = 0;
 
   82                 virtual Robot* parent() 
const = 0;
 
   85                 void name(
const std::string& name) { 
mName = name; }
 
   86                 void description(
const std::string& description) { 
mDescription = description; }
 
   87                 void lastInCycle(
const bool& lastInCycle) { 
mLastInCycle = lastInCycle; }
 
   90                 void minAbsDuration(
const double& minAbsDuration) { 
mMinAbsDuration = minAbsDuration; }
 
   91                 void maxAbsDuration(
const double& maxAbsDuration) { 
mMaxAbsDuration = maxAbsDuration; }
 
   93                 virtual void parent(
Robot* parent) = 0;
 
   94                 virtual void freeAllocatedMemory() = 0;
 
  136                 virtual uint32_t id()
 const { 
return mMid; }
 
  137                 uint32_t mid()
 const { 
return mMid; }
 
  142                 std::vector<Monomial> energyFunction()
 const { 
return mEnergyFunction; }
 
  154                 void minDuration(
const double& minDuration) { 
mMinDuration = minDuration; }
 
  155                 void maxDuration(
const double& maxDuration) { 
mMaxDuration = maxDuration; }
 
  195                 virtual uint32_t id()
 const { 
return mLid; }
 
  196                 uint32_t lid()
 const { 
return mLid; }
 
  197                 uint32_t point()
 const { 
return mPoint; }
 
  198                 std::vector<LocationDependentPowerConsumption> locationDependentPowerConsumption()
 const {
 
  218                 void lid(
const uint32_t& lid) { 
mLid = lid; }
 
  219                 void point(
const uint32_t& point) { 
mPoint = point; }
 
  223                 void enteringMovements(
const std::vector<Movement*>& enteringMovements) { 
mEnteringMovements = enteringMovements; }
 
  224                 void leavingMovements(
const std::vector<Movement*>& leavingMovements) { 
mLeavingMovements = leavingMovements; }
 
  264                 std::vector<Movement*> movements()
 const { 
return mMovements; }
 
  278                 virtual size_t numberOfModes()
 const { 
return mMovements.size(); }
 
  283                 virtual void parent(
Robot* parent);
 
  289                 virtual void freeAllocatedMemory();
 
  307                 std::vector<Location*> locations()
 const { 
return mLocations; }
 
  320                 double inputPower(
const uint32_t& lid, 
const uint32_t& pid) 
const;
 
  327                 double energyConsumption(
double duration, 
const uint32_t& lid, 
const uint32_t& pid) 
const;
 
  332                 virtual size_t numberOfModes()
 const { 
return mLocations.size(); }
 
  337                 virtual void parent(
Robot* parent);
 
  340                 virtual void freeAllocatedMemory();
 
  362                 uint32_t pid()
 const { 
return mPid; }
 
  363                 std::string name()
 const { 
return mName; }
 
  364                 std::string description()
 const { 
return mDescription; }
 
  369                 void pid(
const uint32_t& pid) { 
mPid = pid; }
 
  370                 void name(
const std::string& name) { 
mName = name; }
 
  371                 void description(
const std::string& description) { 
mDescription = description; }
 
  372                 void minimalDelay(
const double& delay) { 
mMinimalDelay = delay; }
 
  373                 void expectedInputPower(
const double& expectedInputPower) { 
mExpectedInputPower = expectedInputPower; }
 
  410                 void inputPower(
const double& inputPower) { 
mInputPower = inputPower; }
 
  435                 std::string name()
 const { 
return mName; }
 
  436                 std::string description()
 const { 
return mDescription; }
 
  437                 std::vector<Activity*> activities()
 const { 
return mActivities; }
 
  438                 std::vector<RobotPowerMode*> powerModes()
 const { 
return mRobotModes; }
 
  443                 void name(
const std::string& name) { 
mName = name; }
 
  444                 void description(
const std::string& description) { 
mDescription = description; }
 
  454                                 const std::map<
Movement*, std::pair<uint32_t, uint32_t>>& movementToPoints);
 
  455                 void freeAllocatedMemory();
 
  494                 double length()
 const { 
return mLength; }
 
  495                 int32_t height()
 const { 
return mHeight; }
 
  499                 void length(
const double& length) { 
mLength = length; }
 
  500                 void height(
const int32_t& height) { 
mHeight = height; }
 
  521                 uint32_t oid()
 const { 
return mOid; }
 
  522                 std::string name()
 const { 
return mName; }
 
  523                 std::string description()
 const { 
return mDescription; }
 
  524                 std::vector<TimeLag> timeLags()
 const { 
return mTimeLags; }
 
  525                 std::vector<std::pair<Location*, Location*>> spatialCompatibility()
 const { 
return mSpatialCompatibility; }
 
  528                 void name(
const std::string& name) { 
mName = name; }
 
  529                 void description(
const std::string& description) { 
mDescription = description; }
 
  568                 std::string name()
 const { 
return mName; }
 
  569                 std::string description()
 const { 
return mDescription; }
 
  570                 std::vector<Robot*> robots()
 const { 
return mRobots; }
 
  572                 std::vector<std::pair<ActivityMode*, ActivityMode*>> collisions()
 const { 
return mCollisions; }
 
  576                 void name(
const std::string& name) { 
mName = name; }
 
  577                 void description(
const std::string& description) { 
mDescription = description; }
 
  580                 void addCollision(
const std::pair<ActivityMode*, ActivityMode*>& collision) { 
mCollisions.push_back(collision); }
 
  581                 void productionCycleTime(
const double& productionCycleTime) { 
mProductionCycleTime = productionCycleTime; }
 
  594                                 const std::map<
Movement*, std::pair<uint32_t, uint32_t>>& movementToPoints);
 
  596                 void freeAllocatedMemory();
 
The instance of the class corresponds to a robot movement between two coordinates. 
double mProductionCycleTime
Production cycle time, also called robot cycle time. 
std::vector< Movement * > mLeavingMovements
The movements leaving from this location. 
virtual bool optional() const 
None of static activities is optional since all of them have to be performed. 
The base class incorporating common properties of robot operations and movements. ...
uint32_t mMid
Movement identification. 
The instance of this class specifies input power of the robot for a particular robot configuration an...
uint32_t mAid
Identification of the activity. 
std::vector< Movement * > mEnteringMovements
The movements entering to this location. 
double inputPower(RobotPowerMode *m) const 
std::vector< std::pair< ActivityMode *, ActivityMode * > > mCollisions
Collisions between robots defined as time disjunctive pairs. 
Instance of this class includes all the data structures and methods related to a robot. 
Activity * mFrom
The activity from which the arc is leaving. 
virtual bool optional() const 
It returns whether this dynamic activity is optional, i.e. may or may not be performed. 
std::string mDescription
Description of the robotic cell. 
std::vector< Location * > mLocations
Each static activity consists of possible robot positions, i.e. locations. 
double mExpectedInputPower
Expected input power of the robot (see mParent) for this power saving mode. 
Collection of movements between two static activities. 
std::string mName
Name of the robot. 
TimeLag(Activity *f, Activity *t, double l, int32_t h)
It constructs an instance corresponding to  equation where  and  are start times of activity t and f ...
uint32_t mOid
Identification of this inter-robot operation. 
Robot * mParent
A robot that is equipped with this power saving mode. 
std::vector< RobotPowerMode * > mRobotModes
Applicable power saving modes for this robot. 
uint32_t mPid
Identification of the power saving mode. 
bool mLastInCycle
It determines whether the activity closes the robot cycle. 
std::vector< Robot * > mRobots
Robots located in this cell. 
std::string mDescription
Description of this inter-robot operation. 
void findMovementsForLocations()
Method assigns entering and leaving movements to each location in mLocations. 
int64_t * mRefCounter
Counter of references, the number of shallow copies sharing the same data. 
std::vector< std::pair< Location *, Location * > > mSpatialCompatibility
List of compatible location pairs for the handover(s). 
Movement * findMovement(const uint32_t &mid) const 
It finds a movement according to its identification. 
std::string mName
Name of the activity. 
StaticActivity * mParent
A parent of the location, i.e. static activity. 
The file defines extended exceptions for the better error handling in the program. 
std::vector< InterRobotOperation * > mInterRobotOperations
Inter-robot operations between robots. 
double mLength
The time offset of the inter-robot arc. 
Collection of locations in which a robot operation (or waiting) can be performed. ...
Robot * mParent
Pointer to the parent, i.e. a robot performing this activity. 
RoboticLine * mParent
Robotic cell in which this robot is located. 
Activity * mTo
The activity to which the arc is entering. 
static std::map< int64_t *, std::set< RoboticLine * > > liveInstances
Track of dynamically created instances, needed for managing the memory. 
A part of the energy function of a movement. 
double energyConsumption(double duration, const uint32_t &lid, const uint32_t &pid) const 
It represents the power saving mode of the robot. 
double mMaxAbsDuration
Maximal possible duration of the activity. 
double mMinDuration
The minimal possible duration of the robot movement. 
std::string mDescription
Description of the robot. 
std::vector< Activity * > mSuccessors
Successors of the activity. 
std::string mName
Name of the robotic cell. 
Instance of TimeLag class defines a time relation between two different robots. 
int32_t mHeight
The time offset in the number of cycles. 
A parallel heuristic for the energy optimization of robotic cells. 
std::string mName
Name of this inter-robot operation. 
std::string mDescription
Description of the activity. 
std::vector< LocationDependentPowerConsumption > mLocationDependentPowerConsumption
StaticActivity * cessor(const std::string &prefix) const 
std::vector< Activity * > mPredecessors
Predecessors of the activity. 
double inputPower(const uint32_t &lid, const uint32_t &pid) const 
virtual bool mandatory() const 
Each static activity is mandatory since it has to be performed. 
std::string mDescription
Description of this power saving mode. 
double mMaxDuration
The maximal duration of the movement. 
double energyConsumption(const double &duration) const 
Location * findLocation(const uint32_t &lid) const 
It finds a location according to its identification. 
uint32_t mLid
Identification of this location. 
std::vector< Monomial > mEnergyFunction
The inter-robot operation corresponding to the workpiece/weldment handling. 
Location * mParent
Parent of this class is the related location for which the input power is calculated. 
virtual bool mandatory() const 
It returns whether this dynamic activity has to be performed. 
double mInputPower
Location dependent input power. 
Either a movement or location. 
const RobotPowerMode * mPowerMode
The power saving mode which input power is location dependent. 
void initialiseDataStructures(const std::map< uint32_t, Location * > &pointToLocation, const std::map< Movement *, std::pair< uint32_t, uint32_t >> &movementToPoints)
It recursively sets parents and initializes relations between activities. 
DynamicActivity * mParent
Parent of the movement, i.e. a dynamic activity. 
double mMinAbsDuration
Minimal possible duration of the activity. 
void setActivitiesRelations(const std::map< uint32_t, Location * > &pointToLocation, const std::map< Movement *, std::pair< uint32_t, uint32_t >> &movementToPoints)
It initializes precedences between activities (successors, predecessors). 
Location of the robot used either during work (welding) or waiting. 
The robotic cell corresponds to an instance of this class. 
RobotPowerMode * fastestPowerSavingMode() const 
The power saving mode with the minimal time for an application is returned. 
double mMinimalDelay
Minimal time needed for an application of this power saving mode. 
std::vector< Activity * > mActivities
Static (operations, waiting) and dynamic (movements) activities of the robot. 
double energyConsumption(const double &duration, RobotPowerMode *m) const 
Location * mFrom
Location representing the start coordinate of the movement. 
Location * mTo
Location representing the end coordinate of the movement. 
std::string mName
Name of this power saving mode, e.g. 'brakes', 'motors', 'bus-power-off', ... 
void setParentOfChildren(RoboticLine *rl)
This method is propagated through all the parts of the robotic cell in order to set parents...
RoboticLine * mParent
A parent of the inter-robot operation is the robotic cell. 
std::vector< Movement * > mMovements
The movements of this dynamic activity. 
std::vector< TimeLag > mTimeLags
Time lags ensuring desired time synchronizations.