Quick Start Tutorial #1

Before beginning this tutorial, you should already be familiar with the following technologies:

The purpose of this tutorial is to give you a quick introduction to using CUTS. You will create a simple client/server application and measuring the oneway event latency (i.e., measuring how long it takes an event to travel between two components). When finished, you will have a basic understanding of the following:

  1. Add simple behavior and instrumentation to components
  2. Generate source code for components
  3. Run a CUTS emulation
 

1. Adding simple behavior and instrumentation to components

Adding behavior and workload to a PICML model is done using two domain specific modeling langauges (DSMLs) named the Component Behavior Modeling Language (CBML) and the Workload Modeling Language (WML). Both DSMLs have been integrated into PICML so users can reference the structural model of their systems when modeling the system's behavior and workload.

Before we begin adding behavior client/server example, we first need to import the the following file into GME (File->Import XML):

$(CUTS_ROOT)/tutorials/QuickStart/models/QuickStart.xme

Behavior and workload modeling is supported at the component level. In this example, we will be adding behavior the PingComponent, which is located at InterfaceDefinitions/PingPong/PingPong. The behavior and workload to the PongComponent has already been added since it is more complex.

 

The PingComponent Behavior

The PingComponent already contains model elements for its output port. You will associate the correct behavior and workload with this output port. With this in mind, it is assumed that the PingComponent sends periodic events to the any component connected to its output port. Therefore complete the following steps (elements will be automatically be generated as well):

  1. Add a PeriodicTask model element to the active model and set its name to eventProducer and its Hertz attribute to 10 (i.e., 10 events/sec).
  2. Insert an InputAction element, change its name to eventProducer, and connect the PeriodicTask to the InputAction.
  3. Insert an OutputAction. This will automatically generate a new state and connect it with the inserted OutputAction.
  4. Connect the final State with the originating InputAction, i.e., periodicPing, to signify end of the behavior.
  5. Connect the InputAction State to the OutputAction.
  6. Insert a Variable and set it to reference the UnsignedLongInteger element in the PredefinedTypes folder. Name the variable eventCount and set the initial value of the variable to 0.
  7. Select the connection between the InputAction and the State. Type the following in the Effects: attribute field: this->eventCount_ ++;
  8. Open the OutputAction and insert a SimpleProperty. Set it to reference the UnsignedLongInteger element in the PredefinedTypes folder, and set its Value attribute to the following: this->eventCount_

Complete model of PingComponent
Figure 1. Complete behavior model for the PingComponent.

Figure 1 illustrates the complete behavior model of the PingComponent in PICML.

 

2. Generate source code for components

After modeling the behavior and workload, the next step is to generate source code from the model. This will enable emulation of the test system on its target architecture. To generate source code from the model, launch the CUTS interpreter and execute the following steps:

  1. Enter the target output directory
  2. Select Component Integrated ACE ORB (CIAO) in the listbox
  3. Click the OK button

Once the CUTS interpreter finishes generating source code, the IDL files need to be generated in order to compile the source code. These files are created by the IDL Generator provided with CoSMIC. Finally, there will be a QuickStart.mwc file located in the output directory selected for source code generation. This is a Makefile, Project and Workspace Creator (MPC) workspace file that contains all the necessary information to sucessfully compile the generated source code. Use QuickStart.mwc to generate the appropriate workspace and then compile it.

NOTE: The auto-generated source code for this model is also available at the following location: $(CUTS_ROOT)/tutorials/QuickStart.

 

3. Run a CUTS emulation

One design goal of CUTS is to (re)use the same infrastructure used in the target environment. The QuickStart example uses the Deployment And Configuration Engine (DAnCE), which is included with CIAO's standard distribution, to deploy the test system. To deploy the example, use the following steps:

  1. Copy the $(CUTS_ROOT)/tutorials/QuickStart/descriptors directory in the tutorial to the directory where you generated the source code.
  2. In one window, launch the deployment infrastructure located in the ./descriptors directory using the following command:
    %> cutsnode_d -c deployment.config
  3. In another window, launch the test in the ./descriptors directory using the following command:
    %> cutstest -c test.config --time=30

This will run the test for 30 seconds.