Hi,
I am using the basic simulator to run my Petri Net model. The Model works properly when I only have a single token. As soon as I add a loop which uses another token and therefore there are two token in the model then it breaks down. Here is the details:
Initially I put a token in the model, when the first transition fires, it puts a token into a place called "time". There is a transition (check time) that keeps checking the value of the token which is in the "time" place and if it is more than a certain value then it puts the token to a new place otherwise it keeps putting it back. At the same time the model keeps receiving tokens from other agents (from "in" place) which trigger another transition. The following is the code for "check time" transition.
Object time=get("t");
((CpnContext)getCpnContext()).remVar("t");
if( System.currentTimeMillis()-Long.parseLong(time.toString())<Constants.waitingTime){
((CpnContext)getCpnContext()).getVarPool().put("time",time.toString());
}
else{
MessageToken token=new MessageToken(new Message(),true);
((CpnContext)getCpnContext()).getVarPool().put("timeisup",token);
}
Cheers,