Class NodeCapacityUtility
java.lang.Object
org.eclipse.mosaic.fed.cell.utility.NodeCapacityUtility
Static methods for handling the bandwidth calculation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconsumeCapacityDown(CellConfiguration nodeCellConfiguration, long bandwidthToConsumeInBps) This method consumes the capacity of a node in the downlink direction.static voidconsumeCapacityUp(CellConfiguration nodeCellConfiguration, long consumeInBps) This method consumes the capacity of a node in the uplink direction.static voidfreeCapacityDown(CellConfiguration nodeCellConfiguration, long bandwidthToFreeInBps) Frees the bandwidth for a given node in the downlink direction.static voidfreeCapacityUp(CellConfiguration nodeCellConfiguration, long bandwidthToFreeInBps) Frees the bandwidth for a given node in the uplink direction.static longgetAvailableDownlinkCapacity(CellConfiguration nodeCellConfiguration) Returns the available bandwidth of a node in the downlink direction.static longgetAvailableUlCapacity(CellConfiguration nodeCellConfiguration) Returns the available bandwidth of a node in the uplink direction.static booleanisAvailable(TransmissionMode mode, CellConfiguration nodeCellConfiguration) This methods checks whether the node has enough capacity left to allow a new transmission with this node.static booleanisCapacitySufficient(TransmissionMode mode, CellConfiguration nodeCellConfiguration, long neededBandwidthInBps) Checks whether the bandwidth is sufficient enough to perform the transmission.
-
Constructor Details
-
NodeCapacityUtility
public NodeCapacityUtility()
-
-
Method Details
-
isCapacitySufficient
public static boolean isCapacitySufficient(TransmissionMode mode, CellConfiguration nodeCellConfiguration, long neededBandwidthInBps) Checks whether the bandwidth is sufficient enough to perform the transmission.- Parameters:
mode- The mode of the transmissionnodeCellConfiguration- The cell configuration of the node that is checkedneededBandwidthInBps- The needed bandwidth in bit/s for the transmission- Returns:
- Returns true if the bandwidth of the node is sufficient for the transmission, returns false if the bandwidth of the node is not sufficient for the transmission
-
consumeCapacityUp
This method consumes the capacity of a node in the uplink direction.- Parameters:
nodeCellConfiguration- The cell configuration of the node whose capacity is consumedconsumeInBps- The capacity to consume in bit/s. The capacity has to be larger than zero to actually consume bandwidth. If the value for consume is negative, the cell configuration remains unchanged.
-
consumeCapacityDown
public static void consumeCapacityDown(CellConfiguration nodeCellConfiguration, long bandwidthToConsumeInBps) This method consumes the capacity of a node in the downlink direction.- Parameters:
nodeCellConfiguration- The cell configuration of the node whose capacity is consumedbandwidthToConsumeInBps- The capacity to consume in bit/s. The capacity has to be larger than zero to actually consume bandwidth. If the value for consume is negative, the cell configuration remains unchanged.
-
freeCapacityUp
public static void freeCapacityUp(CellConfiguration nodeCellConfiguration, long bandwidthToFreeInBps) Frees the bandwidth for a given node in the uplink direction. This method should normally be called when a message that consumed the bandwidth was successfully delivered.- Parameters:
nodeCellConfiguration- The cell configuration of the node whose bandwidth should be freed.bandwidthToFreeInBps- The capacity that should be freed in bit/s. The capacity has to be larger than zero to actually consume bandwidth. If the value for free is negative, the cell configuration remains unchanged.
-
freeCapacityDown
public static void freeCapacityDown(CellConfiguration nodeCellConfiguration, long bandwidthToFreeInBps) Frees the bandwidth for a given node in the downlink direction. This method should normally be called when a message that consumed the bandwidth was successfully delivered.- Parameters:
nodeCellConfiguration- The cell configuration of the node whose bandwidth should be freed.bandwidthToFreeInBps- The capacity that should be freed in bit/s. The capacity has to be larger than zero to actually consume bandwidth. If the value for free is negative, the cell configuration remains unchanged.
-
isAvailable
This methods checks whether the node has enough capacity left to allow a new transmission with this node. If the available capacity of the node is below a threshold value, a new transmission is not possible and the node is not available for a new transmission.- Parameters:
mode- The requested transmission of the transmission that the node should participate in.nodeCellConfiguration- The cellConfiguration of the node that is checked for availability.- Returns:
- The method returns true, if the available capacity of the node is above the threshold for allowing a new transmission. Otherwise, the method returns false.
-
getAvailableUlCapacity
Returns the available bandwidth of a node in the uplink direction.- Parameters:
nodeCellConfiguration- The cell configuration of the node whose bandwidth is requested.- Returns:
- The available uplink bandwidth of the node with the id in bit/s. If the node is not known, the returned value is 0.
-
getAvailableDownlinkCapacity
Returns the available bandwidth of a node in the downlink direction.- Parameters:
nodeCellConfiguration- The cell configuration of the node whose bandwidth is requested.- Returns:
- The available downlink bandwidth of the node with the id in bit/s. If the node is not known, the returned value is 0.
-