output_crosstalk.cpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /***************************************************************************\
  2. * *
  3. * ROUTINE NAME NMMTL_OUTPUT_CROSSTALK *
  4. * *
  5. * ABSTRACT *
  6. * Write forward and backward crosstalk to specified file. *
  7. * *
  8. * CALLING FORMAT *
  9. * nmmtl_output_crosstalk(output_fp, forward_xtk, *
  10. * backward_xtk, signals); *
  11. * *
  12. * RETURN VALUE *
  13. * *
  14. * INPUT PARAMETERS *
  15. * FILE *output_fp; output file ptr *
  16. * float **forward_xtk; *
  17. * float **backward_xtk; *
  18. * struct contour *signals; signal line info (names) *
  19. * *
  20. * OUTPUT PARAMETERS *
  21. * *
  22. * USER FUNCTIONS & SYSTEM SERVICES CALLED *
  23. * *
  24. * AUTHOR Jeff Prentice *
  25. * *
  26. * CREATION DATE 04-MAR-1992 *
  27. * *
  28. * Copyright (C) 1991 by Mayo Foundation. All rights reserved. *
  29. * *
  30. \***************************************************************************/
  31. #include "nmmtl.h"
  32. void nmmtl_output_crosstalk(FILE *output_fp, float **forward_xtk,
  33. float **backward_xtk, struct contour *signals)
  34. {
  35. struct contour *sig_line1, *sig_line2; /* signal ptrs */
  36. int i,j; /* array indices */
  37. /********************************************************************
  38. * *
  39. * Output forward crosstalk. *
  40. * *
  41. ********************************************************************/
  42. fprintf(output_fp, "\nFar-End (Forward) Cross Talk:\n");
  43. fprintf(output_fp, "FXT(Active Signal, Passive Signal)\n");
  44. for (sig_line1 = signals, i = 0;
  45. sig_line1 != NULL;
  46. sig_line1 = sig_line1->next, i++)
  47. {
  48. for (sig_line2 = signals, j = 0;
  49. sig_line2 != NULL;
  50. sig_line2 = sig_line2->next, j++)
  51. {
  52. if (j > i)
  53. {
  54. if(forward_xtk[i][j] != 0.0)
  55. fprintf(output_fp, "FXT( ::%s , ::%s )= %11.5e = %11.5f dB\n",
  56. sig_line1->name, sig_line2->name, forward_xtk[i][j],
  57. (20.0 * log10(fabs(forward_xtk[i][j]))));
  58. else
  59. fprintf(output_fp, "FXT( ::%s , ::%s )= %11.5e = infinite dB\n",
  60. sig_line1->name, sig_line2->name, forward_xtk[i][j]);
  61. }
  62. }
  63. }
  64. /********************************************************************
  65. * *
  66. * Output backward crosstalk. *
  67. * *
  68. ********************************************************************/
  69. fprintf(output_fp, "\nNear-End (Backward) Cross Talk:\n");
  70. fprintf(output_fp, "BXT(Active Signal, Passive Signal)\n");
  71. for (sig_line1 = signals, i = 0;
  72. sig_line1 != NULL;
  73. sig_line1 = sig_line1->next, i++)
  74. {
  75. for (sig_line2 = signals, j = 0;
  76. sig_line2 != NULL;
  77. sig_line2 = sig_line2->next, j++)
  78. {
  79. if (j > i)
  80. {
  81. if(backward_xtk[i][j] != 0.0)
  82. fprintf(output_fp, "BXT( ::%s , ::%s )= %11.5e = %11.5f dB\n",
  83. sig_line1->name, sig_line2->name, backward_xtk[i][j],
  84. (20.0 * log10(fabs(backward_xtk[i][j]))));
  85. else
  86. fprintf(output_fp, "BXT( ::%s , ::%s )= %11.5e = infinite dB\n",
  87. sig_line1->name, sig_line2->name, backward_xtk[i][j]);
  88. }
  89. }
  90. }
  91. fprintf(output_fp,
  92. "\nNOTE: Cross talk results assume there are no reflections.\n");
  93. }