Skip to content

Commit b76fe25

Browse files
DorianGerardinArthoni
authored andcommitted
Update examples simulators to 2.2
1 parent a301030 commit b76fe25

File tree

123 files changed

+8287
-197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+8287
-197
lines changed

.githooks/pre-push

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ done
6060

6161
REPO_ROOT=$(git rev-parse --show-toplevel)
6262

63-
$REPO_ROOT/resources/tools/ofsrc-stylecheck.py $REPO_ROOT --disable=UNRT --exclude=share/openfluid/waresdev/templates,resources/tests/miscsrc/cmdline-check
63+
$REPO_ROOT/resources/tools/ofsrc-stylecheck.py $REPO_ROOT --disable=UNRT --exclude=share/openfluid/waresdev/templates,resources/tests/miscsrc/cmdline-check,examples/wares-dev
6464

6565

6666
# Capture the return value

CMake.in.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SET(OFBUILD_CUSTOM_CMAKE_VERSION "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.
2323
SET(OPENFLUID_VERSION_MAJOR 2)
2424
SET(OPENFLUID_VERSION_MINOR 2)
2525
SET(OPENFLUID_VERSION_PATCH 0)
26-
SET(OPENFLUID_VERSION_STATUS "alpha137") # example: SET(OPENFLUID_VERSION_STATUS "rc1")
26+
SET(OPENFLUID_VERSION_STATUS "alpha138") # example: SET(OPENFLUID_VERSION_STATUS "rc1")
2727

2828
SET(OPENFLUID_VERSION_FULL "${OPENFLUID_VERSION_MAJOR}.${OPENFLUID_VERSION_MINOR}.${OPENFLUID_VERSION_PATCH}")
2929

examples/wares-dev/simulators/traffic.surf.trafficlights-state/src/WareMain.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ class TLUSimulator : public openfluid::ware::PluggableSimulator
122122
if (Modulo!=0)
123123
{
124124
ID = TLU->getID();
125-
std::string IDStr;
126-
openfluid::tools::convertValue(ID,&IDStr);
125+
std::string IDStr = std::to_string(ID);
127126
OPENFLUID_RaiseError("The Duration coefficient of TLU " + IDStr +
128127
" should be compatible with the Simulation Scheduling.");
129128

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
Copyright (c) 2007 INRA - Montpellier SupAgro
3+
Inter Deposit Digital Number : IDDN.FR.001.070012.000.R.P.2010.000.30100
4+
5+
== GNU General Public License Usage ==
6+
7+
This software is free software: you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation, either version 3 of the License, or
10+
(at your option) any later version.
11+
12+
This software is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this software. If not, see <http://www.gnu.org/licenses/>.
19+
20+
21+
== Other Usage ==
22+
23+
Other Usage means a use of this software that is inconsistent with the GPL
24+
license, and requires a written agreement between You and INRA.
25+
Licensees for Other Usage of this software may use this file in accordance
26+
with the terms contained in the written agreement between You and INRA.
27+

examples/wares-dev/simulators/water.atm-surf.rain-su.files/doc/english/RainSUFiles_abstract.tex

100644100755
File mode changed.

examples/wares-dev/simulators/water.atm-surf.rain-su.files/doc/english/RainSUFiles_functional_description.tex

100644100755
+4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
\section{Functional description}
12
\subsection{Function parameters}
23
The function ``\englishname'' must be used with the following parameter :
34
\vspace{1em}
45

6+
\hspace{-0.5cm}
57
\begin{tabular}{|llcc|}
68
\hline
79
\it Symbol & \it Name & \it Value range & \it Unit \\
@@ -27,6 +29,7 @@ \subsection{Variables}
2729
Variable produced by this function is indicated hereafter.
2830
\vspace{1em}
2931

32+
\hspace{-0.5cm}
3033
\begin{tabular}{|lll|}
3134
\hline
3235
\it Symbol & \it Name & \it Unit \\
@@ -43,6 +46,7 @@ \subsection{Extra files}
4346
The ``\englishname'' function requires several extra files :\\
4447
\vspace{1em}
4548

49+
\hspace{-0.5cm}
4650
\begin{tabular}{|l|}
4751
\hline
4852
\it File name \\

examples/wares-dev/simulators/water.atm-surf.rain-su.files/doc/english/RainSUFiles_scientific_concept.tex

100644100755
+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
\section{Scientific concepts}
12
\subsection{Time interpolation}
23
First of all, the function linearly interpolates rain data at the given model time step. Rainfall data are loaded by the function from rain gauge source file. This file contains rain in the form of water height in millimeter. There can be as many rain source files as rain gauges. No specific name or syntax are necessary. Data must be formatted as following with space as separator :
34
\begin{verbatim}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
\section{Concepts scientifiques}
2+
\subsection{Interpolation dans le temps}
3+
La fonction réalise tout d'abord une interpolation linéaire des données pluviométriques au pas de temps de simulation du modèle. Pour cela, la fonction récupère les données de pluie présentent dans le (ou les) fichier(s) spécifié(s) par l'utilisateur. Ces fichiers doivent contenir les données pluviométriques sous forme de hauteurs d'eau. Il peut il y avoir autant de fichiers que de pluviomètres. Aucun nom ou syntaxe particulière ne sont nécessaires. Les données doivent être formatées de la façon suivante avec un espace comme séparateur :
4+
5+
\begin{verbatim}
6+
%AA MM JJ hh mm ss Pluie(mm)
7+
2009 10 21 23 10 00 0.5
8+
\end{verbatim}
9+
10+
Le calcul de la pluie pour chaque pas de temps étant réalisé par interpolation, un paramètre numérique a été ajouté. Il s'agit de la pluie seuil $P_{threshold}$ (en $m$) en dessous de laquelle la pluie calculée est considérée comme nulle. Ce paramètre est à moduler en fonction du pas de temps de simulation.
11+
12+
13+
\subsection{Distribution dans l'espace}
14+
Ensuite, la fonction distribue les hauteurs de pluie calculées pour chaque pas de temps dans l'espace. Pour cette opération, deux fichiers permettent de relier les données pluviométriques à chaque unité de surface SU.\\
15+
16+
Le fichier ``\textbf{rainsources.xml}'' permet d'attribuer un identifiant unique pour chaque fichier pluviométrique. La structure du fichier .xml doit être la suivante :
17+
18+
\begin{verbatim}
19+
<?xml version="1.0" encoding="UTF-8"?>
20+
<openfluid>
21+
<datasources>
22+
<filesource ID="1" file="raingauge_1" />
23+
<filesource ID="2" file="raingauge_3" />
24+
</datasources>
25+
</openfluid>
26+
\end{verbatim}
27+
28+
Le fichier ``\textbf{SUraindistri.dat}'' affecte, pour chaque SU, un fichier de pluie grâce aux identifiants attribués précédemment. Le format du fichier est le suivant :
29+
30+
\begin{verbatim}
31+
%SU ID Pluvio ID
32+
1 2
33+
\end{verbatim}
34+
35+
Les fichiers de pluies et le fichier ``\textbf{rainsources.xml}'' sont communs avec la fonction ``Distribution des données pluviométriques sur les RS''.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
\section{Description fonctionnelle}
2+
\subsection{Nom de la fonction}
3+
Le nom (fileID) de la fonction de simulation est \texttt{\FileID}.
4+
5+
\subsection{Paramètres de la fonction}
6+
La fonction ``\frenchname'' doit être utilisée et renseignée avec le paramètre suivant :\\
7+
8+
9+
\hspace{-0.5cm}
10+
\begin{tabular}{|llcc|}
11+
\hline
12+
\it Symbole & \it Nom & \it Valeurs & \it Unité \\
13+
\hline
14+
$P_{threshold}$ & \texttt{\ParamA} & $\geq 0$ & $m$ \\
15+
\hline
16+
\end{tabular}
17+
\vspace{1em}
18+
19+
La syntaxe correcte de déclaration d'utilisation de la fonction dans le fichier \texttt{model.xml} doit ressembler à l'exemple illustré ci-après :
20+
21+
\begin{verbatim}
22+
<function fileID="water.atm-surf.
23+
rain-su.files">
24+
<param name="threshold"
25+
value="0.0001" />
26+
</function>
27+
\end{verbatim}
28+
29+
30+
\subsection{Variables}
31+
La variable produite par cette fonction est indiquée dans le tableau ci-après :
32+
\vspace{1em}
33+
34+
\hspace{-0.5cm}
35+
\begin{tabular}{|lll|}
36+
\hline
37+
\it Symbole & \it Nom & \it Unité \\
38+
\hline
39+
$P$ & \texttt{\VarProdA} & $m$ \\
40+
\hline
41+
\end{tabular}
42+
\vspace{1em}
43+
44+
45+
\subsection{Fichiers}
46+
La fonction ``\frenchname'' nécessite plusieurs fichiers :\\
47+
\vspace{1em}
48+
49+
\hspace{-0.5cm}
50+
\begin{tabular}{|l|}
51+
\hline
52+
\it Nom du fichier \\
53+
\hline
54+
rainsources.xml \\
55+
SUraindistri.dat \\
56+
\hline
57+
\end{tabular}
58+
\vspace{1em}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
La fonction ``\frenchname'' réalise une interpolation linéaire sur les données de pluie des fichiers sources pour produire la hauteur d'eau précipitée sur chaque unité de surface SU et pour chaque pas de temps de la simulation.

examples/wares-dev/simulators/water.atm-surf.rain-su.files/doc/main.tex

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
% Name
2+
\newcommand{\frenchname}{Distribution de pluie sur les SU}
23
\newcommand{\englishname}{Distribution of rainfall on SU}
34

45
% FileID
@@ -13,15 +14,13 @@
1314

1415

1516
\begin{abstract}
16-
\input{./english/RainSUFiles_abstract.tex}
17+
\iflanguage{english}\input{./english/RainSUFiles_abstract.tex}\input{./french/RainSUFiles_resume.tex}
1718
\end{abstract}
1819

1920
%******************************
2021
% Scientific concepts
21-
\section{Scientific concepts}
22-
\input{./english/RainSUFiles_scientific_concept.tex}
22+
\iflanguage{english}\input{./english/RainSUFiles_scientific_concept.tex}\input{./french/RainSUFiles_concept_scientifique.tex}
2323

2424
%******************************
2525
% Functional description
26-
\section{Functional description}
27-
\input{./english/RainSUFiles_functional_description.tex}
26+
\iflanguage{english}\input{./english/RainSUFiles_functional_description.tex}\input{./french/RainSUFiles_notice_utilisation.tex}

examples/wares-dev/simulators/water.atm-surf.rain-su.files/openfluid-ware.json

+16-7
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,22 @@
1818
"email": "louchart@supagro.inra.fr"
1919
}
2020
],
21-
"contacts": [],
22-
"license": "",
21+
"contacts": [
22+
{
23+
"name": "D. Crevoisier",
24+
"email": "david.crevoisier@inrae.fr"
25+
}
26+
],
27+
"license": "GPL-3.0",
2328
"tags": [
24-
"meteo"
29+
"domain::meteo",
30+
"process::rain",
31+
"method::files",
32+
"water"
2533
],
2634
"links": [],
2735
"issues": [],
36+
"dependencies": {},
2837
"simulator": {
2938
"data": {
3039
"parameters": {
@@ -44,6 +53,8 @@
4453
"produced": []
4554
},
4655
"variables": {
56+
"required": [],
57+
"used": [],
4758
"produced": [
4859
{
4960
"name": "water.atm-surf.H.rain",
@@ -53,18 +64,16 @@
5364
"type": ""
5465
}
5566
],
56-
"required": [],
57-
"used": [],
5867
"updated": []
5968
},
60-
"events": [],
6169
"extrafiles": {
6270
"required": [
6371
"SUraindistri.dat",
6472
"rainsources.xml"
6573
],
6674
"used": []
67-
}
75+
},
76+
"events": []
6877
},
6978
"spatial_graph": {
7079
"description": "",

examples/wares-dev/simulators/water.atm-surf.rain-su.files/src/CMakeLists.txt

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#SET(SIM_SIM2DOC_DISABLED 1) #FIXME
2+
13
# set this to add include directories
24
# ex: SET(WARE_INCLUDE_DIRS /path/to/include/A/ /path/to/include/B/)
35
#SET(WARE_INCLUDE_DIRS )
@@ -21,7 +23,7 @@
2123

2224
OPENFLUID_ADD_WAREPLUGIN(
2325
# list of C++ files
24-
CPP_FILES WareMain.cpp
26+
CPP_FILES RainSUFromFilesSim.cpp
2527
# list of Fortran files
2628
#FORTRAN_FILES
2729
# list of UI files (mainly for builderexts)
@@ -36,6 +38,8 @@ OPENFLUID_ADD_WAREPLUGIN(
3638
#TARGET
3739
# custom installation path, standard path is used if not provided
3840
#INSTALL_PATH
41+
# parametrized signature and/or documentation
42+
CONFIGURED_SIGNATURE OFF
3943

4044

4145
# enable build of parameterization UI (ON/OFF, OFF is default)
@@ -46,6 +50,8 @@ OPENFLUID_ADD_WAREPLUGIN(
4650
#PARAMSUI_UI_FILES
4751
# list of RC files for parametrization UI
4852
#PARAMSUI_RC_FILES
53+
# list of languages for translation of parameterization UI
54+
#PARAMSUI_I18N_LANGS
4955
# list of supplementary OpenFLUID libraries (e.g. tools, ...) for parametrization UI
5056
#PARAMSUI_OPENFLUID_COMPONENTS
5157
# custom target name for parametrization UI, automatically generated by default

examples/wares-dev/simulators/water.atm-surf.rain-su.files/src/WareMain.cpp renamed to examples/wares-dev/simulators/water.atm-surf.rain-su.files/src/RainSUFromFilesSim.cpp

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,36 @@
11
/*
22
3-
This file is part of OpenFLUID software
3+
This file is part of MHYDAS simulators for OpenFLUID software
44
Copyright(c) 2007, INRA - Montpellier SupAgro
55
66
77
== GNU General Public License Usage ==
88
9-
OpenFLUID is free software: you can redistribute it and/or modify
9+
This part of MHYDAS is free software: you can redistribute it and/or modify
1010
it under the terms of the GNU General Public License as published by
1111
the Free Software Foundation, either version 3 of the License, or
1212
(at your option) any later version.
1313
14-
OpenFLUID is distributed in the hope that it will be useful,
14+
This part of MHYDAS is distributed in the hope that it will be useful,
1515
but WITHOUT ANY WARRANTY; without even the implied warranty of
1616
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1717
GNU General Public License for more details.
1818
1919
You should have received a copy of the GNU General Public License
20-
along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
20+
along with this part of MHYDAS. If not, see <http://www.gnu.org/licenses/>.
2121
2222
2323
== Other Usage ==
2424
25-
Other Usage means a use of OpenFLUID that is inconsistent with the GPL
25+
Other Usage means a use of MHYDAS that is inconsistent with the GPL
2626
license, and requires a written agreement between You and INRA.
27-
Licensees for Other Usage of OpenFLUID may use this file in accordance
27+
Licensees for Other Usage of MHYDAS may use this file in accordance
2828
with the terms contained in the written agreement between You and INRA.
29-
29+
3030
*/
3131

3232
/**
33-
@file WareMain.cpp
34-
35-
@author Armel THONI <armel.thoni@inra.fr>
33+
@file RainSUFromFilesSim.cpp
3634
*/
3735

3836

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
%Rain gauge assignment to SU
2+
% SU_ID PLUVIO_ID
3+
127 1
4+
132 1
5+
135 1
6+
198 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<openfluid format="fluidx 4">
3+
<domain>
4+
<definition>
5+
<unit class="SU" ID="127" pcsorder="1">
6+
<to class="SU" ID="132" />
7+
</unit>
8+
<unit class="SU" ID="132" pcsorder="2">
9+
<to class="SU" ID="135" />
10+
</unit>
11+
<unit class="SU" ID="135" pcsorder="3">
12+
</unit>
13+
<unit class="SU" ID="198" pcsorder="1">
14+
</unit>
15+
</definition>
16+
<attributes unitsclass="SU"
17+
colorder="Hc;Ks;area;betaMS;flowdist;nmanning;slope;thetaini;thetains;thetares;thetasat">
18+
127 0.1 1.29E-06 9768.027 1.3 107.798 0.05 0.02412 0.3 0.2 0.02 0.36
19+
132 0.1 1.24E-06 8125.666 1.3 60.184 0.05 0.02758 0.3 0.2 0.02 0.36
20+
135 0.1 9.54E-07 20948.193 1.3 44.529 0.05 0.01594 0.3 0.2 0.02 0.36
21+
198 0.1 2.19E-06 3836.352 1.3 33 0.05 0.01515 0.3 0.2 0.02 0.36
22+
</attributes>
23+
<calendar>
24+
</calendar>
25+
</domain>
26+
</openfluid>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<openfluid format="fluidx 4">
3+
<model>
4+
<simulator ID="water.atm-surf.rain-su.files" enabled="1">
5+
<param name="threshold" value="0.000005" />
6+
</simulator>
7+
</model>
8+
</openfluid>

0 commit comments

Comments
 (0)