From: schristensen@daimi.aau.dk (Soren Christensen) To: designCPN@daimi.aau.dk Date: Fri, 19 Jul 1996 13:14:04 +0200 Subject: Re: Possibility to communicate with a running Unix-process? [[ Below, Soren has made a communication example. You need to do the following in order to build the sub_process executable. Execute cpn.ML (the SML compiler) directly from a shell script. At the "-" prompt type use "sub_process.sml"; and the return key. After a few minutes, kill the SML compiler manually (as it will not terminate after it has completed saving the sub_process executable). The executable file sub_process has now been generated, and now you are ready to read Soren's example. Additionally to Soren's example, I've included an example where the external executable communicated with is a Tcl/Tk script. In the global declaration node, change the execute file path to point to the Tcl/Tk script sub_process.tcl. (If you do not see any graphical feedback when simulating the model, please start manually a cpnmld daemon with a new port number. I do not know why this is necessary, but at least it works for me.) /Kjeld H. Mortensen (moderator) ]] If you assume some limitations it is not that hard to do. I have created a small example which assumes the following: 1) the external process can be started as a sub-process. 2) the communication will be done using std_in/std_out of the sub-process. In http://www.daimi.aau.dk/designCPN/email/p/models/post960720a.tar.Z you'll find a model (process, process.DB) and the SML source file sub_process.sml to build an executable (sub_process). When sub_process is started via the process example in Design/CPN the sub-process will create and write to a log file called /tmp/log_prc.log. (During simulation, read the log file with "tail -f" in a shell window.) In this way it is possible for the simulation to controle an external process, the other way is much harder! Remember to set the path to the sub_process executable in the global declaration node before you try the example. Soren --------------------------------------------------------------------- | Soren Christensen, Computer Science Department, Aarhus University | | Ny Munkegade 116, DK-8000 Aarhus C, DENMARK | | email: schristensen@daimi.aau.dk | phone: +45 89 42 32 65 | | telefax: +45 89 42 32 55 | phone at home: +45 86 93 63 26 | | WWW URL: | --------------------------------------------------------------------- >I am working on my master thesis with Design/CPN 3.01. The background >of the thesis is a simulation of the PROFIBUS system. > >To present some results to the user outside Design/CPN, while >the petri net of the bus simulation is still running, i need >to trigger an external process. This process then reads some >data from a file and updates a Tcl/Tk - application. > >How can i manage this trigger effect? > >Busy waiting can not be used due to the slow machine, i am >currently working on. The simulator eats up all the processor time. > >Has anyone solved a similar problem? --- [[ Post messages and summary of replies: designCPN@daimi.aau.dk ]] [[ To (un)subscribe, send "help" to: Majordomo@daimi.aau.dk ]] [[ The moderator's address: designCPN-owner@daimi.aau.dk ]] [[ World Wide Web URL: http://www.daimi.aau.dk/designCPN/email/ ]]