Try Iterative Feedback Tuning (IFT). If you do a Google search for "Iterative Feedback Tuning" you will find more than 8,000 results. The following are the fundamental papers on IFT:
H. Hjalmarsson, M. Gevers, S. Gunnarsson and O. Lequin, "Iterative feedback tuning : theory and applications", IEEE Control Systems Magazine, vol. 18, No 4, pp. 26-41, August 1998.
H. Hjalmarsson, "Iterative Feedback Tuning: an overview", Int Journal of Adaptive Control and Signal Processing, Vol. 16, No 5, pp. 373-395, June 2002.
The specific application of IFT for PID tuning, including a comparison with classical methods, can be found in
O. Lequin, M. Gevers, M. Mossberg, E. Bosmans and L. Triest, "Iterative Feedback Tuning of PID parameters: comparison with classical tuning rules", Control Engineering Practice, Vol. 11, No 9, pp. 1023-1033, September 2003.
In this web page, you can find free Java based tools for identification and PID controller tuning. One of the tools is for PID tuning based on experimental data. You need an ascii file with the data of the experiment (step response or relé feedback experiment). The file should have three columns: time, input and output. The tool includes several tuning methods, where you can choose between three tunings (from more robust and slow till less robust and faster).
With the same data of the experiment, you can use the identification tool to obtain a model for simulate the controller.
You can use the assignment pole method, which consist in shaping the closed loop characteristic equation. For this, you select the roots of the desired Hurtwitz polynomial for satisfying the requirements of the design. In the following paper you can find an example of this technique.
Chapter FPGA Implementation of PID Controller for the Stabilization ...
An excellent book that has many of the more common algorithms already coded into 'MATLAB' is LINEAR FEEDBACK CONTROL: Analysis and Design using MATLAB by Xue, Chen and Atherton. It's published by SIAM as part of its Advances in Design and Control
In spite of the several excellent control engineering textbooks that adequately treat PID tuning, I would recommend as particularly clear ─ simplified to the essential ─ the introduction to PID tuning that can be found at: Tore Hägglund, "Process Control in Practice", Chartwell Bratt Ltd, Lund (Sweden), 1991 (Cf. Ch. 4).
You may also possibly find interesting a discussion on the meaning of the 'online' (or 'on-line') terminology at this forum: https://www.researchgate.net/post/What_the_meaning_of_online_experimentation