diff --git a/1_one_instance.py b/1_one_instance.py
index 28cba70a1711a0c6976e5b2ff122d7507f13a043..c85cb384aa00b1f0177dc9bc8de9dcae952d22b4 100644
--- a/1_one_instance.py
+++ b/1_one_instance.py
@@ -1,22 +1,24 @@
-from run_batsim_exp import *
-import swf_to_batsim_split_by_user as split_user
+#!/usr/bin/env python3
+
 import time
 import sys
 import os
 import subprocess
+import argparse
 sys.path.insert(0, '/scripts')
 
+import swf_to_batsim_split_by_user as split_user
+from run_batsim_exp import *
 #import swf_moulinette
 
 
-###### Prepare input data ######
-# Cut the original trace to extract 72h starting from this start date
 def prepare_input_data(expe_num, start_date):
+    """Cut the original trace to extract 72h starting from this start date"""
     end_date = start_date + 72*3600
     to_keep = f"submit_time >= {start_date} and submit_time <= {end_date}"
 
-    if not os.path.exists(f'workload/expe{expe_num}.swf'):
-        os.makedirs(f'workload/expe{expe_num}.swf')
+    if not os.path.exists(f'workload/expe{expe_num}'):
+        os.makedirs(f'workload/expe{expe_num}')
     split_user.generate_workload(
         input_swf='workload/MC_selection_article.swf',
         output_folder=f'workload/expe{expe_num}',
@@ -25,52 +27,82 @@ def prepare_input_data(expe_num, start_date):
         job_walltime_factor=8)
 
 
-###### Run the expe ######
-# Run batmen with Rigid behavior
-
-EXPE_FILE = f"out/expe{expe_num}"
-wl_folder = f'workload/expe{expe_num}'
-pf = "platform/average_metacentrum.xml"
-wl = "workload/empty_workload.json"
-uf = "sched_input/user_description_file.json"
-
-
-def user_description(user):
-    return {
-        "name": user,
-        "category": "dm_user_degrad",
-        "param": {"input_json": f"{wl_folder}/{user}.json"}
-    }
-
-
-user_names = [user_file.split('.')[0] for user_file in os.listdir(wl_folder)]
-data = {}
-data["dm_window"] = dm_window
-data["log_user_stats"] = True
-data["log_folder"] = EXPE_FILE
-data["users"] = [user_description(user) for user in user_names]
-
-uf = "sched_input/user_description_file.json"
-with open(uf, 'w') as user_description_file:
-    json.dump(data, user_description_file)
-
-
-batcmd = gen_batsim_cmd(
-    pf, wl, EXPE_FILE, "--energy --enable-compute-sharing --enable-dynamic-jobs --acknowledge-dynamic-jobs --enable-profile-reuse")
-schedcmd = f"batsched -v bin_packing_energy --queue_order=desc_size --variant_options_filepath={uf}"
-instance = RobinInstance(output_dir=EXPE_FILE,
-                         batcmd=batcmd,
-                         schedcmd=schedcmd,
-                         simulation_timeout=30, ready_timeout=5,
-                         success_timeout=10, failure_timeout=0
-                         )
-instance.to_file(robin_filename)
-ret = run_robin(robin_filename)
-
-
-# For each user behavior in {Renonce, Delay, Degrad, Reconfig}
-#   For each dm_window duration in {.5, 1, 2, 4}
-#       Run batmen
-
-###### Output data treatment ######
-# Produce the utilisation viz
+def run_expe(expe_num, user_category, window_size):
+    """Run batmen with given behavior and demand response window"""
+    # Useful vars and output folder
+    if window_size==0.5:
+        w_size = '05'
+    else:
+        w_size = f"{window_size}"
+    EXPE_FILE = f"out/expe{expe_num}/{user_category}_window{w_size}"
+    wl_folder = f'workload/expe{expe_num}'
+    pf = "platform/average_metacentrum.xml"
+    wl = "workload/empty_workload.json"
+    uf = "sched_input/user_description_file.json"
+
+    # Demand response window, from 12 to (12 + window_size) on day2
+    dm_window = [(24+12)*3600, (24+12+window_size)*3600]
+
+    # User description file
+    def user_description(user):
+        return {
+            "name": user,
+            "category": user_category,
+            "param": {"input_json": f"{wl_folder}/{user}.json"}
+        }
+    user_names = [user_file.split('.')[0] for user_file in os.listdir(wl_folder)]
+    data = {}
+    data["dm_window"] = dm_window
+    data["log_user_stats"] = True
+    data["log_folder"] = EXPE_FILE
+    data["users"] = [user_description(user) for user in user_names]
+    with open(uf, 'w') as user_description_file:
+        json.dump(data, user_description_file)
+
+    # Generate and run robin instance
+    batcmd = gen_batsim_cmd(
+        pf, wl, EXPE_FILE, "--energy --enable-compute-sharing --enable-dynamic-jobs --acknowledge-dynamic-jobs --enable-profile-reuse")
+    schedcmd = f"batsched -v bin_packing_energy --queue_order=desc_size --variant_options_filepath={uf}"
+    instance = RobinInstance(output_dir=EXPE_FILE,
+                            batcmd=batcmd,
+                            schedcmd=schedcmd,
+                            simulation_timeout=30, ready_timeout=5,
+                            success_timeout=10, failure_timeout=0
+                            )
+    instance.to_file(robin_filename)
+    ret = run_robin(robin_filename)
+
+
+
+def main():
+    parser = argparse.ArgumentParser(
+        description='One expe instance. To launch for example with `oarsub -l walltime=2 "./1_one_instance arg1 arg2 arg3"`')
+    parser.add_argument('expe_num', type=int, help='The expe ID')
+    parser.add_argument('start_date', type=int, 
+                        help='Start of the 3-day window (in seconds since the start of the original trace')
+    args = parser.parse_args()
+
+    # Prepare workload
+    prepare_input_data(args.expe_num, args.start_date)
+
+    # Create expe folder
+    if not os.path.exists(f"out/expe{expe_num}"):
+        os.makedirs(f"out/expe{expe_num}")
+
+    # Run with Rigid behavior (the demand response window has no influence here)
+    run_expe(expe_num=args.expe_num, 
+             user_category="replay_user_rigid",
+             window_size=1)
+
+    # 4*4 = 16 expe
+    for behavior in ["dm_user_reconfig","dm_user_degrad",
+                     "dm_user_renonce","dm_user_delay"]:
+        for window_size in [0.5, 1, 2, 4]:
+            run_expe(expe_num, behavior, window_size)
+
+
+    ###### Output data treatment ######
+    # Produce the utilisation viz?
+
+if __name__ == "__main__":
+    main()