Skip to content

About

Shared MATLAB functions for wireless communications simulation projects

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

28 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Common Wireless Infrastructure

Shared MATLAB functions used across multiple wireless communications simulation projects. This repository is designed to be included as a git submodule in each project repository.

Included Functions

Database I/O

Function Purpose
mysql_login.m Connect to MySQL using this machine's locally-configured credentials (auto-provisions the database if it doesn't exist)
get_mysql_credentials.m First-run interactive setup - detects a local MySQL server and caches credentials in a git-ignored mysql_local.json
mysql_load.m Fetch rows from MySQL by param_hash
mysql_write.m Insert/update with weighted-averaged metric merging (optional mutex)
mysql_check.m Read flag from system_flags table
mysql_set.m / mysql_unset.m Set/clear inter-process flags
connectWithRetry.m Retry DB connection up to 50 times with 30s wait
addMysqlJarOnce.m Add MySQL JDBC JAR to Java classpath once
mysql_load_resilient.m mysql_load that waits out a lost connection

Result stores

Each computer writes to its own primary store and, optionally, mirrors; readers merge every registered source by param_hash. The registry is the consuming project's db_sources.json, and a computer's store list is Results/<COMPUTER>/stores.json (both machine-specific and gitignored there).

Function Purpose
store_adapter.m One interface over the store kinds: MySQL, SQLite (Database Toolbox) and text files (no toolbox); Excel is a mirror only
results_write.m Write one batch to this computer's primary store, then its mirrors
load_merged.m Read every registered source, merged by param_hash
db_registry.m / db_sources.m / db_target.m Read the registry; list the sources; this computer's write target
machine_stores.m / store_connect.m A computer's stores in priority order; open its primary
storage_view.m / storage_apply.m / store_flush.m The GUI's Storage panel: list, change, refresh Excel mirrors
store_check.m / store_resync.m / store_status.m Compare a mirror to its primary, rebuild it, track staleness
host_id.m This computer's registry name (CWS_HOST, else COMPUTERNAME, else the host name)

Hashing

Function Purpose
jsonencode_sorted.m Deterministic JSON encoding + SHA-256 hash (field names sorted alphabetically)
DataHash.m Third-party SHA-256/MD5 utility (Jan Simon)

Visualization

Function Purpose
gen_table.m Display results as a MATLAB table in the console
updateProgressBar.m Braille-character progress bar with system parameter display

CLI Utilities

Function Purpose
profile_select.m Interactive console menu for profile selection
figure_settings.m Interactive console prompt for figure rendering settings

MySQL Setup (First Run)

No credentials are stored in this repository. The first time a project enables MySQL storage, mysql_login.m walks you through a one-time setup:

  1. It checks whether a MySQL server is running on localhost:3306.
  2. If found, it asks for that server's password (assumes the root user).
  3. If not found, it asks for a remote host to connect to instead - or you can press Enter to skip MySQL (the consuming project then uses a local file store).
  4. Once a connection succeeds, the credentials are cached in mysql_local.json at the consuming project's root (already covered by .gitignore - never committed) and reused silently on every run after that.
  5. The target database schema (e.g. comm_database) is created automatically if it doesn't already exist.

To reconfigure (e.g. a new password), delete mysql_local.json and re-run.

Usage as a Submodule

This repository is not meant to be used standalone. Each project that depends on these functions should add this repo as a git submodule:

git clone --recurse-submodules https://github.com/JRW-lab/Common-Wireless-Infrastructure.git

Or add to an existing project:

cd /path/to/project
git submodule add https://github.com/JRW-lab/Common-Wireless-Infrastructure.git Common-Wireless-Infrastructure

Then in MATLAB, add the submodule to your path:

addpath('Common-Wireless-Infrastructure/Meta Functions');

Versioning

Each project repo pins a specific commit of this shared infrastructure via .gitmodules. To update all projects to the latest shared code:

cd Common-Wireless-Infrastructure
git pull origin main
cd ..
git add Common-Wireless-Infrastructure
git commit -m "Update shared infrastructure to latest"

Requirements

  • MATLAB R2024b or later
  • Database Toolbox (for MySQL functions)
  • Parallel Computing Toolbox (for parfor progress reporting)
  • mysql-connector-j-8.4.0.jar (JDBC driver, included in project repos)

Contact

For questions, contact jrwimer@uark.edu or visit my website.

About

Shared MATLAB functions for wireless communications simulation projects

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages