<commit_before># Loadflow validation

## Configuration

```
<loadflow-validation>
	<threshold>0.1</threshold>
	<verbose>false</verbose>
	<load-flow-factory>com.powsybl.loadflow.mock.LoadFlowFactoryMock</load-flow-factory>
	<table-formatter-factory>com.powsybl.commons.io.table.CsvTableFormatterFactory</table-formatter-factory>
	<epsilon-x>0.1</epsilon-x>
	<apply-reactance-correction>false</apply-reactance-correction>
	<output-writer>CSV_MULTILINE</output-writer>
	<ok-missing-values>false</ok-missing-values>
	<no-requirement-if-reactive-bound-inversion>false</no-requirement-if-reactive-bound-inversion>
	<compare-results>false</compare-results>
</loadflow-validation>
```

* *threshold*: margin used for values comparison; default value is 0
* *verbose*: verbose output, default value is false
* *load-flow-factory*: load flow factory class; if not defined, the default configuration is used
* *table-formatter-factory* table formatter factory class; default value is com.powsybl.commons.io.table.CsvTableFormatterFactory
* *epsilon-x*: value used to correct the reactance in flows validation, used only if apply-reactance-correction is true; default value is 0.1
* *apply-reactance-correction*: apply reactance correction in flows validation; default value is false
* *output-writer*: output format [CSV, CSV_MULTILINE], default is CSV_MULTILINE
* *ok-missing-values*: perform validation check even if some parameters of connected components have NaN values; default value is false (i.e. validation check fails if some parameters of connected components have NaN Values)
* *no-requirement-if-reactive-bound-inversion*: return validation success if there is a reactive bounds inversion (maxQ < minQ); default is false
* *compare-results*: print output files with results both before and after the loadflow

## itool command

```
$ ./itools loadflow-validation --help
usage: itools [OPTIONS] loadflow-validation --case-file <FILE>
       [--compare-results] [--help] [--load-flow] --output-folder <FOLDER>
       [--output-format <VALIDATION_WRITER>] [--types
       <VALIDATION_TYPE,VALIDATION_TYPE,...>] [--verbose]

Available options are:
    --config-name <CONFIG_NAME>   Override configuration file name<commit_msg>Add a general description of the loadflow validation tool goal in the README.<commit_after># Loadflow validation

The goal of the loadflow validation tool is to check that loadflow results, either read from an iidm Network model, or computed by a LoadFlow implementation, are consistent with power systems equations.

The tool reports validation results in output files, with validation data and a success indicator for each equipment which has been tested.


## Configuration

You may configure the following properties in your platform configuration file.

```
<loadflow-validation>
	<threshold>0.1</threshold>
	<verbose>false</verbose>
	<load-flow-factory>com.powsybl.loadflow.mock.LoadFlowFactoryMock</load-flow-factory>
	<table-formatter-factory>com.powsybl.commons.io.table.CsvTableFormatterFactory</table-formatter-factory>
	<epsilon-x>0.1</epsilon-x>
	<apply-reactance-correction>false</apply-reactance-correction>
	<output-writer>CSV_MULTILINE</output-writer>
	<ok-missing-values>false</ok-missing-values>
	<no-requirement-if-reactive-bound-inversion>false</no-requirement-if-reactive-bound-inversion>
	<compare-results>false</compare-results>
</loadflow-validation>
```

* *threshold*: margin used for values comparison; default value is 0
* *verbose*: verbose output, default value is false
* *load-flow-factory*: load flow factory class; if not defined, the default configuration is used
* *table-formatter-factory* table formatter factory class; default value is com.powsybl.commons.io.table.CsvTableFormatterFactory
* *epsilon-x*: value used to correct the reactance in flows validation, used only if apply-reactance-correction is true; default value is 0.1
* *apply-reactance-correction*: apply reactance correction in flows validation; default value is false
* *output-writer*: output format [CSV, CSV_MULTILINE], default is CSV_MULTILINE
* *ok-missing-values*: perform validation check even if some parameters of connected components have NaN values; default value is false (i.e. validation check fails if some parameters of connected components have NaN Values)
* *no-requirement-if-reactive-bound-inversion*: return validation success if there is a reactive bounds inversion (maxQ < minQ); default is false
* *compare-results*: print output files with results both before and after the loadflow

## itools command

You can find below the help of the tool, as returned by the "--help" option.

```
$ ./itools loadflow-validation --help
usage: itools [OPTIONS] loadflow-validation --case-file <FILE>
       [--compare-results] [--help] [--load-flow] --output-folder <FOLDER>
       [--output-format <VALIDATION_WRITER>] [--types
       <VALIDATION_TYPE,VALIDATION_TYPE,...>] [--verbose]

Available options are:
    --config-name <CONFIG_NAME>   Override configuration file name
{'fraction_non_alphanumeric': 0.10761259465922679, 'fraction_numerical': 0.0027899561578318055, 'mean_word_length': 5.128205128205129, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2218447', 'n_tokens_mistral': 1438, 'n_tokens_neox': 1390, 'n_words': 457}