/* Program Section: dk_watts_analyze.c Revision: 28-May-2025 */ /** Loop over the 6 DCDC Converters calculating **/ /** the data for each converter: **/ loop_count = 1 ; while (loop_count <= 6) { /** Based on the Measured Voltage Drop and the known **/ /** value of this DCDC Converter's Shunt Resistor - **/ /** calculate the Input Current to this Converter. **/ /** **/ /** Recall that the Shunt Voltage Drop is in mVolts **/ /** and that we will eventually calculate an Output **/ /** Current in mAmps. **/ I_input[loop_count] = V_drop_measured[loop_count] / R_shunt[loop_count] ; /** Based on the Input Current to this DCDC Converter **/ /** and the known 5.0 Volt value of the bus that feeds **/ /** the Converter's input - calculate the Power going **/ /** to this Converter's Input in mWatts. **/ W_input[loop_count] = I_input[loop_count] * SUPPLY_BUS_VOLTAGE ; /** Based on the Power going to this Converter's Input **/ /** and the Expected Efficiency of this Converter at **/ /** this Operating Point - calculate the Output Power **/ /** coming from this Converter in mWatts. **/ W_output[loop_count] = W_input[loop_count] * Efficiency[loop_count] ; /** Based on the Power coming from this Converter's **/ /** Output and the known Voltage of this Converter's **/ /** Output - calculate this Converter's Output Current. **/ /** **/ /** The Output Current is in mAmps. **/ I_output[loop_count] = W_output[loop_count] / V_bus[loop_count] ; ++loop_count ; } /** Now print a column header for the individual converter information **/ printf( "\n Shunt " ) ; printf( "\n Voltage Input Input Output Output " ) ; printf( "\n DCDC Drop Current Power Power Current " ) ; printf( "\n Converter mVolts mAmps mWatts mWatts mAmps " ) ; printf( "\n --------- ------- ------- ------- ------- ------- " ) ; printf( "\n " ) ; /** Now output the information for the individual Converters **/ loop_count = 1 ; while (loop_count <= 6) { printf( "\n %1d %7.2f %7.2f %7.2f %7.2f %7.2f \n", loop_count, V_drop_measured[loop_count], I_input[loop_count], W_input[loop_count], W_output[loop_count], I_output[loop_count] ) ; ++loop_count ; } printf( "\n\n\n " ) ; /** **/ /** Now calculate the overall: Input Current, Input Power, **/ /** and Output Power **/ /** **/ sum_all_converters = 0.0 ; loop_count = 1 ; while (loop_count <= 6) { sum_all_converters = sum_all_converters + I_input[loop_count] ; ++loop_count ; } printf( " Total Input Current for all 6 Converters = %7.2f mA \n\n", sum_all_converters ) ; sum_all_converters = 0.0 ; loop_count = 1 ; while (loop_count <= 6) { sum_all_converters = sum_all_converters + W_input[loop_count] ; ++loop_count ; } printf( " Total Input Power for all 6 Converters = %7.2f mW \n\n", sum_all_converters ) ; temp_store_1 = sum_all_converters ; sum_all_converters = 0.0 ; loop_count = 1 ; while (loop_count <= 6) { sum_all_converters = sum_all_converters + W_output[loop_count] ; ++loop_count ; } printf( " Total Output Power for all 6 Converters = %7.2f mW \n\n", sum_all_converters ) ; temp_store_1 = ( sum_all_converters / temp_store_1 ) * 100.0 ; printf( " Overall Efficiency converting 5 V to Load Buses = %5.2f percent \n\n\n", temp_store_1 ) ; /** **/ /** That finishes the DCDC Converter power analysis. **/ /** **/ return (1); }