<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Pablo-</div><div>My first project was on embedded hardware, and basically consisted of NIFs and Webmachine dispatching.</div><div>Pretty fun stuff. </div><div><br></div><div>My current project is a little more involved, but is also pretty interesting:</div><div><br></div><div>Right now the bus over which communication takes place is abstracted away by having hardware modules</div><div>which translate API functions into their appropriate wire representation and then transmit those representations</div><div>over a handle that they have to the correct bus. </div><div><br></div><div>In essence what I've done is taken instruments and buses and given them something like behaviors. </div><div>Hardware can perform read,write,or configure, for example. So if I want to read the center frequency of a sweeper,</div><div>I might say</div><div><br></div><div>hp8340b:read(high_frequency_sweeper,<<"cw_freq">>).</div><div><br></div><div>which the device module (in this case hp8340b) translates into the GPIB command "OPCW", and based on the</div><div>device address (which is governed by the atom in the first argument), dispatches it over a bus handle that it owns</div><div>in a state variable via bus:send_query/2. </div><div><br></div><div>At the moment, we only communicate with things over GPIB via ethernet using prologix devices to do the translation</div><div>for us - basically glorified telnet - but it gets the job done. Everything is in a very alpha stage right now for this project,</div><div>but it is working really nicely so far.</div><div><br></div><div>JK</div><br><div><div>On Mar 13, 2012, at 12:20 PM, Pablo Platt wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><span>How do you interact with the hardware?</span></div><div><span>Do you use GPIB C libr and wrap it with a NIF?</span></div><div><br></div> <div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Joe Armstrong <<a href="mailto:erlang@gmail.com">erlang@gmail.com</a>><br> <b><span style="font-weight: bold;">To:</span></b> Jared Kofron <<a href="mailto:jared.nance@gmail.com">jared.nance@gmail.com</a>> <br><b><span style="font-weight: bold;">Cc:</span></b> Erlang Questions <<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>> <br> <b><span style="font-weight: bold;">Sent:</span></b> Tuesday, March 13, 2012 12:34 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [erlang-questions] Erlang meets
physics<br> </font> </div> <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
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 ymailto="mailto:jared.nance@gmail.com" 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
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
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
Kofron<br>> _______________________________________________<br>> erlang-questions mailing list<br>> <a ymailto="mailto:erlang-questions@erlang.org" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>> <a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br>_______________________________________________<br>erlang-questions mailing list<br><a ymailto="mailto:erlang-questions@erlang.org" 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> </div> </div> </div></div></blockquote></div><br></body></html>