ncapp2moml

TinyOS is an event-driven operating system designed for sensor network nodes that have very limited resources (e.g., 8K bytes of program memory, 512 bytes of RAM). TinyOS, is used, for example, on the Berkeley MICA motes, which are small wireless sensor nodes. nesC is an extension to the C programming language designed to embody the structuring concepts and execution model of TinyOS.

ncapp2moml is used to convert nesC application files (.nc) into MoML (.moml) files. This will create Ptolemy II models that you can run in Viptos. You must setup the necessary MoML library of nesC components with the nc2moml tool before you can successfully open files made with this ncapp2moml tool.

Installation instructions

Note: You must follow the instructions here for running the nc2moml tool before you can use models generated with this ncapp2moml tool.

Note: As of 10/05, Windows users will not be able to run TinyOS models inside Ptolemy. The reason is that reloading the TinyOS shared objects into the running Ptolemy interface fails because the TinyOS shared objects use pthreads and under Windows, Java is using Windows native threads. We are working on a solution. In the interim, Windows users can convert .nc files to .moml files and create models, but running the model fails.
  1. Run the script to generate the .moml files from the .nc files.
    cd $PTII/ptolemy/domains/ptinyos/util/ncapp2moml
    ./ncapp2moml
            
    The ncapp2moml command will take a few minutes to complete.

    Note: The ncapp2moml tool requires that you build the tools in $PTII/bin. Do the following and rerun the script above if they are missing:

    cd $PTII/bin
    make
            
  2. See if it worked:
    1. You should see some valid MoML code in:
      $PTII/vendors/ptinyos/momlapp

      The directory structure should reflect that of the TinyOS directory structure.
      1. Try running Viptos:
        $PTII/bin/vergil -viptos
      2. Open a demo by going to File -> Open File, and opening file $PTII/vendors/ptinyos/momlapp/apps/CntToLeds/CntToLeds.moml or $PTII/vendors/ptinyos/momlapp/apps/CntToLeds/CntToLeds-InWireless.moml (only one of these will have been generated, depending on what options were used in running ncapp2moml).
        • If you opened CntToLeds.moml, you may wish to run the automatic graph layout by selecting Graph -> Automatic Layout form the menu, or by typing Ctrl-T.
        • If you opened CntToLeds-InWireless.moml, you have to first right-click on the MicaBoard and select Look Inside, then right-click on the MicaActor and select Look Inside. Then, you can run the automatic graph layout by selecting Graph -> Automatic Layout form the menu, or by typing Ctrl-T.
      3. Try to open a demo that uses the components original source directory. Go to File -> Open File, and open file $PTII/vendors/ptinyos/momlapp/apps/Blink/Blink.moml or $PTII/vendors/ptinyos/momlapp/apps/Blink/Blink-InWireless.moml (only one of these will have been generated, depending on what options were used in running ncapp2moml.