public class ResilienceNetState
extends Object
Represents the current state of a network within the resilience simulation: SRGs/nodes/links up/down, current carried traffic per link...
Important: Users only should use this class only for queries via
getX()
methods, since kernel is in charge of modifying the network
state using the events (ResilienceEvent
)
scheduled by the event generator (see IResilienceEventGenerator
)
and the actions (see ProvisioningAction
)
provided by the event processor (see IProvisioningAlgorithm
).
Constructor and Description |
---|
ResilienceNetState(NetPlan netPlan)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
check(Map<String,String> net2planParameters)
Checks the current network state.
|
NetPlan |
convertToNetPlan()
Converts the current network state to a network plan.
|
ResilienceNetState |
copy()
Returns a deep copy of the network state
|
double[] |
getDemandCarriedTrafficInErlangsVector()
Returns the current carried traffic per demand.
|
void |
getFailureEffects(ResilienceEvent event,
Set<Integer> nodesDown,
Set<Integer> linksDown,
Set<Integer> affectedRoutes,
Set<Integer> unrecoverableRoutes,
List<Double> currentLinkAvailableCapacity,
Set<Integer> segmentsDown,
List<Double> currentSegmentAvailableCapacity) |
double[] |
getFailureGroupMTTFVector()
Returns the mean time to fail per each SRG.
|
double[] |
getFailureGroupMTTRVector()
Returns the mean time to repair per each SRG.
|
int[] |
getFailureGroupsDown() |
int[] |
getFailureStateLinks(int srgId)
Returns the links associated to a given SRG.
|
int[] |
getFailureStateNodes(int srgId)
Returns the nodes associated to a given SRG.
|
int |
getFirstAvailableNodeDownstream(int routeId,
int[] nodesDown,
int[] linksDown)
Returns the first node available from the failure point to the egress node for a given route.
|
int |
getFirstAvailableNodeUpstream(int routeId,
int[] nodesDown,
int[] linksDown)
Returns the first node available before the failure point for a given route.
|
double |
getLinkAvailableCapacityInErlangs(int linkId,
int[] linksDown) |
double[] |
getLinkAvailableCapacityInErlangsVector(int[] linksDown) |
double |
getLinkCurrentCarriedTrafficInErlangs(int linkId)
Returns the carried traffic by the specified link.
|
double[] |
getLinkCurrentCarriedTrafficInErlangsVector()
Returns a vector with the carried traffic per link.
|
int[] |
getLinksDown()
Returns the list of links which are down.
|
int[] |
getLinkTraversingRoutes(int linkId)
Returns the list of routes which are traversed by a given link.
|
double[] |
getNodeEgressTrafficInErlangsVector()
Returns the current egress traffic from each node.
|
double[] |
getNodeIngressTrafficInErlangsVector()
Returns the current ingress traffic to each node.
|
void |
getNodeLinkStateChanges(int[] newSRGsDown,
int[] newSRGsUp,
Set<Integer> nodesDown2Up,
Set<Integer> nodesUp2Down,
Set<Integer> linksDown2Up,
Set<Integer> linksUp2Down)
Returns the set of current state changes in the network.
|
int[] |
getNodesDown()
Returns the list of nodes which are down.
|
int[] |
getNodeTraversingRoutes(int nodeId)
Returns the current routes traversing a given node.
|
double[] |
getNodeTraversingTrafficInErlangsVector()
Returns the current traffic traversing each node.
|
int |
getNumberOfFailureGroups()
Returns the number of defined SRGs.
|
double[] |
getProtectionSegmentAvailableCapacityInErlangsVector(int[] segmentsDown)
Returns the available capacity at each protection segment.
|
double |
getProtectionSegmentCurrentCarriedTrafficInErlangs(int segmentId)
Returns the traffic carried by the specified protection segment.
|
double[] |
getProtectionSegmentCurrentCarriedTrafficInErlangsVector()
Returns a vector with the carried traffic per protection segment.
|
int[] |
getProtectionSegmentsDown(int[] nodesDown,
int[] linksDown)
Returns the list of protection segments which are down.
|
void |
getReparationEffects(ResilienceEvent event,
Set<Integer> nodesDown,
Set<Integer> linksDown,
Set<Integer> reparableRoutes,
Set<Integer> unreparableRoutes,
List<Double> currentLinkAvailableCapacity,
Set<Integer> segmentsDown,
List<Double> currentSegmentAvailableCapacity) |
double |
getRouteCurrentCarriedTrafficInErlangs(int routeId)
Returns the current carried traffic by a route.
|
double[] |
getRouteCurrentCarriedTrafficInErlangsVector()
Returns a vector with the current carried traffic by the routes.
|
int[] |
getRouteCurrentSequenceOfLinksAndSegments(int routeId)
Returns the list of links and segments traversed by the route.
|
int[] |
getRouteCurrentSequenceOfNodes(int routeId) |
void |
setFailureGroups(int[][] N_f,
int[][] E_f,
double[] mttf,
double[] mttr)
Sets the defined SRGs within the network.
|
String |
toString()
Returns a
String representation of the object. |
ResilienceNetState |
unmodifiableView()
Returns an unmodifiable view of the network state.
|
void |
update(ResilienceEvent event,
List<ProvisioningAction> actions)
Update the network state.
|
public ResilienceNetState(NetPlan netPlan)
netPlan
- Complete network design (including traffic routes)public NetPlan convertToNetPlan()
public ResilienceNetState copy()
public int[] getFailureStateNodes(int srgId)
srgId
- Shared-risk group identifierpublic int[] getFailureStateLinks(int srgId)
srgId
- Shared-risk group identifierpublic ResilienceNetState unmodifiableView()
public double[] getFailureGroupMTTFVector()
public double[] getFailureGroupMTTRVector()
public void setFailureGroups(int[][] N_f, int[][] E_f, double[] mttf, double[] mttr)
N_f
- Each row represents the nodes in a given SRGE_f
- Each row represents the links in a given SRGmttf
- Mean time to fail for each failure groupmttr
- Mean time to repair for each failure grouppublic int[] getLinksDown()
public int[] getNodesDown()
public int[] getProtectionSegmentsDown(int[] nodesDown, int[] linksDown)
nodesDown
- Set of nodes which are currently downlinksDown
- Set of links which are currently downpublic void getNodeLinkStateChanges(int[] newSRGsDown, int[] newSRGsUp, Set<Integer> nodesDown2Up, Set<Integer> nodesUp2Down, Set<Integer> linksDown2Up, Set<Integer> linksUp2Down)
newSRGsDown
- Set of failure groups which are moving from up to downnewSRGsUp
- Set of failure groups which are moving from down to upnodesDown2Up
- Set of nodes changing from down to upnodesUp2Down
- Set of nodes changing from up to downlinksDown2Up
- Set of links changing from down to uplinksUp2Down
- Set of links changing from up to downpublic void getFailureEffects(ResilienceEvent event, Set<Integer> nodesDown, Set<Integer> linksDown, Set<Integer> affectedRoutes, Set<Integer> unrecoverableRoutes, List<Double> currentLinkAvailableCapacity, Set<Integer> segmentsDown, List<Double> currentSegmentAvailableCapacity)
event
- Failure eventnodesDown
- linksDown
- affectedRoutes
- unrecoverableRoutes
- currentLinkAvailableCapacity
- segmentsDown
- currentSegmentAvailableCapacity
- public void getReparationEffects(ResilienceEvent event, Set<Integer> nodesDown, Set<Integer> linksDown, Set<Integer> reparableRoutes, Set<Integer> unreparableRoutes, List<Double> currentLinkAvailableCapacity, Set<Integer> segmentsDown, List<Double> currentSegmentAvailableCapacity)
event
- nodesDown
- linksDown
- reparableRoutes
- unreparableRoutes
- currentLinkAvailableCapacity
- segmentsDown
- currentSegmentAvailableCapacity
- public int getFirstAvailableNodeDownstream(int routeId, int[] nodesDown, int[] linksDown)
routeId
- Route identifiernodesDown
- Set of nodes which are currently downlinksDown
- Set of links which are currently downpublic int getFirstAvailableNodeUpstream(int routeId, int[] nodesDown, int[] linksDown)
routeId
- Route identifiernodesDown
- Set of nodes which are currently downlinksDown
- Set of links which are currently downpublic int[] getNodeTraversingRoutes(int nodeId)
nodeId
- Node identifierpublic final int[] getLinkTraversingRoutes(int linkId)
linkId
- Link identifierpublic double[] getDemandCarriedTrafficInErlangsVector()
public double[] getNodeEgressTrafficInErlangsVector()
public double[] getProtectionSegmentAvailableCapacityInErlangsVector(int[] segmentsDown)
segmentsDown
- Set of protection segments which are downpublic double getLinkAvailableCapacityInErlangs(int linkId, int[] linksDown)
linkId
- linksDown
- public double[] getLinkAvailableCapacityInErlangsVector(int[] linksDown)
linksDown
- public double[] getNodeIngressTrafficInErlangsVector()
public double[] getNodeTraversingTrafficInErlangsVector()
public int[] getFailureGroupsDown()
public void check(Map<String,String> net2planParameters)
net2planParameters
- A key-value map with Net2Plan
-wide configuration optionspublic double getLinkCurrentCarriedTrafficInErlangs(int linkId)
linkId
- Link identifierpublic double[] getLinkCurrentCarriedTrafficInErlangsVector()
public double getRouteCurrentCarriedTrafficInErlangs(int routeId)
routeId
- Route identifierpublic double[] getRouteCurrentCarriedTrafficInErlangsVector()
public int[] getRouteCurrentSequenceOfNodes(int routeId)
routeId
- public int[] getRouteCurrentSequenceOfLinksAndSegments(int routeId)
routeId
- Route identifierpublic double getProtectionSegmentCurrentCarriedTrafficInErlangs(int segmentId)
segmentId
- Protection segment identifierpublic double[] getProtectionSegmentCurrentCarriedTrafficInErlangsVector()
public void update(ResilienceEvent event, List<ProvisioningAction> actions)
event
- Failure/reparationactions
- List of action to performpublic int getNumberOfFailureGroups()
public String toString()
String
representation of the object.toString
in class Object
String
representation of the object