<commit_before># Gateway

The gateway is a simple lua script that connects to one or more terra networks. 
It listens to incoming data from the sensors using [tossam](http://www.inf.ufg.br/~brunoos/tossam/) and pushes 
it forward to the main application (terra-core) via a Publisher/Subscriber interface built with ZeroMQ.

##Simulation

Simulating a terra network is a work in progress and very experimental yet. 
A good way to start is downloading the [terra virtual machine](http://www.inf.puc-rio.br/~abranco/files/Terra/TerraNG_v0.3.0.ova) and
 checking out the python script at ~/TerraNG/sim/Net/TerraSim.py.
<commit_msg>update simulation readme<commit_after># Gateway

Gateway is a simple lua script that connects to one or more terra networks. 
It listens to incoming data from the sensors using [tossam](http://www.inf.ufg.br/~brunoos/tossam/) and pushes 
it forward to the main application (terra-core) via a Publisher/Subscriber interface built with ZeroMQ.

##Simulation

Simulating a terra network is a work in progress and very experimental yet. 
The Terra network is created on pre-configured Ubuntu VM and can be done by following the steps below:

1. Open the VM

2. Start the networks

```
    cd ~/TerraNG/sim/Net
    sh run.sh
```

3. Inject the "sendMsg" code into the nodes
```
    cd ~/terra-core/src/gateway/dia
    sh run-dia.sh
```

This will spawn 10 sensor networks in ports 9002 to 9012. 
Each network contains 3 sensors where one is the base station and the other two are ordinary nodes with IDs 11 and 4.

The VM is also configured to run on a static IP so it can be accessed externally by the Gateway or any other application. 
The default IP address is 192.168.1.115.a
{'fraction_non_alphanumeric': 0.06831228473019518, 'fraction_numerical': 0.01722158438576349, 'mean_word_length': 3.480719794344473, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7519223', 'n_tokens_mistral': 569, 'n_tokens_neox': 507, 'n_words': 240}