pydsol-model package¶
Submodules¶
pydsol.model.basic_logger module¶
pydsol.model.entities module¶
- class pydsol.model.entities.Entity(simulator, t, speed=1.4, **kwargs)[source]¶
Bases:
object
This class defines a basic entity for a discrete event simulation model.
- id_iter = count(1)¶
- class pydsol.model.entities.Vehicle(simulator, speed=10, **kwargs)[source]¶
Bases:
Entity
This class defines a vehicle in a discrete event simulation model, and is a subclass of Entity. A vehicle is an entity of which other entities can be transported. The entities on the vehicle are tracked by a list.
pydsol.model.link module¶
- class pydsol.model.link.Link(simulator, origin, destination, length, selection_weight=1, **kwargs)[source]¶
Bases:
object
This class defines a basic link between an origin and destination for a model.
- enter_link(entity, **kwargs)[source]¶
Determines the time for travelling on the link by length and speed of the entity, and schedules the event for exiting the link.
- Parameters:
entity (object) – the target on which a state change is scheduled.
kwargs – kwargs are the keyword arguments that are used to expand the link class.
- exit_link(entity, **kwargs)[source]¶
Schedules the event for entering the input node of the destination of the link. Each destination needs a method “enter_input_node”.
- Parameters:
entity (object) – the target on which a state change is scheduled.
kwargs – kwargs are the keyword arguments that are used to expand the link class.
- id_iter = count(1)¶
- class pydsol.model.link.TimePath(simulator, origin, destination, time, selection_weight=1, **kwargs)[source]¶
Bases:
object
This class defines a time path between an origin and destination for a model.
- enter_path(entity, **kwargs)[source]¶
Determines the time for travelling on the link by length and speed of the entity, and schedules the event for exiting the link.
- Parameters:
entity (object) – the target on which a state change is scheduled.
kwargs – kwargs are the keyword arguments that are used to expand the link class.
- exit_path(entity, **kwargs)[source]¶
Schedules the event for entering the input node of the destination of the link. Each destination needs a method “enter_input_node”.
- Parameters:
entity (object) – the target on which a state change is scheduled.
kwargs – kwargs are the keyword arguments that are used to expand the link class.
- id_iter = count(1)¶
pydsol.model.node module¶
- class pydsol.model.node.Node(simulator, capacity=inf, **kwargs)[source]¶
Bases:
object
This class defines a basic node for travelling in a discrete event simulation model. Input and output links are assigned by the link.
- exit_output_node(entity: Entity, **kwargs)[source]¶
Exit the resource by selecting a link on which the entity should travel to the next destination by weighted choice.
- Parameters:
entity (Entity) – the target on which a state change is scheduled.
kwargs – kwargs are the keyword arguments that are used to expand the function.
- id_iter = count(1)¶
pydsol.model.queue_model module¶
pydsol.model.resource module¶
- class pydsol.model.resource.Resource(id, simulator, queue, distribution, processing_time, transfer_in_time, **kwargs)[source]¶
Bases:
object
This class defines a basic resource for a discrete event simulation. An object (often an entity) can seize a resource. If the resource is seized, other objects cannot seize it anymore until it is released after the processing time. The remaining objects are put into a queue.
- check_queue(**kwargs)[source]¶
Checks whether there are objects in the queue to seize the resource. If there are no objects in the queue, the resource stays free. If there are objects in the queue, the first object seizes the resource.
- Parameters:
obj – optional
kwargs – kwargs are the keyword arguments that are used to expand the function.
- enter_resource()[source]¶
Schedules the event to transfer into the resource and starts processing.
- Parameters:
entity (object) – the target on which a state change is scheduled.
- exit_input_node()[source]¶
Schedules the event to enter the resource when the input node is exited. To ensure that the right resource is called, the resource key is given.
- Parameters:
entity (Entity) – the target on which a state change is scheduled.
- exit_resource(**kwargs)[source]¶
Exits the resource. The resource is released and the queue attached to this resource is checked.
- Parameters:
entity – the target on which a state change is scheduled.
kwargs – kwargs are the keyword arguments that are used to expand the function.
- id_iter = count(1)¶
pydsol.model.server module¶
- class pydsol.model.server.Server(simulator, capacity=1, distribution=<built-in method triangular of numpy.random.mtrand.RandomState object>, processing_time=(0.1, 0.2, 0.3), transfer_in_time=0, **kwargs)[source]¶
Bases:
object
This class defines a basic server for a discrete event simulation. It includes input nodes, input queue, multiple resource processes (so seize-and-release principle) based on the capacity, and output node. Since each resource process in the server has the same characteristics, the capacity is regulated via a dictionary that keeps track of the state of each resource.
- enter_input_node(entity, **kwargs)[source]¶
Schedules the event to seize the resource when an object (often an entity) enters the input node. If the entity is Vehicle, there are entities on the vehicle and therefore, the vehicle will be separated from the entity. The individual entities will try to seize a resource (capacity) in the server.
- Parameters:
entity (object) – the target on which a state change is scheduled.
kwargs – kwargs are the keyword arguments that are used to expand the function.
- enter_output_node(entity, **kwargs)[source]¶
Combine the entity with a Vehicle if an vehicle type is given. Combined or not, it schedules an event for exiting the output node.
- Parameters:
entity (Entity) – the target on which a state change is scheduled.
kwargs –
kwargs are the keyword arguments that are used to expand the function. *vehicle_type: Vehicle class
subclass of Vehicle on which the entity should travel to the next destination.
- *vehicle_speed: int, optional
speed of the vehicle.
- exit_output_node(entity, **kwargs)[source]¶
Exit the resource by selecting a link on which the entity should travel to the next destination by weighted choice.
- Parameters:
entity (Entity) – the target on which a state change is scheduled.
kwargs – kwargs are the keyword arguments that are used to expand the function.
- id_iter = count(1)¶
- seize_resource(entity, **kwargs)[source]¶
Process to seize a resource by the entity. If the resource is free and there is no queue, the entity can directly seize the resource. If the resource is free and there is a queue, the first entity of the queue seizes the resource and this entity is added to the queue. If the resource is occupied, the entity is directly added to the queue.
- Parameters:
entity (Entity) – the target on which a state change is scheduled.
kwargs – kwargs are the keyword arguments that are used to expand the function.
pydsol.model.sink module¶
- class pydsol.model.sink.Sink(simulator, transfer_in_time=0, **kwargs)[source]¶
Bases:
object
This class defines a sink for a discrete event simulation model. A Sink is the end-station of an entity, meaning the system will end here for the entity. The entity will be destroyed to reduce the number of objects in the model.
- destroy_entity(entity, **kwargs)[source]¶
Destroys the entity.
- Parameters:
entity (object) – the target on which a state change is scheduled.
- enter_input_node(entity)[source]¶
Schedules the event to transfer into the sink and exit the input node.
- Parameters:
entity (object) – the target on which a state change is scheduled.
- exit_input_node(entity, **kwargs)[source]¶
Schedules the event to exit the input node and to destroy the entity.
- Parameters:
entity (object) – the target on which a state change is scheduled.
- id_iter = count(1)¶
pydsol.model.source module¶
- class pydsol.model.source.Source(simulator, interarrival_time='default', num_entities=1, entity_type=<class 'pydsol.model.entities.Entity'>, **kwargs)[source]¶
Bases:
object
This class defines a basic source for a discrete event simulation model. A Source is the start-station of each entity, meaning the entities enter the system via the source. Entities are created at a source, given a specific interarrival time.
- create_entities(**kwargs)[source]¶
Create entities via SimEvent, given the interarrival time and the number of entities.
- Parameters:
entity_type (class) – class where to make instances of, for example class Entity
kwargs – kwargs are the keyword arguments that are used to invoke the method or expand the function.
- enter_output_node(entity, **kwargs)[source]¶
Combine the entity with a Vehicle if an vehicle type is given. Combined or not, it schedules an event for exiting the output node.
- Parameters:
entity (object) – the target on which a state change is scheduled.
kwargs –
kwargs are the keyword arguments that are used to expand the function. *vehicle_type: Vehicle class
subclass of Vehicle on which the entity should travel to the next destination.
- *vehicle_speed: int, optional
speed of the vehicle.
- exit_output_node(entity, **kwargs)[source]¶
Exit the resource by selecting a link on which the entity should travel to the next destination by weighted choice.
- Parameters:
entity (object) – the target on which a state change is scheduled.
kwargs – kwargs are the keyword arguments that are used to expand the function.
- exit_source(entity, **kwargs)[source]¶
Schedules the event to exit the source and enter the output node.
- Parameters:
entity (object) – the target on which a state change is scheduled.
kwargs – kwargs are the keyword arguments that are used to expand the function.
- id_iter = count(1)¶