diff --git a/dataModel/SimulationModelDescriptor.js b/dataModel/SimulationModelDescriptor.js index 33732d3..fb0a254 100644 --- a/dataModel/SimulationModelDescriptor.js +++ b/dataModel/SimulationModelDescriptor.js @@ -60,7 +60,7 @@ export const SimulationModelDescriptor = { { "name": "resources", "type": "Resource", isMany : true }, { "name": "timeTables", "type": "Timetable", isMany : true }, { "name": "costDrivers", "type": "AbstractCostDriver", isMany : true }, - { "name": "environmentMappingConfig", "type": "EnvironmentMappingConfig" } + { "name": "variants", "type": "Variant", isMany : true } ] }, @@ -119,54 +119,22 @@ export const SimulationModelDescriptor = { { "name": "cost", "type": "Real"}, ] }, - { - "name" : "EnvironmentMappingConfig", - "properties": [ - { "name": "variants", "type": "VariantExtended", isMany : true }, - ] - }, - { - "name" : "VariantExtended", + "name" : "Variant", "properties": [ { "name": "id", "type": "String"}, { "name": "name", "type": "String"}, { "name": "frequency", "type": "Real"}, - { "name": "mappings", "type": "DriversMapping", isMany : true } + { "name": "mappings", "type": "DriverConcretization", isMany : true } ] }, { - "name" : "DriversMapping", + "name" : "DriverConcretization", "properties": [ { "name": "abstractDriver", "type": "String"}, { "name": "concreteDriver", "type": "String"}, ] }, - - { - "name" : "CostVariantConfig", - "properties": [ - { "name": "count", "type": "String"}, - { "name": "variants", "type": "Variant", isMany : true } - ] - }, - { - "name" : "Variant", - "properties": [ - { "name": "id", "type": "String"}, - { "name": "name", "type": "String"}, - { "name": "frequency", "type": "String"}, - { "name": "drivers", "type": "DriverConcretization", isMany : true } - ] - }, - { - "name" : "DriverConcretization", - "properties": [ - { "name": "abstractId", "type": "String"}, - { "name": "concreteId", "type": "String"} - ] - }, - { "name": "Model", "properties": [ @@ -181,8 +149,7 @@ export const SimulationModelDescriptor = { "properties": [ { "name": "activities", "type": "Activity", "isMany": true }, { "name": "events", "type": "Event", "isMany": true }, - { "name": "gateways", "type": "Gateway", "isMany": true }, - { "name": "costVariantConfig", "type": "CostVariantConfig" } + { "name": "gateways", "type": "Gateway", "isMany": true } ] }, diff --git a/demo/tum_shop_simubridge.json b/demo/tum_shop_simubridge.json index ea06cc5..4062d9e 100644 --- a/demo/tum_shop_simubridge.json +++ b/demo/tum_shop_simubridge.json @@ -1 +1,1204 @@ -[{"scenarioName":"TUM Shop Delivery","startingTime":"00:00","resourceParameters":{"roles":[{"id":"Role 1","schedule":"Role 1","costHour":20,"resources":[{"id":"Kim Passa"},{"id":"Immanuel Karagianni"},{"id":"Alberto Duport"},{"id":"Fjodor Kowalski"},{"id":"Esmana Liubiata"},{"id":"Christian Francois"},{"id":"Tesca Lobes"},{"id":"Penn Osterwalder"},{"id":"Nico Ojenbeer"},{"id":"Anne Olwada"},{"id":"Miu Hanwan"},{"id":"Anna Kaufmann"},{"id":"Elvira Lores"},{"id":"Clement Duchot"}]},{"id":"Role 4","schedule":"Role 4","costHour":20,"resources":[{"id":"Maris Freeman"},{"id":"Heinz Gutschmidt"},{"id":"Francis Odell"}]},{"id":"Role 3","schedule":"Role 3","costHour":20,"resources":[{"id":"Karel de Groot"},{"id":"Magdalena Predutta"},{"id":"Francois de Perrier"}]},{"id":"Role 5","schedule":"Role 5","costHour":20,"resources":[{"id":"Karalda Nimwada"},{"id":"Pedro Alvares"}]},{"id":"Role 2","schedule":"Role 2","costHour":20,"resources":[{"id":"Sean Manney"},{"id":"Esmeralda Clay"},{"id":"Carmen Finacse"},{"id":"Karen Clarens"},{"id":"Kiu Kan"}]}],"resources":[{"id":"Kim Passa","costHour":null,"schedule":null},{"id":"Immanuel Karagianni","costHour":null,"schedule":null},{"id":"Alberto Duport","costHour":null,"schedule":null},{"id":"Fjodor Kowalski","costHour":null,"schedule":null},{"id":"Esmana Liubiata","costHour":null,"schedule":null},{"id":"Christian Francois","costHour":null,"schedule":null},{"id":"Tesca Lobes","costHour":null,"schedule":null},{"id":"Penn Osterwalder","costHour":null,"schedule":null},{"id":"Nico Ojenbeer","costHour":null,"schedule":null},{"id":"Anne Olwada","costHour":null,"schedule":null},{"id":"Miu Hanwan","costHour":null,"schedule":null},{"id":"Anna Kaufmann","costHour":null,"schedule":null},{"id":"Elvira Lores","costHour":null,"schedule":null},{"id":"Clement Duchot","costHour":null,"schedule":null},{"id":"Maris Freeman","costHour":null,"schedule":null},{"id":"Heinz Gutschmidt","costHour":null,"schedule":null},{"id":"Francis Odell","costHour":null,"schedule":null},{"id":"Karel de Groot","costHour":null,"schedule":null},{"id":"Magdalena Predutta","costHour":null,"schedule":null},{"id":"Francois de Perrier","costHour":null,"schedule":null},{"id":"Karalda Nimwada","costHour":null,"schedule":null},{"id":"Pedro Alvares","costHour":null,"schedule":null},{"id":"Sean Manney","costHour":null,"schedule":null},{"id":"Esmeralda Clay","costHour":null,"schedule":null},{"id":"Carmen Finacse","costHour":null,"schedule":null},{"id":"Karen Clarens","costHour":null,"schedule":null},{"id":"Kiu Kan","costHour":null,"schedule":null}],"timeTables":[{"id":"Role 1","timeTableItems":[{"startWeekday":"Monday","startTime":0,"endWeekday":"Monday","endTime":24},{"startWeekday":"Tuesday","startTime":0,"endWeekday":"Tuesday","endTime":24},{"startWeekday":"Wednesday","startTime":0,"endWeekday":"Wednesday","endTime":16},{"startWeekday":"Wednesday","startTime":17,"endWeekday":"Wednesday","endTime":24},{"startWeekday":"Thursday","startTime":0,"endWeekday":"Thursday","endTime":24},{"startWeekday":"Friday","startTime":0,"endWeekday":"Friday","endTime":24},{"startWeekday":"Saturday","startTime":0,"endWeekday":"Saturday","endTime":24},{"startWeekday":"Sunday","startTime":0,"endWeekday":"Sunday","endTime":24}]},{"id":"Role 3","timeTableItems":[{"startWeekday":"Monday","startTime":0,"endWeekday":"Monday","endTime":24},{"startWeekday":"Tuesday","startTime":0,"endWeekday":"Tuesday","endTime":24},{"startWeekday":"Wednesday","startTime":0,"endWeekday":"Wednesday","endTime":24},{"startWeekday":"Thursday","startTime":0,"endWeekday":"Thursday","endTime":24},{"startWeekday":"Friday","startTime":0,"endWeekday":"Friday","endTime":24},{"startWeekday":"Saturday","startTime":0,"endWeekday":"Saturday","endTime":24},{"startWeekday":"Sunday","startTime":0,"endWeekday":"Sunday","endTime":24}]},{"id":"Role 4","timeTableItems":[{"startWeekday":"Monday","startTime":4,"endWeekday":"Monday","endTime":8},{"startWeekday":"Monday","startTime":9,"endWeekday":"Monday","endTime":11},{"startWeekday":"Monday","startTime":12,"endWeekday":"Monday","endTime":13},{"startWeekday":"Monday","startTime":16,"endWeekday":"Monday","endTime":18},{"startWeekday":"Monday","startTime":19,"endWeekday":"Monday","endTime":20},{"startWeekday":"Monday","startTime":21,"endWeekday":"Monday","endTime":24},{"startWeekday":"Tuesday","startTime":0,"endWeekday":"Tuesday","endTime":1},{"startWeekday":"Tuesday","startTime":3,"endWeekday":"Tuesday","endTime":9},{"startWeekday":"Tuesday","startTime":10,"endWeekday":"Tuesday","endTime":21},{"startWeekday":"Tuesday","startTime":22,"endWeekday":"Tuesday","endTime":24},{"startWeekday":"Wednesday","startTime":0,"endWeekday":"Wednesday","endTime":3},{"startWeekday":"Wednesday","startTime":7,"endWeekday":"Wednesday","endTime":8},{"startWeekday":"Wednesday","startTime":9,"endWeekday":"Wednesday","endTime":12},{"startWeekday":"Wednesday","startTime":13,"endWeekday":"Wednesday","endTime":15},{"startWeekday":"Wednesday","startTime":17,"endWeekday":"Wednesday","endTime":19},{"startWeekday":"Wednesday","startTime":20,"endWeekday":"Wednesday","endTime":22},{"startWeekday":"Wednesday","startTime":23,"endWeekday":"Wednesday","endTime":24},{"startWeekday":"Thursday","startTime":0,"endWeekday":"Thursday","endTime":2},{"startWeekday":"Thursday","startTime":3,"endWeekday":"Thursday","endTime":4},{"startWeekday":"Thursday","startTime":5,"endWeekday":"Thursday","endTime":10},{"startWeekday":"Thursday","startTime":11,"endWeekday":"Thursday","endTime":13},{"startWeekday":"Thursday","startTime":14,"endWeekday":"Thursday","endTime":15},{"startWeekday":"Thursday","startTime":16,"endWeekday":"Thursday","endTime":17},{"startWeekday":"Thursday","startTime":18,"endWeekday":"Thursday","endTime":24},{"startWeekday":"Friday","startTime":0,"endWeekday":"Friday","endTime":3},{"startWeekday":"Friday","startTime":4,"endWeekday":"Friday","endTime":5},{"startWeekday":"Friday","startTime":7,"endWeekday":"Friday","endTime":9},{"startWeekday":"Friday","startTime":10,"endWeekday":"Friday","endTime":13},{"startWeekday":"Friday","startTime":14,"endWeekday":"Friday","endTime":20},{"startWeekday":"Friday","startTime":21,"endWeekday":"Friday","endTime":24},{"startWeekday":"Saturday","startTime":1,"endWeekday":"Saturday","endTime":2},{"startWeekday":"Saturday","startTime":4,"endWeekday":"Saturday","endTime":7},{"startWeekday":"Saturday","startTime":9,"endWeekday":"Saturday","endTime":10},{"startWeekday":"Saturday","startTime":11,"endWeekday":"Saturday","endTime":12},{"startWeekday":"Saturday","startTime":18,"endWeekday":"Saturday","endTime":19},{"startWeekday":"Saturday","startTime":20,"endWeekday":"Saturday","endTime":21},{"startWeekday":"Saturday","startTime":22,"endWeekday":"Saturday","endTime":24},{"startWeekday":"Sunday","startTime":1,"endWeekday":"Sunday","endTime":4},{"startWeekday":"Sunday","startTime":5,"endWeekday":"Sunday","endTime":12},{"startWeekday":"Sunday","startTime":15,"endWeekday":"Sunday","endTime":16},{"startWeekday":"Sunday","startTime":17,"endWeekday":"Sunday","endTime":24}]},{"id":"Role 2","timeTableItems":[{"startWeekday":"Monday","startTime":0,"endWeekday":"Monday","endTime":10},{"startWeekday":"Monday","startTime":11,"endWeekday":"Monday","endTime":16},{"startWeekday":"Monday","startTime":18,"endWeekday":"Monday","endTime":22},{"startWeekday":"Monday","startTime":23,"endWeekday":"Monday","endTime":24},{"startWeekday":"Tuesday","startTime":0,"endWeekday":"Tuesday","endTime":7},{"startWeekday":"Tuesday","startTime":8,"endWeekday":"Tuesday","endTime":13},{"startWeekday":"Tuesday","startTime":14,"endWeekday":"Tuesday","endTime":18},{"startWeekday":"Tuesday","startTime":21,"endWeekday":"Tuesday","endTime":23},{"startWeekday":"Wednesday","startTime":0,"endWeekday":"Wednesday","endTime":3},{"startWeekday":"Wednesday","startTime":5,"endWeekday":"Wednesday","endTime":6},{"startWeekday":"Wednesday","startTime":7,"endWeekday":"Wednesday","endTime":11},{"startWeekday":"Wednesday","startTime":14,"endWeekday":"Wednesday","endTime":21},{"startWeekday":"Thursday","startTime":0,"endWeekday":"Thursday","endTime":1},{"startWeekday":"Thursday","startTime":2,"endWeekday":"Thursday","endTime":4},{"startWeekday":"Thursday","startTime":5,"endWeekday":"Thursday","endTime":6},{"startWeekday":"Thursday","startTime":7,"endWeekday":"Thursday","endTime":14},{"startWeekday":"Thursday","startTime":15,"endWeekday":"Thursday","endTime":18},{"startWeekday":"Thursday","startTime":19,"endWeekday":"Thursday","endTime":21},{"startWeekday":"Thursday","startTime":23,"endWeekday":"Thursday","endTime":24},{"startWeekday":"Friday","startTime":0,"endWeekday":"Friday","endTime":17},{"startWeekday":"Friday","startTime":18,"endWeekday":"Friday","endTime":19},{"startWeekday":"Friday","startTime":20,"endWeekday":"Friday","endTime":24},{"startWeekday":"Saturday","startTime":1,"endWeekday":"Saturday","endTime":2},{"startWeekday":"Saturday","startTime":3,"endWeekday":"Saturday","endTime":5},{"startWeekday":"Saturday","startTime":6,"endWeekday":"Saturday","endTime":8},{"startWeekday":"Saturday","startTime":9,"endWeekday":"Saturday","endTime":20},{"startWeekday":"Saturday","startTime":21,"endWeekday":"Saturday","endTime":22},{"startWeekday":"Saturday","startTime":23,"endWeekday":"Saturday","endTime":24},{"startWeekday":"Sunday","startTime":0,"endWeekday":"Sunday","endTime":6},{"startWeekday":"Sunday","startTime":7,"endWeekday":"Sunday","endTime":9},{"startWeekday":"Sunday","startTime":10,"endWeekday":"Sunday","endTime":13},{"startWeekday":"Sunday","startTime":14,"endWeekday":"Sunday","endTime":17},{"startWeekday":"Sunday","startTime":18,"endWeekday":"Sunday","endTime":19},{"startWeekday":"Sunday","startTime":21,"endWeekday":"Sunday","endTime":24}]},{"id":"Role 5","timeTableItems":[{"startWeekday":"Monday","startTime":1,"endWeekday":"Monday","endTime":2},{"startWeekday":"Monday","startTime":4,"endWeekday":"Monday","endTime":8},{"startWeekday":"Monday","startTime":11,"endWeekday":"Monday","endTime":12},{"startWeekday":"Monday","startTime":13,"endWeekday":"Monday","endTime":24},{"startWeekday":"Tuesday","startTime":1,"endWeekday":"Tuesday","endTime":7},{"startWeekday":"Tuesday","startTime":14,"endWeekday":"Tuesday","endTime":23},{"startWeekday":"Wednesday","startTime":0,"endWeekday":"Wednesday","endTime":3},{"startWeekday":"Wednesday","startTime":4,"endWeekday":"Wednesday","endTime":9},{"startWeekday":"Wednesday","startTime":11,"endWeekday":"Wednesday","endTime":14},{"startWeekday":"Wednesday","startTime":15,"endWeekday":"Wednesday","endTime":17},{"startWeekday":"Wednesday","startTime":19,"endWeekday":"Wednesday","endTime":20},{"startWeekday":"Thursday","startTime":5,"endWeekday":"Thursday","endTime":12},{"startWeekday":"Thursday","startTime":13,"endWeekday":"Thursday","endTime":20},{"startWeekday":"Thursday","startTime":22,"endWeekday":"Thursday","endTime":24},{"startWeekday":"Friday","startTime":1,"endWeekday":"Friday","endTime":5},{"startWeekday":"Friday","startTime":7,"endWeekday":"Friday","endTime":11},{"startWeekday":"Friday","startTime":14,"endWeekday":"Friday","endTime":18},{"startWeekday":"Friday","startTime":20,"endWeekday":"Friday","endTime":24},{"startWeekday":"Saturday","startTime":0,"endWeekday":"Saturday","endTime":4},{"startWeekday":"Saturday","startTime":7,"endWeekday":"Saturday","endTime":10},{"startWeekday":"Saturday","startTime":12,"endWeekday":"Saturday","endTime":20},{"startWeekday":"Saturday","startTime":21,"endWeekday":"Saturday","endTime":22},{"startWeekday":"Sunday","startTime":0,"endWeekday":"Sunday","endTime":2},{"startWeekday":"Sunday","startTime":4,"endWeekday":"Sunday","endTime":5},{"startWeekday":"Sunday","startTime":7,"endWeekday":"Sunday","endTime":10},{"startWeekday":"Sunday","startTime":12,"endWeekday":"Sunday","endTime":19},{"startWeekday":"Sunday","startTime":20,"endWeekday":"Sunday","endTime":24}]}],"costDrivers":[{"id":"Delivery","name":"Delivery","concreteCostDrivers":[{"id":"eb2d7a95-af12-4c07-8483-76c222bd2a8a","name":"Delivery_A_Lorry","cost":0.000009222736147284307},{"id":"2320625c-91a6-46fe-a338-30e31da90aeb","name":"Delivery_B_Small_Lorry","cost":0.000017790529652615878},{"id":"e4b2ab16-bab1-44be-91df-8a1e859553f6","name":"Delivery_B_Lorry","cost":0.000013834104220926462},{"id":"7d56ac6e-0d5b-41e4-b83e-cbb43557a937","name":"Delivery_A_Small_Lorry","cost":0.000011860353101743918}]},{"id":"Shipment","name":"Shipment","concreteCostDrivers":[{"id":"ef48baf7-4885-4d95-96b8-8d3d4a1092dc","name":"Shipment_A_Lorry","cost":0.000025279427000910646},{"id":"7fa79147-2fa5-47f8-9bd5-b4a05ec65b49","name":"Shipment_A_Rail_Electric","cost":-3.9450807802685816e-7},{"id":"a0cd2fa8-a7b4-4805-a662-38f701862a2f","name":"Shipment_B_Lorry","cost":0.00005055885400182129},{"id":"256b0228-f05a-4e35-a5f2-efec99b0b406","name":"Shipment_B_Rail_Electric","cost":-7.890161560537163e-7}]},{"id":"Re-Routing","name":"Re-Routing","concreteCostDrivers":[{"id":"70957e6a-c47e-4cc2-b4cf-ca3863153c9f","name":"Re-Routing_A_Lorry","cost":0.000002766820844185292},{"id":"985e5853-47ad-48b9-af14-db5f46249f4a","name":"Re-Routing_A_Small_Lorry","cost":0.000003558105930523175}]},{"id":"Packaging Material","name":"Packaging Material","concreteCostDrivers":[{"id":"1ce01d66-552b-4bc2-9103-680d37531c72","name":"Packaging_Material_B","cost":0.000004607338473103258},{"id":"ee2a9ffc-24ae-499b-b11e-77f52094aa21","name":"Packaging_Material_A","cost":0.000009214676946206515}]},{"id":"Receipt","name":"Receipt","concreteCostDrivers":[{"id":"1964790c-5d5f-412c-b6a1-beb2df9508c9","name":"Receipt","cost":0.000005075463136208346}]},{"id":"Filling Material","name":"Filling Material","concreteCostDrivers":[{"id":"fdd48db8-b321-43a1-9a01-569963bc5f71","name":"Filling_A","cost":0.000005119664581012698}]}],"environmentMappingConfig":{"variants":[]}},"models":[{"BPMN":"Flow_18e5u87Flow_18e5u87Flow_0x4zrhbFlow_0x4zrhbFlow_152dui2Flow_1lgsuz0Flow_1atlp9wFlow_1atlp9wFlow_01lk7fyFlow_1dcn9uqFlow_152dui2Flow_1lgsuz0Flow_01lk7fyFlow_1dcn9uq","name":"BPMN_1","modelParameter":{"activities":[{"id":"Activity_12nhj09","resources":["Role 2"],"duration":{"distributionType":"normal","values":[{"id":"mean","value":1091.827953405018},{"id":"variance","value":646.939769970795}],"timeUnit":"secs"},"cost":0,"costDrivers":[]},{"id":"Activity_0zw7mmo","resources":["Role 2"],"duration":{"distributionType":"normal","values":[{"id":"mean","value":1377.5888516228747},{"id":"variance","value":521.4428899767106}],"timeUnit":"secs"},"cost":0,"costDrivers":[]},{"id":"Activity_0gdnps8","resources":["Role 3"],"duration":{"distributionType":"constant","values":[{"id":"constantValue","value":60}],"timeUnit":"secs"},"cost":0,"costDrivers":[]}],"gateways":[{"id":"Gateway_18euw97","probabilities":{"Flow_1lgsuz0":0.21885521885521886,"Flow_01lk7fy":0.7811447811447811}}],"events":[{"id":"StartEvent_1","interArrivalTime":{"distributionType":"normal","values":[{"id":"mean","value":22393.925501432666},{"id":"variance","value":858177974.4886869}],"timeUnit":"secs"}}],"costVariantConfig":{"count":0,"variants":[]}}}],"startingDate":"01-01-0000","numberOfInstances":608,"currency":"euro"}] \ No newline at end of file +[ + { + "scenarioName": "TUM Shop Delivery", + "startingTime": "00:00", + "resourceParameters": { + "roles": [ + { + "id": "Role 1", + "schedule": "Role 1", + "costHour": 20, + "resources": [ + { + "id": "Kim Passa" + }, + { + "id": "Immanuel Karagianni" + }, + { + "id": "Alberto Duport" + }, + { + "id": "Fjodor Kowalski" + }, + { + "id": "Esmana Liubiata" + }, + { + "id": "Christian Francois" + }, + { + "id": "Tesca Lobes" + }, + { + "id": "Penn Osterwalder" + }, + { + "id": "Nico Ojenbeer" + }, + { + "id": "Anne Olwada" + }, + { + "id": "Miu Hanwan" + }, + { + "id": "Anna Kaufmann" + }, + { + "id": "Elvira Lores" + }, + { + "id": "Clement Duchot" + } + ] + }, + { + "id": "Role 4", + "schedule": "Role 4", + "costHour": 20, + "resources": [ + { + "id": "Maris Freeman" + }, + { + "id": "Heinz Gutschmidt" + }, + { + "id": "Francis Odell" + } + ] + }, + { + "id": "Role 3", + "schedule": "Role 3", + "costHour": 20, + "resources": [ + { + "id": "Karel de Groot" + }, + { + "id": "Magdalena Predutta" + }, + { + "id": "Francois de Perrier" + } + ] + }, + { + "id": "Role 5", + "schedule": "Role 5", + "costHour": 20, + "resources": [ + { + "id": "Karalda Nimwada" + }, + { + "id": "Pedro Alvares" + } + ] + }, + { + "id": "Role 2", + "schedule": "Role 2", + "costHour": 20, + "resources": [ + { + "id": "Sean Manney" + }, + { + "id": "Esmeralda Clay" + }, + { + "id": "Carmen Finacse" + }, + { + "id": "Karen Clarens" + }, + { + "id": "Kiu Kan" + } + ] + } + ], + "resources": [ + { + "id": "Kim Passa", + "costHour": null, + "schedule": null + }, + { + "id": "Immanuel Karagianni", + "costHour": null, + "schedule": null + }, + { + "id": "Alberto Duport", + "costHour": null, + "schedule": null + }, + { + "id": "Fjodor Kowalski", + "costHour": null, + "schedule": null + }, + { + "id": "Esmana Liubiata", + "costHour": null, + "schedule": null + }, + { + "id": "Christian Francois", + "costHour": null, + "schedule": null + }, + { + "id": "Tesca Lobes", + "costHour": null, + "schedule": null + }, + { + "id": "Penn Osterwalder", + "costHour": null, + "schedule": null + }, + { + "id": "Nico Ojenbeer", + "costHour": null, + "schedule": null + }, + { + "id": "Anne Olwada", + "costHour": null, + "schedule": null + }, + { + "id": "Miu Hanwan", + "costHour": null, + "schedule": null + }, + { + "id": "Anna Kaufmann", + "costHour": null, + "schedule": null + }, + { + "id": "Elvira Lores", + "costHour": null, + "schedule": null + }, + { + "id": "Clement Duchot", + "costHour": null, + "schedule": null + }, + { + "id": "Maris Freeman", + "costHour": null, + "schedule": null + }, + { + "id": "Heinz Gutschmidt", + "costHour": null, + "schedule": null + }, + { + "id": "Francis Odell", + "costHour": null, + "schedule": null + }, + { + "id": "Karel de Groot", + "costHour": null, + "schedule": null + }, + { + "id": "Magdalena Predutta", + "costHour": null, + "schedule": null + }, + { + "id": "Francois de Perrier", + "costHour": null, + "schedule": null + }, + { + "id": "Karalda Nimwada", + "costHour": null, + "schedule": null + }, + { + "id": "Pedro Alvares", + "costHour": null, + "schedule": null + }, + { + "id": "Sean Manney", + "costHour": null, + "schedule": null + }, + { + "id": "Esmeralda Clay", + "costHour": null, + "schedule": null + }, + { + "id": "Carmen Finacse", + "costHour": null, + "schedule": null + }, + { + "id": "Karen Clarens", + "costHour": null, + "schedule": null + }, + { + "id": "Kiu Kan", + "costHour": null, + "schedule": null + } + ], + "timeTables": [ + { + "id": "Role 1", + "timeTableItems": [ + { + "startWeekday": "Monday", + "startTime": 0, + "endWeekday": "Monday", + "endTime": 24 + }, + { + "startWeekday": "Tuesday", + "startTime": 0, + "endWeekday": "Tuesday", + "endTime": 24 + }, + { + "startWeekday": "Wednesday", + "startTime": 0, + "endWeekday": "Wednesday", + "endTime": 16 + }, + { + "startWeekday": "Wednesday", + "startTime": 17, + "endWeekday": "Wednesday", + "endTime": 24 + }, + { + "startWeekday": "Thursday", + "startTime": 0, + "endWeekday": "Thursday", + "endTime": 24 + }, + { + "startWeekday": "Friday", + "startTime": 0, + "endWeekday": "Friday", + "endTime": 24 + }, + { + "startWeekday": "Saturday", + "startTime": 0, + "endWeekday": "Saturday", + "endTime": 24 + }, + { + "startWeekday": "Sunday", + "startTime": 0, + "endWeekday": "Sunday", + "endTime": 24 + } + ] + }, + { + "id": "Role 3", + "timeTableItems": [ + { + "startWeekday": "Monday", + "startTime": 0, + "endWeekday": "Monday", + "endTime": 24 + }, + { + "startWeekday": "Tuesday", + "startTime": 0, + "endWeekday": "Tuesday", + "endTime": 24 + }, + { + "startWeekday": "Wednesday", + "startTime": 0, + "endWeekday": "Wednesday", + "endTime": 24 + }, + { + "startWeekday": "Thursday", + "startTime": 0, + "endWeekday": "Thursday", + "endTime": 24 + }, + { + "startWeekday": "Friday", + "startTime": 0, + "endWeekday": "Friday", + "endTime": 24 + }, + { + "startWeekday": "Saturday", + "startTime": 0, + "endWeekday": "Saturday", + "endTime": 24 + }, + { + "startWeekday": "Sunday", + "startTime": 0, + "endWeekday": "Sunday", + "endTime": 24 + } + ] + }, + { + "id": "Role 4", + "timeTableItems": [ + { + "startWeekday": "Monday", + "startTime": 4, + "endWeekday": "Monday", + "endTime": 8 + }, + { + "startWeekday": "Monday", + "startTime": 9, + "endWeekday": "Monday", + "endTime": 11 + }, + { + "startWeekday": "Monday", + "startTime": 12, + "endWeekday": "Monday", + "endTime": 13 + }, + { + "startWeekday": "Monday", + "startTime": 16, + "endWeekday": "Monday", + "endTime": 18 + }, + { + "startWeekday": "Monday", + "startTime": 19, + "endWeekday": "Monday", + "endTime": 20 + }, + { + "startWeekday": "Monday", + "startTime": 21, + "endWeekday": "Monday", + "endTime": 24 + }, + { + "startWeekday": "Tuesday", + "startTime": 0, + "endWeekday": "Tuesday", + "endTime": 1 + }, + { + "startWeekday": "Tuesday", + "startTime": 3, + "endWeekday": "Tuesday", + "endTime": 9 + }, + { + "startWeekday": "Tuesday", + "startTime": 10, + "endWeekday": "Tuesday", + "endTime": 21 + }, + { + "startWeekday": "Tuesday", + "startTime": 22, + "endWeekday": "Tuesday", + "endTime": 24 + }, + { + "startWeekday": "Wednesday", + "startTime": 0, + "endWeekday": "Wednesday", + "endTime": 3 + }, + { + "startWeekday": "Wednesday", + "startTime": 7, + "endWeekday": "Wednesday", + "endTime": 8 + }, + { + "startWeekday": "Wednesday", + "startTime": 9, + "endWeekday": "Wednesday", + "endTime": 12 + }, + { + "startWeekday": "Wednesday", + "startTime": 13, + "endWeekday": "Wednesday", + "endTime": 15 + }, + { + "startWeekday": "Wednesday", + "startTime": 17, + "endWeekday": "Wednesday", + "endTime": 19 + }, + { + "startWeekday": "Wednesday", + "startTime": 20, + "endWeekday": "Wednesday", + "endTime": 22 + }, + { + "startWeekday": "Wednesday", + "startTime": 23, + "endWeekday": "Wednesday", + "endTime": 24 + }, + { + "startWeekday": "Thursday", + "startTime": 0, + "endWeekday": "Thursday", + "endTime": 2 + }, + { + "startWeekday": "Thursday", + "startTime": 3, + "endWeekday": "Thursday", + "endTime": 4 + }, + { + "startWeekday": "Thursday", + "startTime": 5, + "endWeekday": "Thursday", + "endTime": 10 + }, + { + "startWeekday": "Thursday", + "startTime": 11, + "endWeekday": "Thursday", + "endTime": 13 + }, + { + "startWeekday": "Thursday", + "startTime": 14, + "endWeekday": "Thursday", + "endTime": 15 + }, + { + "startWeekday": "Thursday", + "startTime": 16, + "endWeekday": "Thursday", + "endTime": 17 + }, + { + "startWeekday": "Thursday", + "startTime": 18, + "endWeekday": "Thursday", + "endTime": 24 + }, + { + "startWeekday": "Friday", + "startTime": 0, + "endWeekday": "Friday", + "endTime": 3 + }, + { + "startWeekday": "Friday", + "startTime": 4, + "endWeekday": "Friday", + "endTime": 5 + }, + { + "startWeekday": "Friday", + "startTime": 7, + "endWeekday": "Friday", + "endTime": 9 + }, + { + "startWeekday": "Friday", + "startTime": 10, + "endWeekday": "Friday", + "endTime": 13 + }, + { + "startWeekday": "Friday", + "startTime": 14, + "endWeekday": "Friday", + "endTime": 20 + }, + { + "startWeekday": "Friday", + "startTime": 21, + "endWeekday": "Friday", + "endTime": 24 + }, + { + "startWeekday": "Saturday", + "startTime": 1, + "endWeekday": "Saturday", + "endTime": 2 + }, + { + "startWeekday": "Saturday", + "startTime": 4, + "endWeekday": "Saturday", + "endTime": 7 + }, + { + "startWeekday": "Saturday", + "startTime": 9, + "endWeekday": "Saturday", + "endTime": 10 + }, + { + "startWeekday": "Saturday", + "startTime": 11, + "endWeekday": "Saturday", + "endTime": 12 + }, + { + "startWeekday": "Saturday", + "startTime": 18, + "endWeekday": "Saturday", + "endTime": 19 + }, + { + "startWeekday": "Saturday", + "startTime": 20, + "endWeekday": "Saturday", + "endTime": 21 + }, + { + "startWeekday": "Saturday", + "startTime": 22, + "endWeekday": "Saturday", + "endTime": 24 + }, + { + "startWeekday": "Sunday", + "startTime": 1, + "endWeekday": "Sunday", + "endTime": 4 + }, + { + "startWeekday": "Sunday", + "startTime": 5, + "endWeekday": "Sunday", + "endTime": 12 + }, + { + "startWeekday": "Sunday", + "startTime": 15, + "endWeekday": "Sunday", + "endTime": 16 + }, + { + "startWeekday": "Sunday", + "startTime": 17, + "endWeekday": "Sunday", + "endTime": 24 + } + ] + }, + { + "id": "Role 2", + "timeTableItems": [ + { + "startWeekday": "Monday", + "startTime": 0, + "endWeekday": "Monday", + "endTime": 10 + }, + { + "startWeekday": "Monday", + "startTime": 11, + "endWeekday": "Monday", + "endTime": 16 + }, + { + "startWeekday": "Monday", + "startTime": 18, + "endWeekday": "Monday", + "endTime": 22 + }, + { + "startWeekday": "Monday", + "startTime": 23, + "endWeekday": "Monday", + "endTime": 24 + }, + { + "startWeekday": "Tuesday", + "startTime": 0, + "endWeekday": "Tuesday", + "endTime": 7 + }, + { + "startWeekday": "Tuesday", + "startTime": 8, + "endWeekday": "Tuesday", + "endTime": 13 + }, + { + "startWeekday": "Tuesday", + "startTime": 14, + "endWeekday": "Tuesday", + "endTime": 18 + }, + { + "startWeekday": "Tuesday", + "startTime": 21, + "endWeekday": "Tuesday", + "endTime": 23 + }, + { + "startWeekday": "Wednesday", + "startTime": 0, + "endWeekday": "Wednesday", + "endTime": 3 + }, + { + "startWeekday": "Wednesday", + "startTime": 5, + "endWeekday": "Wednesday", + "endTime": 6 + }, + { + "startWeekday": "Wednesday", + "startTime": 7, + "endWeekday": "Wednesday", + "endTime": 11 + }, + { + "startWeekday": "Wednesday", + "startTime": 14, + "endWeekday": "Wednesday", + "endTime": 21 + }, + { + "startWeekday": "Thursday", + "startTime": 0, + "endWeekday": "Thursday", + "endTime": 1 + }, + { + "startWeekday": "Thursday", + "startTime": 2, + "endWeekday": "Thursday", + "endTime": 4 + }, + { + "startWeekday": "Thursday", + "startTime": 5, + "endWeekday": "Thursday", + "endTime": 6 + }, + { + "startWeekday": "Thursday", + "startTime": 7, + "endWeekday": "Thursday", + "endTime": 14 + }, + { + "startWeekday": "Thursday", + "startTime": 15, + "endWeekday": "Thursday", + "endTime": 18 + }, + { + "startWeekday": "Thursday", + "startTime": 19, + "endWeekday": "Thursday", + "endTime": 21 + }, + { + "startWeekday": "Thursday", + "startTime": 23, + "endWeekday": "Thursday", + "endTime": 24 + }, + { + "startWeekday": "Friday", + "startTime": 0, + "endWeekday": "Friday", + "endTime": 17 + }, + { + "startWeekday": "Friday", + "startTime": 18, + "endWeekday": "Friday", + "endTime": 19 + }, + { + "startWeekday": "Friday", + "startTime": 20, + "endWeekday": "Friday", + "endTime": 24 + }, + { + "startWeekday": "Saturday", + "startTime": 1, + "endWeekday": "Saturday", + "endTime": 2 + }, + { + "startWeekday": "Saturday", + "startTime": 3, + "endWeekday": "Saturday", + "endTime": 5 + }, + { + "startWeekday": "Saturday", + "startTime": 6, + "endWeekday": "Saturday", + "endTime": 8 + }, + { + "startWeekday": "Saturday", + "startTime": 9, + "endWeekday": "Saturday", + "endTime": 20 + }, + { + "startWeekday": "Saturday", + "startTime": 21, + "endWeekday": "Saturday", + "endTime": 22 + }, + { + "startWeekday": "Saturday", + "startTime": 23, + "endWeekday": "Saturday", + "endTime": 24 + }, + { + "startWeekday": "Sunday", + "startTime": 0, + "endWeekday": "Sunday", + "endTime": 6 + }, + { + "startWeekday": "Sunday", + "startTime": 7, + "endWeekday": "Sunday", + "endTime": 9 + }, + { + "startWeekday": "Sunday", + "startTime": 10, + "endWeekday": "Sunday", + "endTime": 13 + }, + { + "startWeekday": "Sunday", + "startTime": 14, + "endWeekday": "Sunday", + "endTime": 17 + }, + { + "startWeekday": "Sunday", + "startTime": 18, + "endWeekday": "Sunday", + "endTime": 19 + }, + { + "startWeekday": "Sunday", + "startTime": 21, + "endWeekday": "Sunday", + "endTime": 24 + } + ] + }, + { + "id": "Role 5", + "timeTableItems": [ + { + "startWeekday": "Monday", + "startTime": 1, + "endWeekday": "Monday", + "endTime": 2 + }, + { + "startWeekday": "Monday", + "startTime": 4, + "endWeekday": "Monday", + "endTime": 8 + }, + { + "startWeekday": "Monday", + "startTime": 11, + "endWeekday": "Monday", + "endTime": 12 + }, + { + "startWeekday": "Monday", + "startTime": 13, + "endWeekday": "Monday", + "endTime": 24 + }, + { + "startWeekday": "Tuesday", + "startTime": 1, + "endWeekday": "Tuesday", + "endTime": 7 + }, + { + "startWeekday": "Tuesday", + "startTime": 14, + "endWeekday": "Tuesday", + "endTime": 23 + }, + { + "startWeekday": "Wednesday", + "startTime": 0, + "endWeekday": "Wednesday", + "endTime": 3 + }, + { + "startWeekday": "Wednesday", + "startTime": 4, + "endWeekday": "Wednesday", + "endTime": 9 + }, + { + "startWeekday": "Wednesday", + "startTime": 11, + "endWeekday": "Wednesday", + "endTime": 14 + }, + { + "startWeekday": "Wednesday", + "startTime": 15, + "endWeekday": "Wednesday", + "endTime": 17 + }, + { + "startWeekday": "Wednesday", + "startTime": 19, + "endWeekday": "Wednesday", + "endTime": 20 + }, + { + "startWeekday": "Thursday", + "startTime": 5, + "endWeekday": "Thursday", + "endTime": 12 + }, + { + "startWeekday": "Thursday", + "startTime": 13, + "endWeekday": "Thursday", + "endTime": 20 + }, + { + "startWeekday": "Thursday", + "startTime": 22, + "endWeekday": "Thursday", + "endTime": 24 + }, + { + "startWeekday": "Friday", + "startTime": 1, + "endWeekday": "Friday", + "endTime": 5 + }, + { + "startWeekday": "Friday", + "startTime": 7, + "endWeekday": "Friday", + "endTime": 11 + }, + { + "startWeekday": "Friday", + "startTime": 14, + "endWeekday": "Friday", + "endTime": 18 + }, + { + "startWeekday": "Friday", + "startTime": 20, + "endWeekday": "Friday", + "endTime": 24 + }, + { + "startWeekday": "Saturday", + "startTime": 0, + "endWeekday": "Saturday", + "endTime": 4 + }, + { + "startWeekday": "Saturday", + "startTime": 7, + "endWeekday": "Saturday", + "endTime": 10 + }, + { + "startWeekday": "Saturday", + "startTime": 12, + "endWeekday": "Saturday", + "endTime": 20 + }, + { + "startWeekday": "Saturday", + "startTime": 21, + "endWeekday": "Saturday", + "endTime": 22 + }, + { + "startWeekday": "Sunday", + "startTime": 0, + "endWeekday": "Sunday", + "endTime": 2 + }, + { + "startWeekday": "Sunday", + "startTime": 4, + "endWeekday": "Sunday", + "endTime": 5 + }, + { + "startWeekday": "Sunday", + "startTime": 7, + "endWeekday": "Sunday", + "endTime": 10 + }, + { + "startWeekday": "Sunday", + "startTime": 12, + "endWeekday": "Sunday", + "endTime": 19 + }, + { + "startWeekday": "Sunday", + "startTime": 20, + "endWeekday": "Sunday", + "endTime": 24 + } + ] + } + ], + "costDrivers": [ + { + "id": "Delivery", + "name": "Delivery", + "concreteCostDrivers": [ + { + "id": "eb2d7a95-af12-4c07-8483-76c222bd2a8a", + "name": "Delivery_A_Lorry", + "cost": 0.000009222736147284307 + }, + { + "id": "2320625c-91a6-46fe-a338-30e31da90aeb", + "name": "Delivery_B_Small_Lorry", + "cost": 0.000017790529652615878 + }, + { + "id": "e4b2ab16-bab1-44be-91df-8a1e859553f6", + "name": "Delivery_B_Lorry", + "cost": 0.000013834104220926462 + }, + { + "id": "7d56ac6e-0d5b-41e4-b83e-cbb43557a937", + "name": "Delivery_A_Small_Lorry", + "cost": 0.000011860353101743918 + } + ] + }, + { + "id": "Shipment", + "name": "Shipment", + "concreteCostDrivers": [ + { + "id": "ef48baf7-4885-4d95-96b8-8d3d4a1092dc", + "name": "Shipment_A_Lorry", + "cost": 0.000025279427000910646 + }, + { + "id": "7fa79147-2fa5-47f8-9bd5-b4a05ec65b49", + "name": "Shipment_A_Rail_Electric", + "cost": -3.9450807802685816e-7 + }, + { + "id": "a0cd2fa8-a7b4-4805-a662-38f701862a2f", + "name": "Shipment_B_Lorry", + "cost": 0.00005055885400182129 + }, + { + "id": "256b0228-f05a-4e35-a5f2-efec99b0b406", + "name": "Shipment_B_Rail_Electric", + "cost": -7.890161560537163e-7 + } + ] + }, + { + "id": "Re-Routing", + "name": "Re-Routing", + "concreteCostDrivers": [ + { + "id": "70957e6a-c47e-4cc2-b4cf-ca3863153c9f", + "name": "Re-Routing_A_Lorry", + "cost": 0.000002766820844185292 + }, + { + "id": "985e5853-47ad-48b9-af14-db5f46249f4a", + "name": "Re-Routing_A_Small_Lorry", + "cost": 0.000003558105930523175 + } + ] + }, + { + "id": "Packaging Material", + "name": "Packaging Material", + "concreteCostDrivers": [ + { + "id": "1ce01d66-552b-4bc2-9103-680d37531c72", + "name": "Packaging_Material_B", + "cost": 0.000004607338473103258 + }, + { + "id": "ee2a9ffc-24ae-499b-b11e-77f52094aa21", + "name": "Packaging_Material_A", + "cost": 0.000009214676946206515 + } + ] + }, + { + "id": "Receipt", + "name": "Receipt", + "concreteCostDrivers": [ + { + "id": "1964790c-5d5f-412c-b6a1-beb2df9508c9", + "name": "Receipt", + "cost": 0.000005075463136208346 + } + ] + }, + { + "id": "Filling Material", + "name": "Filling Material", + "concreteCostDrivers": [ + { + "id": "fdd48db8-b321-43a1-9a01-569963bc5f71", + "name": "Filling_A", + "cost": 0.000005119664581012698 + } + ] + } + ], + "variants": [] + }, + "models": [ + { + "BPMN": "Flow_18e5u87Flow_18e5u87Flow_0x4zrhbFlow_0x4zrhbFlow_152dui2Flow_1lgsuz0Flow_1atlp9wFlow_1atlp9wFlow_01lk7fyFlow_1dcn9uqFlow_152dui2Flow_1lgsuz0Flow_01lk7fyFlow_1dcn9uq", + "name": "BPMN_1", + "modelParameter": { + "activities": [ + { + "id": "Activity_12nhj09", + "resources": [ + "Role 2" + ], + "duration": { + "distributionType": "normal", + "values": [ + { + "id": "mean", + "value": 1091.827953405018 + }, + { + "id": "variance", + "value": 646.939769970795 + } + ], + "timeUnit": "secs" + }, + "cost": 0, + "costDrivers": [] + }, + { + "id": "Activity_0zw7mmo", + "resources": [ + "Role 2" + ], + "duration": { + "distributionType": "normal", + "values": [ + { + "id": "mean", + "value": 1377.5888516228747 + }, + { + "id": "variance", + "value": 521.4428899767106 + } + ], + "timeUnit": "secs" + }, + "cost": 0, + "costDrivers": [] + }, + { + "id": "Activity_0gdnps8", + "resources": [ + "Role 3" + ], + "duration": { + "distributionType": "constant", + "values": [ + { + "id": "constantValue", + "value": 60 + } + ], + "timeUnit": "secs" + }, + "cost": 0, + "costDrivers": [] + } + ], + "gateways": [ + { + "id": "Gateway_18euw97", + "probabilities": { + "Flow_1lgsuz0": 0.21885521885521886, + "Flow_01lk7fy": 0.7811447811447811 + } + } + ], + "events": [ + { + "id": "StartEvent_1", + "interArrivalTime": { + "distributionType": "normal", + "values": [ + { + "id": "mean", + "value": 22393.925501432666 + }, + { + "id": "variance", + "value": 858177974.4886869 + } + ], + "timeUnit": "secs" + } + } + ] + } + } + ], + "startingDate": "01-01-0000", + "numberOfInstances": 608, + "currency": "euro" + } +] \ No newline at end of file diff --git a/frontend/cypress/e2e/application.cy.js b/frontend/cypress/e2e/application.cy.js index c71958f..7a994b5 100644 --- a/frontend/cypress/e2e/application.cy.js +++ b/frontend/cypress/e2e/application.cy.js @@ -548,7 +548,10 @@ describe('LCA Configuration Tests', () => { cy.findByText('Variant saved').should('exist'); cy.findByRole('textbox', { placeholder: /Variant Name/i }).should('have.value', ''); cy.get('input[id="variantFrequencyInput"').should('have.value', '15%'); + cy.visit('http://localhost:3000/'); // Click away to ensure data is actually saved and not just displayed + cy.visit('http://localhost:3000/lcavariants'); cy.get('button.chakra-accordion__button').should('have.length', 1); + cy.get('button.chakra-accordion__button').findByText(newVariantName).should('exist'); }); }); }); diff --git a/frontend/cypress/e2e/configFromScenarioTest.mjs b/frontend/cypress/e2e/configFromScenarioTest.mjs index 57bc83e..a33a3a0 100644 --- a/frontend/cypress/e2e/configFromScenarioTest.mjs +++ b/frontend/cypress/e2e/configFromScenarioTest.mjs @@ -954,27 +954,25 @@ const scenarioDataWithCostVariants = ] } ], - "costVariantConfig": { - "count": "100", - "variants": [ - { - "id": "Shipment and delivery over distance A", - "frequency": "0.2", - "drivers": [ - { - "id": "Delivery", - "cost": "0.00002843" - }, - { - "id": "Filling Material", - "cost": "0.00001468" + "variants": [ + { + "id" : "1", + "name": "Shipment and delivery over distance A", + "frequency": "0.2", + "mappings": [ // TODO mappings are not done cost based anymore + { + "id": "Delivery", + "cost": "0.00002843" + }, + { + "id": "Filling Material", + "cost": "0.00001468" - } + } - ] - } - ] - } + ] + } + ] }, "models": [ { @@ -1537,43 +1535,41 @@ const logisticsScenario = { }, ], - "costVariantConfig": { - "count": "100", - "variants": [ - { - "id": "Shipment and delivery over distance A", - "frequency": "0.2", - "drivers": [ - { - "id": "Delivery", - "cost": "0.00002843" - }, - { - "id": "Filling Material", - "cost": "0.00001468" - }, - { - "id": "Packaging Material", - "cost": "0.00003806" - }, - { - "id": "Re-Routing", - "cost": "0.000008529" - }, - { - "id": "Receipt", - "cost": "0.00001153" - }, - { - "id": "Shipment", - "cost": "0.00007839" - }, + "variants": [ + { + "id" : "2", + "name": "Shipment and delivery over distance A", + "frequency": "0.2", + "mappings": [ // TODO mappings are not done cost based anymore + { + "id": "Delivery", + "cost": "0.00002843" + }, + { + "id": "Filling Material", + "cost": "0.00001468" + }, + { + "id": "Packaging Material", + "cost": "0.00003806" + }, + { + "id": "Re-Routing", + "cost": "0.000008529" + }, + { + "id": "Receipt", + "cost": "0.00001153" + }, + { + "id": "Shipment", + "cost": "0.00007839" + }, - ] - } - ] - } + ] + } + ] }, "models": [ { diff --git a/frontend/cypress/fixtures/lca/lcaTestScenario.json b/frontend/cypress/fixtures/lca/lcaTestScenario.json index 646c85e..49d8f4e 100644 --- a/frontend/cypress/fixtures/lca/lcaTestScenario.json +++ b/frontend/cypress/fixtures/lca/lcaTestScenario.json @@ -1097,11 +1097,9 @@ ] } ], - "environmentMappingConfig":{ - "variants":[ - - ] - } + "variants":[ + + ] }, "models":[ { @@ -1638,12 +1636,7 @@ ] } } - ], - "costVariantConfig":{ - "variants":[ - - ] - } + ] } } ] diff --git a/frontend/src/components/EditorSidebar/Modelbased/Activity.jsx b/frontend/src/components/EditorSidebar/Modelbased/Activity.jsx index 861dfc8..a1ac3f3 100644 --- a/frontend/src/components/EditorSidebar/Modelbased/Activity.jsx +++ b/frontend/src/components/EditorSidebar/Modelbased/Activity.jsx @@ -13,11 +13,10 @@ import DistributionEditor from '../../DistributionEditor'; import AbstractModelElementEditor from './AbstractModelElementEditor'; import { distributionToState, stateToDistribution } from '../../../util/Distributions'; -import { saveCostVariantConfig } from '../../Lca/Logic/LcaDataManager'; const Activity = ({ getData, currentElement, setCurrentRightSideBar }) => { - const [allAbstractCostDrivers, setAllAbstractCostDrivers] = useState([]); + const [allAbstractCostDrivers, setAllAbstractCostDrivers] = useState([]); //TODO this shouldn't be a state const reactDomNavigator = useNavigate(); //init @@ -83,13 +82,11 @@ const Activity = ({ getData, currentElement, setCurrentRightSideBar }) => { const removeAbstractCostDriver = (index) => { setAbstractCostDrivers(activityConfiguration.costDrivers.filter((value, localIndex) => localIndex !== index)); - saveCostVariantConfig(getData, allAbstractCostDrivers); } const handleAbstractCostDrivers = (index, value) => { activityConfiguration.costDrivers[index] = value; setAbstractCostDrivers(activityConfiguration.costDrivers.filter(abstractCostDriver => abstractCostDriver)); - saveCostVariantConfig(getData, allAbstractCostDrivers); } return { export const getVariants = (getData) => { const scenario = getData().getCurrentScenario(); - if (scenario) { - if (scenario.resourceParameters.environmentMappingConfig && scenario.resourceParameters.environmentMappingConfig.variants) { - return scenario.resourceParameters.environmentMappingConfig.variants; - } + if (scenario && scenario.resourceParameters.variants) { + return scenario.resourceParameters.variants; } return []; }; @@ -53,90 +51,28 @@ export const saveAllCostDrivers = async (abstractCostDrivers, getData) => { await getData().saveCurrentScenario(); }; -export const saveCostVariant = async (allCostDrivers, variant, - updatedVariants, getData) => { +export const saveCostVariant = async (variant, updatedVariants, getData) => { //save variants and its mappings let driversMappings = variant.mappings.map(mapping => { - return SimulationModelModdle.getInstance().create("simulationmodel:DriversMapping", { + return SimulationModelModdle.getInstance().create("simulationmodel:DriverConcretization", { abstractDriver: mapping.abstractDriver, concreteDriver: mapping.concreteDriver, }); }); - let variantExtended = SimulationModelModdle.getInstance().create("simulationmodel:VariantExtended", { + let updatedVariant = SimulationModelModdle.getInstance().create("simulationmodel:Variant", { id: variant.id, name: variant.name, frequency: variant.frequency, mappings: driversMappings, }); - let updatedVariantsObject = [...updatedVariants.filter(v => v.id !== variant.id), variantExtended]; - const environmentMappingConfig = - SimulationModelModdle.getInstance().create("simulationmodel:EnvironmentMappingConfig", { - variants: updatedVariantsObject, - }); - getData().getCurrentScenario().resourceParameters.environmentMappingConfig = environmentMappingConfig; - await getData().saveCurrentScenario(); - - saveCostVariantConfig(getData, allCostDrivers); + let updatedVariantsObject = [...updatedVariants.filter(v => v.id !== variant.id), updatedVariant]; + getData().getCurrentScenario().resourceParameters.variants = updatedVariantsObject; await getData().saveCurrentScenario(); }; -export const saveCostVariantConfig = async (getData, allCostDrivers) => { - const scenario = getData().getCurrentScenario(); - - if (!scenario) { - return; - } - - let formattedVariants = []; - const variants = scenario.resourceParameters.environmentMappingConfig.variants; - variants.forEach(v => { - let drivers = []; - v.mappings.forEach(m => { - const concreteDriver = allCostDrivers - .flatMap(driver => driver.concreteCostDrivers) - .find(driver => driver.id === m.concreteDriver); - const driver = SimulationModelModdle.getInstance().create("simulationmodel:DriverConcretization", { - abstractId: m.abstractDriver, - concreteId: concreteDriver.name //TODO recheck whole usage of names vs. ids - }); - drivers.push(driver); - }); - - console.log('Drivers:', drivers); - let costVariant = SimulationModelModdle.getInstance().create("simulationmodel:Variant", { - id: v.name, - frequency: v.frequency, - drivers: drivers, - }); - formattedVariants.push(costVariant); - }); - - let costVariantConfig = SimulationModelModdle.getInstance().create("simulationmodel:CostVariantConfig", { - count: formattedVariants.length, - variants: formattedVariants, - }); - - getData().getCurrentScenario().models[0].modelParameter.costVariantConfig = costVariantConfig; - await getData().saveCurrentScenario(); -} export const deleteVariantFromConfiguration = async (variantId, getData) => { - const environmentMappingConfig = SimulationModelModdle.getInstance().create("simulationmodel:EnvironmentMappingConfig", { - variants: getData().getCurrentScenario() - .resourceParameters.environmentMappingConfig.variants.filter(v => v.id !== variantId), - }); - getData().getCurrentScenario().resourceParameters.environmentMappingConfig = environmentMappingConfig; - await getData().saveCurrentScenario(); -}; - -export const deleteVariantFromCostVariantConfig = async (variantId, getData) => { - let costVariantConfig = getData().getCurrentScenario().models[0].modelParameter.costVariantConfig; - const updatedCostVariantConfig = { ...costVariantConfig }; - - updatedCostVariantConfig.variants = updatedCostVariantConfig.variants.filter(v => v.id !== variantId); - updatedCostVariantConfig.count = updatedCostVariantConfig.variants.length; - - getData().getCurrentScenario().models[0].modelParameter.costVariantConfig = updatedCostVariantConfig; + getData().getCurrentScenario().resourceParameters.variants = getData().getCurrentScenario().resourceParameters.variants.filter(v => v.id !== variantId); await getData().saveCurrentScenario(); -} \ No newline at end of file +}; \ No newline at end of file diff --git a/frontend/src/components/Simulation/SimulationPage.jsx b/frontend/src/components/Simulation/SimulationPage.jsx index 1fcc78f..00e214c 100644 --- a/frontend/src/components/Simulation/SimulationPage.jsx +++ b/frontend/src/components/Simulation/SimulationPage.jsx @@ -24,7 +24,7 @@ const SimulationPage = ({projectName, getData, toasting }) => { // function to start the simulation const start = async () => { - let variants = getData().getCurrentScenario().resourceParameters.environmentMappingConfig.variants; + let variants = getData().getCurrentScenario().resourceParameters.variants; if(variants.reduce((sum, variant) => sum + parseInt(variant.frequency), 0) != 100) { toasting("error", "Frequencies sum is not 100%", "For correct simulation, the sum of frequencies must be 100%"); diff --git a/scyllaConverter/ConvertElements.js b/scyllaConverter/ConvertElements.js index c4b411c..c12b589 100644 --- a/scyllaConverter/ConvertElements.js +++ b/scyllaConverter/ConvertElements.js @@ -183,7 +183,8 @@ function createOneTimeTable(timetable) { function createOneAbstractCostDriver(abstractCostDriver) { return { _attributes : { - id : abstractCostDriver.id // TODO: see if defaultTimeUnit is to be added + id : abstractCostDriver.id, // TODO: see if defaultTimeUnit is to be added + name : abstractCostDriver.name }, concreteCostDriver : abstractCostDriver.concreteCostDrivers.map(item => createOneConcreteCostDriver(item)) }; @@ -194,16 +195,17 @@ function createOneVariant(variant) { return { _attributes : { id : variant.id, + name : variant.name, frequency : variant.frequency / 100 }, - driver : variant.drivers.map(driver => createOneDriverConcretization(driver)) + driver : variant.mappings.map(driver => createOneDriverConcretization(driver)) }; } function createOneDriverConcretization(driver) { var item = new Object; var attributes = new Object; - attributes.abstractId = driver.abstractId; - attributes.concreteId = driver.concreteId; + attributes.abstractId = driver.abstractDriver; + attributes.concreteId = driver.concreteDriver; item._attributes = attributes; return item; } @@ -212,6 +214,7 @@ function createOneConcreteCostDriver(concreteCostDriver) { // aka createOneCon var item = new Object; var attributes = new Object; attributes.id = concreteCostDriver.id; + attributes.name = concreteCostDriver.name; attributes.cost = concreteCostDriver.cost; item._attributes = attributes; return item; diff --git a/scyllaConverter/ConvertScenario.js b/scyllaConverter/ConvertScenario.js index 51bd474..be82cc3 100644 --- a/scyllaConverter/ConvertScenario.js +++ b/scyllaConverter/ConvertScenario.js @@ -22,14 +22,6 @@ export async function convertScenario(scenarioRaw) { // copy scenarioRaw object const scenario = JSON.parse(JSON.stringify(scenarioRaw)); - // Iterate over each costDriver in the resourceParameters - scenario.resourceParameters.costDrivers.forEach(abstractDriver => { - // Replace the id of each concreteCostDriver with its name - abstractDriver.concreteCostDrivers.forEach(concreteCostDriver => { - concreteCostDriver.id = concreteCostDriver.name; - }); - }); - if (!scenario.models.length) throw 'No models to convert were provided'; // create one global configuration: diff --git a/scyllaConverter/SimConfig.js b/scyllaConverter/SimConfig.js index 0c18056..650ef76 100644 --- a/scyllaConverter/SimConfig.js +++ b/scyllaConverter/SimConfig.js @@ -21,8 +21,7 @@ async function createSimConfig(scenario, processModel) { elementsById } = await moddle.fromXML(processModel.BPMN, 'bpmn:Definitions'); - costVariantConfig._attributes = { count: processModel.modelParameter.costVariantConfig.count }; - costVariantConfig.variant = conv_ele.createVariants(processModel.modelParameter.costVariantConfig.variants); + costVariantConfig.variant = conv_ele.createVariants(scenario.resourceParameters.variants); simConfig.costVariantConfig = costVariantConfig; // create Tasks: