fbpx
Wikipedia

Petriscript

PetriScript is a modeling language for Petri nets, designed by Alexandre Hamez and Xavier Renault.[1] The CPN-AMI platform provides many tools to work on Petri nets, such as verifying and model-checking tools.[2]

Originally, simple Petri nets were created through graphic design, but research conducted internally at LIP6 revealed that it was needed to automate such tasks.[3] PetriScript was designed to provide some facilities in modeling places-transition and coloured Petri nets within the CPN-AMI platform. Petriscript's main purpose is to automate modeling operations on Petri nets by merging, creating, and connecting nodes. It supports almost everything needed, such as macros, loops control, lists, and string and arithmetic expressions, and blocks intervention of the user as much as possible. Its syntax is Ada-like.

The following script produces a FIFO with three sections:

 define(FIFO_SIZE,3) define(FIFO_BASE_X,100) define(FIFO_BASE_Y,100) define(FIFO_STEP,120) int $wave := 0; for $wave in 1..FIFO_SIZE loop create place "Slot_" & '$wave' (x FIFO_BASE_X + FIFO_STEP * $wave, y FIFO_BASE_Y); create place "Empty_" & '$wave' (x FIFO_BASE_X + FIFO_STEP * $wave, y FIFO_BASE_Y + 100, marking "1"); end loop; for $wave in 1..FIFO_SIZE+1 loop create transition "t" & '$wave -1' & "_to_" & '$wave' (x FIFO_BASE_X + FIFO_STEP * $wave - FIFO_STEP / 2, y FIFO_BASE_Y + 50); if $wave < FIFO_SIZE+1 then connect "1" transition "t" &'$wave -1' & "_to_" & '$wave' to place "Slot_" & '$wave'; connect "1" place "Empty_" & '$wave' to transition "t" &'$wave -1' & "_to_" & '$wave'; end if; if $wave > 1 then connect "1" transition "t" &'$wave -1' & "_to_" & '$wave' to place "Empty_" & '$wave - 1'; connect "1" place "Slot_" & '$wave - 1' to transition "t" &'$wave -1' & "_to_" & '$wave'; end if; end loop; set transition "t0_to_1" to (name "FIFO_Start"); set transition "t" & 'FIFO_SIZE' & "_to_" & 'FIFO_SIZE + 1' to (name "FIFO_End"); 

Which produces the following graph:

Here is another example that shows the power of PetriScript:

 define(X,250) define(Y,350) define(radius,50) define(R,150) define(SECTIONS,15) define(INNER_ANGLE,360/SECTIONS) define(OUTER_ANGLE,360/(2*SECTIONS)) int $i := 0; int $j := 0; for $i in 1.. SECTIONS loop create place "F" & '$i' ( x X, y Y, r radius, t $i * INNER_ANGLE); create place "Section_" & '$i' ( x X, y Y, r R, t $i * INNER_ANGLE); create transition "t" & '$i' & "_to_" & '$i mod SECTIONS + 1' ( x X, y Y, r R, t $i * INNER_ANGLE + OUTER_ANGLE); end loop; for $i in 1.. SECTIONS loop connect place "Section_" & '$i' to transition "t"&'$i' & "_to_" & '$i mod SECTIONS + 1'; connect transition "t" & '$i' & "_to_" & '$i mod SECTIONS + 1' to place "Section_" & '$i mod SECTIONS + 1'; if $i /= 1 then connect place "F" & '$i' to transition "t" & '$i-1' & "_to_" & '$i'; else connect place "F1" to transition "t" & 'SECTIONS' & "_to_" & '1'; end if; connect transition "t" &'$i mod SECTIONS + 1' & "_to_" & '($i+1) mod SECTIONS + 1' to place "F" & '$i'; end loop; for $i in 1.. SECTIONS loop if $i mod 3 = 0 then set place "Section_" & '$i' to marking "1"; else set place "F" & '$i' to marking "1"; end if; end loop; 

Which produces the following graph:

References

  1. ^ Alexandre Hamez; Xavier Renault. (PDF). LIP6. Archived from the original (PDF) on 24 October 2016.
  2. ^ Principles of Information Systems: Computer science
  3. ^ Business Database Systems: Computer science, Database management

External links

Full documentation is available here.

petriscript, this, article, external, links, follow, wikipedia, policies, guidelines, please, improve, this, article, removing, excessive, inappropriate, external, links, converting, useful, links, where, appropriate, into, footnote, references, november, 2012. This article s use of external links may not follow Wikipedia s policies or guidelines Please improve this article by removing excessive or inappropriate external links and converting useful links where appropriate into footnote references November 2012 Learn how and when to remove this template message PetriScript is a modeling language for Petri nets designed by Alexandre Hamez and Xavier Renault 1 The CPN AMI platform provides many tools to work on Petri nets such as verifying and model checking tools 2 Originally simple Petri nets were created through graphic design but research conducted internally at LIP6 revealed that it was needed to automate such tasks 3 PetriScript was designed to provide some facilities in modeling places transition and coloured Petri nets within the CPN AMI platform Petriscript s main purpose is to automate modeling operations on Petri nets by merging creating and connecting nodes It supports almost everything needed such as macros loops control lists and string and arithmetic expressions and blocks intervention of the user as much as possible Its syntax is Ada like The following script produces a FIFO with three sections define FIFO SIZE 3 define FIFO BASE X 100 define FIFO BASE Y 100 define FIFO STEP 120 int wave 0 for wave in 1 FIFO SIZE loop create place Slot amp wave x FIFO BASE X FIFO STEP wave y FIFO BASE Y create place Empty amp wave x FIFO BASE X FIFO STEP wave y FIFO BASE Y 100 marking 1 end loop for wave in 1 FIFO SIZE 1 loop create transition t amp wave 1 amp to amp wave x FIFO BASE X FIFO STEP wave FIFO STEP 2 y FIFO BASE Y 50 if wave lt FIFO SIZE 1 then connect 1 transition t amp wave 1 amp to amp wave to place Slot amp wave connect 1 place Empty amp wave to transition t amp wave 1 amp to amp wave end if if wave gt 1 then connect 1 transition t amp wave 1 amp to amp wave to place Empty amp wave 1 connect 1 place Slot amp wave 1 to transition t amp wave 1 amp to amp wave end if end loop set transition t0 to 1 to name FIFO Start set transition t amp FIFO SIZE amp to amp FIFO SIZE 1 to name FIFO End Which produces the following graph Here is another example that shows the power of PetriScript define X 250 define Y 350 define radius 50 define R 150 define SECTIONS 15 define INNER ANGLE 360 SECTIONS define OUTER ANGLE 360 2 SECTIONS int i 0 int j 0 for i in 1 SECTIONS loop create place F amp i x X y Y r radius t i INNER ANGLE create place Section amp i x X y Y r R t i INNER ANGLE create transition t amp i amp to amp i mod SECTIONS 1 x X y Y r R t i INNER ANGLE OUTER ANGLE end loop for i in 1 SECTIONS loop connect place Section amp i to transition t amp i amp to amp i mod SECTIONS 1 connect transition t amp i amp to amp i mod SECTIONS 1 to place Section amp i mod SECTIONS 1 if i 1 then connect place F amp i to transition t amp i 1 amp to amp i else connect place F1 to transition t amp SECTIONS amp to amp 1 end if connect transition t amp i mod SECTIONS 1 amp to amp i 1 mod SECTIONS 1 to place F amp i end loop for i in 1 SECTIONS loop if i mod 3 0 then set place Section amp i to marking 1 else set place F amp i to marking 1 end if end loop Which produces the following graph References Edit Alexandre Hamez Xavier Renault PetriScript Reference Manual 1 0 PDF LIP6 Archived from the original PDF on 24 October 2016 Principles of Information Systems Computer science Business Database Systems Computer science Database managementExternal links EditFull documentation is available here Retrieved from https en wikipedia org w index php title Petriscript amp oldid 956140237, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.