From: Claus Reinke To: designCPN@daimi.aau.dk Date: Tue, 19 Nov 1996 20:36:22 +0100 (MET) Subject: Asynchronous i/o, initial state, port assignments This letter contains some proposals for extensions/modifications of Design/CPN which arose from my practical experiences with the tool. I am sending it to the mailing list because it seems very likely that others could make similar proposals based on the problems they encountered. A discussion of such problems and proposals could help to improve the tool and the formalism. Nevertheless, the section 'Proposals From Users` in the Design/CPN WWW pages is still empty... To the CPN group: there is a (small;-) chance that some of these proposals may require only minor modifications of the implementation, and I could really use all of them. What do you think about it? Thanks in advance, Claus Reinke --------------- Proposals: 1) Asynchronous input/output via external ports Soren Christensen gave an example on how to achieve communication with external processes with current means, assuming some limitations: > 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 this way it is possible for the simulation to control an external > process, the other way is much harder! The last remark shows up a real problem: Once you have modeled a real system by a net, it seems natural to try and control the system by a simulation run on the net model. However, this gets impracticable as there seems to be no simple way to distribute sensor data from the real system to the corresponding places in the net model. IMO, the reason for the problems is the way in which external communication is (or rather: cannot be) integrated into the net model. Communication happens by side-effecting input/output-operations in code-regions and is thus synchronous with the firing of some transitions. The enabling of these transitions, however, cannot depend on any input-operation, which makes input harder than output. In contrast to these input/output-operations, the standard model of communication in Petri nets is asynchronous. In other words, it would be much more natural to connect input/output to places instead of transitions. The idea, at least, is very simple: introduce external port places. The whole CPN-net can be seen as a subnet of the runtime environment. The environment superpage, which instantiates the CPN-net as a substitution transition, is not modeled as a net, but there needs to be a way to describe the external port assignments. These could be defined in the global declaration node (probably associating each external port with an i/o-stream or with a function that does i/o). The simulation would have to check for input data on streams and for output tokens on external ports. Input data would have to be converted into tokens on external ports and output tokens into data for output streams. Place capacities for external ports may be helpful, but could be modeled by pairs of communication buffers as usual in Petri nets. 2) Initial state, side-effects and initial markings As of now, the code in the global declaration node is evaluated only once (during the switch from the editor to the simulator). Similarly, initial markings are not reevaluated if 'Initial State' is selected. Of course, the manual states that side-effecting code is only allowed in code regions, so this should not matter (and I am certainly not a fan of side-effecting code;-). However, in lack of a better solution and since ML depends on side-effects for i/o, it may be a good idea to provide at least a 'hook' for users to include their own initialization code into the state initialization (e.g., if there is a function named 'init' in the global declaration node, it will be called at switch time and whenever 'Initial State' is selected from the menu). As the code of 'init' may have influence on the values of the initial markings, they would need to be reevaluated instead of simply being reinstantiated on every initialization. This would also allow to load initial markings from a text file and to modify this file prior to an initialization, or to have multiple files with initial markings for one net. The existing 'Save State' seems to copy the whole net and doesn't work with a textual representation. External port assignments and the initialization of subprocesses should go into 'init', too. 3) Port assignments Last, but not least, please do anything to make port assignments easier. Also, any tool support to ensure consistency of port assignments during modifications of the net would be appreciated. - key shortcut for port assignments - highlighting of not yet assigned sockets (ports?) - copying a substitution transitions including its hierarchy region, its socket places and its port assignments should be possible - when connecting a place to a substitution transition, immediately ask for the port assignment (this should be optional, configurable via interface options). Allow to introduce a new port place here, if necessary. - introducing a new port in the subnet should introduce new sockets assigned to this port in all existing instances ... -- Claus Reinke University of Kiel email: cr@informatik.uni-kiel.de Department of Computer Science http://www.informatik.uni-kiel.de/~cr/ Preusserstr. 1-9, 24105 Kiel --- [[ 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/ ]]