2019-11-20 18:53:56 +00:00
|
|
|
| [Home](/trick) → [Tutorial Home](Tutorial) → Recording Simulation Data |
|
2019-11-20 17:04:58 +00:00
|
|
|
|----------------------------------------------------------------------|
|
|
|
|
|
|
|
|
<!-- Section -->
|
|
|
|
<a id=recording-simulation-data></a>
|
|
|
|
## Recording Simulation Data
|
|
|
|
|
|
|
|
<a id=creating-a-data-recording-file-using-dre></a>
|
|
|
|
#### Creating A Data Recording File Using DRE
|
|
|
|
|
|
|
|
Recording data is possible when running real-time and non-real-time (as fast as
|
|
|
|
the computer will run). In order to record data, it is necessary to create a
|
|
|
|
"data recording file". You may create the file using a GUI called dre (data
|
|
|
|
recording editor --- aka Dr. Dre) or you may create it manually.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
% cd $HOME/trick_sims/SIM_cannon_analytic
|
|
|
|
% mkdir Modified_data
|
|
|
|
% trick-dre &
|
|
|
|
```
|
|
|
|
|
2019-11-20 18:53:56 +00:00
|
|
|
![Data Recording Editor](images/dre.png)
|
2019-11-20 17:04:58 +00:00
|
|
|
|
|
|
|
**Figure 3 - Data Recording Editor (dre)**
|
|
|
|
|
|
|
|
* **Step 1.** In the "DR Name" entry box, enter my_cannon.
|
|
|
|
* **Step 2.** In the "DR Cycle" entry box, change 0.1 to 0.01.
|
|
|
|
* **Step 3.** In the "Variables" pane, double-click dyn, then double-click cannon.
|
2022-12-02 20:55:40 +00:00
|
|
|
* **Step 4.** Double-click pos[2] and click OK. The result should result in dyn.cannon.pos[0]
|
2019-11-20 17:04:58 +00:00
|
|
|
and dyn.cannon.pos[1] appearing in the "Selected Variables" pane.
|
|
|
|
* **Step 5.** Choose File->Save. In the "Save" dialog, enter the file name
|
|
|
|
cannon.dr. Save cannon.dr in the Modified_data directory.
|
|
|
|
* **Step 6.** Exit dre.
|
|
|
|
|
|
|
|
Storing the data recording file `cannon.dr` into a directory called `Modified_data`
|
|
|
|
is not mandatory. It is just common convention. You may view `cannon.dr` it is a
|
|
|
|
text file.
|
|
|
|
|
|
|
|
<a id=running-the-simulation-and-recording-data></a>
|
|
|
|
#### Running The Simulation And Recording Data
|
|
|
|
|
|
|
|
The simulation must know about the data recording file created in the last
|
2022-12-02 20:55:40 +00:00
|
|
|
section. This is accomplished by adding exec to the simulation input file.
|
2019-11-20 17:04:58 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
% cd $HOME/trick_sims/SIM_cannon_analytic/RUN_test
|
|
|
|
% vi input.py
|
|
|
|
```
|
|
|
|
|
|
|
|
Add the line:
|
|
|
|
|
|
|
|
```python
|
2020-01-22 17:51:04 +00:00
|
|
|
exec(open("Modified_data/cannon.dr").read())
|
2019-11-20 17:04:58 +00:00
|
|
|
```
|
|
|
|
to the top of the `input.py` file and then save it.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
% cd ..
|
|
|
|
% ./S_main*.exe RUN_test/input.py
|
|
|
|
```
|
|
|
|
|
|
|
|
After the simulation runs, data will be dumped into the `RUN_test` directory.
|
|
|
|
The data, in this case, is recorded in binary form.
|
|
|
|
|
2019-11-20 18:53:56 +00:00
|
|
|
[Next Page](ATutPlottingData)
|