Some word about Control

Sampling rate selection, rule of thumb

There are slightly different views in the choice of sampling rate selection for a digital closed loop control system. The best sampling rate which can be chosen for a digital control system is the slowest rate that meets all performance requirements. Uniform samples of a signal that is band-limited above a frequncy Fb are unique if, and only if, the sampling frequency is higher than 2*F_b, where F_b is termed the Nyquist frequency.

In practice the Nyquist frequncy could the theoretical limit, but in practice the closed loop sampling period (T) should be choosen in the range of

\frac{1}{40*F_{cl}} < T < \frac{1}{10*F_{cl}}

Another criterion is select the sampling time in terms of the rise time as

0.095*T_r < T < 0.57*T_r

See this book for more…

Amazing MEMS

How does a Micro-ElectroMechanical Systems (MEMS) accelerometer works? A MEMS accelerometer is basically a small mass spring made by silicon and have a service life of billions to trillions cycles (which could be considered as large if used as pedometer). The signal is the difference in between the two capacitances originates from the mass and body frame. This clip shows the basics for accelerometers.

How does a MEMS gyroscope works? Inside the MEMS is a vibrating structure gyroscope that measure the Coriolis force of the rotating system. One manufacturer explains how. The trend is that the sensors becoming smaller and less expensive. The market seems to have a large growth rate in the future, due to so called wearables and gadgets.

 

Raspberry Pi

There is a new Pi called 3. The new one has WiFi as well as bluetooth. It should be possible to order it from Microsoft, with a free SD-card.

 

 

Annonser

OpenModelica

In the last MBDLetter, the use of Modelica to create a model of a simple circuit was presented. Library blocks was defined and used as components when building the model, a great feature of Modelica. The example so far has been very simple but using library blocks openModelica_logoeven very complex models can be created in an easy way. Of course, it is not practical to create large models in text, at least not if you are used to graphical tools. Let’s have a look at a graphical Modelica tool!

I have mentioned OpenModelica briefly in previous newsletters as a free graphical editor for Modelica models. Although it has a few flaws compared to commercial software, it is fairly easy to use and sufficient for most applications – download it and try for yourself!

So, with some insight in how Modelica models work, how can the electrical circuit example used in the last few newsletters be implemented in OpenModelica? Simple!

circuitExample
Circuit example from previous newsletters.

All of the components created in the last newsletter are available as libraries in OpenModelica. The libraries contain components for modelling in various domains, such as electrical, mechanical and thermal, and includes everything from simple to very complex components. Of course, it is possible to create personal libraries and add your own components, but for this example we will create the model using built-in blocks. Let’s have a bit more detailed look at the resistor block before continuing to the full circuit model!

circuitExample_Modelica_resistor
OpenModelica Resistor block.

The graphics is not much to comment on. Each block has inputs/outputs and a descriptive figure, most often the commonly used symbol for that component. Each block is configured by double-clicking and assigning parameter values. Basically, the same functionality as every other graphical modelling tool. However, it is possible to show the class definition for each block, i.e. the Modelica code. For the resistor, have a look at the equations below. Comparing these equations with the equations implemented in the previous newsletter, two things are worth noting. First, the resistance of the built-in resistor block is temperature dependent, if enabled; this could of course have been included in our own implementation but was left out for simplicity. Second, the use of extension of other library components, for example OnePort.

circuitExample_Modelica_textBasedResistor
Modelica code for the OpenModelica Resistor block.

Using extensions is a common practice in object oriented programming as it is an efficient way to avoid multiple definitions of the same code. In the case of OnePort, this block consists simply of two pins and the equations for voltage and current between these pins. Compared to our own implementation the pin was indeed defined, but the equations for voltage and currents were defined for each component which makes for less efficient models.

Looking at the full electrical circuit, once the components are defined (or if, as in this

circuitExample_Modelica
OpenModelica implementation of circuit model.

example, using built-in blocks) it is just a simple matter of adding, configuring and connecting the blocks – done! The model is ready for simulation and one nice feature of OpenModelica, common for all Modelica-based software I have come in contact with, is that all simulation data is available for plotting without the need to add scopes to specific signals. Should you want to examine the source code for the modell, just switch to text view.

So, to sum up the last few newsletters, a path from creating model components to complete model simulation has been outlined. Implementing models for other domains is just as easy, depending on model complexity of course. Modelica may not be the best choice for all models, and the non-commercial graphical software still need some usability upgrades, but for many applications it is a viable option to, for example, Mathworks products.