What is a Signal?
A Signal is the fundamental data structure in AveniECA that represents the state of a digital twin at a specific point in time. Every piece of information flowing through the system—whether streamed via Kafka or sent through the REST API—is represented as a Signal.Signal Structure
The Signal dataclass is defined inavenieca/data.py:24-29:
Field Descriptions
The state vector representing the current condition of the digital twin. This is a list of floating-point numbers that encode the twin’s state in multi-dimensional space.Examples:
- Temperature sensor:
[22.5] - RGB color:
[0.8, 0.3, 0.2] - Multi-sensor:
[temp, humidity, pressure]=[22.5, 65.0, 1013.25]
An evaluative or emotional assessment of the state, typically ranging from negative (undesirable) to positive (desirable). This cybernetic feedback helps the system learn which states are preferable.Examples:
- Comfortable temperature:
valence=10.0 - Overheating:
valence=-90.0 - Neutral state:
valence=0.0
A numeric ranking or importance value for this state. Often used to indicate the significance or priority of a particular state observation.Examples:
- Critical alert:
score=100 - Normal reading:
score=1 - Low priority:
score=0
Reference to an embedding input ID that provides semantic or contextual understanding of the state. This links the state vector to human-readable descriptions or natural language inputs.Use case: When
state=[25.0] represents a temperature, emb_inp might reference “Temperature reading from living room sensor at 2pm”Creating Signals
Basic Signal
The simplest signal contains just a state vector:Signal with Valence
Add evaluative feedback to help the system learn preferences:Complete Signal
Include all fields for maximum context:State Vectors Explained
What is a State Vector?
A state vector is a list of numbers that represents the condition of your digital twin in multi-dimensional space. Think of it as coordinates that uniquely identify where your twin is in its “state space.”Dimensionality
The number of elements in the state vector determines its dimensionality:- 1D: Single value like temperature
[22.5] - 2D: Two values like coordinates
[latitude, longitude] - 3D: Three values like RGB color
[red, green, blue] - N-D: Any number of values representing complex state
Design Considerations
Valence: The Cybernetic Feedback
Purpose of Valence
Valence provides evaluative feedback that helps the system understand which states are desirable. This is a key component of the cybernetic aspect of the ECA model—the system learns from feedback loops.Valence Ranges
While valence can be any float value, common patterns include:- Positive valence (+1 to +100): Desirable states
- Zero valence (0): Neutral states
- Negative valence (-1 to -100): Undesirable states
Real-World Examples
Score: Ranking State Importance
Purpose of Score
The score field allows you to rank or prioritize different state observations. Higher scores typically indicate more important or significant states.Common Use Cases
- Time-based priority: More recent observations get higher scores
- Event significance: Critical events get higher scores than routine ones
- Confidence levels: More certain measurements get higher scores
- Business priority: States affecting business KPIs get higher scores
Example: Alert System
Embedding Inputs
Theemb_inp field creates a link between numeric state vectors and semantic, human-readable information through the embedding system.
How It Works
-
Create an embedding input with natural language description:
-
Reference it in your signal:
-
Retrieve semantic information when querying:
Streaming Signals
Continuous Streaming
Use theStream producer for continuous state updates:
Event-Based Signals
Use theEvent producer for one-time or triggered signals:
Signal Utilities
AveniECA provides utility functions for working with signals from Kafka:Best Practices
Maintain Consistent State Dimensions
Maintain Consistent State Dimensions
All signals for a given
module_id should have the same state vector dimensionality and component order. This ensures the system can properly learn patterns and make predictions.Use Meaningful Valence Values
Use Meaningful Valence Values
Valence should reflect genuine preferences or assessments. Don’t use random values—the system learns from this feedback to understand which states are desirable.
Normalize State Values
Normalize State Values
Consider normalizing state values to similar ranges (e.g., 0-1 or -1 to 1) to prevent any single component from dominating the state vector.
Include Context via Embeddings
Include Context via Embeddings
For complex systems, use
emb_inp to link state vectors to human-readable descriptions. This makes debugging easier and enables semantic queries.Next Steps
Digital Twins
Learn how signals flow to digital twins
Streaming Guide
Stream signals via Kafka
API Reference
Complete Signal API documentation