2007/11/23

Annihilation

A second part of the last note has to be written. Not only because finally I didn't write about the decelerator, also because there are more things to take into account about the antimatter: the annihilation.

The matter and the antimatter can not live together. Our universe is composed by matter, but an antimatter universe can exist. It is not possible to distinguish if your existence is in a matter world or in an antimatter one. The antimatter particles has the same stability than matter, but in their universe. The antimatter in a matter world is easily annihilated when it meet its respective matter particle.

This annihilation has some properties because the universe has some rules. There are things that it needs to conserve, like the energy or the momentum. A pair of matter-antimatter, when they annihilate it selves, has to conserve. Then some other types of particles has to be created (mass less like photons, or other exotic particles.

2007/11/22

Decelerator

Do you think I am working on a freak machine? This one is not much freak that a decelerator... Today, comming back home in the train I was talking with a friend (and also a work collegue) about one his lasts jobs, the cern antimatter factory. Less that a year working on a synchrotron and there is no one day that I didn't learn new and new things...

What an antiparticle is? Every particle that compound our matter have it 'specular' particle with the same characteristics but with an opposite charge. Electrons has its antimatter particle with the positron. This two particles have the same mass:
0.510 MeV/c^2, the same spin, the same electric charge: {+,–}1.602176487*10^-19 C, but with an opposite sign. That is, the behaviour of a positron is the same than the electron, but positive. The proton have a mass of 938.272 MeV/c^2, and a charge of 1.60217653*10^-19 C (note that it differs to the electron in -4.3*10^-27, small but not the same); an its antiparticle is the antiproton with the exactly the same values but with negative charge.

But an exception could be to this definition. What about the neutron? This matter particle have no charge, but it doesn't means that it haven't antiparticle (or it is by itself). The neutron have its antineutron, that complain with the characteristic of an antiparticle.

Protons and neutrons are not fundamental particles, this particles are composed by quarks. This basic constituents of the matter, yes, have charge, and the neutrons are composed by two quarks down and one quark up. The down quark have a charge of -1/3 of the electron charge; and the up quark have +2/3 of the electron charge. Two down have (-1/3)+(-1/3)=-2/3, an oposite charge that the up quark that rest in the components of the neutron.

A really good explanation for non physicians can b found in the Tamiz.

The antineutron has to be composed by antiquarks. Then it consist of two anti-down quarks and one anti-up quark. The same but with opposite charges, adds also 0. In the wikipedia's antineutrons article is explained that the opposition that the antineutron has against the neutron is the magnetic moment.

After too much words I didn't say anything about the decelerator, but this is because I need to learn many things to not say something wrong... Next time.

2007/11/17

Secret sharing

Before to write about the possible implementation of elliptic curves over fields of characteristic 2, I want to propose another option: do some implementation over multi-public-key cryptography. This is if you have a secret that can not be trusted in only one person you can divide your secret in parts and give only one to one person. But under one reconstruction of this secret, you need all the people present.

If the secret that I said before is divided using a (n, t)-threshold scheme then your secret is shared between n players, but it can be reconstructed with t survivants from an attacker conspirator (this becomes from the thriller films).

You can create schemas with all the combination that you imagination gives. If you have a group of 10 people with a two heads, and two subgroups of four; and what you want if to have present two people of each subgroups and one of the heads (at least) you should have an schema (3-3)-threshold for the main secret and this keys to the shared secret will be re-shared as a (2-1)-
threshold for the heads, and 2 (4-2)-threshold for each subgroup.

In Barcelona there are people working in this things. I meet some of them in some congresses and they are really nice people. For a long time, the secret sharing schemas have had charm for me. Could be interesting to implement this over embedded systems...

Libgcrypt

As a continuation of the yesterday brainstorming, I want to write something more about the research project. Today I will think about what can make to contribute in the libgcrypt. In this library, the ECDSA that I did in my last research project, was rewritten. This was the objective of the project, to contribute in the free software.

It is necessary to do somethings in this library. The file '
cipher/ecc.c' contains a TODO list with the necessary improvements that this library needs:
  • If we support point compression we need to decide how to compute the keygrip - it should not change due to compression.
  • In mpi/ec.c we use mpi_powm for x^2 mod p: Either implement a special case in mpi_powm or check whether mpi_mulm is faster.
  • Decide whether we should hide the mpi_point_t definition.
  • Support more than just ECDSA.
In my opinion, a research project can not be the solution of one of this points. If the research project goes in this direction, the two first points needs to be solve and the third needs to be decided.

How the project was adapted to the libgcrypt? The patch from it comes was written in a monolithic file in the way to do as less modifications as possible in the gnupg (in the 1.4 branch).

Then Werner made a good work moving the particular elliptic data structures to 'src/mpi.h' maintaining in the cryptofile 'cipher/ecc.c' the ones that have a direct relation with the pub and the private keys. Then, there are another file 'mpi/ec.c' that have everything about the mathematics background. But, in my opinion, this have one problem: the elliptic curve discrete logarithm problem (ecdlp) can be brought over primary fields (F_p) and also over fields of characteristic 2 (F_{2^m}), and this file should be split in this two mathematics bases.

This last paragraph propose another possible research project, that is implement what we had over primary fields but over characteristic 2 fields...

2007/11/16

Elliptic curve isogeny

A few days a go (the 9th of November) a new patch about elliptic curves on GnuPG had been published. With two month delay since Mikael sent the code to me... As I read in the esr's book this is long longer time than acceptable.I'm sorry.

Now it's time to retrieve the projects. It is necessary to recuperate the gumstix development and also this year I will do my master degree research project. Against about elliptic curves. But what I said is really generic. I have some ideas, that I wanna write in this blog to be used as a brain storming to specify what is able to do and discard something else. Today is the turn elliptic curve isogeny.

Without speak on mathematics, and as far as I know, if you have a cryptoanalyst against finite fields and your paranoia says you that your privacy could be compromised, the only option that you have is increase your keylength... Use a bigger RSA or ElGamal key. Over elliptic curves you have one option before this: you can change the elliptic curve (and propose the elliptic discrete logarithm problem over a complete new one field). Nothing that the cryptoanalist computes for the old field can be used here.

But the cost to generate a new curve every key generation is hard. There are too much proprties and characteristics to test and be sure that this curve have good cryptographyc properties. One way to generate a new curve with a guarantee that it has cryptographyc characteristics is to perform some isogeny transformations to one curve that you know that it has this properties.

There exist algorithms to obtain a graph where the nodes represents elliptic curves and the edges represents an isogeny transformation. I don't need to go so far to know about isogenies, in the same university research group with I am studying they are specialists on this. For a long time a go I am listening conversations talking about this transformations an its advantages. The data structures that this isogeny transformation creates receive the name volcanus, and a join of volcanus receive the name of cordillera.

But! If the attacker knows the steps that you did in the volcanus to obtain your new isogeny curve, and it has good knowledge on isogenies transformation, it is possible to 'migrate' all the computation work that before I said that should be not useful, to the new field and continue the attack. This means that the isogeny could only generates more work to the attacker but it maybe doesn't improve the security.

An option, is to perform the transformation in secret. Generate a way in the volcanus during the key generation, from then you use the new elliptic curve and forget the relation with the one from it came... If the attacker is not able to stablish the path from one to the other, the system is secure.

Long time a go I was talking about this with Mikael, and he shows me that there are many people in the world that propose to use a public key isogeny cryptosystem, where the secret key is precisely this path in the volcanus.

Then the question is: Are we complicating so much the problem? In the low level we need to be careful with the AES symmetric cryptoanalysis. In the centre we have to beware if some algorithm better that pollard's-rho has been discovered. An then a third front we will have this transformation that could be grateful to reset a hole smartcard cryptosystem.

Yes, it is a grate thing to have the possibility to reset a institution smart card system without increase the keylength but with a restablishment of the security against an attacker.

2007/11/10

Planet atmosphere

During this time that I has learning for the theory fly exams I was think that I provide me too much thinks to write here. At the same time, the day only have 24 hours (strictly less than this, 23h 56min 4sec). But I have a huge list that I will write, from time to time.

Also last Thursday I fly. In combination with this, I will began with the idea to fly in Mars. How different are the parameters in this planet to take care in an hypothetical fly try?

First of all, the gravity. The main think that you need to fly is the lift force, to do a balanced fly the aircraft will create the same lift than weight but under an opposite direction. As Wikipedia says, the gravity in Mars is 3.69 m/s², that is to say 2.65 times less than in the Earth.

Back to the lift force. Witch other parameters have influence on it? Right now we know that with a half lift force than in the Earth you can fly in Mars, but it doesn't say that is easy to create lift to an object in Mars. The formula becames from the Bernoulli principle:

What is different in Mars? (C_L is the lift coefficient is experimentally calculated). The atmospheric density! In the Earth the density (rho) is 1.225 kg/m³, and Mars rho is 0.020 kg/m³, that is to say 61.25 times less than in the Earth. The Lift force is directly proportional to the air density. If this parameter of the formula is 60 times smaller, the other need to be increased in this order; the speed or the surface of the wing are the only options that you have.

You need a half lift force to fly in Mars, but in Mars is 60 times expensive to have lift force... Then I can deduce that is 30 times much more difficult to fly on mars...


In this las link about Mars in found too much information from this planet in comparison to the Earth values. There are curious values in the atmosphere composition. I study the Earth atmosphere composition for the fly exams, and the Mars one is really different.

The first curiosity is the most common gas: the carbon dioxide. This gas that in the Earth makes move too much ink, with the 0.038% proportion, and the responsible of the greenhouse effect, in Mars is the most common gas with the 95.32%. Far from the most common in the Earth that is the Nitrogen with the 78.084%.

2007/10/31

Tango-ds/ Instrumentation/ TekDPO7000-ds

Today is the day when I can say that my bills can be paid writing free software... Just a couple of minutes a go I publish a Tango Device Server to control in the distributed system the 7000 series Tektronix oscilloscopes. Here, in this blog, can be read the evolution to this goal.

My officially entrance to the free software first line was last March, when Werner Koch decides to include code from the
elliptic curve patch, that was my research project, in the subversion code of libgcrypt. It was not less important (it was a culmination) when in May, Werner publish a libgcrypt development branch that includes support for ECDSA.

This is not a landing operation. This is a
Touch-an-go! A little step from a newbie!

Ps: My first free software contribution was on march 2004, when the elliptic curve project had been release.

2007/10/24

STS-118 Endeavour

Via, I found some photographs from the Endevour shuttle space mission in August. The most impressive photograph, from me is:
The gallery.

2007/10/23

Flight Planning Free Software

This Saturday I will go to Menorca with a couple of an unknown friends. One of this people is the one who invite my to start the curse that I am doing to obtain the Private Pilot License (PPL), and I will meet this journey some other pilots...

They send to the list a flight planning draft generated with a software called
FliteMap. Really nice software, but is there any other option under GPL license? Or another free software license?

Right now, I found
Kflop, that seems fine. It works under Qtopia, then it can be compiled to work under some embedded systems, and be used during the fly. Now is the moment to compile it, install and use it!

EU tells open source to start paying MS patent tax

I copy this title from a FFII press release. I cannot understand the position from the EU commission, neither the concrete position from the Commissioner itself. Who is able to imagine why this European instrument (and I need to remark, it is not elected) is not defending our interests. Furthermore, if the patents could be good or not for the industry (that I am not agree on it) who an European citizen likes to facilitate a foreigner company to be payed from us. Ok, maybe this is an European company with roots on USA.

By the way, if the software patents does not exist in Europe; why a company that operates in Europe has to pay a USA patent to another company (this one that I said has roots in the Estates).

Another turn of nut, the royalties about we are talking about works in the way of the interoperability! Ok, then I am understanding the EU commission antitrust measures impose a record fine to M$ and at the same time, this organism allows this company to smother other competitors, and indirectly help to pay the fine.

Some one can explaint to me?

Actualization: I send my questions to the Spanish ffii mail list from where I read the news. In the responses someone sends this link. I don't have work to express my disgust...

2007/10/22

Osciloscope Remote Gui

Today I solve my lasts problems in the oscilloscope Gui project. I have a running widget that is able to show two channels from an oscilloscope.

This PyTauiwi widget (PyQwt for the gui, and PyTauico for the Tango-cs comunication) that can be configured to draw to different spectrum values from Tango-ds. And with the other widgets that are already available I can produce a thin (and not spectacular) 'oscGUI' as a first iteration of the presentation layer in the Oscilloscope Remote Ctrl project. Second step, do some other PyTauiwi widgets to implement a human readable gui (similar to QtDSO) with buttons and knobs like you have in the realworld in front an oscilloscope...

2007/10/18

PyQwtBiPlot, my (first) PyTauiwi widget

It works!! Finally I improve enough my Python to modify the Fulvio's PyQwtPlot to draw to Tango spectrums attributes in the same plot.

As I wrote before, I need to plot at least to signals to be measured by the timing application. If you need to measure a signal propagation delay, or the jitter, you need to see both at the same time and scale to realize who late the electronics respond to an order.

Thinking in the future, this biplot is prepared to be improved as a multiplot. That is, it has a list of two curves and this value will be easily increased. The old 'FullAttributeName' that now is the spectrum attribute that it is wanted to show will be converted to a list of spectrum attibutes.

2007/10/10

The Tunnel

Take a look on this nice image! For me this is impressive... I
haven't words to say the emotion when I saw how this machine is constructed.

Actualization: This image from cells can disappear 'arbitrary', then a manual upload is necessary:

2007/10/03

Undulator (II)

Having the idea that this element is fundamental to create the synchrotron radiation, now when I am reading a little bit more about it this fundamentalism idea is having an increment.

The fundamental rule, from my point of view, about the undulators is that "any charge that experiences an acceleration will radiate electromagnetic waves". I found this drawing at my height that have one interesting detail: the author wrote "e^-, e^+, p^- beam", that is to say in other words everything that have charge that can be separated using a bending magnet.


This formula, from the Wikipedia undulator article, is specific for electron particle accelerators. But I ask my beamline boss about it, and the 'e' that here is the electron charge can be substituted by the inverse value if the accelerator works with positrons, but in this case the name of the machine is decelerator. And this type of machines should be also constructed to accelerate heavier particles like protons. Then the same formula is valid but then the 'e' parameter will be the proton charge, and the 'm_{e}' will be the proton rest mass.

Finally, in an ion collider like in the Cern, can use this same formula this an matter atomic nucleus, where the charge is positive (a nucleus is composed by protons and neutrons) and the rest mass will be much more heavier.

2007/09/27

Undulator

At the same time that I have attributions in the machine diagnostics at the accelerators division (this to work on the electron beam diagnostics in the alba synchrotron) I have some attributions in one beam line (this is the x-ray photon beam). Here everything has a beam...

Everything on a synchrotron accelerator was designed to the objective to produce the synchrotron light, but the element who is the last responsible to generate this light is the Undolator. Everything moves arround this element.

I do not like to transcribe what there are in the Wikipedia, it is enough with the link. But I want to profit to highlight something, because is here where is defined the brilliance of the beamline who will use this synchrotron x-rays. This is the element who decide witch is the most brilliant synchrotron.

Far from an older annotation here, that someone could have the (false) impression that the world synchrotrons have a competition to play again who have the most brilliant source or who have the most energetic electron beam; this is too far to the reality. The energies of the synchrotrons depends much more about the destination of this light that the number that it have.

Yes, everyone likes to have the biggest one, but at the same time you need to realize the they have less brilliant source for other applications. An the number of GeV of one synchrotron have a translation to money, and a more powerful undolator cost more money, then the brilliance have a cost on the facility finances...

Actualization: I want to say one thing more. I will tell something about the main instruments in a beamline, one by one. I found this image from the diamond synchrotron.

Oscilloscope GUI

After the underworld development we need to show the results to the world (users). There are two parts in the Tango device server development, the device server itself and a gui to show the results. Generically the developer has some tools to test the device like jive and atkpanel, but the enduser (scientific or operator) needs to have exactly the s/he need and nothing more.

As a first step, the users of this oscilloscope device server will have something to see (remotely) waht is measuring the oscilloscope.

2007/09/21

DESY - Petra III

One more synchrotron in the Tango comunity!

This week we had the Tango Meeting in
desy (Hamburg), mainly because one of the synchrotrons that they have is under a refactoring process and it will be controlled by Tango: Petra III. Their main characteristic that they say is that they will have the most brilliant x-ray source, as they say 100keV... (if I am not wrong, where in alba, we will have 65keV in the highest energy beamline).

The importance of this brilliance, depends only to the experiments. There are experiments that needs to be performed on a low energy beamline. Ones who at most they use a few thousands of eV. the value that claims more my attenction reading the petra web is that they have a 2'3km (storage) ring. Remember esrf have 844 perimeter meters. But I could not read anything about the electron energy that petra's will work.

Actualization: I am trying to find the storage ring energy that this Petra III will have, but the information that I have now is that Spring-8 have more brilliant high x-ray.

Actualization: Finally I found this value, and others, the Petra III synchrotron will work at 6 GeV.

2007/09/20

ni-visa command tree

The oscilloscope that I have to test the tango device server is a Tektronix DPO7245. This is a really powerful instrument who is able to calculate everything that I need in this development loop level. The only problem that I have is the documentation about TekVisa running under Gnu/Linux.

From the device server side, it have available the National Instruments library; and inside the instrument they put their Tektronix implementation. Ok, so far so good? No, the important point is visa is a way to do an abstraction of the GPIB commands and with it you can forget in the code if you are writing for a networked connection or under a gpib connector, then you need to know the GPIB commands. But where are the command tree for this oscilloscope series? Mmm... No where because the manufacturer does not provide this list in the TekVisa Programmer Manual! In this manual you only can find some minimal samples, and still worse some of this samples does not work with the linux implementation library!

After many unfruitful search time on Google my was close to the desperations... No one, and no where, is this command tree? Yes! Some one has made something for the 4000 series!

Now I have some reference to work. Some commands could change (because this standard is not much standard and the manufacturers implements some differences, even between the same manufacturer models!). With this, only one day is being enough to implement almost everything in this device server!

2007/09/18

I want to fly!

This afternoon I will start the small aircraft private pilot! After to many years doing alternative activities because I cannot be a professional helicopter pilot, finally I will do it as a hobby.

Why I am a computer scientist? Because I could not be a rescue pilot, that's easy! When I was 18 years old, the moment to do your live elections, and it has not be possible to be this specific type of pilot, I decide to change the options radically to computing. Some people say me to study to be a commercial pilot, but I don't want to drive a bus! There is a really huge difference between drive an ambulance than an a bus, isn't it?


This afternoon, I will start the last option: to fly as a hobby, privately, during my free time... This is a dream: fly by my self!

2007/09/09

Čerenkov radiation

After a couple of days out of service, and without write here, I am back to continue. Time that I have no write, but time that I read much things. Too much thing, that I create a directory in my bookmarks to remember every thing that I want to comment here.

To day is the day that I want to shape here my impression about the Čerenkov radiation. Because I am working in a place where the radiation is important, and this knowledge is interesting for the workers to be safety, I want information.

First of all I need to say, when I read the Wikipedia article about the Čerenkov radiation, I thought if the idea to paint the electrons in blue could have any relation. I don't know if this is common, but in my imagintation the electrons are always little blue spheric balls. Furthermore to the strings theory here my sphere idea is wrong in pro of a string loop vibrating on an eleven dimension world, the colouring idea is also wrong in practice because the blue colour is a photon wavelength of 475nm (like 49'6eV), and the electron is another kind of particle where the colour like we can see have no sense.

But did you ever read something about the quark colours? Really interesting to know something about why they use colours in a too small world where the colours as we say have no sense! (Danger of side splitting through laughter about the anticolours).

At last, why my mean confuse an idea of visible colours characteristic from the electromagnetic boson with in a lepton common particle?

2007/08/08

Pogo device server design


Really very often, the Tango-ds developers are using Pogo. This Tango tool is really useful when you are developing a Corba based application to control something inside the tango-cs. Reading this blog, meybe you are able about what I am talking about, in fact this is the blog intention.

As I explain en the last note, I am writing a remote control for oscilloscopes instrumentation. Specifically I have a DPO7254 to be controlled.

First of all, I decide what is important to be controlled from an oscilloscope. What do you think? Mainly, every thing that you can change if you are in front one of this instruments. But, what I need to prioritize!? Ok, in my notebook I wrote:

  • Vertical knobs & buttons
    • Offset, Volts/div, Channels,...
  • Horizontal knobs & buttons
    • Delay, Time/div,...
  • Trigger knobs & buttons
    • Autiomatic, edge, timeout, glitch,...
  • Wavepilot control knobs & buttons
  • load
    • 50Ω, 1MΩ


Refactoring the Tango device server

Long time working on this development, I am close to say this have a certain maturity. Yes, now I have more perspective of the problem, and I am faster to solve something.

In one hand, I have much more practice in the instrumentation commands. Yes, this is incredible world close to the absurdity. The manufacturers become of agreement to create an standard to the instrumentation control, but every one introduce some differences to the main branch to create a virtual dependence in the software development.


Whatever the manufacturers do, I want to control some instruments with transparency of them. I thought the bridge pattern will solve my problem between the different protocols that the manufacturers allow to use to control their instruments, but furthermore the named '
Abstraction classInstrumentation', maybe it is not enough. I think I will need a 'refined abstraction' to implement in the superclass what is general between manufacturers and in differentiate in this refination what is specific for one manufacturer.

By now we review the class diagram from right to left, and now we are able to see the left column, the main one for
tango-ds. In the sourceforge cvs there are not a device server about the oscilloscope instrument control, neither there are not a tango abstract class for this proposal. This is my task! I need to think very well what I write, it will be official!

2007/07/30

Non Crystalline Diffraction

What kind of experiments can we do in a synchrotron? As far as I know, the beam lines receive the synchrotron light as an X-ray photons. The energy of this light normally is lower that the one used in the common medicine x-ray 'to see yous bones'.

In a basic way, there are two types of beam lines in a synchrotron, doing this differentiation with the energy of the used x-rays. If the used x-rays are from the order of electronVolts (eV), this is a low energy beam line, but with the order of KiloelectronVolts (keV). Remember that, the light (photons), and the matter in general, can be described as punctual particles, like also can be described as an electromagnetic wave. What does it mean the x-ray energy? It means, at more energy, more wave frequency, and smaller things you have the possibility to see. But not for the all experimentation is interesting to have the highest energy.

Why I write this post? Because until now I only work in the synchrotron machine control, and now I have assigned one beam line to construct on it all the control software. Until now, my developments had sense in the machine electron beam section, the accelerator itself. But now, upper that this I will work with x-rays. 'My' beam line will be this 'Non Crystalline Diffraction', a 6.5keV to 13keV beam line.

An alternative differentiation between beam lines is how the experiment use the x-rays. That is like ask where are the experiment observer. In this beam line, that I dare to calling mine, take photographs of the diffracted light from the illuminated source. I will learn more about this type of beam lines, then I will write with a collection of knowledge (that I will have acquired).

2007/07/20

OpenMoko in Qemu

The last February, in fosdem, I discover the OpenMoko project. In my humble opinion, it is a great idea: a completely free mobile; an 'Open Mobile Komunications' free software. The hardware in the terms of the firmware, is also free; but I don't know if you can download the hardware specifications to allow you fabricate the hardware also. By the way, I have not knowledge of how to do that.

As far as I can do, following a WikiHowto, I am able to run the phone over qemu!


2007/07/18

Ni-Visa Spectrum acquisition

After everything, it works. I have been able to show the signal that one oscilloscope have in the channel 1, in the distributed system tango-ds. In the last post, I try to implement an observer design pattern, but this is not the feature that already works now. In one hand there will be situations when the user will likes to see the signal as if him or her be there in front, I my objective likes to minimize the network traffic.

But, if the user refresh period is lower than the period with the instrument refresh the signal, this produce more traffic than the necessary one! I will need both possibilities: subscribe and on demand.

Giving back to the bridge design, the Instrumentation class have a new method under the name
Instrumentation::getCapture(int channel,double **buffer). This will ask the oscilloscope for the current curve (the double's parameter) that it have. This have no subscrition, this will not do any thing else. If you want another one, ask again.

And what is the goal on this? Now, my tango device server is able to ask to a Tektronix oscilloscope (and only a Tektronix) about the signal that it have in one channel. You can see what the instrument measures, via the distributed system:


Actualization:
The last image was on ATKPanel (written in Java), but also we are working with PyTauico (provisional name):



2007/07/12

Ni-Visa Observer pattern

Some days a go, I wrote something about the bridge pattern, and about where I want to apply it on my control software development. Now I am witting the VISA class from the diagram that I propose, that is a subclass of the ControlEnvironment class, this is an implementation in the bridge pattern.

In the way to reduce the number of data transmisions, the ni-visa protocol allows to subscribe your proces to a handler, this is a new thread, who will do the read() operation only when something new is able to be transmitted. Further than this, I want to have shared memory segments in side the agent to minimize also the internals memmove().

But it does not work! The ni-visa library sends me an error when I am trying to do this subscription. Without copy the error handlering my procedure is:

VISA::VISA(char *instrName,int timeout){
    sprintf(_rsrcName,"TCPIP0::%s::INSTR\0",instrName);
    _timeout = timeout;
    _status = viOpenDefaultRM(&_defaultRM);
}


int VISA::Open(){
    _status = viOpen(_defaultRM, _rsrcName, VI_NULL, VI_NULL, &_instr);
    _status = viSetAttribute(_instr, VI_ATTR_TMO_VALUE, _timeout);
    viClear(_instr);
    return _status;
}


int VISA::Open(const unsigned int ch){
    if (shmMalloc(ch) != VI_SUCCESS) return -1;
    if (Handlering(ch)!= VI_SUCCESS) return -1;
    return 0;
}


ViStatus VISA::Handlering(unsigned int ch){
    ViEventType event=VI_EVENT_SERVICE_REQ;
    _status = viInstallHandler(_instr, event, callback, _bufferHandler[ch]);
    _status = viEnableEvent(_instr, event, VI_HNDLR, VI_NULL);
    _status = openAChannel(ch);
    return _status;
}


ViStatus VISA::openAChannel(const unsigned int ch){
    char cmd[MAX_CNT];
    memset(cmd,0,sizeof(cmd));
    sprintf(cmd,"READ:WAVFM:CH%d",ch);
    _status = viWrite(_instr, (ViByte*)cmd, strlen(cmd), &_retCount);
    return _status;
}


I Really don't know what I am doing wrong.

Actualization:
I am trying to communicate with the instrument asynchronous but without the handler. Only asking for the spectrum, and waiting for it to be served. The Open() method change and a new one appears under the name EnqueueRead().



int VISA::Open(const unsigned int ch){
    if (shmMalloc(ch) != VI_SUCCESS) return -1;
    if (EnqueueRead(ch)!= VI_SUCCESS) return -1;
    return 0;
}


ViStatus VISA::EnqueueRead(unsigned int ch){
    ViEventType event=VI_EVENT_IO_COMPLETION;
    _status = viEnableEvent(_instr,event,VI_QUEUE,VI_NULL);
    _status = openAChannel(ch);
    _status = viWaitOnEvent (_instr, event, _timeout, VI_NULL, VI_NULL);
    _status = viReadSTB(_instr,&stb);
    _status = viReadAsync(_instr,(ViBuf)_bufferHandler[ch],MAX_CNT,&jobID);
    _status = viDisableEvent(_instr,event,VI_QUEUE);
    return _status;
}


ViStatus VISA::openAChannel(const unsigned int ch){
    char cmd[MAX_CNT];
    memset(cmd,0,sizeof(cmd));
    sprintf(cmd,"READ:WAVFM:CH%d",ch);
    _status = viWrite(_instr, (ViByte*)cmd, strlen(cmd), &_retCount);
    return _status;
}


Actualization:
The question (problem, issue,...) has been send to Tektronix, and they redirect it to National Instruments...

2007/07/06

I had it at home and I didn't know it

In the cells web site, there are a section called About, and it has a subsection called What is a synchrotron ?, and this is really interesting because it is my plain explanation about what is this machine and what is it good for.

I wrote about the different sections this machine has, but with this image nothing more needs to be explained:

Yes, there are the four segments and the last one (the beam lines) are showed divided also with their subsegments.

In ALBA machine the Linac will works generating electrons this 100 MeV of energy. This electrons will provide the booster where the electron beam is accelerated close to the light speed, and then this beam is injected to the storage ring that is the real place where the synchrotron light is generated and this will goes to the beam line front end.


The main characteristic of the ALBA synchrotron is that the booster and the storage shares the tunnel. In the last image the booster are considerable smaller that the storage using a different tunnel. This is common in this machines, but the own one will reduce a maintenance cost using the same circular room for both.

2007/07/05

Language processors

After many years studying computer science, another step is close to be finished. This is incredible, I need like 7 years to study my bachelor degree to be a technical engineer, using the Spanish naming. An 2 years a go, I began the Master degree and I am only at one subject to finish it. Next September I want to pass it, and then I will work on the research project, indispensable step to obtain the title.

One subject to the end: Language processors, or in other words compilers. Lexical analyzers, the abstract syntax tree, and the semantics. As far as I know, it is close to the subject that I already study when I was on Erasmus in the Vrije Universiteït.

During this summer that I will do the practicum works of this subject, I will profit to explain something.

Bridge pattern

Giving a change to what I have written until now, I think I can go deep in my daily work. In the synchrotron I have some projects in control software development. One of this projects is one Tango device server development to do a remote control of Oscilloscopes. I said something a couple of days a go, here, but only superficially now is a moment to explain a little bit deeper.

The problem:
In the instrumentation remote control there are much protocols to do this control. This protocols will do the same but in different ways, and some of them have different layer levels of abstraction. For example, GPIB or VXI-11 are in the lowest layer level and some times you will depends to the current instrument. Upper layer I like to use a library with the VISA specifications, but this could be not easy.

There are one general specification, but the manufacturers creates control implementations close to it, but not exactly compliant with in it. That is to say, the basic functions should be work in the same way between manufacturers (this is the reason for being of this specs), but some instruments can implement some special functions (or not implement, some others). Then some manufacturers have theirs special libraries.

One possible pattern solution:
To solve my problem about the control of an instrument connected to the Tango control system by an agent of this distributed system, one possibility is separate the abstraction to the several possible implementations. The bridge pattern should be my solution. The agent knows about the problem abstraction with a class that have the need methods, and have a reference to the real environment that knows how to talk with the real instrument.

In the construction on the instrument abstraction, also is created an object of control.

This idea allows the agent to call the abstraction class methods where implemented functions are. In the contruction time the concrete control environment will be decided, but this is not mandatory. By now the abstraction works forever of its existence with the same ControlEnvirinment object, but anything forbids to do the open with VISA and after some methods moves it to one specific manufacturer VISA library.


Right now, there is implemented (and it works) the identification with the VXI-11 protocol and also with VISA. But the capture presents some challenges... After a non productive try to capture with vxi-11, I dedicate my efforts to the ni-VISA library. It presents some advantages, specially a callback subscription executed when new data are available. Any suggestion to 'move' this data from the VISA object to the Tek_DPO7254 without movement?

This is alive

I have been some days very busy and this blog has come of a little forgotten. By the way I didn't publish this blog to many people, then I must not have many readers.

Long time a go, one friend insist, again and again, that it could be interesting that I wrote a blog. I never take seriously this idea, but a student opportunity to go to Svalbard moves me to change the opinion and it becomes the begin of this project.

I am preparing to write something more interesting.

2007/06/25

What is a Synchrotron and what is it good for? (II)

In the last post, the subject question has not be answered. Yes, I wrote a 'to be continue', but it was many days a go. This week I want to answer this question in some deliveries.

Right now, the explained this is a general view of what is a synchrotron. But anything has not been said about what is a synchrotron good for. From the four machine parts explained in the last delivery, the fourth one, the beam line with the x-rays, is the one used for the experiments. That is to say, this is the one who create some results and over this one is where the wonders of this machine can be described. Externally, the synchrotron is the results extracted from theirs beam lines.

A synchrotron is a big machine to play with some wavelengths of light. Including the lengths of the visible light, a synchrotron can generate its special light against the hundred of thousands electronVolts. Iluminating objects with this light is how the experiments in a synchrotron does.

But this is not only the wavelength the parameter with the scientists works. More other parameters came to describe the matter from different points of view with the same light.

The brilliance of this light is the separator between the different generations that exist in this kind on machines.

We will come in deep, but in general lines, the synchrotron light sources are used in physics experimentation, in biology, in microelectronics and micro-mechanics, in pharmaceutical, and even in hairdressing and cosmetics industry.

2007/06/19

What is a Synchrotron and what is it good for?

To describe a synchrotron in one sentence, this will be ``a big machine to see small things´´. Or in other words a supermicroscope.

The anatomy of a synchrotron is hard as you wish, and a simple as the picture shows. In the center, you can see a straight blue line, who becomes in the small ring with a blue beam. This blue beam represents accelerated electrons. The first stage is the 'Linac', that is a gun shooter of fast electrons. This eletrons goes to the booster ring (the small one) where this beam is 'energized' to the need speed to be injected to the third stage.

Here arrives the interesting place. In the ring with many machines represented in the image, we call storage ring, is here the synchrotron light is generated an it's used for the experiments. The main difference between the booster and the storage should be resumed saying the first is to accelerate and the second is to maintain.

After this three machine stages we arrives to the synchrotron light. When the electron beam is bended in the ring to be in the orbit trajectory, some X-ray turn up in the tangent. This x-ray receive the name 'synchrotron light' and this is the necessary thing to have experiments in one machine like this.

To be continue...

We soon see ourselves

On Friday, one work colleague comes back towards home. His original work place is in the esrf, a big ring constructed in the French alps, close to the Montblanc, in Grenoble. This is a paradisaic place, not far from Switzerland.

Why, today, I am writting something about this colleague? Easy, we is a Tango core writer and during the time that we have coincided here in alba, he has been a reference in development (he will continue being it, but we couldn't go every morning to the bar together). Usually, when I have a doubt on a tango-ds design, I ask Manu about what thinks about the design pattern that I am thinking to use. (And also, I write to one friend and university professor in the UdL; but now I am exalting the figure of Manu :P).

The current design pattern I am using on the tango's device development is the bridge pattern. Depending from many things, the distributed system agent will use one low level protocol or another, but the agent doesn't need to know which one is on use. The agent only needs to know the operations to do, and in the execution time will be solved which low level protocol will be used.

With the bridge pattern, the agent should knows an object that it is an abstraction about the allowed low operations. And is this abstraction the one how knows the internals of how the things are made.

In agreement to the development advance, I will be explaining the design details...

2007/06/16

Broadening my intentions...

My intention is not to write every day, but always when you begins a project have this illusion then, today I want to write something. Like in the first post I said I will write about the machine here I am working, also the intention to write includes my other hobby: the cryptology.

A couple of years a go, I knew a research group in my university. Since my first year there, I meet interesting people with much knowledge in so many fields, not only on science (beyond the science). The result of this relation with the cryptology and graph group, at least was my research project. But after 3 years of this project publication, Ramiro and I continue with this development, picking up the satisfaction of the official recognition attaching out work in the main branch of GnuPG.

At the beginning of this month, one article about the cipher algorithm used in this elliptic curve implementation was accepted in a Spanish symposium. The article was written in Spanish, but the problem that is treated could be much more important and this article should be translated. Yes, I can and I will do, but contributions are always accepted.

Ok, summarizing. In this blog I will not only write about synchrotron machines, I will write something about cryptography. For this subject, the close season also is open...

2007/06/15

Opening the close season...

This will be my first experience in blogging, but I could be a good moment for me to write something here. Maybe this is the moment.

The idea that I have to write about in this blog is something related with science and something of software engineering. Why? Because I am a worker in a synchrotron, I am a control software engineer in one of this light source machines.


For a long time, I have been searching a job that has some sense. I belive in free software, and I had the dream to pay me bills writing free software. When accidentally I knew there exist some machines in the works that creates their free control software, I thought this could be a good place to work.


Here I will want to explain the things that seems interesting to me about this machines and about my contribution in the control distributed system that governs the machine. "My" machine is under construction, then this could be more interesting because where will appear the full construction process. But not all is created from scratch! This is free software! We base our control system in the one that some other synchrotron use and we became contributors to it. My role is to develop agents to live in this distributed control system.

I will explain more...