Open-source MATLAB, C++ and Python tools for nonlinear vibration energy harvesting: bistable dynamics, bifurcations, chaos control, uncertainty quantification, optimization and harmonic-Gaussian magnetic barriers.
STONEHENGE (Suite for Nonlinear Analysis of Energy Harvesting Systems) collects numerical tools for studying piezoelectric–magneto–elastic vibration energy harvesters. This directory contains the original MATLAB/C++ modules and the Python HarmonicGaussian research package.
This README is an index of the existing modules, not a new execution framework. Module names and source files are preserved. Each module is intended to be used from its own directory; its main_*.m, main.cpp, or run_all.py file is generally the entry point.
The following groups organize the modules conceptually. No directory has been moved or renamed.
| Module | Language | Purpose | Main entry point |
|---|---|---|---|
| TimeSeriesAnalysis | MATLAB | Integrate the nonlinear electromechanical initial-value problem and plot the response, including asymmetry and nonlinear piezoelectric coupling. | main_pmehna_ivp.m |
| FourierAnalysis | MATLAB | Compute frequency-domain representations of simulated time series, including FFTs and power spectral densities. | main_piezomagbeam_fourier.m |
| PoincareSections | MATLAB | Construct phase portraits and stroboscopic Poincaré sections across excitation amplitudes. | main_PhasePortait_Poincare.m |
| ResonanceCurves | MATLAB | Simulate excitation-frequency sweeps and produce nonlinear resonance-response curves. | main_piezomagbeam_resocurves.m |
| BifurcationAnalysis | MATLAB | Sweep excitation amplitude at several frequencies and plot three-dimensional bifurcation diagrams, including upward and downward sweeps. | main_3D_bifurcation.m |
| BasinsOfAttraction | C++ / MATLAB | Integrate grids of initial states, classify asymptotic responses, and visualize basins of attraction. | main.cpp |
| Module | Language | Purpose | Main entry point |
|---|---|---|---|
| DynamicAnimation | MATLAB | Animate the motion of symmetric and asymmetric piezo-magneto-elastic beams in inertial and moving reference frames; includes GIF output. | main_piezomagbeam_ivp_v2.m; main_piezomagbeam_asymmetric_ivp.m |
| Module | Language | Purpose | Main entry point |
|---|---|---|---|
| ChaosControl | MATLAB / Simulink | Explore control of chaotic harvester responses using OGY and extended time-delayed feedback (ETDF). | main_OGY_R01.m; main_ETDF.m |
| HarvesterOptimization | MATLAB | Optimize mean harvested power with cross-entropy search or direct/grid search, including 2- and 4-variable and noise-perturbed cases. | HarvesterOpt_CrossEntropy2var.m; HarvesterOpt_DirectSearch4var.m |
| DisplacementAmplifier | MATLAB | Simulate a base-excited, two-degree-of-freedom bistable harvester with a mechanical displacement-amplification mechanism. | main_bistable_amplification_base.m |
| Module | Language | Purpose | Main entry point |
|---|---|---|---|
| SobolSensitivity | MATLAB / UQLab | Estimate global Sobol sensitivity indices by Monte Carlo and polynomial-chaos-expansion approaches. | main_pmeh_sobol.m |
| StochasticSimulations | MATLAB | Simulate the bistable harvester under colored-noise disturbances and analyze trajectories, attractors, spectra, and harvested power. | HarvesterColoredNoise_ivp_main.m |
| Module | Language | Purpose | Main entry point |
|---|---|---|---|
| HarmonicGaussian | Python | Reproduce Harmonic-Gaussian vibration energy harvesting: localized Gaussian/point-dipole magnetic barriers, continuation, folds, Floquet stability, capture, electrical power, and manuscript figures. | run_all.py |
For installation, tests, datasets, individual computations, and figure reproduction, consult the HarmonicGaussian README. Its detailed instructions intentionally remain local to that module.
A C++ implementation of basin mapping for a piezo-magneto-elastic harvester. main.cpp sets the initial-displacement/initial-velocity grid, forcing and simulation parameters, and attractor-classification workflow. header.cpp and header.h implement numerical and auxiliary functions. MATLAB files such as ploting.m, graph_type1.m, and graph_contourf_pnt.m visualize the results. Note: this module mixes C++ computation with MATLAB post-processing.
The driver main_3D_bifurcation.m specifies excitation-frequency and forcing-amplitude ranges. bifurcation_3d.m computes upward/downward parameter sweeps; plot_3D_bifurcation.m visualizes the bifurcation data in three dimensions. piezomagbeam_asymmetric.m implements the modeled beam dynamics.
Two control approaches are represented: the Ott–Grebogi–Yorke (OGY) method in main_OGY_R01.m, and extended time-delayed feedback (ETDF) in main_ETDF.m. The latter invokes the Simulink model Harvest_DuffingCL.slx. piezomagbeam.m, plot_time_series.m, and z1test.m support simulation, plotting, and the 0–1 test for chaos. Dependency: Simulink is needed for the ETDF example.
A focused numerical example in main_bistable_amplification_base.m. It models a base-excited two-mass system with coupling springs/dampers, nonlinear bistable stiffness, and piezoelectric voltage dynamics. The script integrates the five-state model and plots the resulting response.
Time-domain simulations and animations of the piezo-magneto-elastic beam. The main scripts cover symmetric and asymmetric configurations. The plot_piezomagbeam_animation_*.m routines provide inertial-frame and moving-frame visualizations, with an option for GIF output. Model functions include pmeh_eom.m and piezomagbeam_asymmetric.m.
Fourier-domain characterization of the harvester response. main_piezomagbeam_fourier.m generates or processes response histories; post_piezomagbeam_fourier.m handles post-processing. signal_fft_1sided.m, signal_psd.m, and signal_psd_1sided.m implement spectral estimators, while graph_type2_psd.m creates the associated plots.
An installable Python research package with a reusable harmonic_gaussian/ library, scripts/compute/ numerical workflows, scripts/figures/ figure generators, numerical checks, regression tests/, stored data/, figures/, results/, and the run_all.py driver. Unlike the older modules, it studies a harmonic beam with a localized Gaussian or point-dipole magnetic barrier and compares this model with quartic approximations. See its module-specific documentation.
Optimization tools for maximizing the harvester’s mean electrical power. HarvesterOpt_CrossEntropy*.m provides cross-entropy-based design search; HarvesterOpt_DirectSearch*.m performs deterministic grid/direct search. The filenames distinguish two- and four-design-variable cases and variants with noise. PiezoMagBeam_ObjFunc*.m and PiezoMagBeam_RHS.m define the objectives and dynamical model. Auxiliary routines plot results and search evolution.
Phase-space and stroboscopic analysis for a bistable harvester. main_PhasePortait_Poincare.m compares responses over several forcing amplitudes. phase_portait.m generates phase-portrait samples, poincare.m samples once per excitation period after transients, and piezomagbeam_asymmetric.m provides the governing dynamics.
Excitation-frequency response of the classical bistable piezo-magneto-elastic model. main_piezomagbeam_resocurves.m is the sweep driver; piezomagbeam.m supplies the equations of motion; and plot_resocurves.m visualizes the response curves.
Global sensitivity analysis of the harvesting model using Sobol indices. main_pmeh_sobol.m defines uncertain parameters and starts the analysis. sobol_mc.m calculates Monte Carlo-based estimates, and sobol_pce.m uses a polynomial-chaos metamodel. piezo_magneto_harvesting.m defines the model outputs and plot_sobol.m plots the indices. Dependency: the scripts call UQLab (uqlab, uq_createModel, uq_createAnalysis).
Responses of a bistable harvester subjected to colored-noise excitation. HarvesterColoredNoise_ivp_main.m runs the numerical study, HarvesterColoredNoise.m defines the stochastic forcing contribution to the ODE, and HarvesterColoredNoise_ivp_post.m supports post-processing. fredholm_expcorr_eig.m computes eigenpairs for an exponential covariance kernel; the remaining helpers process random variables, power, trajectories, attractors, and plots.
A minimal time-domain initial-value analysis. main_pmehna_ivp.m sets the parameters and plots displacement, velocity, and voltage histories. pmehna_eom.m integrates the electromechanically coupled equations with potential asymmetry, bias, and nonlinear piezoelectric coupling.
BasinsOfAttraction contains a standalone source program and supporting C++ files; the results are plotted using MATLAB scripts.ChaosControl.SobolSensitivity.HarmonicGaussian has its own dependency specification, package metadata, tests, and reproducibility instructions.The legacy MATLAB/C++ code has been catalogued, not refactored or execution-tested as part of this README. No claim is made that all scripts run without external dependencies or environment adjustments. For general STONEHENGE documentation, see the repository root README and user manual.
The original MATLAB/C++ modules were previously stored in directories ending in -1.0. The directory names have now been standardized without version suffixes; three names have also been clarified: BasinsOfAttraction, HarvesterOptimization, and SobolSensitivity. The code and module-level files are unchanged. HarmonicGaussian remains a separate, paper-specific Python module.
The groupings in this guide are conceptual only: no additional directory hierarchy has been introduced. External links using the former directory paths must be updated.