Posts

Warning! Will Robinson...

Wait the compiler executes the RLC1 program but there are 15 warnings. Let's not ignore them and try to improve our code. Warning #1 warning: method `Z` should have a snake case name   --> examples\rlc1.rs:16:8    | 16 |     fn Z(&self) -> f64 {    |        ^ help: convert the identifier to snake case (notice the capitalization): `    |    = note: `#[warn(non_snake_case)]` on by default The compiler is complaining about the use of a capital letter (Z) as a variable name and suggests converting it to snake case. How about res_z? The change must be made on two lines: (1) In the fn definition and (2) in the function call in main(). Clear the terminal (CTRL-SHFT-P Termina:Clear) and run the program. Now there are 14 warnings.

Microwave RLC circuit analysis

My interests are in the area of Engineering Tools. After reviewing the references and tutorials, I decided to write a simple microwave RLC circuit analysis program to demonstrate my understanding of Rust. Two-port network analysis at high frequencies involves the following:  Modeling of the circuit components Calculation of component impedance at the frequency of interest Calculation of each components ABCD matrix Calculation of the cascaded ABCD matrix for the complete circuit Conversion of the ABCD matrx to S-parameters Impedance calculations involve complex numbers resulting in complex matrix multiplation and complex math. I used the following crates for complex math: ndarray = "0.15.4" num = "0.4.0" num-complex = "0.4.2" Dependencies can be added to a rust project using Cargo to get the latest version: For example, to get the ndarray crate, type cargo add ndarray in the terminal. The dependency will be added to the project Cargo.toml file [package] nam...

Project Setup and Toolchain

Here is the toolchain I used for this development:      Rust 1.62.0 installation using rustup:  Rust  which will install basic Rust tools rustc cargo rustup      IDE: VSCode with rust-analyzer extension:  VSCode

References & Tutorials

References: 1) The Rust Book , GitHub Repository 2) Rust by Example , GitHub Repository I cloned the repositories associated with the references in my rust-projects directory and used the examples for leaning how to create rust programs. 3) The Cargo Book 4) The Rust Playground - online Rust compiler 5) The Rust Standard Library 6) Rust Crates (3rd Party Libraries) 7) Udemy: Ultimate Rust Crash Course ($$)

Rust Introduction

Rust is an extremely interesting programming language with modern constructs and syntax but with the executable performance of C/C++. This makes Rust suitable for high-speed calculations, games, and other processing intensive system programming applications. This blog will follow my learning process while implementing some Engineering Tools along the way. Engineering Tools are circuit simulators and other applications usually found in a desktop application but may also be web based.