Basic Concepts
How to Model a System?
The world is thought to consist of three types of subjects that interact with one another:
- Actors
- Relations between actors
- Spaces
In HoloBit, these concepts are represented as three entities:
- For a DeFi trading system, there are three types of agents: traders, liquidity providers, and decentralized exchanges (DEX).
- In a classic cellular automaton model, many cells make up a grid representing a two-dimensional discrete space. Each cell updates its state based on the states of its neighbors.
- The three-body problem features three agents, each representing a moving star, plus a cell space that models the space of their orbits.
- A Web3 memecoin project might include users as agents and their social networks as links. Users can boost acceptance by sharing memes through these connections.
- A grassland ecosystem might include cells representing grassland, showing behaviors like growth and carrying properties like color, and agents representing sheep, exhibiting grazing behavior and carrying properties like age. Additionally, these sheep agents are linked by family ties, illustrating the connections among individuals in the ecosystem.
Using HoloBit to build a system model is as easy as drag-and-drop. Select your entities and place them on the canvas to see how they interact!
Key Components of a Complete Model
Models consist of entities, data components, and (global) processes. They may also incorporate assistive objects like charts to enhance human-computer interaction.
In a DeFi trading system, for example, you might have the following components:
- 1 Data Component: ETH price (a global variable)
- 2 Behavioral Entities: Two agents — Traders and DEX
- 2.1 Processes: The behaviors or actions of Traders and DEX
- 3 Charts: Visual representations of data and activity
Entities
- Entities are the fundamental subjects in a system simulation model in HoloBit, characterized by their properties and behaviors. There are three main types of entities: Agents, Cells, and Links.
- Processes represents behavior that can be specific to an entity or global. By dragging and dropping the Process component onto an entity's internal canvas, you can create a behavior specific to that entity. However, if you place the Process component on the model's root canvas, it creates global behavior.
- Data components represent properties associated with an entity or applied globally. These properties can be created by dragging and dropping them onto the internal canvas of an entity, thereby defining the object's properties. If these elements are positioned on the model's root canvas, they can be applied globally.
Basic Syntax
About Canvas
- Building a model involves dragging and dropping various components onto the canvas and configuring their properties.
- Different canvases must follow the corresponding rules based on their syntactic properties.
- There are currently three main types of canvases available in models: Root canvas, Entity internal canvas, and Process internal canvas.
- The Block canvas defines blocks, with syntax identical to the Model canvas. However, the entity type the Root Canvas represents varies based on the block type.
Graphical Modeling Syntax
Each type of canvas follows specific rules for placing and configuring components. Here's a concise overview:
- Data components can be placed on any canvas, with their scope and impact varying by location:
- When variables and containers are placed on the root canvas, they represent global states or parameters.
- If placed within an entity, they define the properties of that entity.
- When placed within a process, they can represent local states within that process or interfaces of the process.
- Root Canvas: This is the main canvas where you can place entities or processes to define global (observer) behavior and properties.
- Entity Internal Canvas: This is the internal canvas of an entity where you can place processes to represent the creation of behaviors of entities. It is also possible to position similar objects to signify inheritance among entities.
- Process Internal Canvas: This is the internal canvas of a process where you can place process components to construct process logic.
- Both the model canvas and the block canvas adhere to the aforementioned principles.
State Access
- Every data object within a canvas has its own specific scope. These scopes follow a principle where a higher layer scope can directly access a lower layer one. This means that an inner scope can directly read from and write into data component objects within an outer scope. For instance, within an Agent entity's canvas in a model, you can call variables from the root canvas.
- The Data Components chapter provides more details about the scope and access rules for data objects.
- The rules for Process Interfaces and Data Passing are detailed in the relevant chapter.
Running Simulations
- The system updates its state with each simulation "tick."
- Once all entities have completed their actions within a tick, the system proceeds to the next tick.
- For a more detailed understanding, please refer to the Running a Simulation chapter.
A simulation "tick" is a time unit in a simulation system. Along with entities, it forms a spatial-temporal system that considers both space and time.
Blocks
- Blocks are custom units, predefined using system components, to facilitate modeling.
- A Block acts as a definition or a template. When you drag a Block onto the canvas, you create an instance of that Block.
The components provided by the system can also be understood as "definitions", with instances being created when placed on the canvas.
- User-modeled Entities and Processes can be saved as blocks and stored in your workspace's library.
- Each workspace on Holobit has its own library, which includes not only the blocks but also the global tag sets, making them readily available for all workspace members.
- Blocks are often created from frequently used or functionally distinct components to enhance modeling efficiency.
- Once a block instance is created, its structure, including components and their connections, is locked and matches the definition exactly. While you can adjust the instance's properties, any modifications are restricted unless the instance is converted back to a standard form through the unblock process. The properties of block instances and their internal component objects can be modified.
- When modeling, a single block definition can be used as multiple instances. This applies to any model within the current workspace.
- Block definition updates do not automatically apply to block instances already deployed in the model. Therefore, there is no need to be concerned about any potential issues impacting the model's running. To update an instance to the latest version of its Block definition, right-click the instance and select Update. After updating, you should always verify your model to ensure it functions as expected.
- In the model, block instances contain all necessary information; they are informationally complete. Therefore, even if the corresponding definitions are deleted, the model can still operate normally, but the block instances will no longer point to the original definitions.
Blocks in the HoloBit Marketplace can also be directly used as model instances, pointing to the original definitions in Marketplace.
Tags (Sets)
-
Tags
These are user-defined, globally enumerable values in a string format.
-
Tag Sets
A tag set is a collection of multiple tags organized in a list format, representing a consensus label.
In Web3, a tag set is often created for tokens, including tags like BTC, ETH, USDC, DAI, etc. These tag sets can define a Container component's key for all its tags, simulating a wallet or liquidity pool. This helps automate the management of trading balances for various tokens.
-
Tags in Modeling
Tags are optional for modeling in HoloBit. However, once defined, they simplify operation selection and reduce repetitive input.
-
Understanding Global Tag Sets and Model Tag Sets in HoloBit
- Model Tag Sets are specific to individual Holo files.
- Apply to all scenarios within a single Holo file.
- Help organize tags for modeling convenience.
- Don't affect the model's core logic.
- Deleting a used tag set prompts a warning but doesn't stop the model from running.
- Global Tag Sets function at the workspace level.
- Serve as templates for commonly used tags.
- Not tied to any specific model.
- Enable easy import and reuse across models to avoid repetitive creation.
- Interaction Between Tag Sets
- You can merge or push your model tag sets to the global level, helping standardize tags across multiple models.
- Or you can import global tag sets into a specific model, quickly applying standard tags to new models.
- When importing or pushing, tags with the same names automatically merge.
- Model Tag Sets are specific to individual Holo files.