Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
externalcommunication [2016/10/25 20:15] romulo |
— (current) | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== External Communication ====== | ||
| - | |||
| - | Dinamica EGO can communicate with external applications by exposing a communication session. By default, an opened session will be created and its name is displayed on the status bar: | ||
| - | |||
| - | {{:statusbar_external.png|}} | ||
| - | |||
| - | To send and receive data, the functors under the 'External Communication' folder in the Library can be used.\\ | ||
| - | |||
| - | {{::externalcommfunctors.png|}} | ||
| - | |||
| - | <note important>If the status bar shows 'External communication: off', check the Message Log for more information.</note> | ||
| - | |||
| - | |||
| - | ==== R Studio ==== | ||
| - | The following packages are necessary for sending and receiving data using R. To install the packages, do: | ||
| - | <code> | ||
| - | install.packages(c("Rcpp", "RcppProgress", "rbenchmark", "inline")) | ||
| - | </code> | ||
| - | \\ | ||
| - | Then, install R Tools from [[https://cran.r-project.org/bin/windows/Rtools/]] \\ | ||
| - | \\ | ||
| - | Download {{::dinamica_1.0.tar.gz|Dinamica Package for R}} and install it (using RStudio): | ||
| - | <code> | ||
| - | Tools -> Install Packages... | ||
| - | </code> | ||
| - | \\ | ||
| - | === Documentation === | ||
| - | The Dinamica R package contains all the documentation available on this page, including examples and R Studio references. | ||
| - | |||
| - | === Session === | ||
| - | To connect to an existing session: | ||
| - | <code> | ||
| - | Dinamica::openSession("DinamicaEGO") # "DinamicaEGO" is the session name. | ||
| - | </code> | ||
| - | \\ | ||
| - | === To Send and Receive Data === | ||
| - | To send a number (e.g. 3.14): | ||
| - | <code> | ||
| - | Dinamica::sendNumber(3.14); | ||
| - | </code> | ||
| - | \\ | ||
| - | To receive a number: | ||
| - | <code> | ||
| - | myNumber <- Dinamica::receiveNumber(); # Will receive a number in myNumber variable | ||
| - | </code> | ||
| - | |||
| - | \\ | ||
| - | To send a list of numbers (e.g. [1,10]): | ||
| - | <code> | ||
| - | Dinamica::sendNumberVector(c(1,10)); # Sends 1,2,3,4,5,6,7,8,9,10 | ||
| - | </code> | ||
| - | \\ | ||
| - | To receive a list of numbers: | ||
| - | <code> | ||
| - | myList <- Dinamica::receiveNumberVector(); # Will receive a list of numbers in myList variable. | ||
| - | </code> | ||
| - | \\ | ||
| - | To send a lookup table (e.g. 1 -> 2; 2 -> 3; 3 -> 4): | ||
| - | <code> | ||
| - | lookupTable <- list(keys = c(1,3), values = c(2,4)); | ||
| - | Dinamica::sendLookupTable(lookupTable$keys, lookupTable$values); # Send 1 -> 2; 2-> 3; 3->4 | ||
| - | </code> | ||
| - | \\ | ||
| - | To receive a lookup table: | ||
| - | <code> | ||
| - | myLUT <- Dinamica::receiveLookupTable(); # Will receive a lookup table in myLUT variable. | ||
| - | </code> | ||
| - | \\ | ||
| - | To send a string (e.g. "testing!"): | ||
| - | <code> | ||
| - | Dinamica::sendString("testing!"); # Send "testing!" | ||
| - | </code> | ||
| - | \\ | ||
| - | To receive a string: | ||
| - | <code> | ||
| - | myString <- Dinamica::receiveString(); # Will receive a string in myString variable. | ||
| - | </code> | ||
| - | \\ | ||