Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Error in simulation petri nets + StateGraph + DiscreteHybrid

Error in simulation petri nets + StateGraph + DiscreteHybrid

Hi,

Based in the Drmodelica's example  (DiscreteHybrid/ClassesforCPT.onb) I developed the follow code, but, when I try to run the simulation, I have this code error.

Error:

messages = "Simulation execution failed for model: example terminate called after throwing an instance of 'TerminateSimulationException'


I don't know where is the problem. I really apreciate your help!!

If somebody can help me with explain me how to run a simulation of petri nets or StateGraph  I really apreciate that!

Code:
connector PTPort  //Conectando Lugares (Places) a trancisiones (Transitions)
Boolean sPT;
Boolean fPT;
end PTPort;

connector PTPortin = PTPort;  //Verisión de entrada
connector PTPortout = PTPort;

connector TPPort  //Conectando trancisiones (Transitions) a Lugares (Places)
Boolean sTP;
Boolean fTP;
end TPPort;


connector TPPortin = TPPort;
connector TPPortout = TPPort;




model Place
TPPortin inPlace;
PTPortout outPlace;
Boolean state, ostate;
equation

ostate=pre(state);
inPlace.sTP=ostate;
outPlace.sPT=ostate;
state=(ostate and not outPlace.fPT) or inPlace.fTP;

end Place;

model Transition
PTPortin inTrans;
TPPortout outTrans;
Boolean fire;

equation

fire= inTrans.sPT and not outTrans.sTP;
inTrans.fPT=fire;
outTrans.fTP=fire;

end Transition;



model example
Transition t1;
Place estado1 (state(start=false));
Transition t2 ;
Place estado2 (state(start=true));

equation
connect (t1.outTrans, estado2.inPlace);
connect (estado2.outPlace, t2.inTrans);
connect (t2.outTrans, estado1.inPlace);
connect (estado1.outPlace, t1.inTrans);

end example;

Re: Error in simulation petri nets + StateGraph + DiscreteHybrid

Hi,

as far as I can see is the model not consist. The token is jumping at time 0 from place1 to place2 and visa vice.
I think you need something like an delay when your transitions are ready to fire.

so long.
Willi

There are 0 guests and 0 other users also viewing this topic
You are here: