Login Form






Lost Password?
No account yet? Register
Home arrow Forums
ECharts
Welcome, Guest
TimerTransitions and runtime model (0 viewing) 
Go to bottom Post Reply Favoured: 0
TOPIC: TimerTransitions and runtime model
#295
Behrad (User)
Fresh Boarder
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
TimerTransitions and runtime model 1 Year, 3 Months ago  
When using timer transitions the only way that my machine works, is as follows:

Code: :

 user = new ExternalPort"testControlPort" ); machine = new SimpleMachineuser ); user.input"Message 1" ); user.input"Message 2" ); machine.run();



BUT both (non-blocking and blocking) models down below doesn't work and program terminates without the timer transition to be fired!

Blocking:
Code: :

 MachineThread t = new MachineThreadmachine ); t.start(); // setting this thread to be daemon also didn't work user.input"Message 1" ); user.input"Message 2" );



Non-blocking:
Code: :

  machine.runuser"Message 1" ); machine.runuser"Message 2" );



What happens to timers? How can I make delay transitions to work for the last two runtime models?
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#296
Gregory W. Bond (User)
Expert Boarder
Posts: 81
graph
User Offline Click here to see the profile of this user
Re:TimerTransitions and runtime model 1 Year, 3 Months ago  
works ok for me:

DelayMachine.ech:

Code: :

  public machine DelayMachine {     <* final ExternalPort port *>     public DelayMachine(ExternalPort port) {         this.port port;     }     initial state S1;     state S2;     transition S1 delay(2000) -> S2;     state S3;     transition S2 port String -> S3; }



DelayMachineTest.java:

Code: :

  import org.echarts.MachineThread; import org.echarts.ExternalPort; public class DelayMachineTest {     public static final void main(String[] args) {         try {             final ExternalPort port = new ExternalPort("port");             new MachineThread(new DelayMachine(port)).start();             port.input("Hello");         } catch (Exception e) { e.printStackTrace(); }     } }



compile and execute:

Code: :

  ech2java DelayMachine.ech javac --classpath echarts.jar DelayMachine.java DelayMachineTest.java java -classpath .:echarts.jar -Dorg.echarts.debugging=true DelayMachineTest



log:

Code: :

  time2009.06.01 09:57:29:766 EDT (1243864649766) eventMessageTransitionEvent root656af1e9:1219c1c480c:-7fff machine656af1e9:1219c1c480c:-7fff state path: :(DelayMachine) sequence656af1e9:1219c1c480c:-7ffd transition: [S1] - delay(2000) -> [S2] activated1243864647764 expired1243864649764 local state:  {     ...     S2     ... } ACTIVATION_TIME1243864647764 DURATION2000 EXPIRY_TIME1243864649764 MESSAGE_CLASSorg.echarts.TransitionTimeoutMessage PORT_ID656af1e9:1219c1c480c:-7ffd PORT_TYPETRANSITION_TIMER_PORT ############################################################ time2009.06.01 09:57:29:772 EDT (1243864649772) eventMessageTransitionEvent root656af1e9:1219c1c480c:-7fff machine656af1e9:1219c1c480c:-7fff state path: :(DelayMachine) sequence656af1e9:1219c1c480c:-8000 transition: [S2] - port String (Hello) -> [S3] local state:  {     ...     S3     ... } MESSAGE_CLASSjava.lang.String PORT_ID656af1e9:1219c1c480c:-8000 PORT_NAMEport PORT_TYPEEXTERNAL_PORT ############################################################

 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop
Copyright © 2006-2009 echarts.org