void mutual::calcSP (nr_double_t frequency) { #if 0 setMatrixS (ytos (calcMatrixY (frequency))); #else nr_double_t l1 = getPropertyDouble ("L1"); nr_double_t l2 = getPropertyDouble ("L2"); nr_double_t k = getPropertyDouble ("k"); nr_double_t o = 2 * M_PI * frequency; nr_double_t a = k * k - 1; nr_complex_t d = rect (o * o * l1 * l2 * a / 2 / z0 + 2 * z0, o * (l1 + l2)); nr_complex_t r; r = rect (2 * z0, o * l2) / d; setS (NODE_1, NODE_4, r); setS (NODE_4, NODE_1, r); r = 1.0 - r; setS (NODE_1, NODE_1, r); setS (NODE_4, NODE_4, r); r = rect (2 * z0, o * l1) / d; setS (NODE_2, NODE_3, r); setS (NODE_3, NODE_2, r); r = 1.0 - r; setS (NODE_2, NODE_2, r); setS (NODE_3, NODE_3, r); r = rect (0, o * k * sqrt (l1 * l2)) / d; setS (NODE_1, NODE_2, r); setS (NODE_2, NODE_1, r); setS (NODE_3, NODE_4, r); setS (NODE_4, NODE_3, r); r = -r; setS (NODE_1, NODE_3, r); setS (NODE_3, NODE_1, r); setS (NODE_2, NODE_4, r); setS (NODE_4, NODE_2, r); #endif }
/*-------------------------------------------------------------------------+ | Function: rtc_read | Description: Read present time from RTC and return it. | Global Variables: None. | Arguments: tod - to return present time in 'rtems_time_of_day' format. | Returns: number of seconds from 1970/01/01 corresponding to 'tod'. +--------------------------------------------------------------------------*/ long int rtc_read(rtems_time_of_day *tod) { uint8_t sa; uint32_t sec = 0; memset(tod, 0, sizeof *tod); /* zero tod structure */ /* do we have a realtime clock present? (otherwise we loop below) */ sa = rtcin(RTC_STATUSA); if (sa == 0xff || sa == 0) return -1; /* ready for a read? */ while ((sa&RTCSA_TUP) == RTCSA_TUP) sa = rtcin(RTC_STATUSA); tod->year = bcd(rtcin(RTC_YEAR)) + 1900; /* year */ if (tod->year < 1970) tod->year += 100; tod->month = bcd(rtcin(RTC_MONTH)); /* month */ tod->day = bcd(rtcin(RTC_DAY)); /* day */ (void) bcd(rtcin(RTC_WDAY)); /* weekday */ tod->hour = bcd(rtcin(RTC_HRS)); /* hour */ tod->minute = bcd(rtcin(RTC_MIN)); /* minutes */ tod->second = bcd(rtcin(RTC_SEC)); /* seconds */ tod->ticks = 0; #ifndef QUICK_READ /* Quick read of the RTC: don't return number of seconds. */ sec = ytos(tod->year); sec += mtos(tod->month, (tod->year % 4) == 0); sec += tod->day * SECS_PER_DAY; sec += tod->hour * 60 * 60; /* hour */ sec += tod->minute * 60; /* minutes */ sec += tod->second; /* seconds */ #endif /* QUICK_READ */ return (long int)sec; } /* rtc_read */
/*! Compute S parameters. *! Reuse computed Y matrix. */ void bondwire::calcSP (const nr_double_t frequency) { setMatrixS (ytos (calcMatrixY (frequency))); }
void mutual2::calcSP (nr_double_t frequency) { setMatrixS (ytos (calcMatrixY (frequency))); }
matvec ytos (matvec y, nr_complex_t z0) { return ytos (y, vector (y.getCols (), z0)); }
// Convert admittance matrix to scattering parameter matrix vector. matvec ytos (matvec y, vector z0) { assert (y.getCols () == y.getRows () && y.getCols () == z0.getSize ()); matvec res (y.getSize (), y.getCols (), y.getRows ()); for (int i = 0; i < y.getSize (); i++) res.set (ytos (y.get (i), z0), i); return res; }
void cpwgap::calcSP (nr_double_t frequency) { setMatrixS (ytos (calcMatrixY (frequency))); }
void mscross::calcSP (nr_double_t frequency) { setMatrixS (ytos (calcMatrixY (frequency))); }