My project is focused on enhancing the stability and reliability of simulation environments. It aims to resolve common issues such as crashes, slow performance, and unexpected behavior that can disrupt the simulation experience for complex circuits.
I’ve found and successfully addressed four issues in this context:
In the previous approach, the priority queue was managed using an array-based method with explicit sorting to maintain priority order, resulting in a complexity of O(n^2). With the new implementation, the ‘add’ method employs heapify-up to determine the correct position for inserting an element. The ‘remove’ method utilizes heapify-down to uphold the heap property after an element is removed. These heapify operations exhibit logarithmic time complexity (O(log n)), significantly enhancing the efficiency of the binary heap for priority queue management compared to the linear approach. Both implementations achieve the same goal of arranging elements based on timestamps (priorities). However, the new implementation is an improvement, utilizing a binary heap data structure that substantially improves performance for larger event queues due to its efficient O(log n) time complexity for insertion and removal operations.
Understanding the functionality of this feature is best facilitated through visualization. For this, a demo video has been attached for reference. Essentially, improvements have been made to the wiring. Now, when components are moved, their connections are less likely to be disrupted. Previously, even slight movement of components resulted in tangled wires, but the new implementation greatly mitigates this issue. This enhancement is poised to significantly benefit users.
I’ve rectified the saving of the ‘zero’ delay value for components. With this fix, components within the circuit can now be set to a delay of 0 and subsequently saved accordingly.
I had observed on Slack that many users reported this issue. I have implemented a fix for this. In the past, when the canvas displayed an error message and a user clicked on it multiple times in quick succession, the message would persist even after resolving the error. I successfully resolved this problem, ensuring that error messages are now properly removed once the issue is addressed.
|Change the implementation of the priority queue to use a heap data structure
|Moving a component messed up the connected wires
I have implemented 4 sub-features within it, which will make the circuit debugging process easier than before.
In this, I have implemented a state machine. So, Now whenever an uncaught exception error occurs in the simulator, the state of the simulator transitions from normal to an error state. All the tabs from which the user can add new component will remain hidden until the simulator is in the error state. Once the user removes the erroneous component, all the tabs become visible again, and the simulator returns to the normal state.
For this feature, I’ve implemented two functions. The first function is ‘getCurrentlySelectedComponent’, which returns the currently selected component. The second function is ‘getAllSelectedComponent’, which returns all the selected components if multiple elements are selected together in the circuit. Then, I’ve implemented the ‘modifyCurrentlySelectedComponent’ function. This function takes two parameters: the property of the currently selected component that needs modification and the modified value. It then updates the specified property in the global scope.
To address this, I’ve introduced a ‘detectCycle()’ function. It enables the identification of nodes within the circuit that form cyclic paths, and highlighting them in the simulator. Using the depth-first search (DFS) algorithm, I’ve employed this function to locate all the nodes involved in cycles. The function returns an array of nodes forming cyclic paths, which makes it possible to detect the nodes contributing to the ‘simulation stack exceeded’ error.
In this task, I’ve implemented several beneficial functions
These advancements undoubtedly enhance the debugging experience and provide valuable tools for managing and troubleshooting circuit-related issues.
|Implemented state machine for simulator
|Added helpful functions for debugging of circuits
Previously, When the simulator crashed, all the circuit data would get lost. Losing all that work was disheartening. To address this issue, I worked on implementing a solution for recovering the circuit data from simulator crashes.
To achieve this, I have added an autosave function that automatically saves the current circuit data at intervals of 3 seconds. So, whenever a simulator crash occurs, the autosave function preserves the data of the last stable state. When the user reloads the page, a message appears on the canvas: “We have detected an unexpected simulator crash. Don’t worry, we have recovered your project. Access it using Project->Recover.” The user can then go to “Project->Recover Project” and restore the circuit. This secure recovery process allows the user to retrieve a previous non-erroneous state of the circuit.
By implementing this simulator crash recovery mechanism, users can avoid losing their work and retain the ability to restore their circuits after an unexpected crash.
|Implemented safe recovery from simulator crash
In the CircuitVerse simulator, there are two circuit elements, Tristate and Controlled Inverter, that exhibit high impedance behavior. Previously, the Controlled Inverter was broken, and the Tristate had some issues.
In this task, I attempted to fix the issues with both of these circuit elements. First, I addressed the functionality of the Controlled Inverter and also fixed the incorrect test associated with it. I focused on identifying and resolving issues related to the Tristate element. Then, there are several open Tristate-related issues in the primary code base repository, I attempted to address all of them.
|Better system for high impedence values
I have attempted to resolve the data integrity issues I encountered. However, if there are any circuit reports in the future on the Slack channel containing data integrity issues, they will still be addressed. Therefore, please continue to report any issues you come across on the simulator.
I’ve created comprehensive blog posts for each phase of GSoC, aiming for them to be both engaging and informative.
|Coding Period Week 1 + 2
|Coding Period Week 3 + 4 + 5
|GSoC'23 Phase 1 Report
|Coding Period Week 7 + 8
|Coding Period Week 9 + 10
|Coding Period Week 11 + 12
It’s true that time flies. It feels as though it was just 2-4 days ago that the GSoC coding period began, and now it has come to an end so quickly. It’s astonishing how swiftly time has passed by. The experience was filled with moments of intense concentration and dedication.
However, I am extremely happy that my project has been successfully completed. And,I would like to express gratitude to my mentors Pulkit Gupta, Ruturaj Mohite, Pranay Simejia, and Satvik Ramaprasad. Their invaluable feedback on my progress and unwavering support have played a pivotal role in this journey.