Core

The core package contains the most essential files in our ManPy extension.

manpy.simulation.core.Feature.py

class manpy.simulation.core.Feature.Feature(id='', name='', victim=None, distribution={}, distribution_state_controller=None, reset_distributions=True, no_negative=False, contribute=None, start_time=0, end_time=0, start_value=None, random_walk=False, dependent=None)[source]

Bases: ObjectProperty

The Feature ObjectProperty generates Features for a Machine and stores them in Entities

Parameters:
  • id – The id of the Feature

  • name – The name of the Feature

  • victim – The machine to which the feature belongs

  • distribution – The statistical distribution of the value of the Feature

  • distribution_state_controller – StateController that can contain different distributions.

  • reset_distributions – Active with deteriorationType working; Resets distribution_state_controller when the victim is interrupted (=repaired)

  • no_negative – If this value is true, returns 0 for values below 0 of the feature value

  • contribute – Needs Failures in a list as an input to contribute the Feature value to conditions

  • start_time – The starting time for the feature. If >0, the feature generation is started if start_time is reached

  • end_time – The end time for the feature. If >0 and > start_time, the feature generation is ended if end_time is reached

  • start_value – The starting value of the Feature

  • random_walk – If this is True, the Feature will continuously take the previous feature_value into account

  • dependent – A dictionary containing a Function and the corresponding variables, to determine dependencies between features

  • kw – The keyword arguments

generate_feature()[source]

Generates the actual feature value

initialize()[source]
run()[source]

Every Object has to have a run method. Simpy is mainly used in this function

manpy.simulation.core.Timeseries.py

class manpy.simulation.core.Timeseries.Timeseries(id='', name='', victim=None, distribution={}, no_negative=False, contribute=None, start_value=0, random_walk=False, step_time=None)[source]

Bases: ObjectProperty

The TimeSeries ObjectProperty generates TimeSeries for a Machine and stores them in Entities

Parameters:
  • id – The id of the Feature

  • name – The name of the Feature

  • victim – The machine to which the feature belongs

  • distribution – The statistical distribution of the value of the Datapoints

  • no_negative – If this value is true, returns 0 for values below 0 of the feature value

  • contribute – Needs Failures in a list as an input to contribute the TimeSeries value to conditions

  • start_value – The starting value of the TimeSeries

  • random_walk – If this is True, the TimeSeries will continuously take the previous Datapoint value into account

  • step_time – The time between each Datapoint for a TimeSeries

initialize()[source]

Initializes the object

run()[source]

Every Object has to have a run method. Simpy is mainly used in this function

Returns:

None

manpy.simulation.core.StateController.py

class manpy.simulation.core.StateController.ContinuousNormalDistribution(mean_change_per_step, initial_mean, std, wear_per_step=0, break_point=None, defect_mean=None, defect_std=None)[source]

Bases: StateController

Normal Distribution that changes its mean value with each step. Optionally, a defect can occur after a defined period. Provides label.

Parameters:
  • wear_per_step – How much wear happens per step

  • break_point – When this value of wear is reached, a defect happens. Will be ignored if None

  • mean_change_per_step – Value that is added to the mean of the normal distribution in each step

  • initial_mean – Initial mean value of the normal distribution

  • std – STD of the normal distribution, does not change

  • defect_mean – Mean value in the defect state

  • defect_std – STD in the defect state

get_and_update()[source]

Retrieves the current state first, then updates the internal state transition mechanism and then returns the retrieved state and a label for the state.

Returns:

Current state and label: (state, label (bool))

get_initial_state()[source]
Returns:

Initial state and label: (state, label (bool))

reset()[source]

Resets the internal statistics of the controller. Should be called after something is repaired.

Returns:

None

class manpy.simulation.core.StateController.RandomDefectStateController(failure_probability, ok_controller: StateController, defect_controllers: list)[source]

Bases: StateController

Orchestrates multiple StateControllers. Using a Bernoulli-Distribution, it chooses either the ok or the defect distribution.

Parameters:
  • failure_probability – Probability of failure for the Bernoulli-Distribution.

  • ok_controller

  • defect_controllers – list of StateControllers. If a random failure occurs, one of them is drawn with uniform distribution. Example: in case of defect, a value can be either too high or too low

get_and_update()[source]

Retrieves the current state first, then updates the internal state transition mechanism and then returns the retrieved state and a label for the state.

Returns:

Current state and label: (state, label (bool))

get_initial_state()[source]
Returns:

Initial state and label: (state, label (bool))

reset()[source]

Resets the internal statistics of the controller. Should be called after something is repaired.

Returns:

None

class manpy.simulation.core.StateController.SimpleStateController(states: list, boundaries: dict, wear_per_step, labels=None, initial_state_index=0, reset_amount=None)[source]

Bases: StateController

Simple version of a StateController that sets states according to a certain amount of wear.

Parameters:
  • (list) (states) – A list containing the actual states

  • (dict) (boundaries) – A dict defining the boundaries for each state. Must contain pairs of (interval, state_index). Intervals are defined as a tuple: (lower, upper). The lower bound is included, upper bound is not included. 0 must be included. Example: states = [state0, state1, state2] boundaries = {(0, 150): 0, (150, 300): 1, (300, None): 2}

  • wear_per_step – A number that defines how much wear is added per step. The account starts at 0.

  • reset_amount – When the account value reaches this amount, the StateController gets reset.

get_and_update()[source]

Retrieves the current state first, then updates the internal state transition mechanism and then returns the retrieved state and a label for the state.

Returns:

Current state and label: (state, label (bool))

get_initial_state()[source]
Returns:

Initial state and label: (state, label (bool))

reset()[source]

Resets the internal statistics of the controller. Should be called after something is repaired.

Returns:

None

class manpy.simulation.core.StateController.StateController[source]

Bases: ABC

Abstract base class for all StateControllers. A StateController must provide a get_and_update() and reset() method.

abstract get_and_update()[source]

Retrieves the current state first, then updates the internal state transition mechanism and then returns the retrieved state and a label for the state.

Returns:

Current state and label: (state, label (bool))

abstract get_initial_state()[source]
Returns:

Initial state and label: (state, label (bool))

abstract reset()[source]

Resets the internal statistics of the controller. Should be called after something is repaired.

Returns:

None

manpy.simulation.core.Machine.py

Created on 8 Nov 2012

@author: George

class manpy.simulation.core.Machine.Machine(id, name, capacity=1, processingTime=None, repairman='None', operatorPool='None', operationType='None', setupTime=None, loadTime=None, preemption={}, canDeliverOnInterruption=False, technology=None, priority=0, control=None, cost=0, **kw)[source]

Bases: CoreObject

Models a machine that can also have failures

canAccept(callerObject=None)[source]

checks if the Machine can accept an entity. it checks also who called it and returns TRUE only to the predecessor that will give the entity.

canAcceptAndIsRequested(callerObject=None)[source]

checks if the Machine can accept an entity and there is an entity in some possible giver waiting for it. also updates the giver to the one that is to be taken

canDeliver(entity=None)[source]

checks whether the entity can proceed to a successor object

checkIfMachineIsUp()[source]

checks if the machine is Up

checkOperator(callerObject=None)[source]

to be called by canAcceptAndIsRequested and check for the operator

createBroker()[source]

create broker if needed

createOperatorPool(operatorPool)[source]

create an operatorPool if needed

createRouter()[source]

create router if needed

endOperationActions(type)[source]

actions to be performed after an operation (setup or processing)

getEntity()[source]

get an entity from the giver

static getOperationTime(time)[source]

returns the dictionary updated

haveToDispose(callerObject=None)[source]

checks if the Machine can dispose an entity to the following object

initialize()[source]

initializes the machine

initializeBroker()[source]

initialise broker if needed

initializeOperatorPool()[source]

initialise broker if needed

initializeRouter()[source]

initialise router if needed

interruptionActions(type='Processing')[source]

actions to be carried out when the processing of an Entity ends

isInterrupted()[source]

returns true if the station is interrupted

isLoadRequested()[source]

return whether Load or setup Requested

isOperated()[source]

check if the machine is currently operated by an operator

operation(type='Processing')[source]

general process, it can be processing or setup

outputResultsJSON()[source]

outputs results to JSON File

postInterruptionActions()[source]

actions to be carried out when the processing of an Entity ends

release()[source]

yielding the broker process for releasing the resource

releaseOperator()[source]

prepare the machine to be released

removeEntity(entity=None)[source]

removes an entity from the Machine

request()[source]

yielding the broker process for requesting an operator

requestOperator()[source]

prepare the machine to be operated

run()[source]

the main process of the machine

shouldYield(operationTypes={}, methods={})[source]

method controlling if there is a need to yield

manpy.simulation.core.Assembly.py

Created on 18 Feb 2013

@author: George

class manpy.simulation.core.Assembly.Assembly(id='', name='', cost=0, processingTime=None, entity='manpy.Part', inputsDict=None, **kw)[source]

Bases: CoreObject

Models an assembly object it gathers frames and parts which are loaded to the frames

appendEntity(entity=None)[source]

appends entity to the receiver object. to be called by the removeEntity of the giver. this method is created to be overridden by the Assembly class in its getEntity where Frames are loaded

canAccept(callerObject=None)[source]

checks if the Assembly can accept an entity

canAcceptAndIsRequested(callerObject=None)[source]

checks if the Assembly can accept a part or a Frame

getEntity(type)[source]

gets an entity from the giver. it may handle both Parts and Frames

haveToDispose(callerObject=None)[source]

checks if the Assembly can dispose an entity to the following object

initialize()[source]

initialize method

outputResultsJSON()[source]

outputs results to JSON File

parseInputs(inputsDict)[source]

parses inputs if they are given in a dictionary

removeEntity(entity=None)[source]

removes an entity from the Assembly

run()[source]

class generator

manpy.simulation.core.Failure.py

Created on 9 Nov 2012

@author: George

class manpy.simulation.core.Failure.Failure(id='', name='', victim=None, distribution={}, index=0, repairman=None, offshift=False, deteriorationType='constant', waitOnTie=False, conditional=None, entity=False, remove=False, cost=0, **kw)[source]

Bases: ObjectInterruption

Models failures of machines.

Parameters:
  • id – Internal ID of the failure.

  • name – Name of the failure.

  • victim – Victim (i.e. the machine that should fail) for the Failure

  • distribution – dictionary containing the individual distributions, e.g. TTF and TTR

  • index – Internal index, only used if name is empty.

  • repairman – Repairman with constrained resources that’s assigned to this failure. Optional.

  • offshift – flag used to identify if the time between failures should be counted while the victim is off-shift

  • deteriorationType – shows how the time to failure is measured; ‘constant’ means it counts not matter the state of the victim; ‘onShift’ counts only if the victim is onShift; ‘working’ counts only working time

  • waitOnTie – flag to show if the failure will wait on tie with other events before interrupting the victim

  • conditional – function that evaluates a condition. If return value true, the failure will be triggered. Is used instead of passing a TTF in distribution.

  • entity – With the parameter entity=True, the Time-to-Failure (TTF) is calculated based on the processing time of the entity within the machine

  • remove – Should the entities on which the failure occured be removed from the production line (=destroyed)?

  • kw

initialize()[source]
run()[source]

The run method for the failure which has to served by a repairman

manpy.simulation.core.Source.py

Created on 8 Nov 2012

@author: George

class manpy.simulation.core.Source.EntityGenerator(victim=None)[source]

Bases: object

models the source object that generates the entities

run()[source]
class manpy.simulation.core.Source.Source(id, name, cost=0, interArrivalTime=None, entity='manpy.Part', capacity=1, **kw)[source]

Bases: CoreObject

Spawns new entities for the simulations.

Parameters:
  • id – Internal ID

  • name – Name of the Source

  • interArrivalTime – Time until the next Entity is spawned

  • entity – Type of Entity that’s generated. One of “manpy.{Part, Batch, Frame, Job, CapacityEntity, CapacityProject}”.

  • capacity – Capacity of the generated Entities, Only relevant for entity=”manpy.Frame”

appendEntity(entity)[source]

add newly created entity to pendingEntities

appendPrevious(previous)[source]

Safeguarding to avoid setting predecessors to sources

calculateInterArrivalTime()[source]

calculates the processing time

createEntity()[source]

creates an Entity

definePrevious(**kw)[source]

Safeguarding to avoid setting predecessors to sources

defineRouting(successorList=[])[source]

sets the routing out element for the Source

initialize()[source]
removeEntity(entity=None)[source]

removes an entity from the Source

run()[source]

the main process of the core object, this is dummy, every object must have its own implementation

Returns:

None

manpy.simulation.core.Queue.py

Created on 8 Nov 2012

@author: George

class manpy.simulation.core.Queue.Queue(id='', name='', capacity=5, isDummy=False, schedulingRule='FIFO', level=None, gatherWipStat=False, cost=0, **kw)[source]

Bases: CoreObject

Models a FIFO queue where entities can wait in order to get into a server

activeQSorter(criterion=None)[source]

sorts the Entities of the Queue according to the scheduling rule

canAccept(callerObject=None)[source]

checks if the Queue can accept an entity it checks also who called it and returns TRUE only to the predecessor that will give the entity.

canAcceptAndIsRequested(callerObject=None)[source]

checks if the Queue can accept an entity and there is an entity in some predecessor waiting for it also updates the predecessorIndex to the one that is to be taken

canDeliver(entity=None)[source]

checks whether the entity can proceed to a successor object

family = 'Buffer'
getEntity()[source]

gets an entity from the predecessor that the predecessor index points to

static getSupportedSchedulingRules()[source]
haveToDispose(callerObject=None)[source]

checks if the Queue can dispose an entity to the following object it checks also who called it and returns TRUE only to the receiver that will give the entity.

initialize()[source]

the initialize method of the Queue class

outputResultsJSON()[source]

Outputs the result to a JSON file.

removeEntity(entity=None)[source]

removes an entity from the Object

run()[source]

run method of the queue

sortEntities()[source]

sorts the Entities of the Queue according to the scheduling rule

manpy.simulation.core.Exit.py

Created on 6 Feb 2013

@author: George

class manpy.simulation.core.Exit.Exit(id, name, cost=0, cancelCondition={}, **kw)[source]

Bases: CoreObject

models the exit of the model

canAccept(callerObject=None)[source]

checks if the Exit can accept an entity

canAcceptAndIsRequested(callerObject=None)[source]

checks if the Exit can accept an entity and there is an entity waiting for it

static clear(entity)[source]
defineNext(successorList=[])[source]

Safeguarding for mistakenly trying to set the next element on an Exit object

defineRouting(predecessorList=[])[source]

sets the routing in element for the Exit

family = 'Exit'
getEntity()[source]

gets an entity from the predecessor

haveToDispose(callerObject=None)[source]

haveToDispose of an exit must always return False

initialize()[source]
outputResultsJSON()[source]

outputs results to JSON File

postProcessing(MaxSimtime=None)[source]

actions to be taken after the simulation ends

run()[source]

the main process of the core object, this is dummy, every object must have its own implementation

Returns:

None

manpy.simulation.core.Database.py

class manpy.simulation.core.Database.ManPyDatabase[source]

Bases: object

abstract close_connection()[source]

Closes the database connection :return: None

abstract commit()[source]

Commits the changes to the database :return: None

abstract establish_connection()[source]

Establishes connection :return: None

abstract insert(table_name: str, column_value_dict: dict)[source]

Inserts values into given columns of a table :param table_name: Name of the table :param column_value_dict: dict containing column-value pairs for the insertion. Example: {“col1”: “Test”} :return: None

class manpy.simulation.core.Database.ManPyKafkaConnection(producer, topics, bootstrap_server_address)[source]

Bases: ManPyDatabase

close_connection()[source]

Closes the database connection :return: None

commit()[source]

Commits the changes to the database :return: None

establish_connection()[source]

Establishes connection :return: None

insert(table_name: str, column_value_dict: dict)[source]

sends data to kafka :param table_name: topic to write to :param column_value_dict: dict containing column-value pairs for the insertion. Example: {“col1”: “Test”} :return: None

class manpy.simulation.core.Database.ManPyQuestDBDatabase(host='localhost', port=9009)[source]

Bases: ManPyDatabase

close_connection()[source]

Closes the database connection :return: None

commit()[source]

Commits the changes to the database :return: None

establish_connection()[source]

Establishes connection :return: None

insert(table_name: str, column_value_dict: dict)[source]

Inserts values into given columns of a table :param table_name: Name of the table :param column_value_dict: dict containing column-value pairs for the insertion. Example: {“col1”: “Test”} :return: None

manpy.simulation.core.Globals.py

Created on 8 Nov 2012

@author: George

manpy.simulation.core.Globals.ExcelPrinter(df, filename)[source]

Prints a dataframe to excel

Parameters:
  • df – The dataframe to export

  • filename – Filename for export

class manpy.simulation.core.Globals.G[source]

Bases: object

Defines global properties for the whole simulation

static get_simulation_entities_history() DataFrame[source]

Iterates through all entities that passed through the simulation and collects their history, i.e. all the objects they passed through and when they entered/left them.

:returns History containing all

static get_simulation_results_dataframe() DataFrame[source]

Collects the logs from the traces in the simulation into a pandas dataframe. This dataframe contains the columns: - Simulation time - Entity (aka Resource) name - Entity ID - Station (aka Machine) ID - Station name - Trace message

:returns Dataframe containing the described columns

exception manpy.simulation.core.Globals.SetWipTypeError(setWipError)[source]

Bases: Exception

Error in the setting up of the WIP

manpy.simulation.core.Globals.findObjectById(id)[source]

method finding objects by ID

manpy.simulation.core.Globals.getClassFromName(dotted_name)[source]

Import a class from a dotted name used in json.

manpy.simulation.core.Globals.getFeatureData(objectList=[], time=False, price=False) DataFrame[source]

getFeatureData returns feature data of specific machines as dataframes

Parameters:
  • objectList – a list of machines that will be included in the dataframe

  • time – boolean, should timestamps be included or not

Returns:

dataframe

manpy.simulation.core.Globals.getMethodFromName(dotted_name)[source]

returns a method by its name. name should be given as manpy.ClassName.MethodName

manpy.simulation.core.Globals.getPhrase()[source]

get the phrase to print from the keyword

manpy.simulation.core.Globals.getSupportedPrintKwrds()[source]

get the supported print Keywords

manpy.simulation.core.Globals.getTimeSeriesData(ts) DataFrame[source]

getTimeSeriesData returns timeseries data

Parameters:

ts – the timeseries you want the data of

Returns:

dataframe with entity-ID|time|value as columns

manpy.simulation.core.Globals.get_feature_labels_by_id(entity, feature_ids)[source]

Returns a list of the entity’s feature labels of the specified ids

Parameters:
  • entity – The entity of which the feature labels should be retrieved.

  • feature_ids – List containing the IDs of the features (as string) that should be retrieved.

manpy.simulation.core.Globals.get_feature_values_by_id(entity, feature_ids)[source]

Returns a list of the entity’s feature values of the specified ids

Parameters:
  • entity – The entity of which the feature values should be retrieved.

  • feature_ids – List containing the IDs of the features (as string) that should be retrieved.

manpy.simulation.core.Globals.moveExcess(consumption=1, safetyStock=70, giverId=None, receiverId=None)[source]

method to move entities exceeding a certain safety stock

manpy.simulation.core.Globals.runSimulation(objectList=[], maxSimTime=100, numberOfReplications=1, trace=False, snapshots=False, seed=1, env=None, data='No', db: ManPyDatabase | None = None)[source]

Starts the simulation

Parameters:
  • objectList – Objects for the simulation

  • maxSimTime – Timespan that’s simulated

  • numberOfReplications – TODO

  • trace – TODO

  • snapshots – TODO

  • seed – TODO

  • env – TODO

  • data – TODO

  • db – Database object. Optional. If passed, the results are saved to the database

manpy.simulation.core.Globals.setWIP(entityList)[source]

method to set-up the entities in the current stations as Work In Progress in this case the current station must be defined! otherwise there is no current station but a list of possible stations although the entity cannot be in more than one stations

manpy.simulation.core.Entity.py

Created on 18 Aug 2013

@author: George

class manpy.simulation.core.Entity.Entity(id=None, name=None, priority=0, dueDate=0, orderDate=0, isCritical=False, remainingProcessingTime=0, remainingSetupTime=0, currentStation=None, status='Good', **kw)[source]

Bases: ManPyObject

The entity object.

checkIfRequiredPartsReady()[source]

method not implemented yet

getRequiredParts()[source]

method not implemented yet

initialize()[source]

initializes all the Entity for a new simulation replication

outputResultsJSON()[source]

outputs results to JSON File

printRoute()[source]

print the route (the different stations the entity moved through)

responsibleForCurrentStep()[source]

return the responsible operator for the current step, not implemented for entities

set_feature(feature, label, time, indexing)[source]

sets internal feature values to passed values

set_timeseries(timeseries, label, time, indexing)[source]

sets internal timeseries values to passed values

type = 'Entity'

manpy.simulation.core.CoreObject.py

class manpy.simulation.core.CoreObject.CoreObject(id, name, cost=0, **kw)[source]

Bases: ManPyObject

Created on 12 Jul 2012

@author: George Class that acts as an abstract. It should have no instances. All the core-objects should inherit from it

Parameters:
  • id – Internal Id

  • name – Name of the CoreObject

activeQueueIsEmpty()[source]

filter that returns True if the activeObject Queue is empty false if object holds entities in its queue

addBlockage()[source]

adds the blockage time to totalBlockageTime each time an Entity is removed

appendEntity(entity=None)[source]

appends entity to the receiver object. to be called by the removeEntity of the giver this method is created to be overridden by the Assembly class in its getEntity where Frames are loaded

appendPrevious(previous)[source]

Append previous to self.previous

assignEntryTo()[source]

assign Exit of the object

assignExitTo(callerObject=None)[source]

assign Exit of the object

calculateProcessingTime()[source]

calculates the processing time

calculateTime(type='Processing')[source]

calculates time (running through a dictionary) according to the type of processing given as argument

canAccept(callerObject=None)[source]

checks if the Object can accept an entity

canAcceptAndIsRequested(callerObject=None)[source]

checks if the Object can accept an entity and there is an entity in some possible giver waiting for it

checkIfActive()[source]

checks if the object is in an active position

class_name = 'manpy.CoreObject'
defineNext(successorList=[])[source]

sets the next element for the object and automatically registers itself as previous object of all objects in successorList. :param successorList: :return: None

definePrevious(predecessorList=[])[source]

Sets self.previous

defineRouting(predecessorList=[], successorList=[])[source]

sets the routing in and out elements for the Object

Parameters:
  • predecessorList – List containing the predecessor Objects

  • successorList – List containing the successor Objects

Returns:

None

endOperationActions()[source]

actions to be carried out when the processing of an Entity ends

entryIsAssignedTo()[source]

checks if the object is blocked

exitIsAssignedTo()[source]

checks if the object is blocked

static findGiversFor(activeObject)[source]

find possible givers

static findReceiversFor(activeObject)[source]

find possible receivers

getActiveObject()[source]

get the active object. This always returns self

getActiveObjectQueue()[source]

get the activeQ of the active object.

getEntity()[source]

gets an entity from the giver

getGiverObject()[source]

get the giver object in a getEntity transaction.

getGiverObjectQueue()[source]

get the giver object queue in a getEntity transaction.

getReceiverObject()[source]

get the receiver object in a removeEntity transaction.

getReceiverObjectQueue()[source]

get the receiver object queue in a removeEntity transaction.

getRoutingTarget()[source]

Returns the object. This method is used for dynamic routing in order to handle CoreObjects and ProductionLineModules differently

haveToDispose(callerObject=None)[source]

checks if the Object can dispose an entity to the following object

identifyEntityToGet()[source]

called be getEntity it identifies the Entity to be obtained so that getEntity gives it to removeEntity as argument

initialAllocationRequest()[source]
initialSignalReceiver()[source]

checks if there is anything set as WIP at the begging of the simulation and sends an event to initialize the simulation

initialize()[source]
interruptionActions()[source]

actions to be carried whenever the object is interrupted (failure, break, preemption, etc)

isInActiveQueue(entity=None)[source]

check if an entity is in the internal Queue of the object

isInRouteOf(callerObject=None)[source]

method used to check whether the station is a successor of the caller

outputResultsJSON()[source]

outputs results to JSON File

postInterruptionActions()[source]

actions to be carried whenever the object recovers control after an interruption (failure, break, preemption, etc)

postProcessing(MaxSimtime=None)[source]

actions to be taken after the simulation ends

preempt()[source]

method to execute preemption

preemptReceiver()[source]

check whether there is a critical entity to be disposed and if preemption is required

printRouting()[source]
removeEntity(entity=None, resetFlags=True, addBlockage=True)[source]

removes an Entity from the Object the Entity to be removed is passed as argument by getEntity of the receiver

Parameters:
  • entity

  • resetFlags

  • addBlockage

Returns:

run()[source]

the main process of the core object, this is dummy, every object must have its own implementation

Returns:

None

static selectGiver(possibleGivers=[])[source]

select a giver Object

static selectReceiver(possibleReceivers=[])[source]

select a receiver Object

signalGiver()[source]

signal the giver that the entity is removed from its internalQueue

signalReceiver(transmitter=None)[source]

signal the successor that the object can dispose an entity

sortEntities()[source]

sorts the Entities in the activeQ of the objects

sortEntitiesForReceiver(receiver=None)[source]

sort the entities of the queue for the receiver

unAssignEntry()[source]

unblock the object

unAssignExit()[source]

unblock the object

updateNext(entity=None)[source]

updates the next list of the object

manpy.simulation.core.ObjectInterruption.py

Created on 18 Aug 2013

@author: George

class manpy.simulation.core.ObjectInterruption.ObjectInterruption(id='', name='', victim=None, remove=False, cost=0, **kw)[source]

Bases: ManPyObject

Class that acts as an abstract. It should have no instances. All object interruptions (eg failures, breaks) should inherit from it

getVictimQueue()[source]

returns the internal queue of the victim

initialize()[source]
interruptVictim()[source]

interrupts the victim

invoke()[source]

hand in the control to the objectIterruption.run to be called by the machine

printTrace(entityName, message)[source]

print message in the console. Format is (Simulation Time | Entity or Frame Name | message)

reactivateVictim()[source]

reactivate the victim

run()[source]

the main process of the core object. this is a dummy, every object must have its own implementation

victimQueueIsEmpty()[source]

check if the victim’s internal queue is empty

manpy.simulation.core.ObjectProperty.py

Created on 18 Aug 2013

@author: LodesL

class manpy.simulation.core.ObjectProperty.ObjectProperty(id='', name='', victim=None, distribution={}, distribution_state_controller=None, reset_distributions=True, no_negative=False, contribute=None, start_time=0, end_time=0, start_value=None, random_walk=False, dependent=None, **kw)[source]

Bases: ManPyObject

Abstract class for all kinds of object properties that are generated in somehow regular interval. Example: Features

getVictimQueue()[source]

returns the internal queue of the victim

get_feature_value()[source]

Returns the current value of the feature.

initialize()[source]
invoke()[source]

hand in the control to the objectIterruption.run to be called by the machine

outputTrace(entity_name: str, entity_id: str, message: str)[source]

Overwrites the ouputTrace function to better suite Features

Parameters:
  • entity_name – The Name of the target Machine

  • entity_id – The ID of the target Machine

  • message – The value of the Feature

Returns:

None

printTrace(entityName, message)[source]

print message in the console. Format is (Simulation Time | Entity or Frame Name | message)

run()[source]

the main process of the core object. this is a dummy, every object must have its own implementation

victimQueueIsEmpty()[source]

check if the victim’s internal queue is empty

manpy.simulation.core.ObjectResource.py

Created on 18 Aug 2013

@author: George

class manpy.simulation.core.ObjectResource.ObjectResource(id='', name='', **kw)[source]

Bases: ManPyObject

The resource that repairs the machines Class that acts as an abstract. It should have no instances. All the Resources should inherit from it.

checkIfResourceIsAvailable(callerObject=None)[source]

checks if the worker is available

getResource()[source]

returns the resource

getResourceQueue()[source]

returns the active queue of the resource

initialize()[source]
isInitialized()[source]

check if the resource is already initialized

printRoute()[source]

print the route (the different stations the resource was occupied by)

manpy.simulation.core.utils.py

manpy.simulation.core.utils.check_config_dict(config_dict: dict, keys: list, object_name: str)[source]

Function to check if config dictionaries contain a mistake. I.e., it checks if certain keys are contained in the dict and warns the user if some are missing. Is used to prevent accidental misconfigurations.

Parameters:
  • config_dict – The config dict to be checked

  • keys – A list with the keys in config_dict that should be checked

  • object_name – The name of the object in which the check is done. Is used for the print statement

manpy.simulation.core.utils.info(text)[source]

Puts “INFO: ” in front of a text.

Parameters:

text – The text to which “INFO: ” should be added.