Running the emulator#

The emulator is a node of the data generation DAG which is scheduled to run every 5 minutes from the scheduled start time for a given duration. This scheduled start time will define the start time of the artificial experiment, and every run of the DAG can represent real time or accelerated time in the emulated experiment. For the generation of the artificial data, the DataGenerator from the simm2 package is used.

There are several steps that must be followed to successfully run the emulator.

Adding emulator variables to airflow UI#

The variables for configuring the emulator start with “emulator_” prefix and can be filtered in Admin/Variables. Once the steps in setting configuration variables have been followed, also including the “config_emulator.json” file, we should have 7 variables for the emulator:

_images/emulator_vars.png

Schedule and time variables#

The start date and time of the experiment must be set to define the beginning of the experiment. In addition, for the DAG to stop, a duration for the experiment should also be set. Finally, if the experiment is wanted in real time, the emulator acceleration variable would be left as by default. For the emulation to run faster, it should be changed as described below.

  • emulator_start_schedule: list containing [year, month, day, hour, minute, second, microsecond]

(see https://docs.python.org/3/library/datetime.html#datetime.datetime for more info about how a datetime is defined).

  • emulator_duration: float with the duration of the experiment in hours

  • emulator_acceleration: float with the desired acceleration for the time, i.e. if the emulated experiment is wanted 10 times

faster than a real one –> 10.0. Default is in real time –> 1.0

Input to the data generator#

Input to the model:

  • Initial conditions (IC) & parameters, as in simm2

  • The input to the data generator DataGenerator

{
  "emulator_measurement_freq": {
    "X": [0.5, 1.0, 0.01],
    "S": [0.52, 1.0, 0.01],
    "A": [0.54, 1.0, 0.01],
    "DOTm": [0.0, 0.016666666666666666, 0.003]
  },
  "emulator_error": {
    "X": ["normal", [0.0, 0.001]],
    "S": ["normal", [0.0, 0.001]],
    "A": ["normal", [0.0, 0.001]],
    "DOTm": ["normal", [0.0, 0.1]]
  },
  "emulator_IC": {
    "X0": 0.2,
    "S0": 3.0,
    "A0": 0.0,
    "DOTa0": 100.0,
    "DOTm0": 100.0,
    "V0": 0.01,
    "P0": 0.0
  },
  "emulator_parameters": {
        "qsmax": 1.25,
        "Yxsem": 0.5,
        "Yps": 0.1,
        "qm": 0.04,
        "qacmax": 0.05,
        "qapmax": 0.05,
        "Yxa": 0.1,
        "Yos": 1.067,
        "Yoa": 1.067,
        "Yasof": 0.667,
        "dsoxp": 0.6,
        "Ks": 0.005,
        "Ka": 0.05,
        "Kqs": 3.0,
        "Kisa": 1.0,
        "Kias": 0.23,
        "Kp": 351.2,
        "kLa": 636.0,
        "DOTstar": 100.0,
        "Si": 200.0,
        "F0": 0.0087,
        "mu_set": 0.222,
        "C_feed": 0.001,
        "Cx": 0.041,
        "Cs": 0.0333,
        "Ca": 0.0333,
        "H": 14000.0
  }
}