(prodrisk_cpar)= # Control data in prodrisk.CPAR The file prodrisk.CPAR contains control parameters for Prodrisk. The file format allows a keyword followed by a parameter and some optional comment. One does not have to specify values for all parameters, non-defined parameters will get default values. All possible control parameters are shown in the table below. |Parameter name | API attribute | |---------------|--------------| |staiter |[max_iterations](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#max-iterations)| |miniter |[min_iterations](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#min-iterations)| |staiter1 |[max_iterations_first_run](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#max-iterations-first-run)| |miniter1 |[min_iterations_first_run](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#min-iterations-first-run)| |fkonv |[convergence_criteria](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#convergence-criteria)| |stor |[inf](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#inf)| |alfastor |[alfa_max](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#alfa-max)| |ctank |[water_ration_cost](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#water-ration-cost)| |cforb_styr |[bypass_cost](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#bypass-cost)| |cflom_styr |[overflow_cost](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#overflow-cost)| |tommax |[max_relaxation_iterations](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#max-relaxation-iterations)| |haldkut |[max_cuts_created](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#max-cuts-created)| |str_magbr |[reservoir_soft_restriction_cost](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#reservoir-soft-restriction-cost)| |antbru1 |[first_relaxation_parameter](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#first-relaxation-parameter)| |slette_frekv |[second_relaxation_parameter](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#second-relaxation-parameter)| |slette_tol |[relaxation_tolerance](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#relaxation-tolerance)| |juke_aggr_pravsn |[aggregated_price_period_start_week](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#aggregated-price-period-start-week)| |jsekv_startuke |[sequential_price_period_start_week](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#sequential-price-period-start-week)| |jsekv_sluttuke |[sequential_price_period_end_week](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#sequential-price-period-end-week)| |pqvalg |[use_input_pq_curve](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#use-input-pq-curve)| |magbal |[reservoir_balance_option](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#reservoir-balance-option)| |framsomsluttsim |[forward_model_option](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#forward-model-option)| |prisscenstrategi |[price_scenario_option](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#price-scenario-option)| |nodeprisprofil |[node_price_profile](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#node-price-profile)| |suppress_seq_res |[suppress_seq_res](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#suppress-seq-res)| |use_reserve_up |[use_reserve_up](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#use-reserve-up)| |use_reserve_down |[use_reserve_down](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#use-reserve-down)| |resstoy |See [inflow_model](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#inflow-model)| |lognormal_inflow|See [inflow_model](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#inflow-model)| |n_kmeans |[n_kmeans](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#n-kmeans)| |read_inflow_h5 |[read_lognormal_model](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#read-inflow-h5)| |n_gen_forward |[n_generated_scenarios](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#n-generated-scenarios)| |n_sample_forward |[n_sample_scenarios](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#n-sample-scenarios)| |gen_inflow_forw_type|[generated_inflow_type](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#generated-inflow-type)| |last_iter_gen_forw |[last_iteration_generated_scenarios](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#last-iteration-generated-scenarios)| |min_iter_no_gen_forw|[min_iterations_without_generated_scenarios](https://docs.prodrisk.sintef.energy/objects/setting/setting.html#min-iterations-without-generated-scenarios)| A description of each control parameter is provided below. We have divided the control parameters into 6 groups of convergence control, penalty values, solution procedure, inflow model, time resolution and miscellaneous features. ## Convergence control **staiter 50, < Max. no. of iterations in final strategy computation** **miniter 5, < Min. no. of iterations in final strategy computation** If Prodrisk is run twice to produce head-coefficients, STAITER and MINITER give the number of main iterations in the final run. The algorithm will run at least MINITER and at most STAITER main iterations in the final run. In large watercourses, 50 iterations may be too little to stabilize reservoir trajectories, but may be sufficient to stabilize the economical result. **staiter1 50, < Max. no. of iterations in initial strategy computation** **miniter1 5, < Min. no. of iterations in initial strategy computation** If Prodrisk is run twice to produce head-coefficients, STAITER1 and MINITER1 give the number of main iterations in the initial run. The algorithm will run at least MINITER1 and at most STAITER1 main iterations in the initial run. **fkonv 3.00, < Convergence criterion** This convergence criterion examines the weighted deviation in all reservoirs in all weeks for all simulated scenarios. The deviation is calculated as the sum of all absolute deviations for all reservoirs divided by the sum of all maximum reservoirs, measured in energy. The convergence criterion is in percentage. ## Penalty values The penalty values specified in prodrisk.CPAR can be seen as basic default values. A much finer control on penalty values is allowed by using the file straff.CPAR, see Penalty values. **ctank 100.0 + highest market price, ** Decides whether the lognormal inflow model should be used. If LOGNORMAL_INFLOW == 0, or if there is no license for lognormal inflow model available, then the value of RESSTOY decides which inflow model to use. For more information about the inflow models, see [Inflow models used in Prodrisk](../../inflow/inflow_model/inflow_model.md). **n_kmeans 10000, < Number of samples used in k-means algorithm>** N_KMEANS is the number of samples to be used in the k-means clustering algorithm that is part of the lognormal inflow model. A higher number can give a higher precision in the inflow model, and a higher number of inflow series can require a higher number of samples. The number of clusters (K) is the same as the number of noise, and is decided by the parameters **NPRBRUK** and **NRSTKOM** from the file [tilsigsddp.CPAR](../../inflow/inflow_model/control_tilsigsddp_cpar.md). **read_inflow_h5 0, < Use lognormal inflow model saved in H5 file>** If a high number of samples is used in the k-means algorithm (N_KMEANS >= 100 000), then the preprocessing time can be long. Therefore it may be desired to read the inflow model from the previous run, which is saved in the H5 file *lognormalInflowModel*. The file is not meant to be provided by the user, only generated by Prodrisk in a previous run. **resstoy 0, < Type of inflow model if lognormal is not used** RESTTOY defines the type of inflow model to be used in the backward recursion if LOGNORMAL_INFLOW is set to zero or if there is no license for lognormal inflow model. The default choice (0) is a model based on principal components. If one wants to use the residual-based inflow model, RESSTOY should be set to 1. **n_gen_forward 0, < Number of generated scenarios used in the optimization>** N_GEN_FORWARD decides whether to include additional generated scenarios in the forward simulation (and in the backward simulation). Inflow series for the scenarios are generated using the [inflow model](../../inflow/inflow_model/inflow_model.md) decided by the parameters LOGNORMAL_INFLOW and RESSTOY. Price series are drawn from the [price model](../../price/price_model/price_model.md). If the additional inflow scenarios are used, the parameter *gen_inflow_forw_type* should be set and it is possible to decide that for the last iterations, only the historical inflow scenarios should be used. See [Including generated scenarios in the optimization](../../inflow/inflow_model/generated_scenarios.md) for more information. **n_sample_forward 1000, < Number of sampled inflow scenarios to generate percentiles or extremes from>** N_SAMPLE_FORWARD decides the number of inflow samples used when generating percentiles or extreme inflow series for the generated scenarios. This parameter is only relevant if n_gen_forward > 0, and if gen_inflow_forw_type = 1 or 2. See [Including generated scenarios in the optimization](../../inflow/inflow_model/generated_scenarios.md) for more information. **gen_inflow_forw_type 0, < Decides configuration of generated inflow scenarios>** This parameter controls the sampling of generated inflow scenarios. The alternatives are: - 0 - random inflow scenarios are used - 1 - percentiles of the inflow scenarios are used - 2 - extreme values of the inflow scenarios are used The parameter is only relevant if N_GEN_FORWARD > 0. See [Including generated scenarios in the optimization](../../inflow/inflow_model/generated_scenarios.md) for more information. **last_iter_gen_forw 1000, < Last iteration to use generated inflow scenarios in forward simulation>** If this parameter is set, it indicates the last iteration where the generated scenarios should be used. If N_GEN_FORWARD == 0, the value of LAST_ITER_GEN_FORW is irrelevant. **min_iter_no_gen_forw 10, < Minimum iterations without generated scenarios in forward simulation>** This parameter decides the minimum number of iterations that should be run without generated scenarios at the end of the optimization. This means that although convergence is reached before the last iteration where generated scenarios should be used, there will still be a minimum number of iterations left with only historical scenarios. If this number is set to 0, only convergence and LAST_ITER_GEN_FORW decides. ## Time resolution **juke_aggr_pravsn 9999, < First week aggregating load periods** Aggregation of load periods mean running the model with weekly time resolution. The default value gives no aggregation. If one sets JUKE_AGGR_PRAVSN to 53, load periods will be aggregated to weekly time resolution from week 53 and to the end of the scheduling period. **jsekv_startuke 1,