diff --git a/models/smooth/smooth.dat b/models/smooth/smooth.dat index d327ee0f..48ebf0ce 100644 --- a/models/smooth/smooth.dat +++ b/models/smooth/smooth.dat @@ -1,1557 +1,3 @@ -#s10>SMOOTH#[A2] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s10>SMOOTH#[A3] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s1>SMOOTH# -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s2>SMOOTH# -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s3>SMOOTH#[A1] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s3>SMOOTH#[A2] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s3>SMOOTH#[A3] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s4>SMOOTH#[A2] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s4>SMOOTH#[A3] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s5>SMOOTH3#[A2] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3 -12 3 -13 6.375 -14 1.3125 -15 6.375 -16 2.15625 -17 5.32031 -18 3.10547 -19 4.58203 -20 3.63281 -21 4.22607 -22 3.86353 -23 0.706055 -24 5.64001 -25 0.652496 -26 4.82799 -27 1.68864 -28 3.88948 -29 2.4208 -30 3.36561 -31 2.7748 -32 3.13599 -33 2.91921 -34 3.04734 -35 2.97258 -36 3.01572 -37 2.99107 -38 3.00504 -39 2.99718 -40 3.00157 -#s5>SMOOTH3#[A3] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3 -12 3 -13 6.375 -14 1.3125 -15 6.375 -16 2.15625 -17 5.32031 -18 3.10547 -19 4.58203 -20 3.63281 -21 4.22607 -22 3.86353 -23 0.706055 -24 5.64001 -25 0.652496 -26 4.82799 -27 1.68864 -28 3.88948 -29 2.4208 -30 3.36561 -31 2.7748 -32 3.13599 -33 2.91921 -34 3.04734 -35 2.97258 -36 3.01572 -37 2.99107 -38 3.00504 -39 2.99718 -40 3.00157 -#s5>SMOOTH3>DL#[A2] -0 0.666667 -1 0.666667 -2 0.666667 -3 0.666667 -4 0.666667 -5 0.666667 -6 0.666667 -7 0.666667 -8 0.666667 -9 0.666667 -10 0.666667 -11 0.666667 -12 0.666667 -13 0.666667 -14 0.666667 -15 0.666667 -16 0.666667 -17 0.666667 -18 0.666667 -19 0.666667 -20 0.666667 -21 0.666667 -22 0.666667 -23 0.666667 -24 0.666667 -25 0.666667 -26 0.666667 -27 0.666667 -28 0.666667 -29 0.666667 -30 0.666667 -31 0.666667 -32 0.666667 -33 0.666667 -34 0.666667 -35 0.666667 -36 0.666667 -37 0.666667 -38 0.666667 -39 0.666667 -40 0.666667 -#s5>SMOOTH3>DL#[A3] -0 0.666667 -1 0.666667 -2 0.666667 -3 0.666667 -4 0.666667 -5 0.666667 -6 0.666667 -7 0.666667 -8 0.666667 -9 0.666667 -10 0.666667 -11 0.666667 -12 0.666667 -13 0.666667 -14 0.666667 -15 0.666667 -16 0.666667 -17 0.666667 -18 0.666667 -19 0.666667 -20 0.666667 -21 0.666667 -22 0.666667 -23 0.666667 -24 0.666667 -25 0.666667 -26 0.666667 -27 0.666667 -28 0.666667 -29 0.666667 -30 0.666667 -31 0.666667 -32 0.666667 -33 0.666667 -34 0.666667 -35 0.666667 -36 0.666667 -37 0.666667 -38 0.666667 -39 0.666667 -40 0.666667 -#s5>SMOOTH3>LV1#[A2] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 4.5 -12 3.75 -13 4.125 -14 3.9375 -15 4.03125 -16 3.98438 -17 4.00781 -18 3.99609 -19 4.00195 -20 3.99902 -21 2.50049 -22 3.24976 -23 2.87512 -24 3.06244 -25 2.96878 -26 3.01561 -27 2.9922 -28 3.0039 -29 2.99805 -30 3.00098 -31 2.99951 -32 3.00024 -33 2.99988 -34 3.00006 -35 2.99997 -36 3.00002 -37 2.99999 -38 3 -39 3 -40 3 -#s5>SMOOTH3>LV1#[A3] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 4.5 -12 3.75 -13 4.125 -14 3.9375 -15 4.03125 -16 3.98438 -17 4.00781 -18 3.99609 -19 4.00195 -20 3.99902 -21 2.50049 -22 3.24976 -23 2.87512 -24 3.06244 -25 2.96878 -26 3.01561 -27 2.9922 -28 3.0039 -29 2.99805 -30 3.00098 -31 2.99951 -32 3.00024 -33 2.99988 -34 3.00006 -35 2.99997 -36 3.00002 -37 2.99999 -38 3 -39 3 -40 3 -#s5>SMOOTH3>LV2#[A2] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3 -12 5.25 -13 3 -14 4.6875 -15 3.5625 -16 4.26562 -17 3.84375 -18 4.08984 -19 3.94922 -20 4.02832 -21 3.98438 -22 1.75854 -23 3.99536 -24 2.315 -25 3.43616 -26 2.73509 -27 3.15587 -28 2.91036 -29 3.05067 -30 2.97174 -31 3.0156 -32 2.99147 -33 3.00463 -34 2.9975 -35 3.00134 -36 2.99928 -37 3.00038 -38 2.9998 -39 3.00011 -40 2.99994 -#s5>SMOOTH3>LV2#[A3] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3 -12 5.25 -13 3 -14 4.6875 -15 3.5625 -16 4.26562 -17 3.84375 -18 4.08984 -19 3.94922 -20 4.02832 -21 3.98438 -22 1.75854 -23 3.99536 -24 2.315 -25 3.43616 -26 2.73509 -27 3.15587 -28 2.91036 -29 3.05067 -30 2.97174 -31 3.0156 -32 2.99147 -33 3.00463 -34 2.9975 -35 3.00134 -36 2.99928 -37 3.00038 -38 2.9998 -39 3.00011 -40 2.99994 -#s6>SMOOTH#[B1] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s6>SMOOTH#[B2] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s6>SMOOTH#[B3] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s7>SMOOTH#[B2] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s7>SMOOTH#[B3] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s8>SMOOTH#[A1,B1] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s8>SMOOTH#[A1,B2] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s8>SMOOTH#[A1,B3] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s8>SMOOTH#[A2,B1] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s8>SMOOTH#[A2,B2] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s8>SMOOTH#[A2,B3] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s8>SMOOTH#[A3,B1] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s8>SMOOTH#[A3,B2] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s8>SMOOTH#[A3,B3] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s9>SMOOTH#[A2,B1] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s9>SMOOTH#[A2,B2] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s9>SMOOTH#[A2,B3] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s9>SMOOTH#[A3,B1] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s9>SMOOTH#[A3,B2] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 -#s9>SMOOTH#[A3,B3] -0 3 -1 3 -2 3 -3 3 -4 3 -5 3 -6 3 -7 3 -8 3 -9 3 -10 3 -11 3.5 -12 3.75 -13 3.875 -14 3.9375 -15 3.96875 -16 3.98438 -17 3.99219 -18 3.99609 -19 3.99805 -20 3.99902 -21 3.49951 -22 3.24976 -23 3.12488 -24 3.06244 -25 3.03122 -26 3.01561 -27 3.0078 -28 3.0039 -29 3.00195 -30 3.00098 -31 3.00049 -32 3.00024 -33 3.00012 -34 3.00006 -35 3.00003 -36 3.00002 -37 3.00001 -38 3 -39 3 -40 3 delay 0 2 delay 2[A2] @@ -1566,6 +12,14 @@ delay 3[A3] 0 2 FINAL TIME 0 40 +initial s +0 50 +initial s with subscripts[A1] +0 50 +initial s with subscripts[A2] +0 50 +initial s with subscripts[A3] +0 50 INITIAL TIME 0 0 input @@ -2576,6 +1030,510 @@ s10[A3,B1] 38 3 39 3 40 3 +s11[A1] +0 3 +1 3 +2 3 +3 3 +4 3 +5 3 +6 3 +7 3 +8 3 +9 3 +10 3 +11 3 +12 3 +13 6.375 +14 1.3125 +15 6.375 +16 2.15625 +17 5.32031 +18 3.10547 +19 4.58203 +20 3.63281 +21 4.22607 +22 3.86353 +23 0.706055 +24 5.64001 +25 0.652496 +26 4.82799 +27 1.68864 +28 3.88948 +29 2.4208 +30 3.36561 +31 2.7748 +32 3.13599 +33 2.91921 +34 3.04734 +35 2.97258 +36 3.01572 +37 2.99107 +38 3.00504 +39 2.99718 +40 3.00157 +s11[A2] +0 3 +1 3 +2 3 +3 3 +4 3 +5 3 +6 3 +7 3 +8 3 +9 3 +10 3 +11 3 +12 3 +13 6.375 +14 1.3125 +15 6.375 +16 2.15625 +17 5.32031 +18 3.10547 +19 4.58203 +20 3.63281 +21 4.22607 +22 3.86353 +23 0.706055 +24 5.64001 +25 0.652496 +26 4.82799 +27 1.68864 +28 3.88948 +29 2.4208 +30 3.36561 +31 2.7748 +32 3.13599 +33 2.91921 +34 3.04734 +35 2.97258 +36 3.01572 +37 2.99107 +38 3.00504 +39 2.99718 +40 3.00157 +s11[A3] +0 3 +1 3 +2 3 +3 3 +4 3 +5 3 +6 3 +7 3 +8 3 +9 3 +10 3 +11 3 +12 3 +13 6.375 +14 1.3125 +15 6.375 +16 2.15625 +17 5.32031 +18 3.10547 +19 4.58203 +20 3.63281 +21 4.22607 +22 3.86353 +23 0.706055 +24 5.64001 +25 0.652496 +26 4.82799 +27 1.68864 +28 3.88948 +29 2.4208 +30 3.36561 +31 2.7748 +32 3.13599 +33 2.91921 +34 3.04734 +35 2.97258 +36 3.01572 +37 2.99107 +38 3.00504 +39 2.99718 +40 3.00157 +s12[A1] +0 50 +1 50 +2 50 +3 -108.625 +4 129.312 +5 -108.625 +6 89.6562 +7 -59.0547 +8 45.043 +9 -24.3555 +10 20.2578 +11 -7.62549 +12 9.41431 +13 2.56543 +14 3.54431 +15 5.08267 +16 2.89708 +17 4.89934 +18 3.34285 +19 4.44909 +20 3.70681 +21 4.18511 +22 3.88609 +23 0.693678 +24 5.64677 +25 0.648818 +26 4.82998 +27 1.68757 +28 3.89006 +29 2.42048 +30 3.36578 +31 2.77471 +32 3.13604 +33 2.91918 +34 3.04736 +35 2.97257 +36 3.01572 +37 2.99106 +38 3.00504 +39 2.99718 +40 3.00157 +s12[A2] +0 50 +1 50 +2 50 +3 -108.625 +4 129.312 +5 -108.625 +6 89.6562 +7 -59.0547 +8 45.043 +9 -24.3555 +10 20.2578 +11 -7.62549 +12 9.41431 +13 2.56543 +14 3.54431 +15 5.08267 +16 2.89708 +17 4.89934 +18 3.34285 +19 4.44909 +20 3.70681 +21 4.18511 +22 3.88609 +23 0.693678 +24 5.64677 +25 0.648818 +26 4.82998 +27 1.68757 +28 3.89006 +29 2.42048 +30 3.36578 +31 2.77471 +32 3.13604 +33 2.91918 +34 3.04736 +35 2.97257 +36 3.01572 +37 2.99106 +38 3.00504 +39 2.99718 +40 3.00157 +s12[A3] +0 50 +1 50 +2 50 +3 -108.625 +4 129.312 +5 -108.625 +6 89.6562 +7 -59.0547 +8 45.043 +9 -24.3555 +10 20.2578 +11 -7.62549 +12 9.41431 +13 2.56543 +14 3.54431 +15 5.08267 +16 2.89708 +17 4.89934 +18 3.34285 +19 4.44909 +20 3.70681 +21 4.18511 +22 3.88609 +23 0.693678 +24 5.64677 +25 0.648818 +26 4.82998 +27 1.68757 +28 3.89006 +29 2.42048 +30 3.36578 +31 2.77471 +32 3.13604 +33 2.91918 +34 3.04736 +35 2.97257 +36 3.01572 +37 2.99106 +38 3.00504 +39 2.99718 +40 3.00157 +s13[A1] +0 50 +1 50 +2 50 +3 -108.625 +4 129.312 +5 -108.625 +6 89.6562 +7 -59.0547 +8 45.043 +9 -24.3555 +10 20.2578 +11 -7.62549 +12 9.41431 +13 2.56543 +14 3.54431 +15 5.08267 +16 2.89708 +17 4.89934 +18 3.34285 +19 4.44909 +20 3.70681 +21 4.18511 +22 3.88609 +23 0.693678 +24 5.64677 +25 0.648818 +26 4.82998 +27 1.68757 +28 3.89006 +29 2.42048 +30 3.36578 +31 2.77471 +32 3.13604 +33 2.91918 +34 3.04736 +35 2.97257 +36 3.01572 +37 2.99106 +38 3.00504 +39 2.99718 +40 3.00157 +s13[A2] +0 50 +1 50 +2 50 +3 -108.625 +4 129.312 +5 -108.625 +6 89.6562 +7 -59.0547 +8 45.043 +9 -24.3555 +10 20.2578 +11 -7.62549 +12 9.41431 +13 2.56543 +14 3.54431 +15 5.08267 +16 2.89708 +17 4.89934 +18 3.34285 +19 4.44909 +20 3.70681 +21 4.18511 +22 3.88609 +23 0.693678 +24 5.64677 +25 0.648818 +26 4.82998 +27 1.68757 +28 3.89006 +29 2.42048 +30 3.36578 +31 2.77471 +32 3.13604 +33 2.91918 +34 3.04736 +35 2.97257 +36 3.01572 +37 2.99106 +38 3.00504 +39 2.99718 +40 3.00157 +s13[A3] +0 50 +1 50 +2 50 +3 -108.625 +4 129.312 +5 -108.625 +6 89.6562 +7 -59.0547 +8 45.043 +9 -24.3555 +10 20.2578 +11 -7.62549 +12 9.41431 +13 2.56543 +14 3.54431 +15 5.08267 +16 2.89708 +17 4.89934 +18 3.34285 +19 4.44909 +20 3.70681 +21 4.18511 +22 3.88609 +23 0.693678 +24 5.64677 +25 0.648818 +26 4.82998 +27 1.68757 +28 3.89006 +29 2.42048 +30 3.36578 +31 2.77471 +32 3.13604 +33 2.91918 +34 3.04736 +35 2.97257 +36 3.01572 +37 2.99106 +38 3.00504 +39 2.99718 +40 3.00157 +s14[A1] +0 50 +1 50 +2 50 +3 -108.625 +4 129.312 +5 -108.625 +6 89.6562 +7 -59.0547 +8 45.043 +9 -24.3555 +10 20.2578 +11 -7.62549 +12 9.41431 +13 2.56543 +14 3.54431 +15 5.08267 +16 2.89708 +17 4.89934 +18 3.34285 +19 4.44909 +20 3.70681 +21 4.18511 +22 3.88609 +23 0.693678 +24 5.64677 +25 0.648818 +26 4.82998 +27 1.68757 +28 3.89006 +29 2.42048 +30 3.36578 +31 2.77471 +32 3.13604 +33 2.91918 +34 3.04736 +35 2.97257 +36 3.01572 +37 2.99106 +38 3.00504 +39 2.99718 +40 3.00157 +s14[A2] +0 50 +1 50 +2 50 +3 -108.625 +4 129.312 +5 -108.625 +6 89.6562 +7 -59.0547 +8 45.043 +9 -24.3555 +10 20.2578 +11 -7.62549 +12 9.41431 +13 2.56543 +14 3.54431 +15 5.08267 +16 2.89708 +17 4.89934 +18 3.34285 +19 4.44909 +20 3.70681 +21 4.18511 +22 3.88609 +23 0.693678 +24 5.64677 +25 0.648818 +26 4.82998 +27 1.68757 +28 3.89006 +29 2.42048 +30 3.36578 +31 2.77471 +32 3.13604 +33 2.91918 +34 3.04736 +35 2.97257 +36 3.01572 +37 2.99106 +38 3.00504 +39 2.99718 +40 3.00157 +s14[A3] +0 50 +1 50 +2 50 +3 -108.625 +4 129.312 +5 -108.625 +6 89.6562 +7 -59.0547 +8 45.043 +9 -24.3555 +10 20.2578 +11 -7.62549 +12 9.41431 +13 2.56543 +14 3.54431 +15 5.08267 +16 2.89708 +17 4.89934 +18 3.34285 +19 4.44909 +20 3.70681 +21 4.18511 +22 3.88609 +23 0.693678 +24 5.64677 +25 0.648818 +26 4.82998 +27 1.68757 +28 3.89006 +29 2.42048 +30 3.36578 +31 2.77471 +32 3.13604 +33 2.91918 +34 3.04736 +35 2.97257 +36 3.01572 +37 2.99106 +38 3.00504 +39 2.99718 +40 3.00157 s2[A1] 0 3 1 3 diff --git a/models/smooth/smooth.mdl b/models/smooth/smooth.mdl index 5ddb79ec..6cd189b0 100755 --- a/models/smooth/smooth.mdl +++ b/models/smooth/smooth.mdl @@ -13,6 +13,9 @@ delay = 2 ~~| delay 2[SubA] = 2 ~~| delay 3[DimA] = 2 ~~| +initial s = 50 ~~| +initial s with subscripts[DimA] = 50 ~~| + s1 = SMOOTH(input, delay) ~~| s2[DimA] = SMOOTH(input, delay) ~~| s3[DimA] = SMOOTH(input 3[DimA], delay 3[DimA]) ~~| @@ -23,6 +26,10 @@ s7[SubB] = SMOOTH(input 2[SubA], delay 2[SubA]) ~~| s8[DimA,DimB] = SMOOTH(input 3x3[DimA,DimB], delay) ~~| s9[SubA,DimB] = SMOOTH(input 2x3[SubA,DimB], delay) ~~| s10[SubA,B1] = SMOOTH(input 2[SubA], delay) ~~| +s11[DimA] = SMOOTH3(input 3[DimA], delay) ~~| +s12[DimA] = SMOOTH3I(input 3[DimA], delay 3[DimA], initial s) ~~| +s13[DimA] = SMOOTH3I(input 3[DimA], delay, initial s) ~~| +s14[DimA] = SMOOTH3I(input 3[DimA], delay, initial s with subscripts[DimA]) ~~| INITIAL TIME = 0 ~~| FINAL TIME = 40 ~~| diff --git a/packages/compile/src/generate/gen-equation-c.spec.ts b/packages/compile/src/generate/gen-equation-c.spec.ts index 19e84bda..44c0b158 100644 --- a/packages/compile/src/generate/gen-equation-c.spec.ts +++ b/packages/compile/src/generate/gen-equation-c.spec.ts @@ -1820,8 +1820,7 @@ describe('generateEquation (Vensim -> C)', () => { expect(genC(vars.get('_y'))).toEqual(['_y = __level3;']) }) - // TODO: Subscripted variants - it('should work for SMOOTH3I function', () => { + it('should work for SMOOTH3I function (no dimensions)', () => { const vars = readInlineModel(` input = 3 + PULSE(10, 10) ~~| delay = 2 ~~| @@ -1845,6 +1844,100 @@ describe('generateEquation (Vensim -> C)', () => { expect(genC(vars.get('_y'))).toEqual(['_y = __level3;']) }) + it('should work for SMOOTH3I function (1D with subscripted delay parameter)', () => { + const vars = readInlineModel(` + DimA: A1, A2 ~~| + input[DimA] = 3 + PULSE(10, 10) ~~| + delay[DimA] = 2 ~~| + y[DimA] = SMOOTH3I(input[DimA], delay[DimA], 5) ~~| + `) + expect(vars.size).toBe(6) + expect(genC(vars.get('_input'))).toEqual([ + 'for (size_t i = 0; i < 2; i++) {', + '_input[i] = 3.0 + _PULSE(10.0, 10.0);', + '}' + ]) + expect(genC(vars.get('_delay'))).toEqual(['for (size_t i = 0; i < 2; i++) {', '_delay[i] = 2.0;', '}']) + expect(genC(vars.get('__level1'), 'init-levels')).toEqual([ + 'for (size_t i = 0; i < 2; i++) {', + '__level1[i] = 5.0;', + '}' + ]) + expect(genC(vars.get('__level1'), 'eval')).toEqual([ + 'for (size_t i = 0; i < 2; i++) {', + '__level1[i] = _INTEG(__level1[i], (_input[i] - __level1[i]) / (_delay[i] / 3.0));', + '}' + ]) + expect(genC(vars.get('__level2'), 'init-levels')).toEqual([ + 'for (size_t i = 0; i < 2; i++) {', + '__level2[i] = 5.0;', + '}' + ]) + expect(genC(vars.get('__level2'), 'eval')).toEqual([ + 'for (size_t i = 0; i < 2; i++) {', + '__level2[i] = _INTEG(__level2[i], (__level1[i] - __level2[i]) / (_delay[i] / 3.0));', + '}' + ]) + expect(genC(vars.get('__level3'), 'init-levels')).toEqual([ + 'for (size_t i = 0; i < 2; i++) {', + '__level3[i] = 5.0;', + '}' + ]) + expect(genC(vars.get('__level3'), 'eval')).toEqual([ + 'for (size_t i = 0; i < 2; i++) {', + '__level3[i] = _INTEG(__level3[i], (__level2[i] - __level3[i]) / (_delay[i] / 3.0));', + '}' + ]) + expect(genC(vars.get('_y'))).toEqual(['for (size_t i = 0; i < 2; i++) {', '_y[i] = __level3[i];', '}']) + }) + + it('should work for SMOOTH3I function (1D with non-subscripted delay parameter)', () => { + const vars = readInlineModel(` + DimA: A1, A2 ~~| + input[DimA] = 3 + PULSE(10, 10) ~~| + delay = 2 ~~| + y[DimA] = SMOOTH3I(input[DimA], delay, 5) ~~| + `) + expect(vars.size).toBe(6) + expect(genC(vars.get('_input'))).toEqual([ + 'for (size_t i = 0; i < 2; i++) {', + '_input[i] = 3.0 + _PULSE(10.0, 10.0);', + '}' + ]) + expect(genC(vars.get('_delay'))).toEqual(['_delay = 2.0;']) + expect(genC(vars.get('__level1'), 'init-levels')).toEqual([ + 'for (size_t i = 0; i < 2; i++) {', + '__level1[i] = 5.0;', + '}' + ]) + expect(genC(vars.get('__level1'), 'eval')).toEqual([ + 'for (size_t i = 0; i < 2; i++) {', + '__level1[i] = _INTEG(__level1[i], (_input[i] - __level1[i]) / (_delay / 3.0));', + '}' + ]) + expect(genC(vars.get('__level2'), 'init-levels')).toEqual([ + 'for (size_t i = 0; i < 2; i++) {', + '__level2[i] = 5.0;', + '}' + ]) + expect(genC(vars.get('__level2'), 'eval')).toEqual([ + 'for (size_t i = 0; i < 2; i++) {', + '__level2[i] = _INTEG(__level2[i], (__level1[i] - __level2[i]) / (_delay / 3.0));', + '}' + ]) + expect(genC(vars.get('__level3'), 'init-levels')).toEqual([ + 'for (size_t i = 0; i < 2; i++) {', + '__level3[i] = 5.0;', + '}' + ]) + expect(genC(vars.get('__level3'), 'eval')).toEqual([ + 'for (size_t i = 0; i < 2; i++) {', + '__level3[i] = _INTEG(__level3[i], (__level2[i] - __level3[i]) / (_delay / 3.0));', + '}' + ]) + expect(genC(vars.get('_y'))).toEqual(['for (size_t i = 0; i < 2; i++) {', '_y[i] = __level3[i];', '}']) + }) + it('should work for SQRT function', () => { const vars = readInlineModel(` x = 1 ~~| diff --git a/packages/compile/src/model/read-equation-fn-smooth.js b/packages/compile/src/model/read-equation-fn-smooth.js index 3c3b3952..d6d4abc4 100644 --- a/packages/compile/src/model/read-equation-fn-smooth.js +++ b/packages/compile/src/model/read-equation-fn-smooth.js @@ -67,12 +67,12 @@ function generateSmoothLevel(v, context, argInput, argDelay, argInit, levelNumbe // `equation-reader.js` and modified to work with the AST instead of directly depending // on antlr4-vensim constructs. This logic is pretty complex so we should try to refactor // or at least add some more fine-grained unit tests for it. - let subs = context.extractSubscriptsFromVarNames(argInput, argDelay, argInit) - // For SMOOTH3, the previous level is the input for level number 2 and 3. Add RHS subscripts. - if (levelNumber > 1 && subs.length > 0) { - argInput = `${argInput}${subs}` - } + // Preserve the original subscript/dimension names that were passed in. In the case of + // separated variables, the `subs` array will be replaced to include the separated subscript + // names, but we still need the original subscript/dimension names. + const origSubs = context.extractSubscriptsFromVarNames(argInput, argDelay, argInit) + let subs = origSubs let levelVarBaseName let levelLHS @@ -129,5 +129,8 @@ function generateSmoothLevel(v, context, argInput, argDelay, argInit, levelNumbe context.defineVariable(levelEqn) context.addVarReference(levelVarRefId) - return [levelVarRefId, levelVarBaseName] + // The name of the level variable returned here includes the original subscript/dimension names + // (not the separated subscript names) so that the `argInput` is correct for the 2nd and 3rd levels + const levelVarFullName = `${levelVarBaseName}${origSubs}` + return [levelVarRefId, levelVarFullName] } diff --git a/packages/compile/src/model/read-equations.js b/packages/compile/src/model/read-equations.js index 8f7cc116..5d5c5c78 100644 --- a/packages/compile/src/model/read-equations.js +++ b/packages/compile/src/model/read-equations.js @@ -148,7 +148,7 @@ class Context { } if (result.size > 1) { - console.error(`ERROR: Subscripts do not agree in extractSubscriptsFromVarNames: ${[...varNames]}`) + throw new Error(`Subscripts do not agree in extractSubscriptsFromVarNames: ${[...varNames]}`) } return [...result][0] || '' } diff --git a/packages/compile/src/model/read-equations.spec.ts b/packages/compile/src/model/read-equations.spec.ts index 026c38da..1ee5df86 100644 --- a/packages/compile/src/model/read-equations.spec.ts +++ b/packages/compile/src/model/read-equations.spec.ts @@ -1992,6 +1992,86 @@ describe('readEquations', () => { ]) }) + it('should work for SMOOTH function (with subscripted input and subscripted delay)', () => { + const vars = readInlineModel(` + DimA: A1, A2 ~~| + input[DimA] = 3 + PULSE(10, 10) ~~| + delay[DimA] = 2, 3 ~~| + y[DimA] = SMOOTH(input[DimA], delay[DimA]) ~~| + `) + expect(vars).toEqual([ + v('input[DimA]', '3+PULSE(10,10)', { + refId: '_input', + referencedFunctionNames: ['__pulse'], + subscripts: ['_dima'] + }), + v('delay[DimA]', '2,3', { + refId: '_delay[_a1]', + separationDims: ['_dima'], + subscripts: ['_a1'], + varType: 'const' + }), + v('delay[DimA]', '2,3', { + refId: '_delay[_a2]', + separationDims: ['_dima'], + subscripts: ['_a2'], + varType: 'const' + }), + v('y[DimA]', 'SMOOTH(input[DimA],delay[DimA])', { + refId: '_y', + references: ['__level1'], + smoothVarRefId: '__level1', + subscripts: ['_dima'] + }), + v('_level1[DimA]', 'INTEG((input[DimA]-_level1[DimA])/delay[DimA],input[DimA])', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_input'], + refId: '__level1', + referencedFunctionNames: ['__integ'], + references: ['_input', '_delay[_a1]', '_delay[_a2]'], + subscripts: ['_dima'], + varType: 'level' + }) + ]) + }) + + it('should work for SMOOTH function (with subscripted input and non-subscripted delay)', () => { + const vars = readInlineModel(` + DimA: A1, A2 ~~| + input[DimA] = 3 + PULSE(10, 10) ~~| + delay = 2 ~~| + y[DimA] = SMOOTH(input[DimA], delay) ~~| + `) + expect(vars).toEqual([ + v('input[DimA]', '3+PULSE(10,10)', { + refId: '_input', + referencedFunctionNames: ['__pulse'], + subscripts: ['_dima'] + }), + v('delay', '2', { + refId: '_delay', + varType: 'const' + }), + v('y[DimA]', 'SMOOTH(input[DimA],delay)', { + refId: '_y', + references: ['__level1'], + smoothVarRefId: '__level1', + subscripts: ['_dima'] + }), + v('_level1[DimA]', 'INTEG((input[DimA]-_level1[DimA])/delay,input[DimA])', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_input'], + refId: '__level1', + referencedFunctionNames: ['__integ'], + references: ['_input', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }) + ]) + }) + it('should work for SMOOTHI function', () => { const vars = readInlineModel(` input = 3 + PULSE(10, 10) ~~| @@ -2322,6 +2402,126 @@ describe('readEquations', () => { ]) }) + it('should work for SMOOTH3 function (with subscripted input and subscripted delay)', () => { + const vars = readInlineModel(` + DimA: A1, A2 ~~| + input[DimA] = 3 + PULSE(10, 10) ~~| + delay[DimA] = 2, 3 ~~| + y[DimA] = SMOOTH3(input[DimA], delay[DimA]) ~~| + `) + expect(vars).toEqual([ + v('input[DimA]', '3+PULSE(10,10)', { + refId: '_input', + referencedFunctionNames: ['__pulse'], + subscripts: ['_dima'] + }), + v('delay[DimA]', '2,3', { + refId: '_delay[_a1]', + separationDims: ['_dima'], + subscripts: ['_a1'], + varType: 'const' + }), + v('delay[DimA]', '2,3', { + refId: '_delay[_a2]', + separationDims: ['_dima'], + subscripts: ['_a2'], + varType: 'const' + }), + v('y[DimA]', 'SMOOTH3(input[DimA],delay[DimA])', { + refId: '_y', + references: ['__level1', '__level2', '__level3'], + smoothVarRefId: '__level3', + subscripts: ['_dima'] + }), + v('_level1[DimA]', 'INTEG((input[DimA]-_level1[DimA])/(delay[DimA]/3),input[DimA])', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_input'], + refId: '__level1', + referencedFunctionNames: ['__integ'], + references: ['_input', '_delay[_a1]', '_delay[_a2]'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level2[DimA]', 'INTEG((_level1[DimA]-_level2[DimA])/(delay[DimA]/3),input[DimA])', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_input'], + refId: '__level2', + referencedFunctionNames: ['__integ'], + references: ['__level1', '_delay[_a1]', '_delay[_a2]'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level3[DimA]', 'INTEG((_level2[DimA]-_level3[DimA])/(delay[DimA]/3),input[DimA])', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_input'], + refId: '__level3', + referencedFunctionNames: ['__integ'], + references: ['__level2', '_delay[_a1]', '_delay[_a2]'], + subscripts: ['_dima'], + varType: 'level' + }) + ]) + }) + + it('should work for SMOOTH3 function (with subscripted input and non-subscripted delay)', () => { + const vars = readInlineModel(` + DimA: A1, A2 ~~| + input[DimA] = 3 + PULSE(10, 10) ~~| + delay = 2 ~~| + y[DimA] = SMOOTH3(input[DimA], delay) ~~| + `) + expect(vars).toEqual([ + v('input[DimA]', '3+PULSE(10,10)', { + refId: '_input', + referencedFunctionNames: ['__pulse'], + subscripts: ['_dima'] + }), + v('delay', '2', { + refId: '_delay', + varType: 'const' + }), + v('y[DimA]', 'SMOOTH3(input[DimA],delay)', { + refId: '_y', + references: ['__level1', '__level2', '__level3'], + smoothVarRefId: '__level3', + subscripts: ['_dima'] + }), + v('_level1[DimA]', 'INTEG((input[DimA]-_level1[DimA])/(delay/3),input[DimA])', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_input'], + refId: '__level1', + referencedFunctionNames: ['__integ'], + references: ['_input', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level2[DimA]', 'INTEG((_level1[DimA]-_level2[DimA])/(delay/3),input[DimA])', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_input'], + refId: '__level2', + referencedFunctionNames: ['__integ'], + references: ['__level1', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level3[DimA]', 'INTEG((_level2[DimA]-_level3[DimA])/(delay/3),input[DimA])', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_input'], + refId: '__level3', + referencedFunctionNames: ['__integ'], + references: ['__level2', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }) + ]) + }) + it('should work for SMOOTH3I function', () => { const vars = readInlineModel(` input = 3 + PULSE(10, 10) ~~| @@ -2541,6 +2741,59 @@ describe('readEquations', () => { ]) }) + it('should work for SMOOTH3I function (with subscripted input and non-subscripted delay)', () => { + const vars = readInlineModel(` + DimA: A1, A2 ~~| + input[DimA] = 3 + PULSE(10, 10) ~~| + delay = 2 ~~| + y[DimA] = SMOOTH3I(input[DimA], delay, 5) ~~| + `) + expect(vars).toEqual([ + v('input[DimA]', '3+PULSE(10,10)', { + refId: '_input', + referencedFunctionNames: ['__pulse'], + subscripts: ['_dima'] + }), + v('delay', '2', { + refId: '_delay', + varType: 'const' + }), + v('y[DimA]', 'SMOOTH3I(input[DimA],delay,5)', { + refId: '_y', + references: ['__level1', '__level2', '__level3'], + smoothVarRefId: '__level3', + subscripts: ['_dima'] + }), + v('_level1[DimA]', 'INTEG((input[DimA]-_level1[DimA])/(delay/3),5)', { + hasInitValue: true, + includeInOutput: false, + refId: '__level1', + referencedFunctionNames: ['__integ'], + references: ['_input', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level2[DimA]', 'INTEG((_level1[DimA]-_level2[DimA])/(delay/3),5)', { + hasInitValue: true, + includeInOutput: false, + refId: '__level2', + referencedFunctionNames: ['__integ'], + references: ['__level1', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level3[DimA]', 'INTEG((_level2[DimA]-_level3[DimA])/(delay/3),5)', { + hasInitValue: true, + includeInOutput: false, + refId: '__level3', + referencedFunctionNames: ['__integ'], + references: ['__level2', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }) + ]) + }) + it('should work for SMOOTH3I function (with separated variables using subdimension)', () => { const vars = readInlineModel(` DimA: A1, A2, A3 ~~| @@ -7045,6 +7298,15 @@ describe('readEquations', () => { refId: '_final_time', varType: 'const' }), + v('initial s', '50', { + refId: '_initial_s', + varType: 'const' + }), + v('initial s with subscripts[DimA]', '50', { + refId: '_initial_s_with_subscripts', + subscripts: ['_dima'], + varType: 'const' + }), v('INITIAL TIME', '0', { refId: '_initial_time', varType: 'const' @@ -7106,16 +7368,40 @@ describe('readEquations', () => { smoothVarRefId: '__level_s10_1[_a3]', subscripts: ['_a3', '_b1'] }), + v('s11[DimA]', 'SMOOTH3(input 3[DimA],delay)', { + refId: '_s11', + references: ['__level2', '__level3', '__level4'], + smoothVarRefId: '__level4', + subscripts: ['_dima'] + }), + v('s12[DimA]', 'SMOOTH3I(input 3[DimA],delay 3[DimA],initial s)', { + refId: '_s12', + references: ['__level5', '__level6', '__level7'], + smoothVarRefId: '__level7', + subscripts: ['_dima'] + }), + v('s13[DimA]', 'SMOOTH3I(input 3[DimA],delay,initial s)', { + refId: '_s13', + references: ['__level8', '__level9', '__level10'], + smoothVarRefId: '__level10', + subscripts: ['_dima'] + }), + v('s14[DimA]', 'SMOOTH3I(input 3[DimA],delay,initial s with subscripts[DimA])', { + refId: '_s14', + references: ['__level11', '__level12', '__level13'], + smoothVarRefId: '__level13', + subscripts: ['_dima'] + }), v('s2[DimA]', 'SMOOTH(input,delay)', { refId: '_s2', - references: ['__level2'], - smoothVarRefId: '__level2', + references: ['__level14'], + smoothVarRefId: '__level14', subscripts: ['_dima'] }), v('s3[DimA]', 'SMOOTH(input 3[DimA],delay 3[DimA])', { refId: '_s3', - references: ['__level3'], - smoothVarRefId: '__level3', + references: ['__level15'], + smoothVarRefId: '__level15', subscripts: ['_dima'] }), v('s4[SubA]', 'SMOOTH(input 2[SubA],delay 2[SubA])', { @@ -7148,8 +7434,8 @@ describe('readEquations', () => { }), v('s6[DimB]', 'SMOOTH(input 3[DimA],delay 3[DimA])', { refId: '_s6', - references: ['__level4'], - smoothVarRefId: '__level4', + references: ['__level16'], + smoothVarRefId: '__level16', subscripts: ['_dimb'] }), v('s7[SubB]', 'SMOOTH(input 2[SubA],delay 2[SubA])', { @@ -7168,8 +7454,8 @@ describe('readEquations', () => { }), v('s8[DimA,DimB]', 'SMOOTH(input 3x3[DimA,DimB],delay)', { refId: '_s8', - references: ['__level5'], - smoothVarRefId: '__level5', + references: ['__level17'], + smoothVarRefId: '__level17', subscripts: ['_dima', '_dimb'] }), v('s9[SubA,DimB]', 'SMOOTH(input 2x3[SubA,DimB],delay)', { @@ -7227,21 +7513,141 @@ describe('readEquations', () => { subscripts: ['_a3'], varType: 'level' }), - v('_level2', 'INTEG((input-_level2)/delay,input)', { + v('_level2[DimA]', 'INTEG((input 3[DimA]-_level2[DimA])/(delay/3),input 3[DimA])', { hasInitValue: true, includeInOutput: false, - initReferences: ['_input'], + initReferences: ['_input_3'], refId: '__level2', referencedFunctionNames: ['__integ'], - references: ['_input', '_delay'], + references: ['_input_3', '_delay'], + subscripts: ['_dima'], varType: 'level' }), - v('_level3[DimA]', 'INTEG((input 3[DimA]-_level3[DimA])/delay 3[DimA],input 3[DimA])', { + v('_level3[DimA]', 'INTEG((_level2[DimA]-_level3[DimA])/(delay/3),input 3[DimA])', { hasInitValue: true, includeInOutput: false, initReferences: ['_input_3'], refId: '__level3', referencedFunctionNames: ['__integ'], + references: ['__level2', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level4[DimA]', 'INTEG((_level3[DimA]-_level4[DimA])/(delay/3),input 3[DimA])', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_input_3'], + refId: '__level4', + referencedFunctionNames: ['__integ'], + references: ['__level3', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level5[DimA]', 'INTEG((input 3[DimA]-_level5[DimA])/(delay 3[DimA]/3),initial s)', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_initial_s'], + refId: '__level5', + referencedFunctionNames: ['__integ'], + references: ['_input_3', '_delay_3'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level6[DimA]', 'INTEG((_level5[DimA]-_level6[DimA])/(delay 3[DimA]/3),initial s)', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_initial_s'], + refId: '__level6', + referencedFunctionNames: ['__integ'], + references: ['__level5', '_delay_3'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level7[DimA]', 'INTEG((_level6[DimA]-_level7[DimA])/(delay 3[DimA]/3),initial s)', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_initial_s'], + refId: '__level7', + referencedFunctionNames: ['__integ'], + references: ['__level6', '_delay_3'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level8[DimA]', 'INTEG((input 3[DimA]-_level8[DimA])/(delay/3),initial s)', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_initial_s'], + refId: '__level8', + referencedFunctionNames: ['__integ'], + references: ['_input_3', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level9[DimA]', 'INTEG((_level8[DimA]-_level9[DimA])/(delay/3),initial s)', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_initial_s'], + refId: '__level9', + referencedFunctionNames: ['__integ'], + references: ['__level8', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level10[DimA]', 'INTEG((_level9[DimA]-_level10[DimA])/(delay/3),initial s)', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_initial_s'], + refId: '__level10', + referencedFunctionNames: ['__integ'], + references: ['__level9', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level11[DimA]', 'INTEG((input 3[DimA]-_level11[DimA])/(delay/3),initial s with subscripts[DimA])', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_initial_s_with_subscripts'], + refId: '__level11', + referencedFunctionNames: ['__integ'], + references: ['_input_3', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level12[DimA]', 'INTEG((_level11[DimA]-_level12[DimA])/(delay/3),initial s with subscripts[DimA])', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_initial_s_with_subscripts'], + refId: '__level12', + referencedFunctionNames: ['__integ'], + references: ['__level11', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level13[DimA]', 'INTEG((_level12[DimA]-_level13[DimA])/(delay/3),initial s with subscripts[DimA])', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_initial_s_with_subscripts'], + refId: '__level13', + referencedFunctionNames: ['__integ'], + references: ['__level12', '_delay'], + subscripts: ['_dima'], + varType: 'level' + }), + v('_level14', 'INTEG((input-_level14)/delay,input)', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_input'], + refId: '__level14', + referencedFunctionNames: ['__integ'], + references: ['_input', '_delay'], + varType: 'level' + }), + v('_level15[DimA]', 'INTEG((input 3[DimA]-_level15[DimA])/delay 3[DimA],input 3[DimA])', { + hasInitValue: true, + includeInOutput: false, + initReferences: ['_input_3'], + refId: '__level15', + referencedFunctionNames: ['__integ'], references: ['_input_3', '_delay_3'], subscripts: ['_dima'], varType: 'level' @@ -7326,11 +7732,11 @@ describe('readEquations', () => { subscripts: ['_a3'], varType: 'level' }), - v('_level4[DimA]', 'INTEG((input 3[DimA]-_level4[DimA])/delay 3[DimA],input 3[DimA])', { + v('_level16[DimA]', 'INTEG((input 3[DimA]-_level16[DimA])/delay 3[DimA],input 3[DimA])', { hasInitValue: true, includeInOutput: false, initReferences: ['_input_3'], - refId: '__level4', + refId: '__level16', referencedFunctionNames: ['__integ'], references: ['_input_3', '_delay_3'], subscripts: ['_dima'], @@ -7356,11 +7762,11 @@ describe('readEquations', () => { subscripts: ['_a3'], varType: 'level' }), - v('_level5[DimA,DimB]', 'INTEG((input 3x3[DimA,DimB]-_level5[DimA,DimB])/delay,input 3x3[DimA,DimB])', { + v('_level17[DimA,DimB]', 'INTEG((input 3x3[DimA,DimB]-_level17[DimA,DimB])/delay,input 3x3[DimA,DimB])', { hasInitValue: true, includeInOutput: false, initReferences: ['_input_3x3'], - refId: '__level5', + refId: '__level17', referencedFunctionNames: ['__integ'], references: ['_input_3x3', '_delay'], subscripts: ['_dima', '_dimb'], diff --git a/packages/compile/src/model/read-variables.spec.ts b/packages/compile/src/model/read-variables.spec.ts index 14e4809f..5f10460e 100644 --- a/packages/compile/src/model/read-variables.spec.ts +++ b/packages/compile/src/model/read-variables.spec.ts @@ -1159,6 +1159,10 @@ describe('readVariables', () => { subscripts: ['_dima'] }), v('FINAL TIME', '40'), + v('initial s', '50'), + v('initial s with subscripts[DimA]', '50', { + subscripts: ['_dima'] + }), v('INITIAL TIME', '0'), v('input', '3+PULSE(10,10)'), v('input 2[SubA]', '3+PULSE(10,10)', { @@ -1192,6 +1196,18 @@ describe('readVariables', () => { separationDims: ['_suba'], subscripts: ['_a3', '_b1'] }), + v('s11[DimA]', 'SMOOTH3(input 3[DimA],delay)', { + subscripts: ['_dima'] + }), + v('s12[DimA]', 'SMOOTH3I(input 3[DimA],delay 3[DimA],initial s)', { + subscripts: ['_dima'] + }), + v('s13[DimA]', 'SMOOTH3I(input 3[DimA],delay,initial s)', { + subscripts: ['_dima'] + }), + v('s14[DimA]', 'SMOOTH3I(input 3[DimA],delay,initial s with subscripts[DimA])', { + subscripts: ['_dima'] + }), v('s2[DimA]', 'SMOOTH(input,delay)', { subscripts: ['_dima'] }),