module SimplePDL2PetriNet; create OUT: petrinet from IN: simplepdl; -- Obtenir le processus qui contient ce process element. -- Remarque: Ce helper ne serait pas utile si une r�f�rence opposite -- avait �t� plac�e entre Process et ProcessElement helper context simplepdl!ProcessElement def: getProcess(): simplepdl!Process = simplepdl!Process.allInstances() ->select(p | p.processElements->includes(self)) ->asSequence()->first(); -- Traduire un Process en un PetriNet de m�me nom rule Process2PetriNet { from p: simplepdl!Process to pn: petrinet!Network (name <- p.name) } -- Traduire une WorkDefinition en un motif sur le r�seau de Petri rule WorkDefinition2PetriNet { from wd: simplepdl!WorkDefinition to -- PLACES d'une WorkDefinition p_idle: petrinet!Place( name <- wd.name + '_idle', tokens <- 1, network <- wd.process), p_running: petrinet!Place( name <- wd.name + '_running', tokens <- 1, network <- wd.process), p_started: petrinet!Place( name <- wd.name + '_started', tokens <- 1, network <- wd.process), p_finished: petrinet!Place( name <- wd.name + '_finished', tokens <- 1, network <- wd.process), -- TRANSITIONS d'une WorkDefinition t_start: petrinet!Transition( name <- wd.name + '_start', weight <- 1, network <- wd.process), t_finish: petrinet!Transition( name <- wd.name + '_finish', weight <- 1, network <- wd.process), -- ARCS d'une WorkDefinition a_idle2start: petrinet!Arc( weight <- 1, place <- p_idle, transition <- t_start, outgoing <- false), a_start2running: petrinet!Arc( weight <- 1, place <- p_running, transition <- t_start, outgoing <- true), a_start2started: petrinet!Arc( weight <- 1, place <- p_started, transition <- t_start, outgoing <- true), a_running2finish: petrinet!Arc( weight <- 1, place <- p_running, transition <- t_finish, outgoing <- false), a_finish2finished: petrinet!Arc( weight <- 1, place <- p_finished, transition <- t_finish, outgoing <- true) } -- Traduire une WorkSequence en un motif sur le r�seau de Petri rule WorkSequence2PetriNet { from ws: simplepdl!WorkSequence to -- ARCS d'une WorkSequence a_s2s: petrinet!Arc( place <- ws.predecessor.name + '_started', transition <- ws.successor.name + '_start'), a_s2f: petrinet!Arc( place <- ws.predecessor.name + '_started', transition <- ws.successor.name + '_finish'), a_f2s: petrinet!Arc( place <- ws.predecessor.name + '_finished', transition <- ws.successor.name + '_start'), a_f2f: petrinet!Arc( place <- ws.predecessor.name + '_finished', transition <- ws.successor.name + '_fnish') }