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] 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.