This is an old revision of the document!
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:
To send and receive data, the functors under the 'External Communication' folder in the Library can be used.
R Studio
The following packages are necessary for sending and receiving data using R. To install the packages, do:
install.packages(c("Rcpp", "RcppProgress", "rbenchmark", "inline"))
Then, install R Tools from https://cran.r-project.org/bin/windows/Rtools/
Download Dinamica Package for R and install it (using RStudio):
Tools -> Install Packages...
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:
Dinamica::openSession("DinamicaEGO") # "DinamicaEGO" is the session name.
To Send and Receive Data
To send a number (e.g. 3.14):
Dinamica::sendNumber(3.14);
To receive a number:
myNumber <- Dinamica::receiveNumber(); # Will receive a number in myNumber variable
To send a list of numbers (e.g. [1,10]):
Dinamica::sendNumberVector(c(1,10)); # Sends 1,2,3,4,5,6,7,8,9,10
To receive a list of numbers:
myList <- Dinamica::receiveNumberVector(); # Will receive a list of numbers in myList variable.
To send a lookup table (e.g. 1 → 2; 2 → 3; 3 → 4):
lookupTable <- list(keys = c(1,3), values = c(2,4)); Dinamica::sendLookupTable(lookupTable$keys, lookupTable$values); # Send 1 -> 2; 2-> 3; 3->4
To receive a lookup table:
myLUT <- Dinamica::receiveLookupTable(); # Will receive a lookup table in myLUT variable.
To send a string (e.g. “testing!”):
Dinamica::sendString("testing!"); # Send "testing!"
To receive a string:
myString <- Dinamica::receiveString(); # Will receive a string in myString variable.