Commit b78657d7 authored by Nicolas Seydoux's avatar Nicolas Seydoux
Browse files

Added maximal distribution, fixed factory generate

Features were not properly attached to sensors
parent b2c8e6b2
......@@ -126,6 +126,12 @@ python3 simulator/generator.py -t simulator/thesis/distribution/distribution_0.j
python3 simulator/generator.py -t simulator/thesis/distribution/distribution_0.json -o simulator/thesis/distribution_0_cip -c cip
python3 simulator/generator.py -t simulator/thesis/distribution/distribution_0.json -o simulator/thesis/distribution_0_adp -c adp
python3 simulator/generator.py -t simulator/thesis/distribution/distribution_4.json -o simulator/thesis/distribution_4_cdr -c cdr
python3 simulator/generator.py -t simulator/thesis/distribution/distribution_4.json -o simulator/thesis/distribution_4_cir -c cir
python3 simulator/generator.py -t simulator/thesis/distribution/distribution_4.json -o simulator/thesis/distribution_4_cdp -c cdp
python3 simulator/generator.py -t simulator/thesis/distribution/distribution_4.json -o simulator/thesis/distribution_4_cip -c cip
python3 simulator/generator.py -t simulator/thesis/distribution/distribution_4.json -o simulator/thesis/distribution_4_adp -c adp
# python3 simulator/generator.py -t simulator/coopis/distribution_syndream/distribution_1.json -o simulator/coopis/distribution_1_cdr -c cdr
# python3 simulator/generator.py -t simulator/coopis/distribution_syndream/distribution_1.json -o simulator/coopis/distribution_1_cir -c cir
# python3 simulator/generator.py -t simulator/coopis/distribution_syndream/distribution_1.json -o simulator/coopis/distribution_1_cdp -c cdp
......
@prefix : <https://w3id.org/laas-iot/edr/iiot/factory#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <https://w3id.org/laas-iot/edr/iiot/factory> .
:Floor0 rdf:type :Floor ; :locatedIn :myFactory.
:Conveyor00 rdf:type :Conveyor ; :locatedIn :Floor0.
:Machine000 :onConveyor :Conveyor00.
:Machine000 rdf:type :SparkGeneratingMachine.:Machine001 :onConveyor :Conveyor00.
:Machine001 rdf:type :Machine.:Conveyor01 rdf:type :Conveyor ; :locatedIn :Floor0.
:Machine010 :onConveyor :Conveyor01.
:Machine010 rdf:type :SparkGeneratingMachine.:Machine011 :onConveyor :Conveyor01.
:Machine011 rdf:type :Machine.:Floor1 rdf:type :Floor ; :locatedIn :myFactory.
:Conveyor10 rdf:type :Conveyor ; :locatedIn :Floor1.
:Machine100 :onConveyor :Conveyor10.
:Machine100 rdf:type :ColdSensitiveMachine.:Machine101 :onConveyor :Conveyor10.
:Machine101 rdf:type :Machine.:Conveyor11 rdf:type :Conveyor ; :locatedIn :Floor1.
:Machine110 :onConveyor :Conveyor11.
:Machine110 rdf:type :SparkGeneratingMachine.:Machine111 :onConveyor :Conveyor11.
:Machine111 rdf:type :Machine.
\ No newline at end of file
......@@ -112,8 +112,8 @@ def build_factory_description(factory, target_file):
floor_counter+=1
return output
def instanciate_sensor(sensor_type):
return {"type":"sensor", "count":1, "host":SENSOR_HOST, "measures":sensor_type}
def instanciate_sensor(sensor, feature):
return {"type":"sensor", "count":1, "host":SENSOR_HOST, "measures":sensor["type"], "feature":feature, "up":sensor["up"]}
def instanciate_node(node, host):
return {
......@@ -137,6 +137,24 @@ def generate_topology(factory, desc_file):
topology["layers"]["concentrates"].append(topo_floor)
return topology
def spread_sensors(root):
sensors = []
for node in [x in root["concentrates"] if x["type"] != "sensor"]:
sensors+=spread_sensors(node)
for i in len(sensors):
sensors[i]["up"]-=1
if sensors[i]["up"]==0:
root["concentrates"].append(sensors[i])
del(sensors[i])
current_sensors = [x in root["concentrates"] if x["type"] == "sensor"]
for i in len(root["concentrates"]):
if root["concentrates"][i]["type"] == "sensor" and root["concentrates"][i]["up"] > 0:
sensors.append(root["concentrates"][i])
del(root["concentrates"][i])
return sensors
parser = argparse.ArgumentParser()
parser.add_argument('-b', '--blueprint', help="JSON in which the factory is described", type=str)
parser.add_argument('-d', '--desc_file', help="the ttl file in which the topology is described", type=str)
......
echo "scalability local 0"
python3 factory_generator.py -b scala_syndream/clone_f_0_blueprint.json -d scala_syndream/clone_f_0.ttl -o scala_syndream/clone_f_0.json
echo "scalability local 1"
python3 factory_generator.py -b scala_syndream/clone_f_1_blueprint.json -d scala_syndream/clone_f_1.ttl -o scala_syndream/clone_f_1.json
echo "scalability local 2"
python3 factory_generator.py -b scala_syndream/clone_f_2_blueprint.json -d scala_syndream/clone_f_2.ttl -o scala_syndream/clone_f_2.json
echo "scalability distributed 0"
python3 factory_generator.py -b scala_distributed/clone_f_0_rpi23sb_blueprint.json -d scala_distributed/clone_f_0_rpi23sb.ttl -o scala_distributed/clone_f_0_rpi23sb.json
echo "scalability distributed 1"
python3 factory_generator.py -b scala_distributed/clone_f_1_rpi23sb_blueprint.json -d scala_distributed/clone_f_1_rpi23sb.ttl -o scala_distributed/clone_f_1_rpi23sb.json
echo "scalability distributed 2"
python3 factory_generator.py -b scala_distributed/clone_f_2_rpi23sb_blueprint.json -d scala_distributed/clone_f_2_rpi23sb.ttl -o scala_distributed/clone_f_2_rpi23sb.json
echo "spe baseline"
python3 factory_generator.py -b specialisation/specialisation_baseline_blueprint.json -d specialisation/specialisation_baseline.ttl -o specialisation/specialisation_baseline.json
echo "spe implem"
python3 factory_generator.py -b specialisation/specialisation_implementation_blueprint.json -d specialisation/specialisation_implementation.ttl -o specialisation/specialisation_implementation.json
# echo "scalability local 0"
# python3 factory_generator.py -b scala_syndream/clone_f_0_blueprint.json -d scala_syndream/clone_f_0.ttl -o scala_syndream/clone_f_0.json
# echo "scalability local 1"
# python3 factory_generator.py -b scala_syndream/clone_f_1_blueprint.json -d scala_syndream/clone_f_1.ttl -o scala_syndream/clone_f_1.json
# echo "scalability local 2"
# python3 factory_generator.py -b scala_syndream/clone_f_2_blueprint.json -d scala_syndream/clone_f_2.ttl -o scala_syndream/clone_f_2.json
#
# echo "scalability distributed 0"
# python3 factory_generator.py -b scala_distributed/clone_f_0_rpi23sb_blueprint.json -d scala_distributed/clone_f_0_rpi23sb.ttl -o scala_distributed/clone_f_0_rpi23sb.json
# echo "scalability distributed 1"
# python3 factory_generator.py -b scala_distributed/clone_f_1_rpi23sb_blueprint.json -d scala_distributed/clone_f_1_rpi23sb.ttl -o scala_distributed/clone_f_1_rpi23sb.json
# echo "scalability distributed 2"
# python3 factory_generator.py -b scala_distributed/clone_f_2_rpi23sb_blueprint.json -d scala_distributed/clone_f_2_rpi23sb.ttl -o scala_distributed/clone_f_2_rpi23sb.json
#
# echo "spe baseline"
# python3 factory_generator.py -b specialisation/specialisation_baseline_blueprint.json -d specialisation/specialisation_baseline.ttl -o specialisation/specialisation_baseline.json
# echo "spe implem"
# python3 factory_generator.py -b specialisation/specialisation_implementation_blueprint.json -d specialisation/specialisation_implementation.ttl -o specialisation/specialisation_implementation.json
# echo "distribution local 0"
# python3 factory_generator.py -b distribution_syndream/distribution_0_blueprint.json -d distribution_syndream/distribution_0.ttl -o distribution_syndream/distribution_0.json
......
@prefix : <https://w3id.org/laas-iot/edr/iiot/factory#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <https://w3id.org/laas-iot/edr/iiot/factory> .
:Floor0 rdf:type :Floor ; :locatedIn :myFactory.
:Conveyor00 rdf:type :Conveyor ; :locatedIn :Floor0.
:Machine000 :onConveyor :Conveyor00.
:Machine000 rdf:type :SparkGeneratingMachine.
:Machine001 :onConveyor :Conveyor00.
:Machine001 rdf:type :ColdSensitiveMachine.
:Conveyor01 rdf:type :Conveyor ; :locatedIn :Floor0.
:Machine010 :onConveyor :Conveyor01.
:Machine010 rdf:type :SparkGeneratingMachine.
:Machine011 :onConveyor :Conveyor01.
:Machine011 rdf:type :ColdSensitiveMachine.
@prefix : <https://w3id.org/laas-iot/edr/iiot/factory#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <https://w3id.org/laas-iot/edr/iiot/factory> .
:Floor0 rdf:type :Floor ; :locatedIn :myFactory.
:Conveyor00 rdf:type :Conveyor ; :locatedIn :Floor0.
:Machine000 :onConveyor :Conveyor00.
:Machine000 rdf:type :SparkGeneratingMachine.
:Conveyor01 rdf:type :Conveyor ; :locatedIn :Floor0.
:Machine010 :onConveyor :Conveyor01.
:Machine010 rdf:type :SparkGeneratingMachine.
:Floor1 rdf:type :Floor ; :locatedIn :myFactory.
:Conveyor10 rdf:type :Conveyor ; :locatedIn :Floor1.
:Machine100 :onConveyor :Conveyor10.
:Machine100 rdf:type :ColdSensitiveMachine.
:Conveyor11 rdf:type :Conveyor ; :locatedIn :Floor1.
:Machine110 :onConveyor :Conveyor11.
:Machine110 rdf:type :SparkGeneratingMachine.
{
"floors": [
{
"url": "https://w3id.org/laas-iot/edr/iiot/factory#Floor0",
"count": 1,
"type": "floor",
"sensors": [],
"conveyors": [
{
"url": "https://w3id.org/laas-iot/edr/iiot/factory#Conveyor00",
"count": 1,
"type": "conveyor",
"sensors": [
"luminosity",
"presence",
"conveyor_state",
"conveyor_speed",
"supervisor_presence"
],
"machines": [
{
"url": "https://w3id.org/laas-iot/edr/iiot/factory#Machine000",
"count": 1,
"type": "spark_machine",
"sensors": [
"particle_level",
"luminosity",
"presence",
"machine_state",
"product_quality",
"machine_speed"
]
},
{
"url": "https://w3id.org/laas-iot/edr/iiot/factory#Machine001",
"count": 1,
"type": "temperature_machine",
"sensors": [
"temperature",
"luminosity",
"presence",
"machine_state",
"product_quality",
"machine_speed"
]
}
]
},
{
"url": "https://w3id.org/laas-iot/edr/iiot/factory#Conveyor01",
"count": 1,
"type": "conveyor",
"sensors": [
"luminosity",
"presence",
"conveyor_state",
"conveyor_speed",
"supervisor_presence"
],
"machines": [
{
"url": "https://w3id.org/laas-iot/edr/iiot/factory#Machine010",
"count": 1,
"type": "spark_machine",
"sensors": [
"particle_level",
"luminosity",
"presence",
"machine_state",
"product_quality",
"machine_speed"
]
},
{
"url": "https://w3id.org/laas-iot/edr/iiot/factory#Machine011",
"count": 1,
"type": "temperature_machine",
"sensors": [
"temperature",
"luminosity",
"presence",
"machine_state",
"product_quality",
"machine_speed"
]
}
]
}
]
}
]
}
\ No newline at end of file
@prefix : <https://w3id.org/laas-iot/edr/iiot/factory#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <https://w3id.org/laas-iot/edr/iiot/factory> .
:Floor0 rdf:type :Floor ; :locatedIn :myFactory.
:Conveyor00 rdf:type :Conveyor ; :locatedIn :Floor0.
:Machine000 :onConveyor :Conveyor00.
:Machine000 rdf:type :SparkGeneratingMachine.:Machine001 :onConveyor :Conveyor00.
:Machine001 rdf:type :Machine.:Conveyor01 rdf:type :Conveyor ; :locatedIn :Floor0.
:Machine010 :onConveyor :Conveyor01.
:Machine010 rdf:type :SparkGeneratingMachine.:Machine011 :onConveyor :Conveyor01.
:Machine011 rdf:type :Machine.:Floor1 rdf:type :Floor ; :locatedIn :myFactory.
:Conveyor10 rdf:type :Conveyor ; :locatedIn :Floor1.
:Machine100 :onConveyor :Conveyor10.
:Machine100 rdf:type :ColdSensitiveMachine.:Machine101 :onConveyor :Conveyor10.
:Machine101 rdf:type :Machine.:Conveyor11 rdf:type :Conveyor ; :locatedIn :Floor1.
:Machine110 :onConveyor :Conveyor11.
:Machine110 rdf:type :SparkGeneratingMachine.:Machine111 :onConveyor :Conveyor11.
:Machine111 rdf:type :Machine.
\ No newline at end of file
......@@ -220,6 +220,8 @@ def parse_topology(topology_name, common_knowledge, topology, node_list, upper_n
node["cycleDuration"] = topology["cycleDuration"]
if replay != None:
node["datafile"] = replay+node["name"]+".log"
if "feature" in topology:
sensor_ref["feature"] = topology["feature"]
upper_node["sensors"].append(sensor_ref)
parametrize_sensor(node)
create_json(topology_name, node, output)
......
This diff is collapsed.
@prefix : <https://w3id.org/laas-iot/edr/iiot/factory#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <https://w3id.org/laas-iot/edr/iiot/factory> .
:Floor0 rdf:type :Floor ; :locatedIn :myFactory.
:Conveyor00 rdf:type :Conveyor ; :locatedIn :Floor0.
:Machine000 :onConveyor :Conveyor00.
:Machine000 rdf:type :SparkGeneratingMachine.
:Machine001 :onConveyor :Conveyor00.
:Machine001 rdf:type :ColdSensitiveMachine.
:Conveyor01 rdf:type :Conveyor ; :locatedIn :Floor0.
:Machine010 :onConveyor :Conveyor01.
:Machine010 rdf:type :SparkGeneratingMachine.
:Machine011 :onConveyor :Conveyor01.
:Machine011 rdf:type :ColdSensitiveMachine.
:Floor1 rdf:type :Floor ; :locatedIn :myFactory.
:Conveyor10 rdf:type :Conveyor ; :locatedIn :Floor1.
:Machine100 :onConveyor :Conveyor10.
:Machine100 rdf:type :SparkGeneratingMachine.
:Machine101 :onConveyor :Conveyor10.
:Machine101 rdf:type :ColdSensitiveMachine.
:Conveyor11 rdf:type :Conveyor ; :locatedIn :Floor1.
:Machine110 :onConveyor :Conveyor11.
:Machine110 rdf:type :SparkGeneratingMachine.
:Machine111 :onConveyor :Conveyor11.
:Machine111 rdf:type :ColdSensitiveMachine.
......@@ -3,10 +3,10 @@
"floors":[{
"type":"floor",
"sensors":[],
"count":1,
"count":2,
"conveyors":[{
"type":"conveyor",
"sensors":[{"type":"luminosity", "up":1}, {"type":"presence", "up":0}, {"type":"conveyor_state", "up":0}, {"type":"conveyor_speed", "up":0}, {"type":"supervisor_presence", "up":0}],
"sensors":[{"type":"luminosity", "up":0}, {"type":"presence", "up":0}, {"type":"conveyor_state", "up":0}, {"type":"conveyor_speed", "up":0}, {"type":"supervisor_presence", "up":0}],
"count":2,
"machines":[{
"type":"spark_machine",
......
echo "distribution local 0"
echo "distribution local"
python3 factory_generator.py -b distribution/distribution_0_blueprint.json -d distribution/distribution_0.ttl -o distribution/distribution_0.json
python3 factory_generator.py -b distribution/distribution_4_blueprint.json -d distribution/distribution_4.ttl -o distribution/distribution_4.json
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