Products Download Support Contact Company
|

ReaGeniX FAQ

Short ReaGeniX FAQ v0.5 by Mikko Levanto 12.1.2009


GENERAL
=======


QUESTION  What else do I need in order to use ReaGeniX?

ANSWER

  You need:

  - A computer with Microsoft Windows
  - Microsoft Visio
  - A C development system for Windows (recommended for simulation)
  - A C development system for your processor


QUESTION  Does ReaGeniX make all I need?

ANSWER

  A major part of typical embedded programming consists of management of
  events, states, timing, and concurrency. External events may happen at
  unpredictable times and in unpredictable order. Meaning and processing
  of events may depend of the state of the system or some part of the
  system. Delayed responses are often needed, and other events need be
  processed during the delay. Reagenix generates the code for this
  management of events, states, timing, and concurrency.

  Some aspects of real time programming are easy enough with traditional
  tools. Expressions of C language are good for computational formulas.
  More complex algorithms can be expressed as C functions. These simple
  codes need ReaGeniX only to get executed at the right time.

  Embedded systems need suitable device drivers. These may be simple
  enough to write in C or even in an assembly language. More complex
  drivers can be divided into simple low level drivers and more abstract
  device management. ReaGeniX is good for the latter.

  If you use an operating system, you need to write the interface code
  that connects the generated code to the operating system. You probably
  need one main module for each task and perhaps some code for start-up
  and configuration.


BUILDING A DIAGRAM
==================

QUESTION  Is it possiple to cut the name of a state or an actor? There
          are sometimes problems to work with the long names in
          diagrams.

  ANSWER 
  
	No, the name of a REAGENIX state or actor may not be cut.


QUESTION  Is it possible to use scandinavian letters?

  ANSWER

  	No, names may only contain ASCII characters

        - lower case letters abcdefghijklmnopqrstuvwxyz
        - upper case letters ABCDEFGHIJKLMNOPQRSTUVWXYZ
        - digits 0123456789
        - underscore _

        A name must not start with a digit. Names starting with an
        underscore are reserved for special purposes and should not
        used otherwise. Names starting with RGX_ are reserved for
        ReaGeniX. Names must be different from reserved words of C
        language (including compiler's extesions), libraries, and
        ReaGeniX.


INTERPRETING THE DIAGRAMS IN REAGENIX
=====================================



QUESTION  How does an indexed port differ from a port with an array data
          type?

  ANSWER

  A port with an array data type is for messages that always contain
  every element of the array.
  
  An indexed port is a numbered collection of similar ports that are
  used separately. Each message only goes to one of the ports. Each port
  may be connected separately to the same or distinct other components.

QUESTION  How the connection names and types are interpreted in ReaGeniX?

  ANSWER

  The connections have usually no names or types. Only names and types
  the of selectors matter. 

  At least one end of each connection must have a named selector. If the
  other selector has no name, the name of the other is used. Each end
  can have different name.

  The type must be specified in a selector in at least one end. If both
  selectors specify a type, they must specify the same type.


QUESTION  What kind of name the states can have?

  ANSWER 

  The same rules apply as for other ReaGeniX names.


QUESTION  How the transition texts are interpreted?

   ANSWER 

   The condition and action parts are copied to the result code.

   For an indexed test the test is executed with different values until
   a either all index values are tested or the condition is true with
   some index value. In the latter case the action is executed with that
   index value.
 


C COMPILING
===========

QUESTION  The compiler gives an error message 
          ".pv not found in structure xxx".

  ANSWER

  Probably the object xxx was accessed as an external store or flow but
  it isn't. Perhaps a v(xxx) macro was used instead of an ov(xxx), or a
  send(xxx) macro was used instead of s(xxx) to send a signal.

  If the macro is right then perhaps there is some mistake in the
  declaration of the port.


QUESTION  The compiler gives an error message ".va not found in structure xxx".

  ANSWER

  Perhaps a flow or store was accessed with an ov(xxx) or 
  own_value(xxx) macro although it is not own. With an external store or flow 
  a v(xxx) macro must be used instead.


QUESTION  The compiler gives an error message ".ev not found in structure xxx.".

  ANSWER

  The object xxx is a store or some other object that does not carry an
  event. The name cannot be used in an on(xxx) macro or arrived(xxx)
  macro, and  there is no other macro that could be used instead. The
  send(xxx) macro can not be used with a store but v(xxx) can be used
  instead for an external store and ov(xxx) for an own store.




QUESTION C-compiler gives an error message in test.c compile:
         Undefined symbol 'xxxflow', where the xxx is a C-datatype


  ANSWER

  Test.c recognizes only the ReaGeniX datatypes. In the module.t file
  you may add other data types that are compatible with these types,
  e.g.:

  #define numflow      realflow

  Data types that require different processing cannot be used unless
  test.c is modified.

  If the module to be tested is not compatible with the tester, one
  possibility is to use an intermediate dfd diagram to adapt the
  interfaces.


  
DEBUGGING
=========

QUESTION  How the errors may be found?

   ANSWER

   As from the other C-programs: by debugging.

   Use for example the ascii-tester as main program. Start from the
   lowest level (state machines). Go ahead from bottom to up.

   Each component's status data structure can be found from place
   pointed by the pointer named p in the tester. A good debugger can
   show the data structure quite easily in an understandable format.


QUESTION  How to use Reagenix tester?
 
  ANSWER
   
  Add to your C-project the file named test.c. The test.c includes a
  file named module.t, which you must write. In the module.t include
  the .h file of the diagram you want to test.

  The tester supports only Reagenix datatypes.
 
  The user interface of the tester sends ANSI ESC control commands with
  whitch it controls the display. You may need an ansi driver to make
  them work. Otherwise the output may look funny but can still be used.


QUESTION  How I can get my own datatype to tester user interface?

  ANSWER

  If your own datatype is equivalent to a ReaGeniX data type, write
  in module.t a definition like

  #define mydataflow realflow

  where mydata is the type you need and real is the corresponding
  ReaGeniX type, and the four letters "flow" are always the same.

  If the module to be tested is not compatible with the tester, one
  possibility is to use an intermediate dfd diagram to adapt the
  interfaces.

QUESTION:  Where I can find the data structures of ports and stores in
           the debugger?

   ANSWER
 
   The data sructures can be found from the component's status data
   structure. When the Reagenix code runs a pointer named p points to
   the component's own status data structure. For each object there is a
   field of p with the name of object. The field is a structure where
   .ev subfield (if present) indicates wether there is an event pending,
   .pv subfield (if present) indicates where the data value can be
   found, and .va subfield (if present) is the (current or last) data
   value. At most one of .pv and .va is present in any object.



INTEGRATE TO C CODE
===================


QUESTION  What's the difference of and_when and or_on operators from &&
          and ||?
   
  ANSWER

  The C operators && and || require normal C expressions on both sides.
  The left side of both or_on and and_when is an on(xxx) either alone
  or followed by one or more or_on(xxx) macros. The right side of an
  and_when is a normal C expression as would be with && or || except
  that it must be in parentheses (because formally it is not a right
  side but an argument of the macro). The or_on also requires
  parentheses around the right side (for the same reason), but the right
  side must be a port name just like in the on(xxx) macro on the left
  side.

  You cannot use && and || in place of and_when or or_on. You can use
  them in the parenthesized expression after and_when.


QUESTION  Is it possible to call normal C-code in Reagenix diagrams?

  ANSWER

  Yes. You can call C functions in transition actions of a state
  machine. Add to the state machine diagram a textual declaration,
  select "include" for its Decl.Class, and write in the Declaration
  field the name of the .h file that contains the prototype of the
  function and other declarations that are needed for the call.


QUESTION  Does Reagenix support C++?

  ANSWER

  ReaGenix generates C code. The C and C++ languages are sufficiently
  similar that generated C code can be compiled with a C++ compiler. It
  may be necessary to change the extension of the file name in order to
  prevent the compiler to compile it as a C program.

  Classes can be used as data types in flows and stores. When methods of
  such classes are called, v macros (or ov for own stores) must be used,
  e.g., v(objectname).methodname();
  
  

INTEGRATION TO ENVIRONMENT
==========================

QUESTION  How is the generated code interfaced to a simulation?

  ANSWER

  Use the interfacing kit. Read the Interfacing Manual.


QUESTION  Do I need an operating system?

  ANSWER

  In a simple case an operating system is not needed. Use the
  interfacing kit to interface to hardware. You need a simple main
  program loop and device drivers. You also need a clock driver
  if your program uses timers. Read the Interfacing Manual for
  instructions about interfacing to the generated code. You also
  need sufficient knowledge about your processor and devices.


QUESTION  How can I get some code be run with a higher priority?

  ANSWER

  In the simplest case you can put the high priority code in an
  interrupt handler.

  If you need to execute a part of the ReaGeniX diagrams with a
  higher priority, you can use ReaGOS (not included in ReaGenix
  Programmer but can be purchased separately). Draw a priority diagram
  and sort your program to priority levels. Generate the ReaGOS kernel
  with ReaGeniX Priorizer. See ReaGeniX Priorizer manual for
  instructions.

  If you use ReaGOS, the device drivers must be interfaced as instructed
  in the ReaGeniX Priorizer manual.

  If instead of ReaGOS you use another operating system, use the
  Interfacing Kit as instructed in the Interfacing Manual to interface
  to the operating system. You probably cannot interface drivers
  directly to generated code but must interface them to the operating
  system.



OTHER QUESTIONS
===============

QUESTION  I did not find what I wanted. Where I can get more
          information?

ANSWER

  Mail your question to adress:


     support@obp.fi


  If possible attach your diagram, the generated C code, and the error
  list to your question (both ReaGeniX and your C compiler). Use zip,
  if nessessary.
OBP Research Oy, c/o Ari Okkonen, Mielikintie 6 A 7, FI-90550 OULU, FINLAND
Tel: +358 40 542 2059, Email: obp@obp.fi