# Input Format and Preparation In this section, we describe the input format of the main algorithms and how to prepare the data. --- ## Input Format To run the main algorithm (e.g. `schedule`), the user must provide a valid `Scenario` object as input.`Scenario` is a class that represents the mathematical problem formulation and its constraints. Consider a `Scenario` instance named `scenario`. `scenario` includes all information required for both load flattening and user-friendly problem, such as: - $N_\text{c} \rightarrow$ N_c - number of chargers - $N_\text{ev} \rightarrow$ N_ev - number of EVs - $T \rightarrow$ T - number of time slots comprising a scenario - $\Delta \rightarrow$ Delta - length of time slot [minutes] - $P^{max} \rightarrow$ P_max - maximum aggregate charging power - $P^{min} \rightarrow$ P_min - maximum aggregate discharging power - EVs - array of `EV` objects - ... In particular, an `EV` class models an electric vehicle with various properties such as arrival time slot, departure time slot, minimum charging power, maximum charging power, battery capacity, minimum allowable energy, energy stored at arrival, reference energy desired at departure, etc. If `scenario.Problem_type=="Lf"`, then `scenario` includes some additional information like `D`, the base load profile [kW]. While, if `scenario.Problem_type=="Uf"`, then `scenario` includes some additional information like `C`, the electricity price profile [kW]. For more details about `Scenario`, see [Scenario](../src/class/Scenario.md), about `EV`, see [EV](../src/class/EV.md). ## Preparation We provide two simple ways to prepare a valid `Scenario` object. For more advanced way of preparing and editting a `Scenario` object, refer to [Tutorial 1: EVs and Scenarios](../guide/tutorial.md). ### 1. Customizing the scenario _ Using JSON file Once a properly formatted JSON file is ready, user can create the corresponding `Scenario` instance using the `import_scenario()` function: ```matlab scenario = import_scenario(jsonfile) ``` Sample JSON files for both load flattening problem and user-friendly problem are provided in `tutorial/Samples`. Try: ```matlab jsonfile = "Sample_Lf.json" scenario = import_scenario(jsonfile) ``` For more details about proper JSON file format, see [import_scenario](../src/import_scenario.md). ### 2. Customizing the scenario distribution _ Using scenario generator We provide `PoissonScenarioGenerator` class, so user can create the corresponding `Scenario` instance following Poisson distribution using the `generate()` function. Try: ```matlab % Set parameters T = 24; N_c = 20; L = ones(N_c+1); for i=1:N_c L(i,i) = -N_c; end arrival_rates = 2*ones(T,1); mean_stay_duration = 3*60; % Generate scenario gen = PoissonScenarioGenerator(Problem_type="Lf",... T=T, N_c=N_c, L=L, arrival_rates=arrival_rates,... mean_stay_duration=mean_stay_duration); scenario = generate(gen) ``` ```{tip} You can create `MyOwnScenarioGenerator` inheriting `AbstractScenarioGenerator`. ``` For more details about `PoissonScenarioGenerator`, see [PoissonScenarioGenerator](../src/class/PoissonScenarioGenerator.md), about `AbstractScenarioGenerator`, see [AbstractScenarioGenerator](../src/class/AbstractScenarioGenerator.md).