+#define QTY_SUPPLIED(f,...) this_##f != VAL_NOTFOUND &&
+#define QTY_USE_ENERGY(f,...) this_##f = this_##f##_energy;
+#define QTY_USE_CHARGE(f,...) this_##f = this_##f##_charge;
+
+ double funky_multiplier;
+ if (BAT_QTYS(QTY_SUPPLIED,_energy,,) 1) {
+ if (debug) printf(" using energy\n");
+ BAT_QTYS(QTY_USE_ENERGY,,,);
+ funky_multiplier = 1.0;
+ } else if (BAT_QTYS(QTY_SUPPLIED,_charge,,)
+ this_voltage != VAL_NOTFOUND) {
+ if (debug) printf(" using charge\n");
+ BAT_QTYS(QTY_USE_CHARGE,,,);
+ funky_multiplier = this_voltage * 1e-6;
+ } else {
+ batfailc("neither complete set of energy nor charge");
+ continue;
+ }