@@ -76,14 +76,23 @@ public void convert() {
7676 addAliases (vl );
7777
7878 // Check voltage limit consistency.
79- if (lowVoltageLimit <= highVoltageLimit ) {
80- vl .setHighVoltageLimit (highVoltageLimit );
81- vl .setLowVoltageLimit (lowVoltageLimit );
82- vl .setProperty (PROPERTY_HIGH_VOLTAGE_LIMIT , String .valueOf (highVoltageLimit ));
83- vl .setProperty (PROPERTY_LOW_VOLTAGE_LIMIT , String .valueOf (lowVoltageLimit ));
84- } else {
79+ if (highVoltageLimit < lowVoltageLimit ) {
80+ // this code path is never reached if either of the values is NaN, i.e. not provided in input
8581 ignored ("high/low voltage limits" ,
86- () -> String .format ("lowVoltageLimit (%f) is greater than highVoltageLimit (%f)." , lowVoltageLimit , highVoltageLimit ));
82+ () -> String .format ("lowVoltageLimit (%f) is greater than highVoltageLimit (%f)." , lowVoltageLimit , highVoltageLimit ));
83+ } else {
84+ // either:
85+ // - no limits defined
86+ // - or, only one limit is defined
87+ // - or, both limits are defined and they are consistent
88+ if (!Double .isNaN (highVoltageLimit )) {
89+ vl .setHighVoltageLimit (highVoltageLimit );
90+ vl .setProperty (PROPERTY_HIGH_VOLTAGE_LIMIT , String .valueOf (highVoltageLimit ));
91+ }
92+ if (!Double .isNaN (lowVoltageLimit )) {
93+ vl .setLowVoltageLimit (lowVoltageLimit );
94+ vl .setProperty (PROPERTY_LOW_VOLTAGE_LIMIT , String .valueOf (lowVoltageLimit ));
95+ }
8796 }
8897 }
8998 }
0 commit comments