Personalizar nodos netanim
Configuring Machine Settings for Net Anim
Importance of Disk Space
- The speaker highlights a warning about low disk space, indicating only 1.7 GB is available and suggests increasing it to at least 30 GB to avoid issues during operations.
- A note will be added in earlier videos regarding this requirement to prevent future problems when downloading necessary applications.
Customizing Icons in Net Anim
Example Setup
- The tutorial uses simple examples from a folder named "examples" that includes scripts labeled first, second, and third, which were previously executed as tests.
- The process involves copying a script into the Scratch folder and opening it in a code editor for modifications.
Code Modifications
- To generate an XDML file, the command should be placed before the lines
simulator runandsimulator destroy, noting that some scripts may differ.
- After adding the library and generating the XML file, users are instructed to execute their example network simulation.
Running Simulations and Modifying Node Appearance
Simulation Execution
- Upon completion of the simulation, users can open their output file (named by them), which contains generic icons representing nodes.
Icon Customization
- Users can modify node colors through interface options; however, background changes are limited unless defined within settings.
- Any changes made during a session reset upon restarting the simulation, requiring reconfiguration of colors and parameters each time.
Programming Custom Node Images
Setting Up Custom Images
- The speaker discusses how to programmatically set custom images for nodes using specific code lines already prepared for use.
Documentation Reference
- It’s emphasized that understanding how to configure these images requires consulting Net Anim documentation for proper implementation details.
Image Resource Management
- Before updating node images with custom graphics, users must define image paths correctly; PNG format is mandatory for compatibility.
Final Steps in Implementation
- The speaker mentions having prepared resources in a designated folder structure while ensuring correct naming conventions are followed for successful integration.
Update Node Image and Custom Backgrounds in Simulation
Updating Node Images
- The function
update node imageallows for updating the node's image. Further documentation is available for deeper insights into this functionality.
- A search was conducted to find specific functions related to animation interface class references, which yielded favorable results after refining the search parameters.
- To update a node's image, the ID of the node (usually starting from zero) and the resource (image ID) must be provided. The variable
ID droneholds this resource.
Resizing Nodes
- The size of nodes can be adjusted by passing the node number followed by setting its size; for example, setting it to six points indicates a specific dimension.
- After saving changes and executing NS3, updates were confirmed in Nedanim with only node zero being modified.
Adding Custom Backgrounds
- To add a custom background, similar syntax as used for calling the node image is applied but includes additional parameters such as file name and coordinates (X, Y).
- Parameters include X and Y coordinates where the image starts, scale factors for resizing width and height, and opacity levels ranging from 0 (transparent) to 1.0 (opaque).
Testing Image Placement
- Coordinates (-10, -10) were set to position the image off-center. Adjustments are made through trial and error until desired placements are achieved.
Implementing Routing Protocol Comparisons
- A new project was initiated based on previous routing protocol comparisons with drones included in a custom background setup.
- Initial steps involve copying libraries/modules alongside generating XML files necessary for simulation setups.
Creating Multiple Nodes
- For simulations involving multiple nodes (50 in this case), a loop structure is utilized to apply images across all nodes effectively.
- The script iterates through creating 50 nodes while ensuring each receives an appropriate drone ID.
This structured approach provides clarity on how to manipulate images within simulation environments while also addressing practical coding techniques relevant to managing multiple nodes efficiently.
Simulation Setup and Adjustments
Creating a Square Simulation
- The simulation is set up to create a perfect square with dimensions of 100, resulting in an area of 1500. The drone's size is adjusted to occupy only 30 units for better visualization.
- It is noted that the background setup should be outside the loop to avoid errors during execution. The time for the simulation is reduced from 200 seconds to 50 seconds for quicker results.
Initializing Simulation Parameters
- The starting value for the simulation is modified to begin randomly at either the 10th or 11th second, enhancing variability in outcomes.
- After saving changes, the new file is executed, indicating successful generation of the simulation parameters.
Reviewing Output and Adjustments
- Upon reviewing the output file named "manet simular grupo 8," challenges arise regarding proper dimensioning. Experimentation with command values reveals that a setting of 0.5 results in a background that appears too small, leading to visibility issues.
- Zooming into the simulation confirms that drones are present despite initial sizing concerns, emphasizing the need for careful adjustments in future iterations.