1+ {
2+ "nodes" : [
3+ {
4+ "id" : " 0" ,
5+ "type" : " constant" ,
6+ "position" : {
7+ "x" : 219.5 ,
8+ "y" : 219.5
9+ },
10+ "data" : {
11+ "label" : " constant 0" ,
12+ "nodeColor" : " #DDE6ED" ,
13+ "value" : " -g"
14+ },
15+ "measured" : {
16+ "width" : 206 ,
17+ "height" : 54
18+ },
19+ "selected" : false ,
20+ "dragging" : false
21+ },
22+ {
23+ "id" : " 1" ,
24+ "type" : " integrator" ,
25+ "position" : {
26+ "x" : 367.8036110436579 ,
27+ "y" : 330.00000000000006
28+ },
29+ "data" : {
30+ "label" : " integrator_v" ,
31+ "nodeColor" : " #DDE6ED" ,
32+ "initial_value" : " v0" ,
33+ "reset_times" : " "
34+ },
35+ "measured" : {
36+ "width" : 200 ,
37+ "height" : 48
38+ },
39+ "selected" : false ,
40+ "dragging" : false
41+ },
42+ {
43+ "id" : " 2" ,
44+ "type" : " integrator" ,
45+ "position" : {
46+ "x" : 639.8036110436578 ,
47+ "y" : 322.00000000000006
48+ },
49+ "data" : {
50+ "label" : " integrator_x" ,
51+ "nodeColor" : " #DDE6ED" ,
52+ "initial_value" : " x0" ,
53+ "reset_times" : " "
54+ },
55+ "measured" : {
56+ "width" : 200 ,
57+ "height" : 48
58+ },
59+ "selected" : false ,
60+ "dragging" : false
61+ },
62+ {
63+ "id" : " 3" ,
64+ "type" : " scope" ,
65+ "position" : {
66+ "x" : 903.7342215603948 ,
67+ "y" : 264.84964717890483
68+ },
69+ "data" : {
70+ "label" : " scope 3" ,
71+ "nodeColor" : " #DDE6ED" ,
72+ "labels" : " " ,
73+ "sampling_rate" : " " ,
74+ "t_wait" : " "
75+ },
76+ "measured" : {
77+ "width" : 120 ,
78+ "height" : 140
79+ },
80+ "selected" : false ,
81+ "dragging" : false
82+ }
83+ ],
84+ "edges" : [
85+ {
86+ "id" : " e0-1" ,
87+ "source" : " 0" ,
88+ "target" : " 1" ,
89+ "sourceHandle" : null ,
90+ "targetHandle" : null ,
91+ "type" : " smoothstep" ,
92+ "data" : {},
93+ "style" : {
94+ "strokeWidth" : 2 ,
95+ "stroke" : " #ECDFCC"
96+ },
97+ "markerEnd" : {
98+ "type" : " arrowclosed" ,
99+ "width" : 20 ,
100+ "height" : 20 ,
101+ "color" : " #ECDFCC"
102+ }
103+ },
104+ {
105+ "id" : " e1-2" ,
106+ "source" : " 1" ,
107+ "target" : " 2" ,
108+ "sourceHandle" : null ,
109+ "targetHandle" : null ,
110+ "type" : " smoothstep" ,
111+ "data" : {},
112+ "style" : {
113+ "strokeWidth" : 2 ,
114+ "stroke" : " #ECDFCC"
115+ },
116+ "markerEnd" : {
117+ "type" : " arrowclosed" ,
118+ "width" : 20 ,
119+ "height" : 20 ,
120+ "color" : " #ECDFCC"
121+ }
122+ },
123+ {
124+ "id" : " e2-3" ,
125+ "source" : " 2" ,
126+ "target" : " 3" ,
127+ "sourceHandle" : null ,
128+ "targetHandle" : null ,
129+ "type" : " smoothstep" ,
130+ "data" : {},
131+ "style" : {
132+ "strokeWidth" : 2 ,
133+ "stroke" : " #ECDFCC"
134+ },
135+ "markerEnd" : {
136+ "type" : " arrowclosed" ,
137+ "width" : 20 ,
138+ "height" : 20 ,
139+ "color" : " #ECDFCC"
140+ }
141+ }
142+ ],
143+ "nodeCounter" : 4 ,
144+ "solverParams" : {
145+ "dt" : " 0.01" ,
146+ "dt_min" : " 1e-16" ,
147+ "dt_max" : " 0.04" ,
148+ "Solver" : " RKBS32" ,
149+ "tolerance_fpi" : " 1e-16" ,
150+ "iterations_max" : " 100" ,
151+ "log" : " true" ,
152+ "simulation_duration" : " 10" ,
153+ "extra_params" : " {\" tolerance_lte_rel\" : 1e-5, \" tolerance_lte_abs\" : 1e-7}"
154+ },
155+ "globalVariables" : [],
156+ "events" : [
157+ {
158+ "name" : " bounce" ,
159+ "type" : " ZeroCrossing" ,
160+ "func_evt" : " def func_evt(t):\n *_, x = integrator_x_2() #get block outputs and states\n return x" ,
161+ "func_act" : " def func_act(t):\n *_, x = integrator_x_2()\n *_, v = integrator_v_1()\n integrator_x_2.engine.set(abs(x))\n integrator_v_1.engine.set(-b*v)" ,
162+ "tolerance" : " 1e-8" ,
163+ "id" : 1755015764685
164+ }
165+ ],
166+ "pythonCode" : " #gravitational acceleration\n g = 9.81\n\n #elasticity of bounce\n b = 0.9\n\n #initial conditions\n x0, v0 = 1, 5"
167+ }
0 commit comments