/* Program Section: dk_watts_read_measured_data.c Revision: 29-May-2025 Note: The Converter Efficiencies are Revision 6-June-2025 */ #include #include #include /** Define some Constants **/ #define SUPPLY_BUS_VOLTAGE 5.00 #define MAX_ARRAY 7 main( int argc, char *argv[] ) { double V_drop_measured[MAX_ARRAY] ; double R_shunt[MAX_ARRAY] ; double I_input[MAX_ARRAY] ; double W_input[MAX_ARRAY] ; double Efficiency[MAX_ARRAY] ; double W_output[MAX_ARRAY] ; double V_bus[MAX_ARRAY] ; double I_output[MAX_ARRAY] ; /** Declare Character Variables **/ char* end; /** Declare some Integer Variables **/ int loop_count = 1 ; /** Declare some Double Floating Point Variables **/ double sum_all_converters = 0.0 ; double temp_store_1 = 0.0 ; /** Give the values of the 6 Current Shunt Resistors in Ohms **/ R_shunt[1] = 0.020 ; R_shunt[2] = 0.020 ; R_shunt[3] = 0.010 ; R_shunt[4] = 0.025 ; R_shunt[5] = 0.025 ; R_shunt[6] = 0.025 ; /** Give the values of the 6 DCDC Converter Expected Efficiencies **/ /** **/ /** ---> The Converter Efficiencies are Revision 6-June-2025 **/ /** **/ /** These values come from the TI Converter Datasheets where the **/ /** efficiency curves are evaluated at the expected operating point. **/ Efficiency[1] = 0.77 ; Efficiency[2] = 0.86 ; Efficiency[3] = 0.76 ; Efficiency[4] = 0.81 ; Efficiency[5] = 0.60 ; Efficiency[6] = 0.72 ; /** Give the values of the 6 DCDC Converter Output Voltages in Voits **/ V_bus[1] = 1.000 ; V_bus[2] = 1.050 ; V_bus[3] = 1.200 ; V_bus[4] = 1.800 ; V_bus[5] = 2.500 ; V_bus[6] = 3.300 ; /** **/ /** Before starting the actual program first put up on the **/ /** screen some background information about the 6x DCDC **/ /** Converters just to help folks recall how these DK Brd **/ /** power supplies are setup. E.G. the output voltage **/ /** from each of these 6x DCDC Converters and where on the **/ /** DK Brd they are located. **/ /** **/ printf( "\n\n\n " ); printf( " Main \n "); printf( " DCDC Output \n "); printf( " Converter Net Principal Filtered Output Nets \n "); printf( " --------- --------- ----------------------------------------- \n "); printf( " 1 BULK_1V00 ADC_ANALOG_1V00, ADC_DIGITAL_1V00 \n "); printf( " 2 BULK_1V05 CORE_1V05, XCVR_1V05 \n "); printf( " 3 BULK_1V2 \n "); printf( " 4 BULK_1V8 FPGA_1V8, ADC_ANALOG_1V8, ADC_DIGITAL_1V8 \n "); printf( " 5 BULK_2V5 ANALOG_2V5, DIGITAL_2V5 \n "); printf( " 6 BULK_3V3 \n "); printf( "\n\n\n " ); printf( " Interposer Connectors \n "); printf( " +-----------------------------------------+ \n "); printf( " | | \n "); printf( " | | \n "); printf( " | DCDC6 DCDC5 DCDC4 | \n "); printf( " Main | | \n "); printf( " Cable | | PMT \n "); printf( " Conn | | 1:8 \n "); printf( " | | \n "); printf( " | | \n "); printf( " | D D | PMT \n "); printf( " | C C DCDC1 | 9:16 \n "); printf( " | D D | \n "); printf( " | C C | \n "); printf( " | 3 2 | \n "); printf( " | | \n "); printf( " +-----------------------+ / \n "); printf( " | Optical / \n "); printf( " Barnacle | Connectors / \n "); printf( " Connector | / \n "); printf( " +------------/ \n "); printf( " \n "); /** **/ /** Get the value of the Voltage Drop across the 4 Terminal **/ /** Current Shunt Resistors at the inputs to the 6 **/ /** DCDC Converters. **/ /** **/ /** **/ /** Note: that these 6 values are in mVolts and may be either **/ /** supplied here in responce to the prompt or may have **/ /** been supplied on the command line used to start this **/ /** program. **/ /** **/ if ( argc == 1) /** Prompt the user for 6 Voltage Drop values **/ { printf(" \n \n \n ") ; loop_count = 1 ; while (loop_count <= 6) { printf("Enter the Voltage Drop across the DCDC_%1d Shunt Resistor in mV: ", loop_count ); scanf( "%lf", &V_drop_measured[loop_count] ) ; printf(" \n ") ; ++loop_count ; } } else if ( argc == 7 ) /** 6 Voltage Drops come from the command line **/ { printf( "\n\n\n " ); printf( "The 6 Shunt Voltage Drops are received from the command line. \n\n\n "); loop_count = 1 ; while (loop_count <= 6) { V_drop_measured[loop_count] = strtod(argv[loop_count], &end) ; ++loop_count ; } } else { printf( "\n\n\n " ); printf( "ERROR an illegal number of arguments was present \n "); printf( "on the command line. The user should either provide \n "); printf( "no arguments on the command line in which case this \n "); printf( "program will prompted the user for all required \n "); printf( "arguments or the user should supply all 6 \n "); printf( "Shunt Resistor Voltage Drops on the command line. \n\n\n "); exit (1); } /** **/ /** We now have all the information that we need to start the actual work **/ /** **/