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
- Download AppBlocks Desktop from website
- Run installer
- Simulator included in desktop application
macOS
- Download AppBlocks Desktop for macOS
- Install application
- Grant necessary permissions
- Simulator ready to use
Linux
- Download AppBlocks Desktop for Linux
- Install dependencies
- Run application
- Simulator accessible
Starting the Simulator
From AppBlocks Designer
- Open your project
- Click Run menu
- Select Start Simulator
- Simulator window opens
Standalone Mode
- Launch AppBlocks Simulator application
- Select project file to load
- 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:
- Click on block in designer
- Set breakpoint
- Execution pauses at breakpoint
- 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:
- Test all execution paths
- Simulate error conditions
- Verify edge cases
- Test network failures
- Monitor resource usage
- Document test scenarios
- 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:
- Define sensor parameters
- Create value generation script
- Add to simulator configuration
Recorded Scenarios
Record and replay:
- Execute test scenario
- Record all inputs
- Save scenario
- Replay for testing
Automated Testing
Script automated tests:
- Define test sequence
- Set expected results
- Run automated validation
- Generate test reports
Keyboard Shortcuts
Speed up testing:
- Space: Play/Pause
- F10: Step
- Ctrl+R: Reset
- F5: Reload project