Artifact 59c9450bf7b30445a3dddadfda5e1837e196f2b6ee369726aae544fb7a4f3da0:
- Executable file mttroot/mtt/lib/cr/hh/squarelaw.hh — part of check-in [558c174ebf] at 2000-12-28 09:19:07 on branch origin/master — put under RCS (user: gawthrop@users.sourceforge.net, size: 502) [annotate] [blame] [check-ins using] [more...]
#ifndef SQUARELAW_HH #define SQUARELAW_HH #include <math.h> #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