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
  • Index
  • » Users
  • » oaamados
  • » Profile

Posts

Posts

Mar-20-11 03:02:35
An example of Drmodelica doesn't simulate successfully
Category: Programming

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;

Mar-09-11 20:24:03
An example of the Standard Library compiles but doesn't works fine

Hi, thanks for answer.

When I run the simulation, the InitialStep always is active and the second step always is deactivated. I run the simulation for 5 seconds, and the transitions has 1 second in the waitime parameter. I understand what should hapen, but the simulation no have a logical result. I don't know what I have to do to the simulation have succesfully results.

Mar-08-11 18:54:53
An example of the Standard Library compiles but doesn't works fine

I'm working in ubuntu with the lastest version of OpenModelica (8109-1). I try to simulate the example Modelica.StateGrapg.Examples.FirstExample. This example compiles but the results are not logical. In http://lup.lub.lu.se/luur/download?func … OId=625575  show that:

"In the above example, the simulation starts at ini-
tialStep. After 1 second, transition1 fires and step1
becomes active. After another second transition2
fires and initialStep becomes again active. After a
further second step1 becomes active, and so on.
"

But when I run the simulation step1 is always deactivated.

I don't know if is a problem from the library, openmodelica or mine.

  • Index
  • » Users
  • » oaamados
  • » Profile
You are here: