Skip to main content

Device Simulator

The AppBlocks Device Simulator allows you to test and debug your applications without physical hardware. This is essential for rapid development and testing.

Overview​

The simulator provides:

  • Virtual device environment
  • Simulated sensors and GPIO
  • Network connectivity testing
  • Real-time application execution
  • Debug and monitoring tools

Installation​

Windows​

  1. Download AppBlocks Desktop from website
  2. Run installer
  3. Simulator included in desktop application

macOS​

  1. Download AppBlocks Desktop for macOS
  2. Install application
  3. Grant necessary permissions
  4. Simulator ready to use

Linux​

  1. Download AppBlocks Desktop for Linux
  2. Install dependencies
  3. Run application
  4. Simulator accessible

Starting the Simulator​

From AppBlocks Designer​

  1. Open your project
  2. Click Run menu
  3. Select Start Simulator
  4. Simulator window opens

Standalone Mode​

  1. Launch AppBlocks Simulator application
  2. Select project file to load
  3. Click Start

Simulator Interface​

Main Window​

  • Device Display: Shows simulated device
  • Console Output: Debug messages and logs
  • Variable Inspector: Monitor variable values
  • Control Panel: Simulate inputs

Controls​

  • Play/Pause: Start/stop execution
  • Step: Execute one step at a time
  • Reset: Restart simulation
  • Speed: Adjust simulation speed

Simulated Hardware​

GPIO Pins​

  • Virtual input/output pins
  • Click to toggle input states
  • View output states in real-time
  • Configurable pull-up/pull-down

Sensors​

  • Temperature: Slider to adjust value
  • Humidity: Slider control
  • Pressure: Adjustable reading
  • Motion: Toggle detection
  • Custom sensors: Configurable

Displays​

  • LCD/OLED display simulation
  • Shows actual content
  • Interactive when applicable

Network​

  • Simulated WiFi connection
  • Internet connectivity
  • Local network services
  • Configurable network conditions

Testing Features​

Input Simulation​

Generate test inputs:

- Button clicks
- Sensor value changes
- Network events
- Timer triggers

Output Monitoring​

Monitor outputs:

- GPIO state changes
- Display updates
- Network messages
- Log entries

Breakpoints​

Set breakpoints:

  1. Click on block in designer
  2. Set breakpoint
  3. Execution pauses at breakpoint
  4. Inspect variables and state

Variable Inspection​

Monitor variables:

  • View all variable values
  • Watch variable changes
  • Edit values during execution
  • Export variable logs

Network Simulation​

MQTT Testing​

  • Built-in MQTT broker
  • Or connect to external broker
  • Monitor published/subscribed messages
  • Simulate network delays

HTTP Testing​

  • Simulated HTTP server/client
  • Test API endpoints
  • View requests/responses
  • Simulate errors

Socket Communication​

  • Test TCP/IP sockets
  • Simulate client/server
  • Monitor data flow

Debugging​

Console Output​

View debug information:

- Debug print messages
- Error messages
- System events
- Execution flow

Execution Trace​

Track execution:

  • See which blocks execute
  • Timing information
  • Flow visualization
  • Performance metrics

Error Detection​

Simulator detects:

  • Logic errors
  • Invalid configurations
  • Resource conflicts
  • Potential runtime issues

Use Cases​

Development​

  • Test logic before deploying to hardware
  • Rapid iteration and testing
  • Try different scenarios quickly
  • Validate complex flows

Training​

  • Learn AppBlocks without hardware
  • Experiment safely
  • Follow tutorials
  • Practice application design

Demonstration​

  • Show applications to clients
  • Present concepts
  • Training materials
  • Sales demos

Testing​

  • Unit test individual blocks
  • Integration testing
  • Stress testing
  • Edge case validation

Limitations​

Simulator limitations:

  • Timing may differ from real hardware
  • Some hardware-specific features unavailable
  • Performance not representative
  • Real-world interference not simulated
  • Physical constraints not enforced

Always test on actual hardware before deployment.

Configuration​

Simulator Settings​

Configure simulation:

  • Execution Speed: Real-time or accelerated
  • Hardware Model: Choose device to simulate
  • Network Conditions: Latency, bandwidth, reliability
  • Random Failures: Test error handling

Hardware Selection​

Choose simulated hardware:

  • TPS (Tibbo Project System) models
  • Custom hardware configurations
  • Sensor configurations
  • I/O pin mappings

Scenarios​

Create test scenarios:

Scenario 1: Normal Operation​

- Sensors at nominal values
- Normal network connectivity
- All hardware functioning

Scenario 2: Network Failure​

- Simulate network disconnect
- Test offline behavior
- Verify reconnection logic

Scenario 3: Sensor Failures​

- Invalid sensor readings
- Sensor disconnection
- Out-of-range values

Scenario 4: Load Testing​

- High message rates
- Many simultaneous operations
- Resource constraints

Best Practices​

Simulator best practices:

  1. Test all execution paths
  2. Simulate error conditions
  3. Verify edge cases
  4. Test network failures
  5. Monitor resource usage
  6. Document test scenarios
  7. Always final test on hardware

Troubleshooting​

Common simulator issues:

  • Application won't start: Check project configuration
  • Sensors not responding: Verify sensor setup
  • Network not working: Check simulator network settings
  • Slow execution: Adjust execution speed

Integration with Designer​

Seamless integration:

  • One-click start from designer
  • Automatic project sync
  • Live debugging
  • Hot reload during development

Advanced Features​

Custom Sensors​

Add custom simulated sensors:

  1. Define sensor parameters
  2. Create value generation script
  3. Add to simulator configuration

Recorded Scenarios​

Record and replay:

  1. Execute test scenario
  2. Record all inputs
  3. Save scenario
  4. Replay for testing

Automated Testing​

Script automated tests:

  1. Define test sequence
  2. Set expected results
  3. Run automated validation
  4. Generate test reports

Keyboard Shortcuts​

Speed up testing:

  • Space: Play/Pause
  • F10: Step
  • Ctrl+R: Reset
  • F5: Reload project

See Also​