vle-forge / irritator Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
How to develop HSM model and connect hsm-wrapper?
Currently, atomic model names are numbers. Would be better when givong a name to a model, irritator saves it in the irt files.
Hi
After a long pause in Using Irritator I came back to the latest version and installed it on windows quite easily and successfully.
However an assert instruction frequently kills the application when clearing (by clicking on "Clear" button) the simulation editor panel.
The line responsible for this is the commented one in :
template<typename Dynamics>
static void add_output_attribute(simulation_editor& ed,
const Dynamics& dyn) noexcept
{
if constexpr (is_detected_v<has_output_port_t, Dynamics>) {
const auto** names = get_output_port_names<Dynamics>();
const auto& mdl = get_model(dyn);
const auto mdl_id = ed.sim.models.get_id(mdl);
sz i = 0;
for ([[maybe_unused]] auto& elem : dyn.y) {
irt_assert(i < 8u);
//assert(ed.sim.models.try_to_get(mdl_id) == &mdl); //xxx Nedelec
ImNodes::BeginOutputAttribute(make_output_node_id(mdl_id, (int)i),
ImNodesPinShape_TriangleFilled);
ImGui::TextUnformatted(names[i]);
ImNodes::EndOutputAttribute();
++i;
}
}
}
[simulation-editor.cpp]
I couldn't identify a reason for these fatal errors nor any faulty order in instructions prior to its happening, it occurs after a while but sometimes quickly, sometimes after a few successful imports.
I commented the instruction but I guess it's not a good idea.
It does not change the simulation quality so i just report the situation.
Have a nice summer
Yves
Irritator crashes when I select QSS 2 lotka-volterra (right panel), then check observation boxes for X et Y (left panel), then select import model in the simulation tab.
Hereafter the back trace with gdb:
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff7a25537 in __GI_abort () at abort.c:79
#2 0x00007ffff7a2540f in __assert_fail_base (fmt=0x7ffff7b8e128 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x555555791b3f "obs",
file=0x5555557991e0 "/home/raph/vle/irritator/app/gui/simulation-component.cpp", line=269, function=) at assert.c:92
#3 0x00007ffff7a34662 in __GI___assert_fail (assertion=0x555555791b3f "obs", file=0x5555557991e0 "/home/raph/vle/irritator/app/gui/simulation-component.cpp",
line=269, function=0x555555799368 "irt::status irt::simulation_init_observation(irt::simulation_editor&, irt::tree_node&, irt::component&)")
at assert.c:101
#4 0x000055555566d64c in irt::simulation_init_observation(irt::simulation_editor&, irt::tree_node&, irt::component&) ()
#5 0x000055555566d8bc in irt::simulation_init_observation(irt::component_editor&, irt::simulation_editor&, irt::tree_node&) ()
#6 0x000055555566dcbe in irt::simulation_copy(irt::component_editor&, irt::simulation_editor&) ()
#7 0x000055555566e0f8 in irt::simulation_copy_impl(void*) ()
#8 0x000055555556c867 in irt::worker::run() ()
#9 0x000055555559bf65 in void std::__invoke_impl<void, void (irt::worker::)() noexcept, irt::worker>(std::__invoke_memfun_deref, void (irt::worker::&&)() noexcept, irt::worker&&) ()
#10 0x000055555559bd8d in std::__invoke_result<void (irt::worker::)() noexcept, irt::worker>::type std::__invoke<void (irt::worker::)() noexcept, irt::worker>(void (irt::worker::&&)() noexcept, irt::worker&&) ()
#11 0x000055555559bca3 in void std::thread::_Invoker<std::tuple<void (irt::worker::)() noexcept, irt::worker> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) ()
#12 0x000055555559bb3c in std::thread::_Invoker<std::tuple<void (irt::worker::)() noexcept, irt::worker> >::operator()() ()
#13 0x000055555559b6b0 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (irt::worker::)() noexcept, irt::worker> > >::_M_run() ()
#14 0x00007ffff7df3ed0 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#15 0x00007ffff7f26ea7 in start_thread (arg=) at pthread_create.c:477
#16 0x00007ffff7afddef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
It would be useful to have observations that combine observations on several
component instances. For example, on a grid, an observation that combines the
values of the same QSS integrators of each cell (sum of prey and predator for
lotka volterra).
Can not observe simulation results in output editor window.
Actions : Select lotka-volterra QSS2, check observation for X variable, import model in simulation tab -> crash
(gdb) bt
#0 0x00007ffff7a46a7c in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff79f2476 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff79d87f3 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff79d871b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x00007ffff79e9e96 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#5 0x000055555568447c in irt::simulation_init_observation(irt::simulation_editor&, irt::tree_node&, irt::component&) ()
#6 0x0000555555684745 in irt::simulation_init_observation(irt::component_editor&, irt::simulation_editor&, irt::tree_node&) ()
#7 0x0000555555684b7c in irt::simulation_copy(irt::component_editor&, irt::simulation_editor&) ()
#8 0x000055555568500b in irt::simulation_copy_impl(void*) ()
#9 0x000055555556dbc1 in irt::worker::run() ()
#10 0x00005555555a25b9 in void std::__invoke_impl<void, void (irt::worker::)() noexcept, irt::worker>(std::__invoke_memfun_deref, void (irt::worker::&&)() noexcept, irt::worker&&) ()
#11 0x00005555555a2375 in std::__invoke_result<void (irt::worker::)() noexcept, irt::worker>::type std::__invoke<void (irt::worker::)() noexcept, irt::worker>(void (irt::worker::&&)() noexcept, irt::worker&&) ()
#12 0x00005555555a2273 in void std::thread::_Invoker<std::tuple<void (irt::worker::)() noexcept, irt::worker> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>)
()
#13 0x00005555555a20f4 in std::thread::_Invoker<std::tuple<void (irt::worker::)() noexcept, irt::worker> >::operator()() ()
#14 0x00005555555a1c50 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (irt::worker::)() noexcept, irt::worker> > >::_M_run() ()
#15 0x00007ffff7dbd2c3 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#16 0x00007ffff7a44b43 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#17 0x00007ffff7ad6a00 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
May be in the right part of the node-editor?
May be a new documentation.cpp
Selecting either QSS1 QSS2 or QSS3 SEIR model crashes irrotator after one left mouse click in the editor window.
In the three cases, a QSS2 power model is visible.
Allocator: can fail (or stop application)
We known the type of output/input for each ports. So we can provide a constant
expression is-compatible port for each model.
enum class value_port_type : i8 {
continuous,
discrete,
both
};
class counter {
input_port x[1];
constexpr value_port_type x_type(int i) noexcept
{
return value_port_type::both;
}
};
class abstract_cross{
input_port x[4];
output_port y[3];
constexpr value_port_type x_type(int i) noexcept
{
return value_port_type::both;
}
constexpr value_port_type y_type(int i) noexcept
{
if (i == 0 || i == 1)
return value_port_type::continuous;
else
return value_port_type::discrete;
}
};
To simplify code in containers:
We must use all derivative value from qss 1, 2 or 3 to produce better output in file ans plot.
Irritator crashes after the following actions:
gdb backtrace:
#0 0x00007ffff7a46a7c in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff79f2476 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff79d87f3 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff79d871b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x00007ffff79e9e96 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#5 0x0000555555b8e74a in ImGui::ErrorCheckEndFrameSanityChecks() ()
#6 0x0000555555b8244f in ImGui::EndFrame() ()
#7 0x0000555555b828b0 in ImGui::Render() ()
#8 0x0000555555c34322 in main ()
Since generator have time
and value
external sources, flow model can be removed.
After unchecking the box "lock windows" in the "view" menu, irritator crashes if we try to resize main or components list window.
(gdb) bt
#0 0x00007ffff7a46a7c in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff79f2476 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff79d87f3 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff79d871b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x00007ffff79e9e96 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#5 0x00005555556ebe0c in ImGui::ErrorCheckEndFrameSanityChecks() ()
#6 0x00005555556dfb11 in ImGui::EndFrame() ()
#7 0x00005555556dff72 in ImGui::Render() ()
#8 0x000055555579217d in main ()
(gdb) cont
Program terminated with signal SIGABRT, Aborted.
Hi
sort and other file dialog functions use the is_directory function which raises an error when touching pagefile.sys, hiberfil.sys...
Therefore disk C:\ cannot be a starting point for exploration in file select dialog (windows version).
I fixed it with a special sort fonction (9 cases instead of 4) but total fixing needs a modification of all the dialog functions which call is_directory.
The sort function in dialog-file.cpp becomes :
void sort() // Nedelec
{
std::sort(std::begin(paths),
std::end(paths),
[](const auto& lhs, const auto& rhs) {
std::string slhs = lhs.filename().string();
std::string srhs = rhs.filename().string();
if (slhs.find(".sys") == -1) {
if (std::filesystem::is_directory(lhs)) {
if (srhs.find(".sys") == -1) {
if (std::filesystem::is_directory(rhs))
return lhs.filename() < rhs.filename();
else
return true;
} else {
return true;
}
} else {
if (srhs.find(".sys") == -1) {
if (std::filesystem::is_directory(rhs))
return false;
else
return lhs.filename() < rhs.filename();
} else {
return lhs.filename() < rhs.filename();
}
}
} else {
if (srhs.find(".sys") == -1) {
if (std::filesystem::is_directory(rhs))
return false;
else
return lhs.filename() < rhs.filename();
} else {
return lhs.filename() < rhs.filename();
}
}
});
}
I didn't find a solution to avoid this error, maybe a function different from is_directory, or a modified one...
To remove the call to strlen, we need to provide an ImGui Callback function to get the BufTextLen variable.
Adding a flow or a filter model in the editor cause a core dumped.
While adding a "filter" model, I got this from gdb:
Thread 1 "irritator-0.1" received signal SIGTRAP, Trace/breakpoint trap. 0x00005555555692e4 in irt::flow::initialize() ()
It seems it is a wrong function call.
While adding a "flow" model, I got exactly the same message from gdb.
Hi
My version of irritator is recent (2 days) and installed on windows 10
After having selected output directory (D:\irritator in my case, D: being the installation disk, changing output location on C: crashes anyway) the simulation does nothing when components should observe in files (third radiobutton selected).
I can't get any file in the selected directory at the end of simulation.
Could it be due to dos directory names with \ ?
Thanks for any clue
Yves
abandon (core dumped) when clicking on +hsm -> log
Right after launching irritator, adding a "flow" model in the editor window (right clic) cause a crash.
To simplify grid/graph component development (avoid duplicated component) we
can improve the contant
model. Instead of user real value assignation at
begin of the simulation or at the construction of the model, we can provide
more general value.
For example, at modeling level, a pair of real:
At simulation level, only:
This feature need a new algorithm in modeling-to-simulation algorithm
(project::set
).
Hi,
I'm testing a simple model d2x/dt2 - x = 0 which produces sin and cos output.
irt file :
4
0 qss1_integrator 0 0.001
1 qss1_integrator 1 0.001
2 qss1_multiplier
3 constant -1
0 0 1 0
1 0 2 0
2 0 0 0
3 0 2 1
When a file output is selected for both integrators the files are written only at first run. It is necessary to select something else (None or plot) and then select back file to get updated files after a new run (in my case following a change in reset value).
Position of models in the editor window are not saved when clicking on "file->save" in the editor menu. They are correctly saved clicking on "menu->save as..." and using a new file name.
Having simulation control and plotting in one window, and log and modelling frames in another would enable to perform participatory modelling and simulation easier, by displaying both activities on different screens for instance.
Move all simulation/execution variables into hsm_wrapper
:
hierarchical_state_machine
class in show_dynamics_inputs
hsm_wrapper
can use the same hierarchical_state_machine
The QSS1 SEIR Model doesn't exhibit the right behavior. It shows an exponential growth which is unexpected. Hereafter is a screenshot of what should be the results (using QSS2).
I copy the irt source file for you to check :
0
0
0
0
33
0 0.0 0.0 qss2_integrator 999 0.01
1 0.0 0.0 qss2_integrator 1 0.01
2 0.0 0.0 qss2_integrator 1 0.01
3 0.0 0.0 qss2_integrator 0 0.01
4 0.0 0.0 constant 16.667
5 0.0 0.0 qss2_sum_2
6 0.0 0.0 qss2_multiplier
7 0.0 0.0 qss1_multiplier
8 0.0 0.0 constant 0.001
9 0.0 0.0 constant 1
10 0.0 0.0 qss2_multiplier
11 0.0 0.0 qss2_multiplier
12 0.0 0.0 constant 0.3
13 0.0 0.0 qss2_multiplier
14 0.0 0.0 constant -1
15 0.0 0.0 qss2_multiplier
16 0.0 0.0 constant -0.01667
17 0.0 0.0 qss2_sum_2
18 0.0 0.0 qss2_multiplier
19 0.0 0.0 constant 0.1
20 0.0 0.0 qss2_multiplier
21 0.0 0.0 constant -1
22 0.0 0.0 qss2_sum_2
23 0.0 0.0 qss2_sum_2
24 0.0 0.0 qss1_sum_2
25 0.0 0.0 qss2_multiplier
26 0.0 0.0 constant 0.1
27 0.0 0.0 qss2_multiplier
28 0.0 0.0 constant -1
29 0.0 0.0 qss2_multiplier
30 0.0 0.0 qss2_sum_2
31 0.0 0.0 qss2_multiplier
32 0.0 0.0 qss2_sum_2
0 0 15 0
0 0 6 0
1 0 18 0
1 0 6 1
2 0 29 1
2 0 25 0
3 0 31 0
4 0 5 1
5 0 17 1
6 0 7 0
7 0 10 0
8 0 7 1
9 0 10 1
10 0 11 0
11 0 23 1
11 0 13 0
12 0 11 1
13 0 5 0
14 0 13 1
15 0 17 0
16 0 31 1
16 0 29 0
16 0 15 1
17 0 0 0
18 0 24 0
18 0 20 0
19 0 18 1
20 0 22 1
21 0 20 1
22 0 23 0
23 0 1 0
24 0 2 0
25 0 32 0
25 0 27 0
26 0 25 1
27 0 30 0
28 0 27 1
29 0 30 1
30 0 24 1
31 0 32 1
32 0 3 0
warning: format specifies type 'unsigned long long' but the argument has type 'irt::cluster*'
[-Wformat] log_w.log(7, "delete group %" PRIu64 "\n", gp);
In menu View
, Fix window layout
disable, Merge main editors
disable, the
Components list
and Observation
flick when simulation
or modeling
editors are selected.
May be use ImGui::TabBar and multiple windows.
I had to multiply ball location by -1 to compare with threshold, the computation session launched by "Simulation run one" automatically selects "Up detection" (a bug ?)
Originally posted by @ynedelec3 in #25 (comment)
On ubuntu (16.04 and 20.04) libglew2 has not been bound but the install works without this requirement.
The qss[1-3] [negative-]lif
internal components fail to produce observation.
Need to remove this warnings about unused variables. Maybe define C variable to
improve code?
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_C_COMPILER
WITH_FULL_OPTIMIZATION
Hi,
with the following irt file :
4
0 qss1_integrator 0 0.01
1 qss1_integrator 1 0.01
2 qss1_multiplier
3 constant -1
0 0 1 0
1 0 2 0
2 0 0 0
3 0 2 1
and a simulation duration of 40.
output files end with incomplete data (observed value is missing, sometimes there is just ",-" as second data) :
39.39542200587955,-0.12
39.403486522008585,-0.13
39.41155103813762,-0.14
39.41961555426665,-0.15
39.42768007
and
39.322841360718265,-1.2478225
39.3309058768473,-1.2475806
39.33897039297633,-1.2472581
39.34703490910536,-1.2468548
39.35509942523439,-1.2463709
39.363163941363
when run should end at 40.0
39.99365467195294,-0.76860154
39.994954484185236,-0.7678392
39.99625576205632,-0.76707226
39.99755851445617,-0.7663007
39.998862750304426,-0.76552445
39.99998064193025,-0.7642376
and
39.994954484185236,-0.6796578
39.99625576205632,-0.6805243
39.99755851445617,-0.6813941
39.998862750304426,-0.68226725
39.99998064193025,-0.68371147
The modeling API (variable-observer
, grid-observer
, graph-observer
) stores irt::small_string
name. To optimize memory model/use, remove name from irt::observer
.
I built a SIR epidemiological model using the graphical interface. Everything looked good, I could simulate my model. I decided to save what I have done in a .irt file. I quit irritator and then try to reopen my file, but it crashed. I opened my .irt file to change the names of my models, suspecting that models with the same names (automatically generated by the GUI) could be the origin of the crash. Unfortunately changing the names does not fix the problem.
Hereafter are the two files I tried to open.
--------
File 2:
--------
8
0 qss2_i qss2_integrator 0.9 0.0001
1 qss2_m qss2_multiplier
2 qss2_i qss2_integrator 0.1 0.0001
3 qss2_w qss2_wsum_2 -0.1 0
4 qss2_w qss2_wsum_2 0.1 0
5 qss2_i qss2_integrator 0 0.0001
6 qss2_w qss2_wsum_2 -0.01 1
7 qss2_w qss2_wsum_2 0.01 0
0 0 3 1
0 0 1 1
1 0 4 0
1 0 3 0
2 0 7 0
2 0 6 0
2 0 4 1
2 0 1 0
3 0 0 0
4 0 6 1
5 0 7 1
6 0 2 0
7 0 5 0
--------
File 2:
--------
8
0 Suceptible qss2_integrator 0.9 0.0001
1 S_multi qss2_multiplier
2 Infectious qss2_integrator 0.1 0.0001
3 I_sum_1 qss2_wsum_2 -0.1 0
4 I_sum_2 qss2_wsum_2 0.1 0
5 Recovered qss2_integrator 0 0.0001
6 R_sum_1 qss2_wsum_2 -0.01 1
7 R_Sum_2 qss2_wsum_2 0.01 0
0 0 3 1
0 0 1 1
1 0 4 0
1 0 3 0
2 0 7 0
2 0 6 0
2 0 4 1
2 0 1 0
3 0 0 0
4 0 6 1
5 0 7 1
6 0 2 0
7 0 5 0
Irritator crashes when I tried to change the "reset" parameter for a QSS2 integrator in the modelling tab.
Hereafter the gdb bt;
#0 0x00007ffff7a46a7c in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff79f2476 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff79d87f3 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff79d871b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x00007ffff79e9e96 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#5 0x0000555555b835ba in ImGui::GetKeyData(int) ()
#6 0x0000555555b838ba in ImGui::IsKeyReleased(int) ()
#7 0x0000555555aa3410 in irt::show_modeling_widget(irt::settings_manager const&, irt::component_editor&, irt::tree_node&, irt::component&) ()
#8 0x0000555555aa3678 in irt::application::show_modeling_editor_widget() ()
#9 0x0000555555571328 in irt::application::show_main_as_tabbar(ImVec2, ImVec2, int, int, int) ()
#10 0x0000555555570e1a in irt::application_show_windows(irt::application&) ()
#11 0x0000555555571013 in irt::application::show() ()
#12 0x0000555555c2fce5 in main ()
It would be nice to see node number on editor graphics too (on header near the type for example)
irritator/app/gui/node-editor.cpp:790:30: warning: operator '?:' has lower precedence than '+'; '+' will be evaluated first
+[-Wparentheses]
line + (remaining > 0) ? settings.automatic_layout_y_distance : 0.f;
~~~~~~~~~~~~~~~~~~~~~~ ^
irritator/app/gui/node-editor.cpp:790:30: note: place parentheses around the '+' expression to silence this warning
line + (remaining > 0) ? settings.automatic_layout_y_distance : 0.f;
^
( )
irritator/app/gui/node-editor.cpp:790:30: note: place parentheses around the '?:' expression to evaluate it first
line + (remaining > 0) ? settings.automatic_layout_y_distance : 0.f;
A component stores models and provides public "API": input and output ports and observable.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.