To access to Polychrony services inside Eclipse, the compiler has been deeply connected to the reflexive editor and the graphical environment. The main goal for this connection is to obtain a traceability between the SME models and the results returned by the compiler. Thus, it becomes possible to indicate directly on the source model the compilation errors.
The connection between the SME Eclipse editors and the Polychrony compiler consists of a Java/C interface to communicate with the compiler through native libraries (for Linux and Windows). The principle of the communication (represented on previous figure) is the following:
The Signal compiler can be parameterized to specify the memory size used for its operations. To access to these parameters, select the Polychrony section in the Preferences Window as shown in the following picture.
There are four parameters:
If you change one of these values, validate these changes by clicking on the apply button. For restoring the initial values, click on the Restore Defaultsbutton.
To call Polychrony services, right-click on the SME file on which you want to apply the service(s), and select Polychrony. You can choose to use a predefined scenario : in this case, select the Execute Predefined Scenarios option.
Seven actions are proposed:
The three first actions generate the executable code files respectively in C, C++, Java language from the SME model specifications. The next three actions generate a Signal textual file : a normal SIG file, a pretty printing of the tree internal structure or a Signal file generated during the transformation to the internal graph structure. The last option applies a compilation scenario on the SME model (see previous part). All these files are generated only in a directory named as the SME model file. They are only generated if all previous compilation steps are all successful.
It is also possible to call Polychrony services on SIG file. In the same manner as for the SME file, right click on the SIG file, and select Polychrony to obtain all actions proposed for the SME file and one action to generate a SME file from the SIG file in a directory named as the SIG file.
There are two new options that appeared in the 0.20.0 version of the plugin : the interactive compilation and the general compilation. Let's see the interactive compilation first : to be able to use it, choose the General Compilation menu in the Polychrony menu, and then click on Interactive Compilation.
A new window will pop up, with all the options available in the scenario editor :
Each time you click on an option, the corresponding operation is realized in real-time. When you have finished, you can close this window by clicking on the Quit button.
To use the general compilation GUI, choose the General Compilation menu in the Polychrony menu, and then click on General Compilation. A GUI with tabs will pop up :
Each time you're clicking or unclicking an option, the option manager of the SIGNAL compiler is called and the corresponding options are activated or unactivated. The compilation starts when you push the Compile button.
The Polychrony services provides several kinds of generators which needs external tools to be used or executed: SynDEx tools for sdx files, Sigali (distributed with the classical Polychrony distribution) for z3z files... The C, C++ or Java code generation is dedicated to simulations.
By default, the code (C, C++, or Java) generated by Polychrony will read input values from a files called R<input name>.dat (or RC_<input name>.dat if the input signal is of type event) and will write output values into a file called W<output name>.dat. These input files has to be created and filled by the user (one value per line, and for event signal, 0 for absence and 1 for presence).
For C and C++, you will need to use an external C/C++ compiler. The Polychrony libraries are provided and can be found in the Eclipse plugins directory and specifically in:
Currently, there is not automatic generation of makefile to compile C/C++ file. This will be done in a later release.
For the Java generation code, we take benefit of Eclipse which is originally a Java environment which provides several facilities to manage Java project. The call of the Java generation code creates (if all previous operations are executed without errors) a Java project containing the Polychrony Java libraries (SignalJavaStd.jar, and SignalGraphicalJavaStd.jar) and the Java source classes are generated in the src directory of the project. There may be some errors in the Java code if your SME model has constant parameters. The correction of these errors consists in replacing the UNDEF() calls by the value of the constant parameter.
To execute the simulation, you have only to right-click on the project (or on the Java class corresponding to the main) and select Run As->Java Application.