コード例 #1
0
void Neuron::inhibit(double clock){
	for (std::vector<double>::const_iterator i = refractions.begin(); i != refractions.end(); i++)
		v += refrac(clock - (*i));
}
コード例 #2
0
ファイル: solpos00.c プロジェクト: AsherBond/MondocosmOS
/*============================================================================
*    Long integer function S_solpos, adapted from the VAX solar libraries
*
*    This function calculates the apparent solar position and the
*    intensity of the sun (theoretical maximum solar energy) from
*    time and place on Earth.
*
*    Requires (from the struct posdata parameter):
*        Date and time:
*            year
*            daynum   (requirement depends on the S_DOY switch)
*            month    (requirement depends on the S_DOY switch)
*            day      (requirement depends on the S_DOY switch)
*            hour
*            minute
*            second
*            interval  DEFAULT 0
*        Location:
*            latitude
*            longitude
*        Location/time adjuster:
*            timezone
*        Atmospheric pressure and temperature:
*            press     DEFAULT 1013.0 mb
*            temp      DEFAULT 10.0 degrees C
*        Tilt of flat surface that receives solar energy:
*            aspect    DEFAULT 180 (South)
*            tilt      DEFAULT 0 (Horizontal)
*        Function Switch (codes defined in solpos.h)
*            function  DEFAULT S_ALL
*
*    Returns (via the struct posdata parameter):
*        everything defined in the struct posdata in solpos.h.
*----------------------------------------------------------------------------*/
long S_solpos(struct posdata *pdat)
{
    long int retval;

    struct trigdata trigdat, *tdat;

    tdat = &trigdat;		/* point to the structure */

    /* initialize the trig structure */
    tdat->sd = -999.0;		/* flag to force calculation of trig data */
    tdat->cd = 1.0;
    tdat->ch = 1.0;		/* set the rest of these to something safe */
    tdat->cl = 1.0;
    tdat->sl = 1.0;

    if ((retval = validate(pdat)) != 0)	/* validate the inputs */
	return retval;


    if (pdat->function & L_DOY)
	doy2dom(pdat);		/* convert input doy to month-day */
    else
	dom2doy(pdat);		/* convert input month-day to doy */

    if (pdat->function & L_GEOM)
	geometry(pdat);		/* do basic geometry calculations */

    if (pdat->function & L_ZENETR)	/* etr at non-refracted zenith angle */
	zen_no_ref(pdat, tdat);

    if (pdat->function & L_SSHA)	/* Sunset hour calculation */
	ssha(pdat, tdat);

    if (pdat->function & L_SBCF)	/* Shadowband correction factor */
	sbcf(pdat, tdat);

    if (pdat->function & L_TST)	/* true solar time */
	tst(pdat);

    if (pdat->function & L_SRSS)	/* sunrise/sunset calculations */
	srss(pdat);

    if (pdat->function & L_SOLAZM)	/* solar azimuth calculations */
	sazm(pdat, tdat);

    if (pdat->function & L_REFRAC)	/* atmospheric refraction calculations */
	refrac(pdat);

    if (pdat->function & L_AMASS)	/* airmass calculations */
	amass(pdat);

    if (pdat->function & L_PRIME)	/* kt-prime/unprime calculations */
	prime(pdat);

    if (pdat->function & L_ETR)	/* ETR and ETRN (refracted) */
	etr(pdat);

    if (pdat->function & L_TILT)	/* tilt calculations */
	tilt(pdat);

    return 0;
}