Artifact 57afb078763565223c60ccb5ff92669d48d58f7dd2315292ff2e744280d5dd64:
- Executable file mttroot/mtt/lib/cr/hh/squarelaw.hh — part of check-in [b22e319862] at 2004-08-09 17:45:56 on branch origin/master — cmath is preferred to math.h (user: geraint@users.sourceforge.net, size: 500) [annotate] [blame] [check-ins using] [more...]
#ifndef SQUARELAW_HH #define SQUARELAW_HH #include <cmath #include "sign.hh" inline double squarelaw(const double gain, const causality_t causality, const int port, const double input, const causality_t in_causality, const int in_port) /* * implements P = R Q^2 * direction of flow is retained */ { if (causality == effort) { return pow(input, 2) * gain * sign(input * gain); } else { return sqrt(fabs(input / gain)) * sign(input / gain); } } #endif // SQUARELAE_HH