/** * Convertit une masse d'une unite vers une autre unite * * @param float $weight Masse a convertir * @param int &$from_unit Unite originale en puissance de 10 * @param int $to_unit Nouvelle unite en puissance de 10 * @return float Masse convertie */ function weight_convert($weight, &$from_unit, $to_unit) { /* Pour convertire 320 gr en Kg appeler * $f = -3 * weigh_convert(320, $f, 0) retournera 0.32 * */ while ($from_unit != $to_unit) { if ($from_unit > $to_unit) { $weight = $weight * 10; $from_unit = $from_unit - 1; $weight = weight_convert($weight, $from_unit, $to_unit); } if ($from_unit < $to_unit) { $weight = $weight / 10; $from_unit = $from_unit + 1; $weight = weight_convert($weight, $from_unit, $to_unit); } } return $weight; }
$xml_output .= "\t\t</STYLE>\n"; // Begin <EQUIPMENT> tag if ($source == "brewLog" && $row_log['brewEquipProfile'] != "") { $xml_output .= "\t\t<EQUIPMENT>\n"; $replaced = strtr($row_equip_profiles['equipProfileName'], $html_remove); $xml_output .= "\t\t\t<NAME>" . $replaced . "</NAME>\n"; $xml_output .= "\t\t\t<VERSION>1</VERSION>\n"; if ($row_pref['measWeight2'] == "pounds") { $xml_output .= "\t\t\t<BOIL_SIZE>" . weight_convert($row_equip_profiles['equipBoilVolume'], "kilograms") . "</BOIL_SIZE>\n"; $xml_output .= "\t\t\t<BATCH_SIZE>" . weight_convert($row_equip_profiles['equipBatchSize'], "kilograms") . "</BATCH_SIZE>\n"; $xml_output .= "\t\t\t<TUN_VOLUME>" . weight_convert($row_equip_profiles['equipMashTunVolume'], "kilograms") . "</TUN_VOLUME>\n"; $xml_output .= "\t\t\t<TUN_WEIGHT>" . weight_convert($row_equip_profiles['equipMashTunWeight'], "kilograms") . "</TUN_WEIGHT>\n"; $xml_output .= "\t\t\t<TOP_UP_WATER>" . weight_convert($row_equip_profiles['equipTopUp'], "kilograms") . "</TOP_UP_WATER>\n"; $xml_output .= "\t\t\t<LAUTER_DEADSPACE>" . weight_convert($row_equip_profiles['equipMashTunDeadspace'], "kilograms") . "</LAUTER_DEADSPACE>\n"; $xml_output .= "\t\t\t<TOP_UP_KETTLE>" . weight_convert($row_equip_profiles['equipTopUpKettle'], "kilograms") . "</TOP_UP_KETTLE>\n"; $xml_output .= "\t\t\t<TRUB_CHILLER_LOSS>" . weight_convert($row_equip_profiles['equipLoss'], "kilograms") . "</TRUB_CHILLER_LOSS>\n"; } else { $xml_output .= "\t\t\t<BOIL_SIZE>" . $row_equip_profiles['equipBoilVolume'] . "</BOIL_SIZE>\n"; $xml_output .= "\t\t\t<BATCH_SIZE>" . $row_equip_profiles['equipBatchSize'] . "</BATCH_SIZE>\n"; $xml_output .= "\t\t\t<TUN_VOLUME>" . $row_equip_profiles['equipMashTunVolume'] . "</TUN_VOLUME>\n"; $xml_output .= "\t\t\t<TUN_WEIGHT>" . $row_equip_profiles['equipMashTunWeight'] . "</TUN_WEIGHT>\n"; $xml_output .= "\t\t\t<TOP_UP_WATER>" . $row_equip_profiles['equipTopUp'] . "</TOP_UP_WATER>\n"; $xml_output .= "\t\t\t<LAUTER_DEADSPACE>" . $row_equip_profiles['equipMashTunDeadspace'] . "</LAUTER_DEADSPACE>\n"; $xml_output .= "\t\t\t<TOP_UP_KETTLE>" . $row_equip_profiles['equipTopUpKettle'] . "</TOP_UP_KETTLE>\n"; $xml_output .= "\t\t\t<TRUB_CHILLER_LOSS>" . $row_equip_profiles['equipLoss'] . "</TRUB_CHILLER_LOSS>\n"; } $xml_output .= "\t\t\t<TUN_SPECIFIC_HEAT>" . $row_equip_profiles['equipMashTunSpecificHeat'] . "</TUN_SPECIFIC_HEAT>\n"; $xml_output .= "\t\t\t<EVAP_RATE>" . $row_equip_profiles['equipEvapRate'] . "</EVAP_RATE>\n"; $xml_output .= "\t\t\t<BOIL_TIME>" . $row_log['brewBoilTime'] . "</BOIL_TIME>\n"; $xml_output .= "\t\t\t<HOP_UTILIZATION>" . $row_equip_profiles['equipHopUtil'] . "</HOP_UTILIZATION>\n"; $replaced = strtr($row_equip_profiles['equipNotes'], $string);