From 5300450bfbd205d40865ec0c83998e7368bbf8b0 Mon Sep 17 00:00:00 2001 From: paultjevdh <59084059+paultjevdh@users.noreply.github.com> Date: Sun, 28 Jan 2024 16:50:54 +0100 Subject: [PATCH 01/13] Clarified documentation on periodic table extrapolation. --- Modelica/Blocks/Tables.mo | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/Modelica/Blocks/Tables.mo b/Modelica/Blocks/Tables.mo index 91973d4107..1ee0ebafd0 100644 --- a/Modelica/Blocks/Tables.mo +++ b/Modelica/Blocks/Tables.mo @@ -156,7 +156,13 @@ extrapolation = 1: Hold the first or last value of the table, (If smoothness is LinearSegments or ConstantSegments this means to extrapolate linearly through the first/last two table points.). - = 3: Periodically repeat the table data (periodical function). + = 3: Periodically repeat the table data (periodical function), + where the repetition period is table[end,1]-table[1,1]. + For u = table[end,1] the result is table[end,2]. However for the limit of u downwards + to table[end,1] the result is table[1,2]. + This implies that for correct reproduction of a periodic function + the first and last data values should be the same + (table[1,2] = table[end,2]). = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one row, the table value is returned, @@ -420,7 +426,13 @@ extrapolation = 1: Hold the first or last value of the table, (If smoothness is LinearSegments or ConstantSegments this means to extrapolate linearly through the first/last two table points.). - = 3: Periodically repeat the table data (periodical function). + = 3: Periodically repeat the table data (periodical function), + where the repetition period is table[end,1]-table[1,1]. + For u = table[end,1] the result is table[end,2]. However for the limit of u downwards + to table[end,1] the result is table[1,2]. + This implies that for correct reproduction of a periodic function + the first and last data values should be the same + (table[1,2] = table[end,2]). = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one row, the table value is returned, @@ -620,7 +632,15 @@ extrapolation = 1: Hold the first or last values of the table, (If smoothness is LinearSegments or ConstantSegments this means to extrapolate linearly through the first/last two table points.). - = 3: Periodically repeat the table data (periodical function). + = 3: Periodically repeat the table data (periodical function), + where the repetition period is table[end,1]-table[2,1] and + table[1,end]-table[1,2] for columns and rows respectively. + Assuming u1 is one of the abscissa values: for u2 = table[1,end] + the result is table[u1,end]. However for the lim of u2 downwards + to table[1,end] the result is table[u1,2]. + This implies that for correct reproduction of a periodic function + the first and last rows/columns should be the same (table[2,2:] = table[end,2:] + and table[2:,2] = table[2:,end]). = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one element, the table value is returned, @@ -811,7 +831,15 @@ extrapolation = 1: Hold the first or last values of the table, (If smoothness is LinearSegments or ConstantSegments this means to extrapolate linearly through the first/last two table points.). - = 3: Periodically repeat the table data (periodical function). + = 3: Periodically repeat the table data (periodical function), + where the repetition period is table[end,1]-table[2,1] and + table[1,end]-table[1,2] for columns and rows respectively. + Assuming u1 is one of the abscissa values: for u2 = table[1,end] + the result is table[u1,end]. However for the lim of u2 downwards + to table[1,end] the result is table[u1,2]. + This implies that for correct reproduction of a periodic function + the first and last rows/columns should be the same (table[2,2:] = table[end,2:] + and table[2:,2] = table[2:,end]). = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one element, the table value is returned, From d2869654f078ac13830dff494960fe73e1f21400 Mon Sep 17 00:00:00 2001 From: paultjevdh <59084059+paultjevdh@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:06:50 +0100 Subject: [PATCH 02/13] Fixed HTML warning on use of The code changes were generated in a modelica program which uses the tag for bold. This is apparently deprecated in github, thus the code was fixed by substituting with . --- Modelica/Blocks/Tables.mo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modelica/Blocks/Tables.mo b/Modelica/Blocks/Tables.mo index 1ee0ebafd0..31ee9c8ea6 100644 --- a/Modelica/Blocks/Tables.mo +++ b/Modelica/Blocks/Tables.mo @@ -159,7 +159,7 @@ extrapolation = 1: Hold the first or last value of the table, = 3: Periodically repeat the table data (periodical function), where the repetition period is table[end,1]-table[1,1]. For u = table[end,1] the result is table[end,2]. However for the limit of u downwards - to table[end,1] the result is table[1,2]. + to table[end,1] the result is table[1,2]. This implies that for correct reproduction of a periodic function the first and last data values should be the same (table[1,2] = table[end,2]). @@ -429,7 +429,7 @@ extrapolation = 1: Hold the first or last value of the table, = 3: Periodically repeat the table data (periodical function), where the repetition period is table[end,1]-table[1,1]. For u = table[end,1] the result is table[end,2]. However for the limit of u downwards - to table[end,1] the result is table[1,2]. + to table[end,1] the result is table[1,2]. This implies that for correct reproduction of a periodic function the first and last data values should be the same (table[1,2] = table[end,2]). @@ -637,7 +637,7 @@ extrapolation = 1: Hold the first or last values of the table, table[1,end]-table[1,2] for columns and rows respectively. Assuming u1 is one of the abscissa values: for u2 = table[1,end] the result is table[u1,end]. However for the lim of u2 downwards - to table[1,end] the result is table[u1,2]. + to table[1,end] the result is table[u1,2]. This implies that for correct reproduction of a periodic function the first and last rows/columns should be the same (table[2,2:] = table[end,2:] and table[2:,2] = table[2:,end]). @@ -836,7 +836,7 @@ extrapolation = 1: Hold the first or last values of the table, table[1,end]-table[1,2] for columns and rows respectively. Assuming u1 is one of the abscissa values: for u2 = table[1,end] the result is table[u1,end]. However for the lim of u2 downwards - to table[1,end] the result is table[u1,2]. + to table[1,end] the result is table[u1,2]. This implies that for correct reproduction of a periodic function the first and last rows/columns should be the same (table[2,2:] = table[end,2:] and table[2:,2] = table[2:,end]). From c8dc8fc45e2957ae9ccd7c931ac822f94addcb5c Mon Sep 17 00:00:00 2001 From: paultjevdh <59084059+paultjevdh@users.noreply.github.com> Date: Mon, 29 Jan 2024 14:06:05 +0100 Subject: [PATCH 03/13] Update Modelica/Blocks/Tables.mo Fixed tab/space indentation issue Co-authored-by: tobolar --- Modelica/Blocks/Tables.mo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modelica/Blocks/Tables.mo b/Modelica/Blocks/Tables.mo index 31ee9c8ea6..2c429b4f2c 100644 --- a/Modelica/Blocks/Tables.mo +++ b/Modelica/Blocks/Tables.mo @@ -158,9 +158,9 @@ extrapolation = 1: Hold the first or last value of the table, two table points.). = 3: Periodically repeat the table data (periodical function), where the repetition period is table[end,1]-table[1,1]. - For u = table[end,1] the result is table[end,2]. However for the limit of u downwards - to table[end,1] the result is table[1,2]. - This implies that for correct reproduction of a periodic function + For u = table[end,1] the result is table[end,2]. However for the + limit of u downwards to table[end,1] the result is table[1,2]. + This implies that for correct reproduction of a periodic function the first and last data values should be the same (table[1,2] = table[end,2]). = 4: No extrapolation, i.e. extrapolation triggers an error From 46485c8292a17fbd6432428ae3122c1febdb6d5d Mon Sep 17 00:00:00 2001 From: paultjevdh <59084059+paultjevdh@users.noreply.github.com> Date: Mon, 29 Jan 2024 14:09:00 +0100 Subject: [PATCH 04/13] Apply suggestions from code review Fixed tab/space indentation issue Co-authored-by: tobolar --- Modelica/Blocks/Tables.mo | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Modelica/Blocks/Tables.mo b/Modelica/Blocks/Tables.mo index 2c429b4f2c..13472302a4 100644 --- a/Modelica/Blocks/Tables.mo +++ b/Modelica/Blocks/Tables.mo @@ -428,9 +428,9 @@ extrapolation = 1: Hold the first or last value of the table, two table points.). = 3: Periodically repeat the table data (periodical function), where the repetition period is table[end,1]-table[1,1]. - For u = table[end,1] the result is table[end,2]. However for the limit of u downwards - to table[end,1] the result is table[1,2]. - This implies that for correct reproduction of a periodic function + For u = table[end,1] the result is table[end,2]. However for the + limit of u downwards to table[end,1] the result is table[1,2]. + This implies that for correct reproduction of a periodic function the first and last data values should be the same (table[1,2] = table[end,2]). = 4: No extrapolation, i.e. extrapolation triggers an error @@ -635,12 +635,12 @@ extrapolation = 1: Hold the first or last values of the table, = 3: Periodically repeat the table data (periodical function), where the repetition period is table[end,1]-table[2,1] and table[1,end]-table[1,2] for columns and rows respectively. - Assuming u1 is one of the abscissa values: for u2 = table[1,end] + Assuming u1 is one of the abscissa values: for u2 = table[1,end] the result is table[u1,end]. However for the lim of u2 downwards to table[1,end] the result is table[u1,2]. - This implies that for correct reproduction of a periodic function - the first and last rows/columns should be the same (table[2,2:] = table[end,2:] - and table[2:,2] = table[2:,end]). + This implies that for correct reproduction of a periodic function + the first and last rows/columns should be the same + (table[2,2:] = table[end,2:] and table[2:,2] = table[2:,end]). = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one element, the table value is returned, @@ -834,12 +834,12 @@ extrapolation = 1: Hold the first or last values of the table, = 3: Periodically repeat the table data (periodical function), where the repetition period is table[end,1]-table[2,1] and table[1,end]-table[1,2] for columns and rows respectively. - Assuming u1 is one of the abscissa values: for u2 = table[1,end] + Assuming u1 is one of the abscissa values: for u2 = table[1,end] the result is table[u1,end]. However for the lim of u2 downwards to table[1,end] the result is table[u1,2]. - This implies that for correct reproduction of a periodic function - the first and last rows/columns should be the same (table[2,2:] = table[end,2:] - and table[2:,2] = table[2:,end]). + This implies that for correct reproduction of a periodic function + the first and last rows/columns should be the same + (table[2,2:] = table[end,2:] and table[2:,2] = table[2:,end]). = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one element, the table value is returned, From fc1a734338bc3b949816d89105e74564d06a8317 Mon Sep 17 00:00:00 2001 From: paultjevdh <59084059+paultjevdh@users.noreply.github.com> Date: Tue, 2 Apr 2024 15:06:14 +0200 Subject: [PATCH 05/13] Update Modelica/Blocks/Tables.mo Use proper Modelica syntax. Co-authored-by: Hans Olsson --- Modelica/Blocks/Tables.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Blocks/Tables.mo b/Modelica/Blocks/Tables.mo index 1a5fd79297..9508b9098e 100644 --- a/Modelica/Blocks/Tables.mo +++ b/Modelica/Blocks/Tables.mo @@ -654,7 +654,7 @@ extrapolation = 1: Hold the first or last values of the table, to table[1,end] the result is table[u1,2]. This implies that for correct reproduction of a periodic function the first and last rows/columns should be the same - (table[2,2:] = table[end,2:] and table[2:,2] = table[2:,end]). + (table[2,2:end] = table[end,2:end] and table[2:end,2] = table[2:end,end]). = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one element, the table value is returned, From ea8e75ff2f801f89cba8d8fddc371b953d6b15f1 Mon Sep 17 00:00:00 2001 From: paultjevdh <59084059+paultjevdh@users.noreply.github.com> Date: Tue, 2 Apr 2024 15:06:32 +0200 Subject: [PATCH 06/13] Update Modelica/Blocks/Tables.mo Use proper Modelica syntax. Co-authored-by: Hans Olsson --- Modelica/Blocks/Tables.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Blocks/Tables.mo b/Modelica/Blocks/Tables.mo index 9508b9098e..63bff1a5c0 100644 --- a/Modelica/Blocks/Tables.mo +++ b/Modelica/Blocks/Tables.mo @@ -860,7 +860,7 @@ extrapolation = 1: Hold the first or last values of the table, to table[1,end] the result is table[u1,2]. This implies that for correct reproduction of a periodic function the first and last rows/columns should be the same - (table[2,2:] = table[end,2:] and table[2:,2] = table[2:,end]). + (table[2,2:end] = table[end,2:end] and table[2:end,2] = table[2:end,end]). = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one element, the table value is returned, From a02d6cbe1ddec608b16cb5ac6fd81d6a0090ce83 Mon Sep 17 00:00:00 2001 From: paultjevdh <59084059+paultjevdh@users.noreply.github.com> Date: Tue, 2 Apr 2024 15:38:06 +0200 Subject: [PATCH 07/13] Update Tables.mo Clarified periodicity requirement --- Modelica/Blocks/Tables.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modelica/Blocks/Tables.mo b/Modelica/Blocks/Tables.mo index 63bff1a5c0..9ba34c320a 100644 --- a/Modelica/Blocks/Tables.mo +++ b/Modelica/Blocks/Tables.mo @@ -653,7 +653,7 @@ extrapolation = 1: Hold the first or last values of the table, the result is table[u1,end]. However for the lim of u2 downwards to table[1,end] the result is table[u1,2]. This implies that for correct reproduction of a periodic function - the first and last rows/columns should be the same + the first and last data rows/columns should be the same (table[2,2:end] = table[end,2:end] and table[2:end,2] = table[2:end,end]). = 4: No extrapolation, i.e. extrapolation triggers an error
  • @@ -859,7 +859,7 @@ extrapolation = 1: Hold the first or last values of the table, the result is table[u1,end]. However for the lim of u2 downwards to table[1,end] the result is table[u1,2]. This implies that for correct reproduction of a periodic function - the first and last rows/columns should be the same + the first and last data rows/columns should be the same (table[2,2:end] = table[end,2:end] and table[2:end,2] = table[2:end,end]). = 4: No extrapolation, i.e. extrapolation triggers an error From 183d581b2701ca270f0727a723ac0535efcfeded Mon Sep 17 00:00:00 2001 From: paultjevdh <59084059+paultjevdh@users.noreply.github.com> Date: Fri, 5 Apr 2024 20:40:37 +0200 Subject: [PATCH 08/13] Update Modelica/Blocks/Tables.mo Changed the documentation to recognize that multiple outputs are possible --- Modelica/Blocks/Tables.mo | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Modelica/Blocks/Tables.mo b/Modelica/Blocks/Tables.mo index 9ba34c320a..e0ef71b8d0 100644 --- a/Modelica/Blocks/Tables.mo +++ b/Modelica/Blocks/Tables.mo @@ -435,11 +435,12 @@ extrapolation = 1: Hold the first or last value of the table, two table points.). = 3: Periodically repeat the table data (periodical function), where the repetition period is table[end,1]-table[1,1]. - For u = table[end,1] the result is table[end,2]. However for the - limit of u downwards to table[end,1] the result is table[1,2]. + For input u[i] = table[end,1] the output value is table[end,columns[i]]. + However for the limit of u downwards to table[end,1] the result is + table[1,columns[i]]. This implies that for correct reproduction of a periodic function - the first and last data values should be the same - (table[1,2] = table[end,2]). + the first and last data rows should be the same + (table[1,2:end] = table[end,2:end]). = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one row, the table value is returned, From 8f919782eebe23f72a5d60bd25a7904c969e541a Mon Sep 17 00:00:00 2001 From: paultjevdh <59084059+paultjevdh@users.noreply.github.com> Date: Fri, 5 Apr 2024 20:41:42 +0200 Subject: [PATCH 09/13] Update Modelica/Blocks/Tables.mo Changed documentation to reflect that multiple inputs and outputs are possible. --- Modelica/Blocks/Tables.mo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modelica/Blocks/Tables.mo b/Modelica/Blocks/Tables.mo index e0ef71b8d0..4e0c79fef7 100644 --- a/Modelica/Blocks/Tables.mo +++ b/Modelica/Blocks/Tables.mo @@ -158,11 +158,11 @@ extrapolation = 1: Hold the first or last value of the table, two table points.). = 3: Periodically repeat the table data (periodical function), where the repetition period is table[end,1]-table[1,1]. - For u = table[end,1] the result is table[end,2]. However for the - limit of u downwards to table[end,1] the result is table[1,2]. + For u = table[end,1] the output(-array) is table[end,columns]. However for the + limit of u downwards to table[end,1] the result is table[1,columns]. This implies that for correct reproduction of a periodic function - the first and last data values should be the same - (table[1,2] = table[end,2]). + the first and last data rows should be the same + (table[1,2:end] = table[end,2:end]). = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one row, the table value is returned, From fce8a3d73f62160805c350812e0693083703cff9 Mon Sep 17 00:00:00 2001 From: paultjevdh <59084059+paultjevdh@users.noreply.github.com> Date: Mon, 22 Apr 2024 11:11:59 +0200 Subject: [PATCH 10/13] Added example model with comments. Simplified documentation in table models with reference to example. --- Modelica/Blocks/Tables.mo | 53 ++++++++++++++------------------------ Modelica/Blocks/package.mo | 25 +++++++++++++++++- 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/Modelica/Blocks/Tables.mo b/Modelica/Blocks/Tables.mo index 4e0c79fef7..f46f61bf58 100644 --- a/Modelica/Blocks/Tables.mo +++ b/Modelica/Blocks/Tables.mo @@ -156,13 +156,11 @@ extrapolation = 1: Hold the first or last value of the table, (If smoothness is LinearSegments or ConstantSegments this means to extrapolate linearly through the first/last two table points.). - = 3: Periodically repeat the table data (periodical function), - where the repetition period is table[end,1]-table[1,1]. - For u = table[end,1] the output(-array) is table[end,columns]. However for the - limit of u downwards to table[end,1] the result is table[1,columns]. - This implies that for correct reproduction of a periodic function - the first and last data rows should be the same - (table[1,2:end] = table[end,2:end]). + = 3: Periodically repeat the table data (periodical function). + Because no assumption can be made about the spacing of the + samples -- defined in the first column -- the repetition period + is table[end,1]-table[1,1]. See 'ContinuityPeriodicTableExtrapolation' + in the examples. = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one row, the table value is returned, @@ -433,14 +431,11 @@ extrapolation = 1: Hold the first or last value of the table, (If smoothness is LinearSegments or ConstantSegments this means to extrapolate linearly through the first/last two table points.). - = 3: Periodically repeat the table data (periodical function), - where the repetition period is table[end,1]-table[1,1]. - For input u[i] = table[end,1] the output value is table[end,columns[i]]. - However for the limit of u downwards to table[end,1] the result is - table[1,columns[i]]. - This implies that for correct reproduction of a periodic function - the first and last data rows should be the same - (table[1,2:end] = table[end,2:end]). + = 3: Periodically repeat the table data (periodical function). + Because no assumption can be made about the spacing of the + samples -- defined in the first column -- the repetition period + is table[end,1]-table[1,1]. See 'ContinuityPeriodicTableExtrapolation' + in the examples. = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one row, the table value is returned, @@ -647,15 +642,11 @@ extrapolation = 1: Hold the first or last values of the table, (If smoothness is LinearSegments or ConstantSegments this means to extrapolate linearly through the first/last two table points.). - = 3: Periodically repeat the table data (periodical function), - where the repetition period is table[end,1]-table[2,1] and - table[1,end]-table[1,2] for columns and rows respectively. - Assuming u1 is one of the abscissa values: for u2 = table[1,end] - the result is table[u1,end]. However for the lim of u2 downwards - to table[1,end] the result is table[u1,2]. - This implies that for correct reproduction of a periodic function - the first and last data rows/columns should be the same - (table[2,2:end] = table[end,2:end] and table[2:end,2] = table[2:end,end]). + = 3: Periodically repeat the table data (periodical function). + Because no assumption can be made about the spacing of the + samples, the repetition period is table[end,1]-table[2,1] + and table[1,end]-table[1,2] for columns and rows respectively. + See 'ContinuityPeriodicTableExtrapolation' in the examples. = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one element, the table value is returned, @@ -853,15 +844,11 @@ extrapolation = 1: Hold the first or last values of the table, (If smoothness is LinearSegments or ConstantSegments this means to extrapolate linearly through the first/last two table points.). - = 3: Periodically repeat the table data (periodical function), - where the repetition period is table[end,1]-table[2,1] and - table[1,end]-table[1,2] for columns and rows respectively. - Assuming u1 is one of the abscissa values: for u2 = table[1,end] - the result is table[u1,end]. However for the lim of u2 downwards - to table[1,end] the result is table[u1,2]. - This implies that for correct reproduction of a periodic function - the first and last data rows/columns should be the same - (table[2,2:end] = table[end,2:end] and table[2:end,2] = table[2:end,end]). + = 3: Periodically repeat the table data (periodical function). + Because no assumption can be made about the spacing of the + samples, the repetition period is table[end,1]-table[2,1] + and table[1,end]-table[1,2] for columns and rows respectively. + See 'ContinuityPeriodicTableExtrapolation' in the examples. = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one element, the table value is returned, diff --git a/Modelica/Blocks/package.mo b/Modelica/Blocks/package.mo index 32552ecc54..0b276f60e7 100644 --- a/Modelica/Blocks/package.mo +++ b/Modelica/Blocks/package.mo @@ -1679,7 +1679,30 @@ we can compare the numerical solution with the analytical solution: The output is constant from the beginning.

    ")); - end DemoSignalCharacteristic; + end DemoSignalCharacteristic; + + model ContinuityPeriodicTableExtrapolation "Compare continuity of period extrapolation of CombiTable1Ds/CombiTable1Dv" + extends Modelica.Icons.Example; + Modelica.Blocks.Sources.Ramp ramp(height = 15, offset = -5, duration = 1.5) annotation( + Placement(transformation(origin = {-18, 0}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Tables.CombiTable1Ds discontinuousExtrapol(table = [0, -1; 4, 1], extrapolation = Modelica.Blocks.Types.Extrapolation.Periodic, smoothness = Modelica.Blocks.Types.Smoothness.ModifiedContinuousDerivative) "Table block with discontinuous periodic extrapolation" annotation( + Placement(transformation(origin = {22, 30}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Tables.CombiTable1Ds continuousC0ExtraPol(table = [0, -1; 1, 0; 2, 1; 3, 0; 4, -1], extrapolation = Modelica.Blocks.Types.Extrapolation.Periodic, smoothness = Modelica.Blocks.Types.Smoothness.ModifiedContinuousDerivative) "Table block with C0 periodic extrapolation" annotation( + Placement(transformation(extent = {{12, -10}, {32, 10}}))); + Modelica.Blocks.Tables.CombiTable1Ds continuousC1Extrapol(table = [0, -1; 0.25, -1; 0.5, -1; 2, 1; 3.5, -1; 3.75, -1; 4, -1], extrapolation = Modelica.Blocks.Types.Extrapolation.Periodic, smoothness = Modelica.Blocks.Types.Smoothness.ModifiedContinuousDerivative) "Table block with C1 periodic extrapolation" annotation( + Placement(transformation(origin = {22, -30}, extent = {{-10, -10}, {10, 10}}))); + equation + connect(continuousC0ExtraPol.u, ramp.y) annotation( + Line(points = {{10, 0}, {-7, 0}}, color = {0, 0, 127})); + connect(discontinuousExtrapol.u, ramp.y) annotation( + Line(points = {{10, 30}, {0, 30}, {0, 0}, {-7, 0}}, color = {0, 0, 127})); + connect(continuousC1Extrapol.u, ramp.y) annotation( + Line(points = {{10, -30}, {0, -30}, {0, 0}, {-7, 0}}, color = {0, 0, 127})); + annotation( + experiment(StartTime = 0, StopTime = 1.5, Tolerance = 1e-06, Interval = 0.01), + Documentation(info = "This model demonstrates the less obvious charactristics of periodic table interpolation.
    This is relevant to both 1D and 2D tables.

    Periodicity
    The periodicity of a one-dimensional table is defined as table[end,1]-table[1,1].
    This implies that the first and last points in the table 'overlap' when extrapolating. 
    The top model in this example, 'discontinuousExtrapol', illustrates how this works out during simulation. It defines a saw-tooth function by its minimum and maximum value and linear interpolation.
    The values at both ends of the definition interval (at t=0.5s and t=0.9s) are equal to the values defined in table[1,2] and table[end,2] respectively. Thus the table is evaluated including the interval limits: [start, end]

    Outside of the definition interval, the limit towards the definition interval is used. On the left side, the table is evaluated excluding the end value: [start, end>. On the right side it is evaluated excluding the start value: <start, end].
    This effect is deliberately exaggerated in this model by choosing a large simulation interval.
    It is clear that for t > 0.9s, the table output approaches -1 when t decreases, but at t=0.9s (and t=1.3s, etc.), the output will be exactly equal to 1.
    Likewise, for t<0.5s the table output will be <1  but never equal to 1. Instead at t=0.5 (and t=0.1 etc.), the output will be exactly -1.

    Differentiability
    The second model 'continuousC0Extrapolation' demonstrates that the derivative is not defined in the edges of the definition interval. The table definition [0, -1; 1, 0; 2, 1; 3, 0; 4, -1] defines a function that would be a triangle with linear interpolation.
    With continuous derivative, it is smooth in the interval, but not in the edges (t=0.5s, t= 0.9s, etc.).

    The bottom model 'continuousC1Extrapol' with table [0, -1; 0.25, -1; 0.5, -1; 2, 1; 3.5, -1; 3.75, -1; 4, -1] defines a function which is continuous in the interval edge, as well as its first 2 derivatives: around the interval edge there are 5 consequtive points at -1.
    This results in a smooth function.


    For more information, see Proceedings of the 10th International Modelica Conference. Ed. by Hubertus Tummescheit and Karl-Erik Årzén. Lund, Sweden, March 2014.
    + DOI: 10.3384/ecp14096893.")); + end ContinuityPeriodicTableExtrapolation; package Noise "Library of examples to demonstrate the usage of package Blocks.Noise" extends Modelica.Icons.ExamplesPackage; From 607b58297f0c9c480f74b0225460a8cf23bc9fe2 Mon Sep 17 00:00:00 2001 From: paultjevdh <59084059+paultjevdh@users.noreply.github.com> Date: Mon, 22 Apr 2024 11:11:59 +0200 Subject: [PATCH 11/13] Added example model with comments. Simplified documentation in table models with reference to example. --- Modelica/Blocks/Tables.mo | 53 ++++++++++++++------------------------ Modelica/Blocks/package.mo | 25 +++++++++++++++++- 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/Modelica/Blocks/Tables.mo b/Modelica/Blocks/Tables.mo index 4e0c79fef7..f46f61bf58 100644 --- a/Modelica/Blocks/Tables.mo +++ b/Modelica/Blocks/Tables.mo @@ -156,13 +156,11 @@ extrapolation = 1: Hold the first or last value of the table, (If smoothness is LinearSegments or ConstantSegments this means to extrapolate linearly through the first/last two table points.). - = 3: Periodically repeat the table data (periodical function), - where the repetition period is table[end,1]-table[1,1]. - For u = table[end,1] the output(-array) is table[end,columns]. However for the - limit of u downwards to table[end,1] the result is table[1,columns]. - This implies that for correct reproduction of a periodic function - the first and last data rows should be the same - (table[1,2:end] = table[end,2:end]). + = 3: Periodically repeat the table data (periodical function). + Because no assumption can be made about the spacing of the + samples -- defined in the first column -- the repetition period + is table[end,1]-table[1,1]. See 'ContinuityPeriodicTableExtrapolation' + in the examples. = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one row, the table value is returned, @@ -433,14 +431,11 @@ extrapolation = 1: Hold the first or last value of the table, (If smoothness is LinearSegments or ConstantSegments this means to extrapolate linearly through the first/last two table points.). - = 3: Periodically repeat the table data (periodical function), - where the repetition period is table[end,1]-table[1,1]. - For input u[i] = table[end,1] the output value is table[end,columns[i]]. - However for the limit of u downwards to table[end,1] the result is - table[1,columns[i]]. - This implies that for correct reproduction of a periodic function - the first and last data rows should be the same - (table[1,2:end] = table[end,2:end]). + = 3: Periodically repeat the table data (periodical function). + Because no assumption can be made about the spacing of the + samples -- defined in the first column -- the repetition period + is table[end,1]-table[1,1]. See 'ContinuityPeriodicTableExtrapolation' + in the examples. = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one row, the table value is returned, @@ -647,15 +642,11 @@ extrapolation = 1: Hold the first or last values of the table, (If smoothness is LinearSegments or ConstantSegments this means to extrapolate linearly through the first/last two table points.). - = 3: Periodically repeat the table data (periodical function), - where the repetition period is table[end,1]-table[2,1] and - table[1,end]-table[1,2] for columns and rows respectively. - Assuming u1 is one of the abscissa values: for u2 = table[1,end] - the result is table[u1,end]. However for the lim of u2 downwards - to table[1,end] the result is table[u1,2]. - This implies that for correct reproduction of a periodic function - the first and last data rows/columns should be the same - (table[2,2:end] = table[end,2:end] and table[2:end,2] = table[2:end,end]). + = 3: Periodically repeat the table data (periodical function). + Because no assumption can be made about the spacing of the + samples, the repetition period is table[end,1]-table[2,1] + and table[1,end]-table[1,2] for columns and rows respectively. + See 'ContinuityPeriodicTableExtrapolation' in the examples. = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one element, the table value is returned, @@ -853,15 +844,11 @@ extrapolation = 1: Hold the first or last values of the table, (If smoothness is LinearSegments or ConstantSegments this means to extrapolate linearly through the first/last two table points.). - = 3: Periodically repeat the table data (periodical function), - where the repetition period is table[end,1]-table[2,1] and - table[1,end]-table[1,2] for columns and rows respectively. - Assuming u1 is one of the abscissa values: for u2 = table[1,end] - the result is table[u1,end]. However for the lim of u2 downwards - to table[1,end] the result is table[u1,2]. - This implies that for correct reproduction of a periodic function - the first and last data rows/columns should be the same - (table[2,2:end] = table[end,2:end] and table[2:end,2] = table[2:end,end]). + = 3: Periodically repeat the table data (periodical function). + Because no assumption can be made about the spacing of the + samples, the repetition period is table[end,1]-table[2,1] + and table[1,end]-table[1,2] for columns and rows respectively. + See 'ContinuityPeriodicTableExtrapolation' in the examples. = 4: No extrapolation, i.e. extrapolation triggers an error
  • If the table has only one element, the table value is returned, diff --git a/Modelica/Blocks/package.mo b/Modelica/Blocks/package.mo index 32552ecc54..0b276f60e7 100644 --- a/Modelica/Blocks/package.mo +++ b/Modelica/Blocks/package.mo @@ -1679,7 +1679,30 @@ we can compare the numerical solution with the analytical solution: The output is constant from the beginning.

    ")); - end DemoSignalCharacteristic; + end DemoSignalCharacteristic; + + model ContinuityPeriodicTableExtrapolation "Compare continuity of period extrapolation of CombiTable1Ds/CombiTable1Dv" + extends Modelica.Icons.Example; + Modelica.Blocks.Sources.Ramp ramp(height = 15, offset = -5, duration = 1.5) annotation( + Placement(transformation(origin = {-18, 0}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Tables.CombiTable1Ds discontinuousExtrapol(table = [0, -1; 4, 1], extrapolation = Modelica.Blocks.Types.Extrapolation.Periodic, smoothness = Modelica.Blocks.Types.Smoothness.ModifiedContinuousDerivative) "Table block with discontinuous periodic extrapolation" annotation( + Placement(transformation(origin = {22, 30}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Tables.CombiTable1Ds continuousC0ExtraPol(table = [0, -1; 1, 0; 2, 1; 3, 0; 4, -1], extrapolation = Modelica.Blocks.Types.Extrapolation.Periodic, smoothness = Modelica.Blocks.Types.Smoothness.ModifiedContinuousDerivative) "Table block with C0 periodic extrapolation" annotation( + Placement(transformation(extent = {{12, -10}, {32, 10}}))); + Modelica.Blocks.Tables.CombiTable1Ds continuousC1Extrapol(table = [0, -1; 0.25, -1; 0.5, -1; 2, 1; 3.5, -1; 3.75, -1; 4, -1], extrapolation = Modelica.Blocks.Types.Extrapolation.Periodic, smoothness = Modelica.Blocks.Types.Smoothness.ModifiedContinuousDerivative) "Table block with C1 periodic extrapolation" annotation( + Placement(transformation(origin = {22, -30}, extent = {{-10, -10}, {10, 10}}))); + equation + connect(continuousC0ExtraPol.u, ramp.y) annotation( + Line(points = {{10, 0}, {-7, 0}}, color = {0, 0, 127})); + connect(discontinuousExtrapol.u, ramp.y) annotation( + Line(points = {{10, 30}, {0, 30}, {0, 0}, {-7, 0}}, color = {0, 0, 127})); + connect(continuousC1Extrapol.u, ramp.y) annotation( + Line(points = {{10, -30}, {0, -30}, {0, 0}, {-7, 0}}, color = {0, 0, 127})); + annotation( + experiment(StartTime = 0, StopTime = 1.5, Tolerance = 1e-06, Interval = 0.01), + Documentation(info = "This model demonstrates the less obvious charactristics of periodic table interpolation.
    This is relevant to both 1D and 2D tables.

    Periodicity
    The periodicity of a one-dimensional table is defined as table[end,1]-table[1,1].
    This implies that the first and last points in the table 'overlap' when extrapolating. 
    The top model in this example, 'discontinuousExtrapol', illustrates how this works out during simulation. It defines a saw-tooth function by its minimum and maximum value and linear interpolation.
    The values at both ends of the definition interval (at t=0.5s and t=0.9s) are equal to the values defined in table[1,2] and table[end,2] respectively. Thus the table is evaluated including the interval limits: [start, end]

    Outside of the definition interval, the limit towards the definition interval is used. On the left side, the table is evaluated excluding the end value: [start, end>. On the right side it is evaluated excluding the start value: <start, end].
    This effect is deliberately exaggerated in this model by choosing a large simulation interval.
    It is clear that for t > 0.9s, the table output approaches -1 when t decreases, but at t=0.9s (and t=1.3s, etc.), the output will be exactly equal to 1.
    Likewise, for t<0.5s the table output will be <1  but never equal to 1. Instead at t=0.5 (and t=0.1 etc.), the output will be exactly -1.

    Differentiability
    The second model 'continuousC0Extrapolation' demonstrates that the derivative is not defined in the edges of the definition interval. The table definition [0, -1; 1, 0; 2, 1; 3, 0; 4, -1] defines a function that would be a triangle with linear interpolation.
    With continuous derivative, it is smooth in the interval, but not in the edges (t=0.5s, t= 0.9s, etc.).

    The bottom model 'continuousC1Extrapol' with table [0, -1; 0.25, -1; 0.5, -1; 2, 1; 3.5, -1; 3.75, -1; 4, -1] defines a function which is continuous in the interval edge, as well as its first 2 derivatives: around the interval edge there are 5 consequtive points at -1.
    This results in a smooth function.


    For more information, see Proceedings of the 10th International Modelica Conference. Ed. by Hubertus Tummescheit and Karl-Erik Årzén. Lund, Sweden, March 2014.
    + DOI: 10.3384/ecp14096893.")); + end ContinuityPeriodicTableExtrapolation; package Noise "Library of examples to demonstrate the usage of package Blocks.Noise" extends Modelica.Icons.ExamplesPackage; From c2c81047997f0ffa0f0bb4256c6848adf7249257 Mon Sep 17 00:00:00 2001 From: Thomas Beutlich Date: Tue, 21 May 2024 18:42:14 +0200 Subject: [PATCH 12/13] Fix layout --- Modelica/Blocks/package.mo | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/Modelica/Blocks/package.mo b/Modelica/Blocks/package.mo index 0b276f60e7..8bc630eb8d 100644 --- a/Modelica/Blocks/package.mo +++ b/Modelica/Blocks/package.mo @@ -1683,24 +1683,35 @@ The output is constant from the beginning. model ContinuityPeriodicTableExtrapolation "Compare continuity of period extrapolation of CombiTable1Ds/CombiTable1Dv" extends Modelica.Icons.Example; - Modelica.Blocks.Sources.Ramp ramp(height = 15, offset = -5, duration = 1.5) annotation( - Placement(transformation(origin = {-18, 0}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Tables.CombiTable1Ds discontinuousExtrapol(table = [0, -1; 4, 1], extrapolation = Modelica.Blocks.Types.Extrapolation.Periodic, smoothness = Modelica.Blocks.Types.Smoothness.ModifiedContinuousDerivative) "Table block with discontinuous periodic extrapolation" annotation( - Placement(transformation(origin = {22, 30}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Tables.CombiTable1Ds continuousC0ExtraPol(table = [0, -1; 1, 0; 2, 1; 3, 0; 4, -1], extrapolation = Modelica.Blocks.Types.Extrapolation.Periodic, smoothness = Modelica.Blocks.Types.Smoothness.ModifiedContinuousDerivative) "Table block with C0 periodic extrapolation" annotation( - Placement(transformation(extent = {{12, -10}, {32, 10}}))); - Modelica.Blocks.Tables.CombiTable1Ds continuousC1Extrapol(table = [0, -1; 0.25, -1; 0.5, -1; 2, 1; 3.5, -1; 3.75, -1; 4, -1], extrapolation = Modelica.Blocks.Types.Extrapolation.Periodic, smoothness = Modelica.Blocks.Types.Smoothness.ModifiedContinuousDerivative) "Table block with C1 periodic extrapolation" annotation( - Placement(transformation(origin = {22, -30}, extent = {{-10, -10}, {10, 10}}))); + Sources.Ramp ramp( + height=15, + offset=-5, + duration=1.5) annotation (Placement(transformation(origin={-18, 0}, extent={{-10,-10},{10,10}}))); + Tables.CombiTable1Ds discontinuousExtrapol( + table=[0,-1;4,1], + extrapolation=Types.Extrapolation.Periodic, + smoothness=Types.Smoothness.ModifiedContinuousDerivative) "Table block with discontinuous periodic extrapolation" + annotation (Placement(transformation(origin={22,30}, extent={{-10,-10},{10,10}}))); + Tables.CombiTable1Ds continuousC0ExtraPol( + table=[0,-1;1,0;2,1;3,0;4,-1], + extrapolation=Types.Extrapolation.Periodic, + smoothness=Types.Smoothness.ModifiedContinuousDerivative) "Table block with C0 periodic extrapolation" + annotation (Placement(transformation(extent={{12,-10},{32,10}}))); + Tables.CombiTable1Ds continuousC1Extrapol( + table=[0,-1;0.25,-1;0.5,-1;2,1;3.5,-1;3.75,-1;4,-1], + extrapolation=Types.Extrapolation.Periodic, + smoothness=Types.Smoothness.ModifiedContinuousDerivative) "Table block with C1 periodic extrapolation" + annotation (Placement(transformation(origin={22,-30}, extent={{-10,-10},{10,10}}))); equation connect(continuousC0ExtraPol.u, ramp.y) annotation( - Line(points = {{10, 0}, {-7, 0}}, color = {0, 0, 127})); + Line(points={{10,0},{-7,0}},color={0,0,127})); connect(discontinuousExtrapol.u, ramp.y) annotation( - Line(points = {{10, 30}, {0, 30}, {0, 0}, {-7, 0}}, color = {0, 0, 127})); + Line(points={{10,30},{0,30},{0,0},{-7,0}}, color={0,0,127})); connect(continuousC1Extrapol.u, ramp.y) annotation( - Line(points = {{10, -30}, {0, -30}, {0, 0}, {-7, 0}}, color = {0, 0, 127})); + Line(points={{10,-30},{0,-30},{0,0},{-7,0}}, color={0,0,127})); annotation( - experiment(StartTime = 0, StopTime = 1.5, Tolerance = 1e-06, Interval = 0.01), - Documentation(info = "This model demonstrates the less obvious charactristics of periodic table interpolation.
    This is relevant to both 1D and 2D tables.

    Periodicity
    The periodicity of a one-dimensional table is defined as table[end,1]-table[1,1].
    This implies that the first and last points in the table 'overlap' when extrapolating. 
    The top model in this example, 'discontinuousExtrapol', illustrates how this works out during simulation. It defines a saw-tooth function by its minimum and maximum value and linear interpolation.
    The values at both ends of the definition interval (at t=0.5s and t=0.9s) are equal to the values defined in table[1,2] and table[end,2] respectively. Thus the table is evaluated including the interval limits: [start, end]

    Outside of the definition interval, the limit towards the definition interval is used. On the left side, the table is evaluated excluding the end value: [start, end>. On the right side it is evaluated excluding the start value: <start, end].
    This effect is deliberately exaggerated in this model by choosing a large simulation interval.
    It is clear that for t > 0.9s, the table output approaches -1 when t decreases, but at t=0.9s (and t=1.3s, etc.), the output will be exactly equal to 1.
    Likewise, for t<0.5s the table output will be <1  but never equal to 1. Instead at t=0.5 (and t=0.1 etc.), the output will be exactly -1.

    Differentiability
    The second model 'continuousC0Extrapolation' demonstrates that the derivative is not defined in the edges of the definition interval. The table definition [0, -1; 1, 0; 2, 1; 3, 0; 4, -1] defines a function that would be a triangle with linear interpolation.
    With continuous derivative, it is smooth in the interval, but not in the edges (t=0.5s, t= 0.9s, etc.).

    The bottom model 'continuousC1Extrapol' with table [0, -1; 0.25, -1; 0.5, -1; 2, 1; 3.5, -1; 3.75, -1; 4, -1] defines a function which is continuous in the interval edge, as well as its first 2 derivatives: around the interval edge there are 5 consequtive points at -1.
    This results in a smooth function.


    For more information, see Proceedings of the 10th International Modelica Conference. Ed. by Hubertus Tummescheit and Karl-Erik Årzén. Lund, Sweden, March 2014.
    + experiment(StartTime=0, StopTime=1.5, Tolerance=1e-06, Interval=0.01), + Documentation(info="This model demonstrates the less obvious charactristics of periodic table interpolation.
    This is relevant to both 1D and 2D tables.

    Periodicity
    The periodicity of a one-dimensional table is defined as table[end,1]-table[1,1].
    This implies that the first and last points in the table 'overlap' when extrapolating. 
    The top model in this example, 'discontinuousExtrapol', illustrates how this works out during simulation. It defines a saw-tooth function by its minimum and maximum value and linear interpolation.
    The values at both ends of the definition interval (at t=0.5s and t=0.9s) are equal to the values defined in table[1,2] and table[end,2] respectively. Thus the table is evaluated including the interval limits: [start, end]

    Outside of the definition interval, the limit towards the definition interval is used. On the left side, the table is evaluated excluding the end value: [start, end>. On the right side it is evaluated excluding the start value: <start, end].
    This effect is deliberately exaggerated in this model by choosing a large simulation interval.
    It is clear that for t > 0.9s, the table output approaches -1 when t decreases, but at t=0.9s (and t=1.3s, etc.), the output will be exactly equal to 1.
    Likewise, for t<0.5s the table output will be <1  but never equal to 1. Instead at t=0.5 (and t=0.1 etc.), the output will be exactly -1.

    Differentiability
    The second model 'continuousC0Extrapolation' demonstrates that the derivative is not defined in the edges of the definition interval. The table definition [0, -1; 1, 0; 2, 1; 3, 0; 4, -1] defines a function that would be a triangle with linear interpolation.
    With continuous derivative, it is smooth in the interval, but not in the edges (t=0.5s, t= 0.9s, etc.).

    The bottom model 'continuousC1Extrapol' with table [0, -1; 0.25, -1; 0.5, -1; 2, 1; 3.5, -1; 3.75, -1; 4, -1] defines a function which is continuous in the interval edge, as well as its first 2 derivatives: around the interval edge there are 5 consequtive points at -1.
    This results in a smooth function.


    For more information, see Proceedings of the 10th International Modelica Conference. Ed. by Hubertus Tummescheit and Karl-Erik Årzén. Lund, Sweden, March 2014.
    DOI: 10.3384/ecp14096893.")); end ContinuityPeriodicTableExtrapolation; From 3a6d74b288c564e7763e0425d440c4d683aac53e Mon Sep 17 00:00:00 2001 From: Thomas Beutlich Date: Tue, 21 May 2024 19:13:21 +0200 Subject: [PATCH 13/13] Fix typos --- Modelica/Blocks/package.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modelica/Blocks/package.mo b/Modelica/Blocks/package.mo index 8bc630eb8d..ab57749c0e 100644 --- a/Modelica/Blocks/package.mo +++ b/Modelica/Blocks/package.mo @@ -1681,7 +1681,7 @@ The output is constant from the beginning. ")); end DemoSignalCharacteristic; - model ContinuityPeriodicTableExtrapolation "Compare continuity of period extrapolation of CombiTable1Ds/CombiTable1Dv" + model ContinuityPeriodicTableExtrapolation "Compare continuity of periodic extrapolation of CombiTable1Ds/CombiTable1Dv" extends Modelica.Icons.Example; Sources.Ramp ramp( height=15, @@ -1711,7 +1711,7 @@ The output is constant from the beginning. Line(points={{10,-30},{0,-30},{0,0},{-7,0}}, color={0,0,127})); annotation( experiment(StartTime=0, StopTime=1.5, Tolerance=1e-06, Interval=0.01), - Documentation(info="This model demonstrates the less obvious charactristics of periodic table interpolation.
    This is relevant to both 1D and 2D tables.

    Periodicity
    The periodicity of a one-dimensional table is defined as table[end,1]-table[1,1].
    This implies that the first and last points in the table 'overlap' when extrapolating. 
    The top model in this example, 'discontinuousExtrapol', illustrates how this works out during simulation. It defines a saw-tooth function by its minimum and maximum value and linear interpolation.
    The values at both ends of the definition interval (at t=0.5s and t=0.9s) are equal to the values defined in table[1,2] and table[end,2] respectively. Thus the table is evaluated including the interval limits: [start, end]

    Outside of the definition interval, the limit towards the definition interval is used. On the left side, the table is evaluated excluding the end value: [start, end>. On the right side it is evaluated excluding the start value: <start, end].
    This effect is deliberately exaggerated in this model by choosing a large simulation interval.
    It is clear that for t > 0.9s, the table output approaches -1 when t decreases, but at t=0.9s (and t=1.3s, etc.), the output will be exactly equal to 1.
    Likewise, for t<0.5s the table output will be <1  but never equal to 1. Instead at t=0.5 (and t=0.1 etc.), the output will be exactly -1.

    Differentiability
    The second model 'continuousC0Extrapolation' demonstrates that the derivative is not defined in the edges of the definition interval. The table definition [0, -1; 1, 0; 2, 1; 3, 0; 4, -1] defines a function that would be a triangle with linear interpolation.
    With continuous derivative, it is smooth in the interval, but not in the edges (t=0.5s, t= 0.9s, etc.).

    The bottom model 'continuousC1Extrapol' with table [0, -1; 0.25, -1; 0.5, -1; 2, 1; 3.5, -1; 3.75, -1; 4, -1] defines a function which is continuous in the interval edge, as well as its first 2 derivatives: around the interval edge there are 5 consequtive points at -1.
    This results in a smooth function.


    For more information, see Proceedings of the 10th International Modelica Conference. Ed. by Hubertus Tummescheit and Karl-Erik Årzén. Lund, Sweden, March 2014.
    + Documentation(info="This model demonstrates the less obvious characteristics of periodic table interpolation.
    This is relevant to both 1D and 2D tables.

    Periodicity
    The periodicity of a one-dimensional table is defined as table[end,1]-table[1,1].
    This implies that the first and last points in the table 'overlap' when extrapolating. 
    The top model in this example, 'discontinuousExtrapol', illustrates how this works out during simulation. It defines a saw-tooth function by its minimum and maximum value and linear interpolation.
    The values at both ends of the definition interval (at t=0.5s and t=0.9s) are equal to the values defined in table[1,2] and table[end,2] respectively. Thus the table is evaluated including the interval limits: [start, end]

    Outside of the definition interval, the limit towards the definition interval is used. On the left side, the table is evaluated excluding the end value: [start, end>. On the right side it is evaluated excluding the start value: <start, end].
    This effect is deliberately exaggerated in this model by choosing a large simulation interval.
    It is clear that for t > 0.9s, the table output approaches -1 when t decreases, but at t=0.9s (and t=1.3s, etc.), the output will be exactly equal to 1.
    Likewise, for t<0.5s the table output will be <1  but never equal to 1. Instead at t=0.5 (and t=0.1 etc.), the output will be exactly -1.

    Differentiability
    The second model 'continuousC0Extrapolation' demonstrates that the derivative is not defined in the edges of the definition interval. The table definition [0, -1; 1, 0; 2, 1; 3, 0; 4, -1] defines a function that would be a triangle with linear interpolation.
    With continuous derivative, it is smooth in the interval, but not in the edges (t=0.5s, t= 0.9s, etc.).

    The bottom model 'continuousC1Extrapol' with table [0, -1; 0.25, -1; 0.5, -1; 2, 1; 3.5, -1; 3.75, -1; 4, -1] defines a function which is continuous in the interval edge, as well as its first 2 derivatives: around the interval edge there are 5 consecutive points at -1.
    This results in a smooth function.


    For more information, see Proceedings of the 10th International Modelica Conference. Ed. by Hubertus Tummescheit and Karl-Erik Årzén. Lund, Sweden, March 2014.
    DOI: 10.3384/ecp14096893.")); end ContinuityPeriodicTableExtrapolation;