Location

The script is located in project_root/Data generation

  • NN_data_generator.m: Runs the automatic data generation

Script's description

This MATLAB script performs a series of simulations for the SCU_FULL model, generating random input data, running simulations, collecting results, and saving the data for further analysis. The process involves initializing parameters, running simulations in a loop, and storing the results.

Steps in the Script

  1. Initialization:

    • The script begins by closing all open figures and setting the simulation time to 3 seconds.
    • The name of the Simulink model (SCU_FULL) is defined. This can be changed if the user wants to randomly generate datasets for other configurations
    • A time vector is created with 500 points uniformly distributed over the simulation time.
    • An offset for the quadrupole is defined.
    • The random number generator is seeded using the current time to ensure different results on each run.
    • The number of data points for the simulation is set to 1500 (N). This can be changed based on the dimension of the space
  2. Generating Random Input Data:

    • Minimum and maximum values for the input data are set to -2.5 and 2.5, respectively. This corresponds to the actuator's stroke
    • A matrix A of size Nx5 is created with random values between -2.5 and 2.5. This matrix represents different sets of inputs for the simulations.
    • An empty matrix sim_results of the same size is initialized to store the simulation outputs.
  3. Running Simulations:

    • A loop iterates over each row of the matrix A, representing different input configurations.
    • For each configuration, arrays for positions (A1 to A5) are created using the time vector and the current set of inputs.
    • The Simulink model is run with these input positions, and the output is captured.
    • The positions and orientations of the quadrupole are extracted from the simulation results.
    • The script calculates the mean values of these outputs over the second half of the simulation time to avoid transient effects.
    • The results are stored in the sim_results matrix.
  4. Progress Tracking:

    • The script calculates and displays the elapsed time and the estimated remaining time for the simulations to complete.
  5. Saving Results:

    • After all simulations are completed, the results are saved to .mat files.
    • The filenames include the current date and time to ensure uniqueness.
    • The results are saved in a directory structure that includes the model name.

Summary

This script automates the process of running multiple simulations for the SCU_FULL model with randomly generated input data, collecting the output data, and saving the results. The main steps include initialization, generating random inputs, running simulations in a loop, calculating mean outputs, and saving the results for further analysis.

Since the datasets are unique (random position) we can create small batches of N points and then combine all of them during the training phase

  • No labels