Fix/random fds factor 2#6
Merged
Merged
Conversation
The random Fatigue Damage Spectrum was 2x too high, from two independent causes (each a factor of 2; they are in separate code paths, so the net error is 2x, not 4x): 1. _get_random_psd_ers_fds: the cycle rate used n0 = (1/pi)*(dz_rms/z_rms), i.e. ~2*f0. The mean upward zero-crossing rate is n0+ = (1/2pi)*sqrt(M2/M0) = (1/2pi)*(dz_rms/z_rms) (Lalanne, Random Vibration, Vol.3 eq [5.76]); for a Q=10 narrow-band SDOF response n0+ = f0 (Specification Development, Vol.5 p.46 and Example 4.4). FDS scales linearly with n0 -> was 2x too high. (ERS uses the same n0 inside sqrt(2*ln(n0*T)), so the ERS effect is only ~3-4%; corrected here too for consistency with the book.) 2. _get_random_time_ers_fds (FDS): rainflow.count_cycles returns full cycles, so full-cycle Miner-Basquin damage is (p**k/C)*sum(count*(range/2)**k). The extra '*2' (full->half cycles) had no matching 1/2 from Lalanne Fatigue Damage Vol.4 eq [4.6] (K**b/(2C)), doubling the result. Removed the '*2'. Sine and sine-sweep FDS are unaffected and were already correct. Tests: - Regenerated random golden arrays in tests/test_data.py. Verified the change is exactly what was intended: the three random FDS arrays are exactly 0.5x the previous values; sine/sweep and the convolution-ERS arrays are unchanged; the two random-ERS arrays drop ~3.5%. - Added test_narrowband_crossing_rate_equals_f0: an absolute, literature- anchored check (Lalanne Vol.5 Example 4.4) that the response cycle rate of a Q=10 narrow-band oscillator equals f0, guarding against reintroducing 1/pi. BREAKING (numerical): random FDS magnitudes are halved and random ERS shifts ~3-4%. Relative comparisons / FDS inversion of random-only profiles are unchanged; absolute damage and any sine-vs-random mixing are corrected. Suggest a 0.2.0 -> 0.3.0 release.
Documents the correction and its validation against Lalanne (2009): - numeric convergence to the book's closed form eq [4.9] (-> 1.000 as Q->inf; pre-fix code -> 2.000) - side-by-side reproduction of Vol.5 Figs 4.3 and 4.4 - Example 4.3 damage ratio (15.34 vs book 16) - note on the book's own table-vs-figure inconsistency in Example 4.2
…dent verification Correct the version note (the bug is present in both 0.2.0 and 0.3.0; 0.3.0 shipped without the fix), and add an independent-verification section: direct rainflow ground truth (corrected = 1.0000x, pre-fix = 2.0000x), measured cycle rate = 1.000*f0, an adversarial review that failed to defend the pre-fix code, and the half-cycle/full-cycle root cause.
Add in-code citations to the underlying theory so the references are not confined to the README. - spectrum.py / tools.py: add a module-level References bibliography (Lalanne Mechanical Vibration and Shock Analysis, Vol. 1/3/4/5, 2009, + Thomson) with consistent [LalanneN]/[Thomson] keys. - Spectrum class docstring maps each signal type to its governing equation. - Per-method/inline references with exact equation numbers for the sine, sine-sweep, random-PSD and random-time ERS/FDS formulae, the segmented-PSD response RMS (eq [8.86]), the I0/I2/I4 closed forms (App. A6), and the damped SDOF impulse response. Also corrects several pre-existing inaccurate citations: - sine-sweep ERS comments cited Vol.1 "[1.21]/[1.22]/[1.23], p.31-32"; the correct source is Vol.5 eqs [1.31]/[1.32]/[1.33], p.16 (branch tags were also swapped). - random-PSD FDS cited "Vol. 0 ... (A1-93)"; replaced with Vol.4 eq [4.41] = Vol.5 eqs [4.7]-[4.8]. - response_relative_displacement cited Thomson eq (4.2-5), the undamped kernel; clarified that the code implements the damped impulse response. Documentation only; no behaviour change. Full test suite passes.
docs: add literature references throughout the code (closes #3)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.