Skip to content

Commit a9dc1f7

Browse files
fix stick slip demo + update in Readme
1 parent f6e0ac3 commit a9dc1f7

File tree

2 files changed

+39
-28
lines changed

2 files changed

+39
-28
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ pathview/
1919

2020
│ ├── backend.py # Python backend API
2121

22+
│ ├── components/ # JSx components
23+
24+
│ ├── python/ # python package source
25+
26+
│ ├── main.jsx
27+
28+
│ ├── App.jsx # main App
29+
30+
│ ├── nodeConfig.js # file to configure all the nodes
31+
2232
```
2333

2434
# Installation and Setup

example_graphs/stick_slip.json

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": {
33
"pathsim_version": "0.8.2",
4-
"pathview_version": "0.1.dev470+g017515800.d20250812"
4+
"pathview_version": "0.2.dev12+gf6e0ac326"
55
},
66
"nodes": [
77
{
@@ -142,8 +142,8 @@
142142
"id": "11",
143143
"type": "function",
144144
"position": {
145-
"x": -54.52837524178651,
146-
"y": 186.62617481093713
145+
"x": 124.20448463464157,
146+
"y": 166.46144190180163
147147
},
148148
"data": {
149149
"label": "Function",
@@ -163,8 +163,8 @@
163163
"id": "12",
164164
"type": "source",
165165
"position": {
166-
"x": -257.2259405285811,
167-
"y": 57.613473116620824
166+
"x": -267.3083069831488,
167+
"y": 56.69689434802376
168168
},
169169
"data": {
170170
"label": "source",
@@ -417,11 +417,11 @@
417417
"selected": false
418418
},
419419
{
420-
"id": "e10-4-to_target-0",
421-
"source": "10",
422-
"target": "4",
420+
"id": "e4-5",
421+
"source": "4",
422+
"target": "5",
423423
"sourceHandle": null,
424-
"targetHandle": "target-0",
424+
"targetHandle": null,
425425
"type": "smoothstep",
426426
"data": {},
427427
"style": {
@@ -436,11 +436,11 @@
436436
}
437437
},
438438
{
439-
"id": "e12-4-to_target-1",
440-
"source": "12",
441-
"target": "4",
439+
"id": "e4-6",
440+
"source": "4",
441+
"target": "6",
442442
"sourceHandle": null,
443-
"targetHandle": "target-1",
443+
"targetHandle": null,
444444
"type": "smoothstep",
445445
"data": {},
446446
"style": {
@@ -452,12 +452,13 @@
452452
"width": 20,
453453
"height": 20,
454454
"color": "#ECDFCC"
455-
}
455+
},
456+
"selected": false
456457
},
457458
{
458-
"id": "e4-5",
459+
"id": "e4-19",
459460
"source": "4",
460-
"target": "5",
461+
"target": "19",
461462
"sourceHandle": null,
462463
"targetHandle": null,
463464
"type": "smoothstep",
@@ -474,11 +475,11 @@
474475
}
475476
},
476477
{
477-
"id": "e4-6",
478-
"source": "4",
479-
"target": "6",
478+
"id": "e10-4-to_target-1",
479+
"source": "10",
480+
"target": "4",
480481
"sourceHandle": null,
481-
"targetHandle": null,
482+
"targetHandle": "target-1",
482483
"type": "smoothstep",
483484
"data": {},
484485
"style": {
@@ -493,11 +494,11 @@
493494
}
494495
},
495496
{
496-
"id": "e4-19",
497-
"source": "4",
498-
"target": "19",
497+
"id": "e10-11-to_target-0",
498+
"source": "10",
499+
"target": "11",
499500
"sourceHandle": null,
500-
"targetHandle": null,
501+
"targetHandle": "target-0",
501502
"type": "smoothstep",
502503
"data": {},
503504
"style": {
@@ -512,9 +513,9 @@
512513
}
513514
},
514515
{
515-
"id": "e4-11-to_target-0",
516-
"source": "4",
517-
"target": "11",
516+
"id": "e12-4-to_target-0",
517+
"source": "12",
518+
"target": "4",
518519
"sourceHandle": null,
519520
"targetHandle": "target-0",
520521
"type": "smoothstep",
@@ -581,5 +582,5 @@
581582
"id": 1755090603806
582583
}
583584
],
584-
"pythonCode": "import numpy as np\n#initial position and velocity\nx0, v0 = 0, 0\n\n#system parameters\nm = 20.0 # mass\nk = 70.0 # spring constant\nd = 10.0 # spring damping\nmu = 1.5 # friction coefficient\ng = 9.81 # gravity\nv = 3.0 # belt velocity magnitude\nT = 50.0 # excitation period\n\nF_c = mu * m * g # friction force\n\n#function for belt velocity\ndef v_belt(t):\n return v * np.sin(2*np.pi*t/T)\n\n#function for coulomb friction force\ndef f_coulomb(v, vb):\n return F_c * np.sign(vb - v)\n\ndef slip_to_stick_evt(t):\n _1, v_box , _2 = switch_4()\n _1, v_belt, _2 = source_12()\n dv = v_box - v_belt\n\n return dv\n\ndef slip_to_stick_act(t):\n\n #change switch state\n switch_4.state = 1\n\n integrator_1_10.off()\n function_11.off()\n\n E_slip_to_stick.off()\n E_stick_to_slip.on()\n\ndef stick_to_slip_evt(t):\n _1, F, _2 = add_8()\n return F_c - abs(F)\n\ndef stick_to_slip_act(t):\n\n #change switch state\n switch_4.state = 0\n\n integrator_1_10.on()\n function_11.on()\n\n #set integrator state\n _1, v_box , _2 = switch_4()\n integrator_1_10.engine.set(v_box)\n\n E_slip_to_stick.on()\n E_stick_to_slip.off()\n"
585+
"pythonCode": "import numpy as np\n#initial position and velocity\nx0, v0 = 0, 0\n\n#system parameters\nm = 20.0 # mass\nk = 70.0 # spring constant\nd = 10.0 # spring damping\nmu = 1.5 # friction coefficient\ng = 9.81 # gravity\nv = 3.0 # belt velocity magnitude\nT = 50.0 # excitation period\n\nF_c = mu * m * g # friction force\n\n#function for belt velocity\ndef v_belt(t):\n return v * np.sin(2*np.pi*t/T)\n\n#function for coulomb friction force\ndef f_coulomb(v, vb):\n return F_c * np.sign(vb - v)\n\ndef slip_to_stick_evt(t):\n _1, v_box , _2 = switch_4()\n _1, v_belt, _2 = source_12()\n dv = v_box - v_belt\n\n return dv\n\ndef slip_to_stick_act(t):\n\n #change switch state\n switch_4.select(0)\n\n integrator_1_10.off()\n function_11.off()\n\n E_slip_to_stick.off()\n E_stick_to_slip.on()\n\ndef stick_to_slip_evt(t):\n _1, F, _2 = add_8()\n return F_c - abs(F)\n\ndef stick_to_slip_act(t):\n\n #change switch state\n switch_4.select(1)\n\n integrator_1_10.on()\n function_11.on()\n\n #set integrator state\n _1, v_box , _2 = switch_4()\n integrator_1_10.engine.set(v_box)\n\n E_slip_to_stick.on()\n E_stick_to_slip.off()\n"
585586
}

0 commit comments

Comments
 (0)