Petriscript

Last updated

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$wavein1..FIFO_SIZEloopcreateplace"Slot_"&'$wave'(xFIFO_BASE_X+FIFO_STEP*$wave,yFIFO_BASE_Y);createplace"Empty_"&'$wave'(xFIFO_BASE_X+FIFO_STEP*$wave,yFIFO_BASE_Y+100,marking"1");endloop;for$wavein1..FIFO_SIZE+1loopcreatetransition"t"&'$wave-1'&"_to_"&'$wave'(xFIFO_BASE_X+FIFO_STEP*$wave-FIFO_STEP/2,yFIFO_BASE_Y+50);if$wave<FIFO_SIZE+1thenconnect"1"transition"t"&'$wave-1'&"_to_"&'$wave'toplace"Slot_"&'$wave';connect"1"place"Empty_"&'$wave'totransition"t"&'$wave-1'&"_to_"&'$wave';endif;if$wave>1thenconnect"1"transition"t"&'$wave-1'&"_to_"&'$wave'toplace"Empty_"&'$wave-1';connect"1"place"Slot_"&'$wave-1'totransition"t"&'$wave-1'&"_to_"&'$wave';endif;endloop;settransition"t0_to_1"to(name"FIFO_Start");settransition"t"&'FIFO_SIZE'&"_to_"&'FIFO_SIZE+1'to(name"FIFO_End");

Which produces the following graph: Petriscript fifo.png

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$iin1..SECTIONSloopcreateplace"F"&'$i'(xX,yY,rradius,t$i*INNER_ANGLE);createplace"Section_"&'$i'(xX,yY,rR,t$i*INNER_ANGLE);createtransition"t"&'$i'&"_to_"&'$imodSECTIONS+1'(xX,yY,rR,t$i*INNER_ANGLE+OUTER_ANGLE);endloop;for$iin1..SECTIONSloopconnectplace"Section_"&'$i'totransition"t"&'$i'&"_to_"&'$imodSECTIONS+1';connecttransition"t"&'$i'&"_to_"&'$imodSECTIONS+1'toplace"Section_"&'$imodSECTIONS+1';if$i/=1thenconnectplace"F"&'$i'totransition"t"&'$i-1'&"_to_"&'$i';elseconnectplace"F1"totransition"t"&'SECTIONS'&"_to_"&'1';endif;connecttransition"t"&'$imodSECTIONS+1'&"_to_"&'($i+1)modSECTIONS+1'toplace"F"&'$i';endloop;for$iin1..SECTIONSloopif$imod3=0thensetplace"Section_"&'$i'tomarking"1";elsesetplace"F"&'$i'tomarking"1";endif;endloop;

Which produces the following graph: Trains.png

Related Research Articles

<span class="mw-page-title-main">Cutoff frequency</span> Frequency response boundary

In physics and electrical engineering, a cutoff frequency, corner frequency, or break frequency is a boundary in a system's frequency response at which energy flowing through the system begins to be reduced rather than passing through.

<span class="mw-page-title-main">Lua (programming language)</span> Lightweight programming language

Lua is a lightweight, high-level, multi-paradigm programming language designed primarily for embedded use in applications. Lua is cross-platform, since the interpreter of compiled bytecode is written in ANSI C, and Lua has a relatively simple C API to embed it into applications.

<span class="mw-page-title-main">Triangle wave</span> Non-sinusoidal waveform

A triangular wave or triangle wave is a non-sinusoidal waveform named for its triangular shape. It is a periodic, piecewise linear, continuous real function.

In programming languages, a closure, also lexical closure or function closure, is a technique for implementing lexically scoped name binding in a language with first-class functions. Operationally, a closure is a record storing a function together with an environment. The environment is a mapping associating each free variable of the function with the value or reference to which the name was bound when the closure was created. Unlike a plain function, a closure allows the function to access those captured variables through the closure's copies of their values or references, even when the function is invoked outside their scope.

<span class="mw-page-title-main">Petri net</span> One of several mathematical modeling systems for the description of distributed systems

A Petri net, also known as a place/transition (PT) net, is one of several mathematical modeling languages for the description of distributed systems. It is a class of discrete event dynamic system. A Petri net is a directed bipartite graph that has two types of elements: places and transitions. Place elements are depicted as white circles and transition elements are depicted as rectangles. A place can contain any number of tokens, depicted as black circles. A transition is enabled if all places connected to it as inputs contain at least one token. Some sources state that Petri nets were invented in August 1939 by Carl Adam Petri—at the age of 13—for the purpose of describing chemical processes.

In mathematics and physics, a tensor field assigns a tensor to each point of a mathematical space. Tensor fields are used in differential geometry, algebraic geometry, general relativity, in the analysis of stress and strain in materials, and in numerous applications in the physical sciences. As a tensor is a generalization of a scalar and a vector, a tensor field is a generalization of a scalar field or vector field that assigns, respectively, a scalar or vector to each point of space. If a tensor A is defined on a vector fields set X(M) over a module M, we call A a tensor field on M.

In classical and quantum mechanics, geometric phase is a phase difference acquired over the course of a cycle, when a system is subjected to cyclic adiabatic processes, which results from the geometrical properties of the parameter space of the Hamiltonian. The phenomenon was independently discovered by S. Pancharatnam (1956), in classical optics and by H. C. Longuet-Higgins (1958) in molecular physics; it was generalized by Michael Berry in (1984). It is also known as the Pancharatnam–Berry phase, Pancharatnam phase, or Berry phase. It can be seen in the conical intersection of potential energy surfaces and in the Aharonov–Bohm effect. Geometric phase around the conical intersection involving the ground electronic state of the C6H3F3+ molecular ion is discussed on pages 385–386 of the textbook by Bunker and Jensen. In the case of the Aharonov–Bohm effect, the adiabatic parameter is the magnetic field enclosed by two interference paths, and it is cyclic in the sense that these two paths form a loop. In the case of the conical intersection, the adiabatic parameters are the molecular coordinates. Apart from quantum mechanics, it arises in a variety of other wave systems, such as classical optics. As a rule of thumb, it can occur whenever there are at least two parameters characterizing a wave in the vicinity of some sort of singularity or hole in the topology; two parameters are required because either the set of nonsingular states will not be simply connected, or there will be nonzero holonomy.

<span class="mw-page-title-main">Spirograph</span> Geometric drawing device

Spirograph is a geometric drawing device that produces mathematical roulette curves of the variety technically known as hypotrochoids and epitrochoids. The well-known toy version was developed by British engineer Denys Fisher and first sold in 1965.

Coloured Petri nets are a backward compatible extension of the mathematical concept of Petri nets.

In computer science, loop fission is a compiler optimization in which a loop is broken into multiple loops over the same index range with each taking only a part of the original loop's body. The goal is to break down a large loop body into smaller ones to achieve better utilization of locality of reference. This optimization is most efficient in multi-core processors that can split a task into multiple tasks for each processor.

<span class="mw-page-title-main">JavaScript syntax</span> Set of rules defining correctly structured programs

The syntax of JavaScript is the set of rules that define a correctly structured JavaScript program.

<span class="mw-page-title-main">Recursion (computer science)</span> Use of functions that call themselves

In computer science, recursion is a method of solving a computational problem where the solution depends on solutions to smaller instances of the same problem. Recursion solves such recursive problems by using functions that call themselves from within their own code. The approach can be applied to many types of problems, and recursion is one of the central ideas of computer science.

The power of recursion evidently lies in the possibility of defining an infinite set of objects by a finite statement. In the same manner, an infinite number of computations can be described by a finite recursive program, even if this program contains no explicit repetitions.

Photon polarization is the quantum mechanical description of the classical polarized sinusoidal plane electromagnetic wave. An individual photon can be described as having right or left circular polarization, or a superposition of the two. Equivalently, a photon can be described as having horizontal or vertical linear polarization, or a superposition of the two.

Libdmc is a library designed at the LIP6 laboratory. Its goal is to ease the distribution of existing model checkers. It has also been designed to provide the most generic interfaces, without sacrificing performance, thanks to the C++ language.

<span class="mw-page-title-main">Midpoint circle algorithm</span> Determines the points needed for rasterizing a circle

In computer graphics, the midpoint circle algorithm is an algorithm used to determine the points needed for rasterizing a circle. It's a generalization of Bresenham's line algorithm. The algorithm can be further generalized to conic sections.

This comparison of programming languages (array) compares the features of array data structures or matrix processing for various computer programming languages.

<span class="mw-page-title-main">Euler spiral</span> Curve whose curvature changes linearly

An Euler spiral is a curve whose curvature changes linearly with its curve length. The curve is also referred to as clothoids or Cornu spirals. The behavior of Fresnel integrals can be illustrated by Euler spirals, a connection first made by Alfred Marie Cornu 1874. Euler's spiral is a type of superspiral that has the property of a monotonic curvature function.

The α-algorithm or α-miner is an algorithm used in process mining, aimed at reconstructing causality from a set of sequences of events. It was first put forward by van der Aalst, Weijters and Măruşter. The goal of Alpha miner is to convert the event log into a workflow-net based on the relations between various activities in the event log. An event log is a multi-set of traces, and a trace is a sequence of activity names. Several extensions or modifications of it have since been presented, which will be listed below.

In mathematics and computer algebra the factorization of a polynomial consists of decomposing it into a product of irreducible factors. This decomposition is theoretically possible and is unique for polynomials with coefficients in any field, but rather strong restrictions on the field of the coefficients are needed to allow the computation of the factorization by means of an algorithm. In practice, algorithms have been designed only for polynomials with coefficients in a finite field, in the field of rationals or in a finitely generated field extension of one of them.

Nets within Nets is a modelling method belonging to the family of Petri nets. This method is distinguished from other sorts of Petri nets by the possibility to provide their tokens with a proper structure, which is based on Petri net modelling again. Hence, a net can contain further net items, being able to move around and fire themselves.

References

  1. Alexandre Hamez; Xavier Renault. "PetriScript Reference Manual 1.0" (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

Full documentation is available here.