- STM32F429i Discover Board - Emblocks IDE 2.30 - ARM GCC Compiler 4.7 (Emblocks - bare-metal) - Compiler options with harf-FPU (-mfloat-abi=hard) - CMSIS library “libarm_cortexM4lf_math.a”
Unfortunately, the original example did not terminated successfully, and falled into hard fault. After some investigation, I figured out the problem is related with bit reversing flag. When the example without bit reversing terminates successfuly, ofcource it is not useful.
The reason of this problem is the pre-built GCC library has not the function “arm_bitreversal_32”, because a reason regarding the source written in assembly language. So in my situation following workaround succeeded.
Re implement the function “arm_bitreversal_32” with another name like that “sg_bitreversal_32” for avoiding to call original bit reversing function, the code as follow
While evaluating code generation tools under Eclipse, I tried Xpand and Acceleo but I didn’t succeed with them for Papyrus UML models. So recently, I decided to try Epsilon Modeling Tools. I tried it for GMF tools generation with Emfatic and EuGENia. Epsilon is a family of languages and tools for code generation, model-to-model transformation, model validation, comparison, migration and refactoring that work out of the box with EMF and other types of models.
The example below is inspired from this article. In this example, we’ll try to generate an HTML Form model which is prepared with Papyrus UML. Papyrus is a tool for modeling with UML, SysML and ModelicaML.
Modeling HTML Form We assumed that you are familiar wit Papyrus. An HTML form Class is shown in the image below. It is a Papyrus Class Diagram. Model has a Form Class with two type of fields as TextField and MultiLİneTextField which is derived from TextFiled.
In the image below, an a HTML form design with the instance of the Class elements in Class diagram. The form has three instance, a Name TextField, an Email TextField, and a Message MultiLineTextField.
Creating Epsilon Generator Language Templates We have two EGL file to generate HTML code, “create.egl” and “uml2html.egl” as follow. The first one is used to call converter, and the second one is used to generate. create.egl
[%
var t := TemplateFactory.load('uml2html.egl');
t.populate ('dummy', null);
t.generate ('../out/contact.html');
%]
uml2html.egl
[% var FormAttr : Set; var FormFields : Set; var name : String; var label : String;
for (p in Package.all.select(t|t.type.name.equals("Package"))) { if (p.name.equals("System")==true){ for (i in p.packagedElement.select(e|e.isTypeOf(InstanceSpecification))) { if (i.classifier.first.type.name == "Class") { if (i.classifier.first.name == "Form") { for (s in i.slot) { if (s.value.first.isTypeOf(LiteralString)) { FormAttr.add(s); } else if (s.value.first.isTypeOf(InstanceValue)) { FormFields.add(s); } } } } } } } %] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>[% for (attr in FormAttr) { if (attr.definingFeature.name.equals("title")) { %][%=attr.value.first.value %][%}}%]</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <div id="page-wrap"> <form method="post" action="form.php"> [% for (field in FormFields) { for (s in field.value.first.instance.slot) { if (s.definingFeature.name.equals("name")) { name = s.value.first.value; } else if (s.definingFeature.name.equals("label")) { label = s.value.first.value; } }%] <label for="[%=name%]">[%=label%]:</label> [% if (field.definingFeature.name.equals("textField")) {%] <input type="text" name="[%=name%]" id="[%=name%]" /> [%} else {%] <textarea name="[%=name%]" id="[%=name%]" rows="20" cols="20"></textarea> [%}}%] <input type="submit" name="submit" value="Submit" class="submit-button" /> </form> <div style="clear: both;"></div> </div> </div> </body> </html>
Launcher Configuration To initiate launcher is done as follow.
Rigt-click on the file “create.egl” in “Project Explorer” and select “Run As > Run Configuration…”. You’ll reach the window below.
Click “Models” tab. Add the new one as shown the image below.
To save your run configuration in your project, click the tab “Common”, then click “Shared file:” radio button and select your project location as shown in the image below
Then click Run, then you’ll have your HTML file in folder “out”. The form looks like as follow.
Please feel free to ask any question. The complete Eclipse project can be downloaded from here.
In previous blog post, First Experience on Modelica and ModelicaML, I tried to show how to simulate a discrete time model on OMEdit (Open Modelica Connection editor) and on Eclipse with ModelicaML plugin.
In this post you’ll find simulation of a continious-time model. For this purpose we’ll us a Permanent Magnet DC Machine with a load. Model includes only standart Modelica Blocks. We assume that you have OpenModelica and Eclipse with ModelicaML/MDT plugin installations, and you are familiar with creating Modelica models on OMEdit and ModelicaML model Eclipse/Papyrus.
So, for now, we can skip the steps regarding creations model, then just download the models previously created from the links below. However, please feel free to contact us for furher information.
What is Modelica? Modelica is an object-oriented, declarative, multi-domain modeling language for component-oriented modeling of complex systems, e.g., systems containing mechanical, electrical, electronic, hydraulic, thermal, control, electric power or process-oriented subcomponents. The free Modelica language is developed by the non-profit Modelica Association. The Modelica Association also develops the free Modelica Standard Library that contains about 1360 generic model components and 1280 functions in various domains, as of version 3.2.1.
What is ModelicaML? Modelica Modeling Language (ModelicaML) is a graphical modeling language for the description of time-continuous and time-discrete/event-based system dynamics. ModelicaML is defined as an extended subset of the OMG Unified Modeling Language (UML). This subset enables the generation of executable Modelica code.
ModelicaML extends the graphical modeling capabilities of Modelica by providing more diagrams (UML diagrams for presenting the composition, connection, inheritance or behavior of classes) for graphical model definition or documentation. Moreover, ModelicaML supports a method for formalizing and evaluating system requirements using simulations.
What is UML? The Unified Modeling Language (UML) is a general-purpose modeling language in the field of software engineering, which is designed to provide a standard way to visualize the design of a system.It was created and developed by Grady Booch, Ivar Jacobson and James Rumbaugh at Rational Software during 1994–95 with further development led by them through 1996. In 1997 it was adopted as a standard by the Object Management Group (OMG), and has been managed by this organization ever since. In 2000 the Unified Modeling Language was also accepted by the International Organization for Standardization (ISO) as an approved ISO standard. Since then it has been periodically revised to cover the latest revision of UML.
Simulation on Eclipse When I look for an Eclipse based tools for my sgJavaSci Code Generation project, I tried many basic tools for Modeling like that EMF, GMF, Graphiti, Spray and so on… However Eclipse has more powerful tools based UML on top of basic tools, Papyrus, Sirius for System Engineer. It also has tools for code generation Acceleo and Xtext.
Regarding UML, it can be extended for using on various domain. For example one of them is SysML for system engineering and developing Embedde systems. However, this modeling languages are not for simulation.
Regarding ModelicaML, it can be used for code generation and simulation. A Modelica open source project, OpenModelica already has tools for development graphical and textual, Connection Editor (OMEdit) and NoteBook (OMNoteBook) applications. But output of this tools can not be used for code generation because they are not XML based. That is why ModelicaML was selected for code generation with GeneAuto. Also all of the tools to be used are open source.
You’ll find an example model on OpenModelica Connection editor, and an equivalent model on ModelicaML on Eclipse Kepler below. Also you can download source code of example below.
Example is a discrete model of simple up-counter
Modelica Model on OpenModelica Connection Editor You should have OpenModelica installation to try this model
ModelicaML Model on Eclipse Kepler You should have OpenModelica installation and Eclipse Kepler with ModelicaML plugin to try this model
What is Scilab ? Scilab is free and open source software for numerical computation providing a powerful computing environment for engineering and scientific applications.
What is Scilab/Xcos ? Scilab includes a toolbox called Xcos which is based on Scicos.
What is Scicos ? Scicos is a graphical dynamical system modeler and simulator. Users can create block diagrams to model and simulate the dynamics of hybrid dynamical systems (both continuous and discrete time) and compile these models into executable code. Applications include signal processing, systems control, queuing systems, and the of study physical and biological systems.
What is GeneAuto ? Gene-Auto is an open-source toolset for real-time embedded systems. The toolset takes as input a functional description of an application specified in a high-level modelling language (Simulink/Stateflow/Scicos) and produces C (in close future also Ada) code as output.
What is sgJavaSci ? sgJavaSci is a tool for binding Scilab and Java. The first module if the toolbox is C Code Generator by using above tools.
Currently it has the features as follow
Supported Xcos Blocks
SUPER_f defines a system
CONST_m defines a constant
DOLLAR_m defines a unit delay
IFTHEL_f calls a system block according to condition based on an input value (u>0)
SUMMATION adds or subtracts inputs
SWITCH2_m selects an inputs from two according to conditions based on an input value and a trishold value (u>a, u>=a, u~=a)
OUT_f defines an output variable
CLKINV_f defines an event or action input
Supported Data Types
Double
Supported Block Parameter Types
Real Expression
Integer Expression
Binary Expression
String Expression
Features
Block Names
Usage
Before using the tool you shoul have programs as follow
Eclipse Java Development Environment
Java RTE 1.7
Java JDK 1.7
Scilab
There is no published binaries or Java Byte Code of the tool. You can get it as Eclipse project as follow.
Then you can import the project into your Eclipse workspace. If you have Git plugin with Eclipse you can directly import project from above git repository.
Creating Scilab/Xcos diagram We assume that you are familiar with Scilab/Xcos diagrams. Diagram should be created by using only supported blocks. Parameters should be in type of double and scalar. An example diagram are given below.
Code Generation Process After creating diagram or already you have a diagram which comply with the condition above, you can run the tool within Eclipse. The window will be displayed as follow.
At this stage, the process is as simple as press button and select input diagram and output folder by means menu or toolbar buttons. The steps should be in sequences as in the image below.
In the end everything were go well. You will be found C Files in output folder “cfiles”, and GeneAuto XML file in output folder “XML”. Output folder is the one you were select at the step 2.
Other windows you will see as follow along with process
After all, c files in output folder, trees views of input diagram XML file and GeneAuto XML file in main window of the tool and a generated C file in Eclipse will be shown as follow
I hope that the tool is useful and look for your valued feedback.
We have started up a new project sgJavaSci Scilab/Xcos tools to manage Scilab from Java environment. Initially, JavaSci example was imported from Scilab installation. Also a class was created to display Xcos diagram in XML format as SWT/JFace treeviewer.
Current development environment on Windows 7 / 64bit machine as follow
Eclipse Luna Release (4.4.0) x86_64
IBM 64-bit SDK for Windows AMD64/EM64T architecture, Java Technology Edition, Version 7
Scilab-5.5.0 64bit
Source code can be downloaded from BitBucket repository.
Toolbox was updated… It can be downloaded also from BitBucket
SciPowerLab (0.2) * Update blocks to comply Scilab API * Toolbox title is changed as SciPowerLab * Source tree was moved to BitBucket – Ibrahim ERTURK <[email protected]> Mon, 25 Aug 2014
XCPL (0.1) * Repacked for ATOMS Module – Ibrahim ERTURK <[email protected]> Fri, 02 Mar 2012
XCPL_toolbox (0.0) * Initial Release – Ibrahim ERTURK <[email protected]> Wed, 01 Jun 2011
Previously developed blocks under ScicosLab has been ported to Scilab/Xcos. It can be downloaded from link below. We will be glad to receive your valued feedback.
Usage
Run builder.sce in root folder
Run loader.sce created by builder macro
Available Blocks
xcpl_BLDC Brushless DC Machine in abc frame
xcpl_BLSC Brushless DC Machine Sensored Controller
xcpl_PMSM Permanent Magnet Synchronous Machine in dq frame
Scilab is a powerful computing platform for engineers and academicians. Python has many scientific tools. While I look for a tools for binding Python and Scilab for a project, I found one on ScilabForge.
Unfortunately, it doesn’t work with recent version of Scilab and Python under Windows. The original was coded as pure C extension.
Whatever, I decided to simplify it for my purpose. At the moment, the simplified code is sufficient for my purpose. However, it will be developed. Initial version was uploaded onto BitBucket as Git repository.
Dr. Sergio Cittolin has worked at CERN for the past 30 years as a research physicist. He has also made several drawings of the Large Hadron Collider in the style of Leonardo da Vinci.
Symmetry magazine profiled Cittolin a few years ago.
As a naturalist, da Vinci probed, prodded, and tested his way to a deeper understanding of how organisms work and why, often dissecting his object of study with this aim. “I thought, why not present the idea of data analysis to the world within the naturalist world of Leonardo?” Cittolin says. In the drawing below, the CMS detector is the organism to be opened; the particles passing through it and the tracks they leave behind are organs exposed for further investigation.
Cittolin brings a sense of humor to his work. For example, after betting CMS colleague Ariella Cattai that he could produce a quality drawing for the cover of the CMS tracker technical proposal by a given deadline, he included in the drawing a secret message in mirror-image writing-which was also a favorite of da Vinci’s. The message jokingly demanded a particular reward for his hard work. The completed picture was delivered on time and within a few hours Cattai cleverly spotted and deciphered the message. She promptly presented him with the requested bottle of wine.