PC Simulator
With Movesense device library v1.7 it has become possible to develop sensor software using a "PC Simulator" build. The simulator provides many advantages (and some limitations) over "on sensor" development. The following pages will provide a small introduction on what the differences are and how they affect the development. To see how to the sensor software is built for Simulator, see the Getting Started document.
The simulator build creates a Windows executable that is based on the Movesense simulation framework. At this time the only supported environments for building and running the simulated sensor software are Visual Studio 2015 and 2017 on Microsoft Windows operating systems.
Differences
The major differences between Movesense app on sensor vs simulator are:
- Different Tick rate: Simulator runs on tick rate of 1000 Hz vs sensors 1024 Hz.
- No BLE: The simulator does not support BLE (it is not possible to build for example the ble_std_services -sample)
- Much larger memory: The simulator has hundreds of kB of free RAM memory
- CSV data source: It is possible to provide pre-recorded sensor data to simulator build with a csv-file (see below for detailed info)
- No 1Wire or Gear/Id: 1Wire and Gear/ID interfaces are not supported
- Different UTC time: When simulator build has started the UTC time is 1.1.1970
- No support for wakeup: Simulator does not simulate poweroff / wakeup functions
- System/States support: Simulator does not support most of /System/States
Accessing simulator
When the simulated sensor app is started it registers a whiteboard communication on TCP port 7809 (used to be 7044). This means that one can send Whiteboard requests to the sensor app using the wbcmd.exe and TCP port definition:
wbcmd.exe --port TCP127.0.0.1:7809 --path /Info
or to get the simulated accelerometer data:
wbcmd.exe --port TCP127.0.0.1:7809 --path /Meas/Acc/13 --op subscribe
Simulator also shows a simple UI that shows the tick counter and used/free RAM, current working directory (needed to place the sensor data csv's) as well as visual presentation of the analog switch (left square) and LED (right square).
Simulated sensor data
By default the simulator provides a simple sensor data (1G acceleration, no rotation, fixed magnetic field etc.). The simulator framework tries to open csv file for each sensor from the current working folder and if it finds a suitable csv files, it loads them and uses the data found in them. The names of the csv files are:
- accelerometer.csv: contains data for accelerometer, gyroscope and magnetometer
- ecg.csv: contains ECG data
- hr.csv: contains RR data for /Meas/HR
- temperature.csv: contains temperature data
Each csv file must be structured as follows:
- Header rows
- Column Headers
- Data rows
Header rows
The only supported header in v1.7.0 is the LoopingTimestamp which instructs the simulator to loop the sensor data at the specified time.
sample (repeats data after 60 seconds)
LoopingTimestamp:60000
Column headers
List of comma separated names for columns. The first column must be "Timestamp" which defines which relativeTime (ms) the data is provided. The rest of the columns are:
- /Meas/Acc/x: Accelerometer x-axis data [m/s^2]
- /Meas/Acc/y: Accelerometer y-axis data [m/s^2]
- /Meas/Acc/z: Accelerometer z-axis data [m/s^2]
- /Meas/Gyro/x: Gyroscope x-axis data [dps]
- /Meas/Gyro/y: Gyroscope y-axis data [dps]
- /Meas/Gyro/z: Gyroscope z-axis data [dps]
- /Meas/Magn/x: Magnetometer x-axis data [uT]
- /Meas/Magn/y: Magnetometer y-axis data [uT]
-
/Meas/Magn/z: Magnetometer z-axis data [uT]
-
/Meas/Temp: Temperature data [K]
-
/Meas/HR/RR: RR-interval [ms]
-
/Meas/ECG/{RequiredSampleRate}: ECG data
Data rows
After column headers the rows must contain the data values for each Timestamp separated by comma.