Class SimulatedLinkingResource
- java.lang.Object
-
- de.uka.ipd.sdq.simulation.abstractsimengine.SimulationElement
-
- de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator
-
- de.uka.ipd.sdq.simucomframework.entities.SimuComEntity
-
- de.uka.ipd.sdq.simucomframework.resources.AbstractScheduledResource
-
- de.uka.ipd.sdq.simucomframework.resources.SimulatedLinkingResource
-
- All Implemented Interfaces:
de.uka.ipd.sdq.scheduler.sensors.IActiveResourceStateSensor
,de.uka.ipd.sdq.simulation.abstractsimengine.IEntity
public class SimulatedLinkingResource extends AbstractScheduledResource
Realizes a LinkingResource. Adds the latency time to the passed demand in#consumeResource(SimuComSimProcess, double)
, and they is loaded by latency + demand / throughput.
-
-
Constructor Summary
Constructors Constructor Description SimulatedLinkingResource(org.palladiosimulator.pcm.resourceenvironment.LinkingResource linkingResource, SimuComModel simuComModel, String resourceContainerID)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activateResource()
Called by the framework to inform that the resource should start its lifecycleprotected double
calculateDemand(double demand)
Template method.void
consumeResource(SimuComSimProcess process, int resourceServiceID, Map<String,Serializable> parameterMap, double abstractDemand)
Called by client of this resource to make the resource simulate resource processing.protected de.uka.ipd.sdq.scheduler.IActiveResource
createActiveResource(SimuComModel simuComModel)
Subclasses are responsible for creating theIActiveResource
to use internally.void
deactivateResource()
Called by the framework to inform the resource that the simulation has been stopped.String
getId()
org.palladiosimulator.pcm.resourceenvironment.LinkingResource
getLinkingResource()
static String
getNextResourceId()
double
getRemainingDemandForProcess(SimuComSimProcess thread)
de.uka.ipd.sdq.scheduler.IActiveResource
getScheduledResource()
void
setLatency(String latency)
Change the linking resource latency after its creation.void
setThroughput(String throughput)
Change the linking resource throughput after its creation.void
updateDemand(SimuComSimProcess thread, double demand)
-
Methods inherited from class de.uka.ipd.sdq.simucomframework.resources.AbstractScheduledResource
addDemandListener, addOverallUtilizationListener, addStateListener, assertAvailability, demandCompleted, fireDemand, fireOverallUtilization, fireStateEvent, getDescription, getNumberOfInstances, getQueueLength, getResourceTypeId, getSchedulingStrategyID, getUnderlyingResource, isAvailable, isRequiredByContainer, setAvailable, update
-
Methods inherited from class de.uka.ipd.sdq.simucomframework.entities.SimuComEntity
getModel
-
-
-
-
Constructor Detail
-
SimulatedLinkingResource
public SimulatedLinkingResource(org.palladiosimulator.pcm.resourceenvironment.LinkingResource linkingResource, SimuComModel simuComModel, String resourceContainerID)
-
-
Method Detail
-
getId
public String getId()
-
createActiveResource
protected de.uka.ipd.sdq.scheduler.IActiveResource createActiveResource(SimuComModel simuComModel)
Description copied from class:AbstractScheduledResource
Subclasses are responsible for creating theIActiveResource
to use internally. Is called in the constructor.- Specified by:
createActiveResource
in classAbstractScheduledResource
- Returns:
- the
IActiveResource
resource to use as determined by the subclasses.
-
calculateDemand
protected double calculateDemand(double demand)
Description copied from class:AbstractScheduledResource
Template method. Implementers have to use the given demand and return the time span needed to process the demand on this resource.- Specified by:
calculateDemand
in classAbstractScheduledResource
- Parameters:
demand
- The demand issued to this resource in units understood by the resource- Returns:
- The service time, given in seconds
-
consumeResource
public void consumeResource(SimuComSimProcess process, int resourceServiceID, Map<String,Serializable> parameterMap, double abstractDemand)
Description copied from class:AbstractScheduledResource
Called by client of this resource to make the resource simulate resource processing. This is the queueing network service center part of our simulation. Allows passing of additional parameters.- Specified by:
consumeResource
in classAbstractScheduledResource
- Parameters:
abstractDemand
- : may be zero, in that case only the latency is considered.process
- The thread or job requesting the processing of its demandresourceServiceID
- The id of the resource service to be called for resource consumptionparameterMap
- Additional parameters which can be used by the resource. Map can be empty.
-
getRemainingDemandForProcess
public double getRemainingDemandForProcess(SimuComSimProcess thread)
- Specified by:
getRemainingDemandForProcess
in classAbstractScheduledResource
-
updateDemand
public void updateDemand(SimuComSimProcess thread, double demand)
- Specified by:
updateDemand
in classAbstractScheduledResource
-
getScheduledResource
public de.uka.ipd.sdq.scheduler.IActiveResource getScheduledResource()
- Specified by:
getScheduledResource
in classAbstractScheduledResource
-
activateResource
public void activateResource()
Description copied from class:AbstractScheduledResource
Called by the framework to inform that the resource should start its lifecycle- Overrides:
activateResource
in classAbstractScheduledResource
-
deactivateResource
public void deactivateResource()
Description copied from class:AbstractScheduledResource
Called by the framework to inform the resource that the simulation has been stopped. Fires aIStateListener#stateChanged()
event.- Overrides:
deactivateResource
in classAbstractScheduledResource
-
getNextResourceId
public static String getNextResourceId()
-
getLinkingResource
public org.palladiosimulator.pcm.resourceenvironment.LinkingResource getLinkingResource()
-
setThroughput
public void setThroughput(String throughput)
Change the linking resource throughput after its creation.- Parameters:
throughput
- the new throughput specification
-
setLatency
public void setLatency(String latency)
Change the linking resource latency after its creation.- Parameters:
latency
- the new latency specification
-
-