How to create S2A-BPJ integrated solution

From WeizmannWiki
Revision as of 06:18, 29 April 2014 by Smadar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

There is great value in integrating parts of the same specification written in different BP implementations into a single running application. We describe here how to create an application that integrates scenarios written in LSC with ones written in BPJ.

  1. Create an LSC project.
  2. Add the b-threads' source code to the LSC project under the 'src/bthreads/' directory.
  3. Play-in your LSCs.
  4. S2A listens out for BPJ events of type MessageEvent. Therefore BPJ events that participate in the LSC specification have to be of type MessageEvent. To generate MessageEvent, right-click a method in the system model, choose update and select the 'Generate corresponding BPJ event':
    GenerateBPJevent.png
    The corresponding MessageEvent is generated in the 'src/bthreads/events' package.
  5. Play-out
    1. Select the S2A-BPJ strategy
      1. Righc-click the LSC project, chose Project Properties->PlayGo->Play-Out->Strategy and select the il.ac.wis.cs.bpjs2a.BPJCoordinatorStrategyImpl strategy.
    2. Add the b-threads' priority to the Project Properties->PlayGo->Play-Out->Behaviors->BPJ (PlayGo identifies all b-threads in the LSC project by scanning the project, once the relevant strategy was selected - as described in bullet 1).
    3. Disabling certain b-threads can be done by removing the check mark from the relevant b-threads in the Project Properties->PlayGo->Play-Out->Behaviors->BPJ.
  6. PlayGo generates, to the SystemModelMainGenerated.java file, the activation of all b-threads. If you provide your own main, make sure to add the b-threads activation code, for example:


BThread  bt = new TestBThread();
BProgram.bp.add(bt, 1.1);
bt.startBThread();