<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div><div>On Mar 14, 2012, at 5:21 PM, CGS wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<br><br>Firstly, I am glad to see physicists getting interest in Erlang.<br><br>I see Erlang best usage in physics in few fields from Astrophysics/Astroparticle Physics/Elementary Particle Physics:<br>1. GRID;<br>2. integrated in the readout of an array of detectors for atmospheric showers,<br></blockquote><div><br></div><div>Very true, these are great test cases for Erlang. EPICS is a project that accelerator folks wrote a long time ago (and still use and maintain to an extent)</div><div>that I think is a no-brainer application for Erlang: <a href="http://www.aps.anl.gov/epics/">http://www.aps.anl.gov/epics/</a>. It is written in C and forms a distributed data acquisition system.</div><div><br></div><blockquote type="cite">but there are few fields in which Erlang still cannot replace C/C++ (or Verilog in some cases):<br>1. accelerator (high and medium energy) physics (high frequency readout may not be compatible with Erlang, or vice-versa);</blockquote><blockquote type="cite">
2. Monte Carlo simulations (even if it provides nice concurrency and code hot swap, it lacks some quite important characteristics).</blockquote><blockquote type="cite"><br>There may be some other fields from physics where Erlang may be suitable (except for communications for which is intended), but I am not the person to speak about. Nevertheless, it's good to know Erlang enters the above mentioned fields.<br>
<br>Good luck!<br>CGS<br><br><br><br><br><div class="gmail_quote">On Wed, Mar 14, 2012 at 4:33 PM, Pablo Platt <span dir="ltr"><<a href="mailto:pablo.platt@yahoo.com">pablo.platt@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">>which the device module (in this case hp8340b) translates into the GPIB command "OPCW", and based on the<br>
>device address (which is governed by the atom in the first argument), dispatches it over a bus handle that it owns<br>
>in a state variable via bus:send_query/2. <br>
<br>
</div>Can you explain how the device module translate to the GPIB command "OPCW"?<br>
Is it pure erlang?<br>
Maybe you can share some code?<br>
<br>
Thanks<br>
<br>
<br>
<br>
<br>
________________________________<br>
From: Jared Kofron <<a href="mailto:jared.nance@gmail.com">jared.nance@gmail.com</a>><br>
To: Erlang Questions <<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>><br>
Sent: Wednesday, March 14, 2012 1:43 AM<br>
<div><div></div><div class="h5">Subject: Re: [erlang-questions] Erlang meets physics<br>
<br>
<br>
Hi Pablo-<br>
My first project was on embedded hardware, and basically consisted of NIFs and Webmachine dispatching.<br>
Pretty fun stuff. <br>
<br>
My current project is a little more involved, but is also pretty interesting:<br>
<br>
Right now the bus over which communication takes place is abstracted away by having hardware modules<br>
which translate API functions into their appropriate wire representation and then transmit those representations<br>
over a handle that they have to the correct bus. <br>
<br>
In essence what I've done is taken instruments and buses and given them something like behaviors. <br>
Hardware can perform read,write,or configure, for example. So if I want to read the center frequency of a sweeper,<br>
I might say<br>
<br>
hp8340b:read(high_frequency_sweeper,<<"cw_freq">>).<br>
<br>
which the device module (in this case hp8340b) translates into the GPIB command "OPCW", and based on the<br>
device address (which is governed by the atom in the first argument), dispatches it over a bus handle that it owns<br>
in a state variable via bus:send_query/2. <br>
<br>
At the moment, we only communicate with things over GPIB via ethernet using prologix devices to do the translation<br>
for us - basically glorified telnet - but it gets the job done. Everything is in a very alpha stage right now for this project,<br>
but it is working really nicely so far.<br>
<br>
JK<br>
<br>
On Mar 13, 2012, at 12:20 PM, Pablo Platt wrote:<br>
<br>
How do you interact with the hardware?<br>
>Do you use GPIB C libr and wrap it with a NIF?<br>
><br>
><br>
><br>
>________________________________<br>
> From: Joe Armstrong <<a href="mailto:erlang@gmail.com">erlang@gmail.com</a>><br>
>To: Jared Kofron <<a href="mailto:jared.nance@gmail.com">jared.nance@gmail.com</a>><br>
>Cc: Erlang Questions <<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>><br>
>Sent: Tuesday, March 13, 2012 12:34 PM<br>
>Subject: Re: [erlang-questions] Erlang meets physics<br>
><br>
>Great news - spread the word !<br>
><br>
>Just for the record Erlang programmers numbers 1 and 2 (ie myself and<br>
>Robert Virding)<br>
>are both ex physicists.<br>
><br>
>When I lecture I often point out the similarity between causality and<br>
>message reception.<br>
>You don't know that something has happened until you get a message<br>
>telling that it has happened.<br>
><br>
>(In physics it's a ray of light, or a photon, or something -<br>
>forgetting entanglement for the moment)<br>
><br>
>In computing it's the reception of a message.<br>
><br>
>As a ex physicist I know that we can't say anything about simultaneous<br>
>events occurring<br>
>at different places in space-time - turn this into computer science<br>
>and the same arguments<br>
>apply to things like making sure replicated data is consistent on<br>
>remote sites - well you can't<br>
>- at least if you want to change it - Brewer's CAP theorem applies -<br>
>which for a physicist makes<br>
>perfect sense.<br>
><br>
>Also as an ex physicist<br>
I realize that things do actually happen in<br>
>parallel in the real world,<br>
>so modelling them in a sequential programming language (if I wanted to do that)<br>
>is big time crazy - just describe the parallel stuff in a concurrent<br>
>language and the program<br>
>writes itself. Wait a few years till we have million core computers<br>
>and the parallel problems<br>
>can be solved 1:1 on parallel computers - and programming simulations<br>
>and so on will be<br>
>really easy - but don't even think about doing it in a sequential language...<br>
><br>
>Cheers<br>
><br>
>/Joe<br>
><br>
><br>
>On Mon, Mar 12, 2012 at 2:34 AM, Jared Kofron <<a href="mailto:jared.nance@gmail.com">jared.nance@gmail.com</a>> wrote:<br>
>> Hi All,<br>
>> I've been using Erlang at work for a few years now, and I thought I'd throw my experience out there, as<br>
>> my application is a little different than what you usually see on the list - I am a graduate<br>
student at the<br>
>> Center for Nuclear Physics and Astrophysics at the University of Washington, and use Erlang extensively<br>
>> in my work.<br>
>><br>
>> In my experience, something that Erlang is really great at but doesn't receive much attention for these days<br>
>> is managing and interacting with hardware. In any physics experiment of even modest sizes, you wind up<br>
>> having to keep track of the state of various pieces of equipment, often modify that state, and constantly<br>
>> interrogate particular values. For example, we might want to change the current in a magnetic trap, turn<br>
>> that trap off altogether, or simply read back the voltage drop across our superconducting magnet.<br>
>><br>
>> So far, I have deployed Erlang in this zone for two separate experiments (SNO+, a large particle physics<br>
>> experiment in Canada) and Project 8 (a small nuclear physics experiment here in Seattle). Both times<br>
have<br>
>> been great successes, and I have found the reception of Erlang in this market to be great. In general, what<br>
>> I have done is wrap a hardware management layer with some kind of outside world interface. For SNO+, we<br>
>> used Webmachine and RESTful control, and for Project 8 we actually conduct all communication<br>
>> by using CouchDB as a message passing interface.<br>
>><br>
>> Physicists are suspicious creatures, but once you demonstrate the feature set that you get for practically<br>
>> free with OTP, they see the advantage pretty quickly. On top of that, the development cycle for sophisticated<br>
>> applications can be greatly reduced - more than once it made my group float to the top in terms of meeting<br>
>> goals.<br>
>><br>
>> In short, as far as I am concerned, Erlang has found a new niche in the world of Physics, and I intend to<br>
>> spread the word as much as I can!<br>
>><br>
>> Jared<br>
Kofron<br>
>> _______________________________________________<br>
>> erlang-questions mailing list<br>
>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
>> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
>_______________________________________________<br>
>erlang-questions mailing list<br>
><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
><a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>
><br>
><br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br>
_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>http://erlang.org/mailman/listinfo/erlang-questions<br></blockquote></div><br></body></html>