• Ingen resultater fundet

Conclusion and Future Work

Web-Based Interfaces for Simulation of Coloured Petri Net Models

6.6 Conclusion and Future Work

In this paper we have described how a web interface to a simulator of coloured Petri net models can be designed. In particular we have illustrated how it has been done in the Design/CPN tool. The approach is based on giving CPN experts the ability to easily create a CGI script containing the entire simulator.

The initial conditions of the simulator can be specified via an HTML form on a web page. The fact that the initial conditions of a simulation can be specified via a domain specific form, gives users without knowledge of either CPN or Design/CPN the ability to use pre-constructed simulators for specific analysis purposes.

The paper has also illustrated that integrating batch scripts into a CGI script has some advantages. Batch scripts give the user the ability to run several simulations after having specified input for all the simulations. Thus we will be able to first specify input via a web page and then based on the input run several simulations. The fact that the input to the CGI script can be specified in a HTML form on a web page means that the interface to the simulator can

6.6. Conclusion and Future Work 59

fungen output() =

((* Print HTML directly to web browser *) 2

print"Content-type: text/html\n\n"; (* CGI-header *)

print"<HTML><BODY BGCOLOR=#FFFFFF>"; 4 print("<FORM method=GET action=\"http://"^

"www.daimi.au.dk/cgi-sim/place_order.cgi\">"); 6

print"<CENTER>";

print"<H1>Backup Unlimited Inc.</H1>"; 8 print"</CENTER>";

10 (* Print the results of running the simulations *)

print("We have now simulated a model of your system "^ 12

"using your specifiedrequirements. We propose "^

"that you buy the following backup devices:"); 14

print(model alternatives(!alternatives));

print"You can decide which best suits your needs "^ 16

"from the graphs below:<BR>";

print"<CENTER>"; 18

(* Generate graphics using Gnuplot *)

print graphics (data files()); 20

print"</CENTER>";

print"I order the following item: <input size=15 "^ 22

"type=text name=item_no><BR>";

print"<INPUT type=submit value=\" Place Order \">"^ 24

"<BR><BR>";

print"</FORM></BODY></HTML>"); 26

Figure 6.18: Generate output similar to Fig. 6.4.

be domain specific and configurable. The domain specific and user-relevant graphical interface to simulators makes simulations of CPN models accessible for non-CPN experts.

Some Petri net based tools allow a similar architecture to the one presented in this paper. A tool like e.g. ExSpect [28] can be used as a COM component which makes it possible to create facilities similar to the ones described in this paper. Furthermore, ExSpect allows using so-called dashboards which is a domain specific interface for a Petri net based engine.

Future work may include investigating the ability to explore state spaces via a browser – again possibly with a domain tailored web page as graphical inter-face. This will also make it possible for non-experts to use the power of state spaces for answering questions by querying the state space of a CPN model.

This could be obtained using the occurrence graph tool [47] of Design/CPN via a CGI script. It will be immediately possible to explore state spaces from a web page using the approach described in this paper. In Design/CPN it is just a matter of saving a CGI script after generating code for the occurrence graph tool instead of the code for the simulator.

Another interesting area is interactive simulation control via Java applets [95] embedded in HTML documents. It will be possible to implement a domain specific GUI giving interactive control of the simulator of Design/CPN using a Java applet. Java applets are small Java programs that are automatically

(* Create a plot using Gnuplot *) 2 funprint graphics (datafilesxtitles) =

let val unique filename=get unique filename (); 4

in (gen gnuplots {filenamesxtitles= datafilesxtitles,

title= ("Backup Device Model "^ 6

(model alternatives (!alternatives))),

xlabel = "GB Processed", 8

ylabel = "Process time (minutes)",

dest filename = unique filename, 10

gnuplot path ="/usr/local/bin/gnuplot"};

print ("<IMG SRC=\"http://www.daimi.au.dk/"^ 12 unique filename^"\" ><br>"))

end; 14

Figure 6.19: Create a plot using Gnuplot.

downloaded from a web server when a user requests an HTML document refer-ring to the Java applet. When the Java applet is downloaded it is automatically started within the browser using a Java interpreter on the client machine. Us-ing Java applets the simulator on the web server and the Java applet on the client machine can communicate during a simulation. By using Java applets it is possible to obtain interactive simulations via the web browser. To be able to use Java applets there are some extra requirements for the simulation tool re-lated to communication between the Java applet and the simulator. It requires TCP/IP communication between the applet in the browser and the simulator residing on a server.

Finally, future work may also include developing auxiliary functions for generating templates of code for batch scripts and HTML forms. In particular template code for retrieving data from input fields in forms would be easy to generate automatically. The CPN expert could annotate the relevant system parameters in the CPN model and then the coloured Petri net tool could auto-matically generate a HTML form including fields for the annotated variables.

Furthermore, it could also create functions for parsing the fields of the form and for assigning the system parameters in the CPN model to the values entered in the form by the application user. Experiments will show whether creating such template code will be useful in practice. One thing that will indeed be gained from generating both the HTML form and the functions for parsing the form is consistency between the HTML form and the CGI script, i.e. it will be possible to avoid some errors due to inconsistency between the names of the fields in the HTML form and the names referred to by functions for retrieving data from a form.

In conclusion, this paper has described a technique for making simulation of CPN models usable for people without knowledge of the technical details of CPN models. Thus, the paper has opened for using CPN simulators behind services on the Internet.

6.7. Acknowledgements 61

6.7 Acknowledgements

The ideas presented in this paper have been developed during a project con-ducted in cooperation with Søren Christensen, University of Aarhus, Lee W.

Wagenhals, Insub Shin and Daesik Kim from George Mason University, Fair-fax, VA, USA. We want to thank these people for valuable discussions during the development of the CGI approach. In particular, we want to thank Lee W.

Wagenhals for his involvement in writing early versions of this paper. Finally, we also thank the CPN Group at University of Aarhus and the anonymous reviewers for their careful and valuable comments on this paper.

Chapter 7

Equivalent Coloured Petri Net Models of a