Commit f077ff4a authored by Georgios Dagkakis's avatar Georgios Dagkakis

projects that consume space because their assembly started in a previous...

projects that consume space because their assembly started in a previous period and is not finished yet are now taken into accout. Test added
parent 7dbbc9bb
......@@ -214,7 +214,7 @@ class CapacityStationController(EventGenerator):
exit.currentlyObtainedEntities=[]
def calculateWhatIsToBeProcessed(self):
availableSpace=self.assemblySpace
availableSpace=self.assemblySpace-self.calculateConsumedSpace()
# loop through the capacity station buffers
for buffer in G.CapacityStationBufferList:
activeObjectQueue=buffer.getActiveObjectQueue()
......@@ -455,7 +455,12 @@ class CapacityStationController(EventGenerator):
# returns true if there is enough space for the entity to move
def checkIfThereIsEnoughSpace(self, entity, buffer, availableSpace):
if buffer.requireFullProject:
# if the project already consumes assembly space then there is enough space for it
if self.checkIfProjectConsumesAssemblySpace(entity, buffer):
return True
# else check if there is enough space
return entity.capacityProject.assemblySpaceRequirement<=availableSpace
# if the station is not assembly then return true
return True
# sorts the buffers so if they have shared resources the ones with highest priority will go in front
......@@ -464,4 +469,30 @@ class CapacityStationController(EventGenerator):
station=buffer.next[0]
buffer.sharedPriority=station.sharedResources.get('priority', -float('inf'))
G.CapacityStationBufferList.sort(key=lambda x: x.sharedPriority, reverse=True)
# calculates the space that is already consumed before the allocation for current period
def calculateConsumedSpace(self):
consumedSpace=0
# loop in the buffers and find projects that have started assembly without having been finished
# add what they consume
for buffer in G.CapacityStationBufferList:
station=buffer.next[0]
for entity in buffer.getActiveObjectQueue():
if self.checkIfProjectConsumesAssemblySpace(entity, buffer):
consumedSpace+=entity.capacityProject.capacityRequirementDict[station.id]
return consumedSpace
# checks if a project already consumes assembly space because assembly work started in a previous period
# and was not completed
def checkIfProjectConsumesAssemblySpace(self, entity, buffer):
if buffer.requireFullProject:
station=buffer.next[0]
project=entity.capacityProject
projectRequirement=project.capacityRequirementDict[station.id]
if projectRequirement>entity.requiredCapacity:
return True
return False
\ No newline at end of file
{
"_class": "Dream.Simulation",
"edges": {
"0": [
"CB1",
"CS1",
{}
],
"1": [
"CS1",
"CE1",
{}
],
"2": [
"CB2",
"CS2",
{}
],
"3": [
"CS2",
"CE2",
{}
]
},
"general": {
"_class": "Dream.Configuration",
"confidenceLevel": "0.95",
"maxSimTime": "-1",
"numberOfReplications": "1",
"trace": "Yes",
"extraPropertyDict": {
"assemblySpace": 70
}
},
"nodes": {
"CB1": {
"_class": "Dream.CapacityStationBuffer",
"name": "PPASBBuffer",
"requireFullProject": 1,
"wip": [
{
"_class": "Dream.CapacityEntity",
"capacityProjectId": "P1",
"name": "P1_ASBTST_50",
"requiredCapacity": 50
}
]
},
"CS1": {
"_class": "Dream.CapacityStation",
"name": "PPASB",
"intervalCapacity": [
80,
100,
300,
100,
200,
300
],
"sharedResources": {
"stationIds": [
"CS2"
],
"priority": 1
}
},
"CE1": {
"_class": "Dream.CapacityStationExit",
"name": "PPASBExit",
"nextCapacityStationBufferId": "CB2"
},
"CB2": {
"_class": "Dream.CapacityStationBuffer",
"name": "ASBTSTBuffer",
"requireFullProject": 1,
"wip": [
{
"_class": "Dream.CapacityEntity",
"capacityProjectId": "P2",
"name": "P2_ASBTST_50",
"requiredCapacity": 50
}
]
},
"CS2": {
"_class": "Dream.CapacityStation",
"name": "ASBTST",
"sharedResources": {
"stationIds": [
"CS1"
],
"priority": 2
}
},
"CE2": {
"_class": "Dream.CapacityStationExit",
"name": "ASBTSTExit"
},
"QD": {
"_class": "Dream.Queue",
"capacity": "-1",
"id": "QD",
"name": "DUMMY",
"wip": [
{
"_class": "Dream.CapacityProject",
"id": "P1",
"name": "P1",
"capacityRequirementDict": {
"CS1": 100,
"CS2": 100
},
"dueDate": 10,
"assemblySpaceRequirement":50
},
{
"_class": "Dream.CapacityProject",
"id": "P2",
"name": "P2",
"capacityRequirementDict": {
"CS2": 100
},
"earliestStartDict": {
"CS2": 1
},
"dueDate": 10,
"assemblySpaceRequirement":50
}
]
},
"CSC": {
"_class": "Dream.CapacityStationController",
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"prioritizeIfCanFinish": 1,
"dueDateThreshold": 7
}
}
}
\ No newline at end of file
{
"_class": "Dream.Simulation",
"elementList": [
{
"_class": "Dream.CapacityStationBuffer",
"id": "CB1"
},
{
"_class": "Dream.CapacityStationBuffer",
"id": "CB2"
},
{
"_class": "Dream.Exit",
"id": "CE2",
"results": {
"lifespan": 3.5,
"takt_time": 2.0,
"throughput": 2
}
},
{
"_class": "Dream.CapacityStation",
"id": "CS1",
"results": {
"capacityUsed": [
{
"P1": 80.0,
"period": 0.0,
"utilization": 1.0
},
{
"P1": 20.0,
"period": 1.0,
"utilization": 0.2
},
{
"period": 2.0,
"utilization": 0.0
},
{
"period": 3.0,
"utilization": 0.0
}
],
"detailedWorkPlan": [
{
"allocation": 80.0,
"operation": "CS1",
"project": "P1",
"time": 0.0
},
{
"allocation": 20.0,
"operation": "CS1",
"project": "P1",
"time": 1.0
}
],
"meanUtilization": 0.3
}
},
{
"_class": "Dream.CapacityStation",
"id": "CS2",
"results": {
"capacityUsed": [
{
"period": 0.0,
"utilization": 0.0
},
{
"period": 1.0,
"utilization": 0.0
},
{
"P2": 100,
"period": 2.0,
"utilization": 0.3333333333333333
},
{
"P1": 100,
"period": 3.0,
"utilization": 1.0
}
],
"detailedWorkPlan": [
{
"allocation": 100,
"operation": "CS2",
"project": "P2",
"time": 2.0
},
{
"allocation": 100,
"operation": "CS2",
"project": "P1",
"time": 3.0
}
],
"meanUtilization": 0.3333333333333333
}
},
{
"_class": "Dream.CapacityProject",
"id": "P1",
"results": {
"schedule": [
{
"entranceTime": 0.0,
"exitTime": 2.0,
"stationId": "CS1"
},
{
"entranceTime": 3.0,
"exitTime": 4.0,
"stationId": "CS2"
}
]
}
},
{
"_class": "Dream.CapacityProject",
"id": "P2",
"results": {
"schedule": [
{
"entranceTime": 2.0,
"exitTime": 3.0,
"stationId": "CS2"
}
]
}
},
{
"_class": "Dream.Queue",
"id": "QD"
}
],
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment