- Rust 99.6%
- Nix 0.2%
- CSS 0.1%
Simac
Simac (Simulator for Analog Circuits) is a program to design and simulate analog circuits, built for casual experimentation and educational use.
Work in Progress
Many essential features are missing. Visit the issue tracker for remaining tasks.
Design Principles
-
Modern UI. The application's user interface should meet the high standards expected of modern applications.
- The GTK shell uses libadwaita and tries to adhere to the GNOME Human Interface Guidelines. Touch and stylus inputs are supported.
-
Portability. Low-level components should avoid depending on specific runtime environments.
- Device models are implemented by no-std generic code so that the simulation can run anywhere where Rust can, even where the full standard library or double-precision FP datatype is not supported.
-
Interactivity. Emphasize responsiveness over qualitative accuracy.
- Default error limits can be relaxed to provide a reasonable simulation speed as long as this does not preclude important phenomenons from being observed.
-
Intuitiveness. Imitate breadboard experiments. The simulator should try to produce reasonable results in all but the most extreme or contradictory situations.
- The simulator core uses extended precision (double-double arithmetic) to avoid numerical issues.
-
Hackable. The source code should be well-organized and documented to make it understandable, educative, and extensible while providing reasonable performance.
-
This project is written mostly in Rust, whose strong typing and ownership-oriented paradigm guide programmers toward writing correct, well-organized code, and whose tooling enables them to document code easily and regularly.
-
New compact device models can be easily added. They can be implemented in Rust or Verilog-A.
-
Usage
GTK Shell
CLI Shell
The CLI shell can be used to run simulation from a command-line.
$ cargo run --bin simac-cli --release -- -w examples/bjt/multivibrator-astable.simac schematic -o /tmp/frame-####.png -D 1e-3 -d 1e-5
Start time = 0.000000e0
End time = 1.000000e-3
Simulation for 1.000000e-3 secs completed in 9.901145e-2 secs (factor 0.010)
[..] INFO simac_cli::verb_schematic: Images saved: /tmp/frame-0099.png (and 99 more)
On NixOS
You can launch the latest development version of the application by (requires Nix flakes):
$ nix run git+https://codeberg.org/yvt/simac.git
Developing
On NixOS:
$ nix develop
$ cargo run -p simac_shell_gtk