diff --git a/models/power/power.dat b/models/power/power.dat new file mode 100644 index 00000000..0ac76f23 --- /dev/null +++ b/models/power/power.dat @@ -0,0 +1,20 @@ +a +0 4 +1 4 +b +0 1.41421 +1 1.41421 +base +0 2 +c +0 2.82843 +1 2.82843 +FINAL TIME +0 1 +INITIAL TIME +0 0 +SAVEPER +0 1 +1 1 +TIME STEP +0 1 diff --git a/models/power/power.mdl b/models/power/power.mdl new file mode 100644 index 00000000..bbabae27 --- /dev/null +++ b/models/power/power.mdl @@ -0,0 +1,10 @@ +{UTF-8} +base = 2 ~~| +a = POWER(base, 2) ~~| +b = POWER(base, 0.5) ~~| +c = POWER(base, 1.5) ~~| + +INITIAL TIME = 0 ~~| +FINAL TIME = 1 ~~| +TIME STEP = 1 ~~| +SAVEPER = TIME STEP ~~| diff --git a/packages/cli/src/c/vensim.h b/packages/cli/src/c/vensim.h index b5fb37b4..ca38e743 100644 --- a/packages/cli/src/c/vensim.h +++ b/packages/cli/src/c/vensim.h @@ -26,6 +26,7 @@ extern "C" { #define _MAX(a, b) fmax(a, b) #define _MIN(a, b) fmin(a, b) #define _MODULO(a, b) fmod(a, b) +#define _POWER(a, b) pow(a, b) #define _QUANTUM(a, b) ((b) <= 0 ? (a) : (b) * trunc((a) / (b))) #define _SAMPLE_IF_TRUE(current, condition, input) (bool_cond(condition) ? (input) : (current)) #define _SIN(x) sin(x)