The following figure shows how this IoT simulator works.
All the arrows in the figure represents Socket Connections in the network. Multiple sensors send data to one aggregator. The aggregator uploads the data to the cloud. Currently there is only one aggregator and one cloud server.
Sensors can be configured to send certain amount of data to the aggregator with fixed intervals.
The aggregator collect the data from all the sensors and attach time-stamps to each data item received from them. It saves these data items to a upload buffer. The upload buffer uploads the data to the cloud server. Currently, only one upload policy is implemented, which is upload as soon as possible.
The cloud server receives data from the aggregator and insert into the database. Currently, it is not connected to the database.
The only way to configure this project is to use a config file which is a .json file. There are four items in the json file, which are shown in the following table.
- byteNum: The number of bytes in each data item.
- intervalLength: The time interval between sending two data items.
- itemNum: The total number of items send by a sensor.
- sensorNum: The number of sensors connected to the aggregator.
If you want to change the IP address or the port, you need to dive into common.PortInfo to change it.
- Add two more uploading policies to the aggregator.
- Connect the project with influxDB.
- Add a class which encloses all the steps needed to start each part of the project.
- Let the cloud can connect to multiple aggregators.
- Enable aggregators to upload data to an aggregator.