pyBondGraph 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/
@@ -0,0 +1,170 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyBondGraph
3
+ Version: 0.1.0
4
+ Summary: Modelling tool for linear bond graph systems in Python
5
+ Author-email: Matthias Panny <matthias.panny@mci.edu>
6
+ License-Expression: CC-BY-NC-SA-4.0
7
+ Project-URL: Homepage, https://github.com/MrP123/pyBondGraph
8
+ Project-URL: Issues, https://github.com/MrP123/pyBondGraph/issues
9
+ Classifier: Programming Language :: Python :: 3.13
10
+ Classifier: Programming Language :: Python :: 3.14
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Topic :: Scientific/Engineering
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Requires-Python: >=3.13
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: sympy>=1.14.0
18
+ Requires-Dist: networkx>=3.5
19
+ Requires-Dist: numpy>=2.3.0
20
+ Requires-Dist: matplotlib>=3.10.3
21
+ Requires-Dist: control>=0.10.2
22
+ Provides-Extra: streamlit
23
+ Requires-Dist: streamlit>=1.47.0; extra == "streamlit"
24
+ Requires-Dist: streamlit-flow-component>=1.6.1; extra == "streamlit"
25
+ Dynamic: license-file
26
+
27
+ # pyBondGraph
28
+ **pyBondGraph** is a Python library for **modeling and analyzing linear bond graph systems** using symbolic computation.
29
+
30
+ The library allows users to construct bond graph models programmatically, automatically derive the governing equations, and analyze the resulting dynamic systems using tools from control theory.
31
+
32
+ Bond graphs provide a **domain-independent modeling framework** for physical systems. Using a unified representation of power exchange, the same modeling approach can be used for electrical, mechanical, hydraulic, and multi-domain systems.
33
+
34
+ ---
35
+
36
+ # Features
37
+
38
+ * Programmatic construction of **bond graph models**
39
+ * Automatic **symbolic equation derivation** using SymPy
40
+ * Conversion of models to **state-space systems**
41
+ * Example models for electrical and mechanical systems
42
+
43
+ ---
44
+
45
+ # Installation
46
+
47
+ ## Install directly from GitHub
48
+ The easiest way to install the library is directly via pip:
49
+ ```bash
50
+ pip install git+https://github.com/MrP123/pyBondGraph.git
51
+ ```
52
+ This installs the latest version of the package from the repository.
53
+
54
+ ---
55
+
56
+ ## Development installation
57
+ To work with the source code:
58
+ ```bash
59
+ git clone https://github.com/MrP123/pyBondGraph.git
60
+ cd pyBondGraph
61
+ pip install -e .
62
+ ```
63
+
64
+ ---
65
+
66
+ # Dependencies
67
+
68
+ The main dependencies are:
69
+
70
+ * `sympy`
71
+ * `numpy`
72
+ * `networkx`
73
+ * `matplotlib`
74
+ * `control` only needed for the examples
75
+
76
+ Optional dependencies are used for experimental visualization tools.
77
+
78
+ ---
79
+
80
+ # Basic Usage
81
+ A bond graph model is constructed by creating elements and connecting them via bonds.
82
+
83
+ Simple RC-Filter circuit:
84
+
85
+ ```python
86
+ from pyBondGraph import BondGraph, SourceEffort, Resistor, Capacitor, OneJunction, Bond, Causality
87
+
88
+ bg = BondGraph()
89
+
90
+ # create elements
91
+ voltage_source = SourceEffort("U", "u_in")
92
+ resistor = Resistor("R", "R")
93
+ capacitor = Capacitor("C", "C")
94
+ series_junction = OneJunction("J1")
95
+
96
+ # connect elements
97
+ # causalities need to be assigned manually
98
+ bg.add_bond(Bond(voltage_source, series_junction, Causality.EFFORT_OUT))
99
+ bg.add_bond(Bond(series_junction, resistor, Causality.EFFORT_OUT))
100
+ bg.add_bond(Bond(series_junction, capacitor, Causality.FLOW_OUT))
101
+
102
+ # plot the resulting BondGraph
103
+ bg.plot()
104
+
105
+ # derive system equations in linear state space form
106
+ A, B, C, D, x, n_states, n_inputs, n_outputs = bond_graph.get_state_space()
107
+ ```
108
+
109
+ The library automatically derives the **symbolic system equations** describing the dynamics of the model.
110
+
111
+ ---
112
+
113
+
114
+ # Core Concepts
115
+ Bond graphs represent **power exchange between system components**, where power is the product of **effort** and **flow** associated with the following components:
116
+
117
+ ## Elements
118
+ | Element | Meaning |
119
+ |---------|------------------------------------------|
120
+ | R | Dissipation |
121
+ | C | Energy storage (compliance, capacitance) |
122
+ | I | Energy storage (inertia, inductance) |
123
+ | Se | Effort source |
124
+ | Sf | Flow source |
125
+
126
+ ## Junctions
127
+ | Junction | Meaning |
128
+ |----------|---------------|
129
+ | 0 | Common effort |
130
+ | 1 | Common flow |
131
+
132
+ ## Sensors
133
+ | Sensor | Meaning |
134
+ |------------------------|---------------------------------------------|
135
+ | IntegratedEffortSensor | Measures integral of the effort at its bond |
136
+ | IntegratedFlowSensor | Measures integral of the flow at its bond |
137
+
138
+ In mechanical bond graph models:
139
+ * **flow** corresponds to **velocity**
140
+ * **effort** corresponds to **force**
141
+
142
+ An **integrated flow sensor** can therefore be used to compute **position**:
143
+
144
+ ---
145
+
146
+ # Example Systems
147
+ The repository contains example models illustrating typical applications of bond graphs.
148
+
149
+ ### RLC Circuit
150
+ Demonstrates modeling of an electrical circuit using bond graph elements.
151
+
152
+ ### DC Motor
153
+ A multi-domain electromechanical system coupling electrical and mechanical dynamics.
154
+
155
+ ### Transformer
156
+ Example of energy transformation between two ports.
157
+
158
+ ### Two DOF Mass–Spring–Damper System
159
+ Classical mass-spring-damper system with two degrees of freedom.
160
+
161
+ ---
162
+
163
+ # Typical Applications
164
+ Bond graph modeling is particularly useful for:
165
+
166
+ * electromechanical systems
167
+ * robotics and mechatronics
168
+ * multi-domain energy systems
169
+ * control system modeling
170
+ * teaching system dynamics
@@ -0,0 +1,144 @@
1
+ # pyBondGraph
2
+ **pyBondGraph** is a Python library for **modeling and analyzing linear bond graph systems** using symbolic computation.
3
+
4
+ The library allows users to construct bond graph models programmatically, automatically derive the governing equations, and analyze the resulting dynamic systems using tools from control theory.
5
+
6
+ Bond graphs provide a **domain-independent modeling framework** for physical systems. Using a unified representation of power exchange, the same modeling approach can be used for electrical, mechanical, hydraulic, and multi-domain systems.
7
+
8
+ ---
9
+
10
+ # Features
11
+
12
+ * Programmatic construction of **bond graph models**
13
+ * Automatic **symbolic equation derivation** using SymPy
14
+ * Conversion of models to **state-space systems**
15
+ * Example models for electrical and mechanical systems
16
+
17
+ ---
18
+
19
+ # Installation
20
+
21
+ ## Install directly from GitHub
22
+ The easiest way to install the library is directly via pip:
23
+ ```bash
24
+ pip install git+https://github.com/MrP123/pyBondGraph.git
25
+ ```
26
+ This installs the latest version of the package from the repository.
27
+
28
+ ---
29
+
30
+ ## Development installation
31
+ To work with the source code:
32
+ ```bash
33
+ git clone https://github.com/MrP123/pyBondGraph.git
34
+ cd pyBondGraph
35
+ pip install -e .
36
+ ```
37
+
38
+ ---
39
+
40
+ # Dependencies
41
+
42
+ The main dependencies are:
43
+
44
+ * `sympy`
45
+ * `numpy`
46
+ * `networkx`
47
+ * `matplotlib`
48
+ * `control` only needed for the examples
49
+
50
+ Optional dependencies are used for experimental visualization tools.
51
+
52
+ ---
53
+
54
+ # Basic Usage
55
+ A bond graph model is constructed by creating elements and connecting them via bonds.
56
+
57
+ Simple RC-Filter circuit:
58
+
59
+ ```python
60
+ from pyBondGraph import BondGraph, SourceEffort, Resistor, Capacitor, OneJunction, Bond, Causality
61
+
62
+ bg = BondGraph()
63
+
64
+ # create elements
65
+ voltage_source = SourceEffort("U", "u_in")
66
+ resistor = Resistor("R", "R")
67
+ capacitor = Capacitor("C", "C")
68
+ series_junction = OneJunction("J1")
69
+
70
+ # connect elements
71
+ # causalities need to be assigned manually
72
+ bg.add_bond(Bond(voltage_source, series_junction, Causality.EFFORT_OUT))
73
+ bg.add_bond(Bond(series_junction, resistor, Causality.EFFORT_OUT))
74
+ bg.add_bond(Bond(series_junction, capacitor, Causality.FLOW_OUT))
75
+
76
+ # plot the resulting BondGraph
77
+ bg.plot()
78
+
79
+ # derive system equations in linear state space form
80
+ A, B, C, D, x, n_states, n_inputs, n_outputs = bond_graph.get_state_space()
81
+ ```
82
+
83
+ The library automatically derives the **symbolic system equations** describing the dynamics of the model.
84
+
85
+ ---
86
+
87
+
88
+ # Core Concepts
89
+ Bond graphs represent **power exchange between system components**, where power is the product of **effort** and **flow** associated with the following components:
90
+
91
+ ## Elements
92
+ | Element | Meaning |
93
+ |---------|------------------------------------------|
94
+ | R | Dissipation |
95
+ | C | Energy storage (compliance, capacitance) |
96
+ | I | Energy storage (inertia, inductance) |
97
+ | Se | Effort source |
98
+ | Sf | Flow source |
99
+
100
+ ## Junctions
101
+ | Junction | Meaning |
102
+ |----------|---------------|
103
+ | 0 | Common effort |
104
+ | 1 | Common flow |
105
+
106
+ ## Sensors
107
+ | Sensor | Meaning |
108
+ |------------------------|---------------------------------------------|
109
+ | IntegratedEffortSensor | Measures integral of the effort at its bond |
110
+ | IntegratedFlowSensor | Measures integral of the flow at its bond |
111
+
112
+ In mechanical bond graph models:
113
+ * **flow** corresponds to **velocity**
114
+ * **effort** corresponds to **force**
115
+
116
+ An **integrated flow sensor** can therefore be used to compute **position**:
117
+
118
+ ---
119
+
120
+ # Example Systems
121
+ The repository contains example models illustrating typical applications of bond graphs.
122
+
123
+ ### RLC Circuit
124
+ Demonstrates modeling of an electrical circuit using bond graph elements.
125
+
126
+ ### DC Motor
127
+ A multi-domain electromechanical system coupling electrical and mechanical dynamics.
128
+
129
+ ### Transformer
130
+ Example of energy transformation between two ports.
131
+
132
+ ### Two DOF Mass–Spring–Damper System
133
+ Classical mass-spring-damper system with two degrees of freedom.
134
+
135
+ ---
136
+
137
+ # Typical Applications
138
+ Bond graph modeling is particularly useful for:
139
+
140
+ * electromechanical systems
141
+ * robotics and mechatronics
142
+ * multi-domain energy systems
143
+ * control system modeling
144
+ * teaching system dynamics
@@ -0,0 +1,38 @@
1
+ from .core import Bond, Causality
2
+ from .elements import (
3
+ SourceEffort,
4
+ SourceFlow,
5
+ OneJunction,
6
+ ZeroJunction,
7
+ Capacitor,
8
+ Compliance,
9
+ Inductor,
10
+ Inertance,
11
+ Resistor,
12
+ Resistance,
13
+ Transformer,
14
+ Gyrator,
15
+ )
16
+ from .sensors import IntegratedEffortSensor, IntegratedFlowSensor
17
+
18
+ from .bondgraph import BondGraph
19
+
20
+ __all__ = [
21
+ "Bond",
22
+ "Causality",
23
+ "SourceEffort",
24
+ "SourceFlow",
25
+ "OneJunction",
26
+ "ZeroJunction",
27
+ "Capacitor",
28
+ "Compliance",
29
+ "Inductor",
30
+ "Inertance",
31
+ "Resistor",
32
+ "Resistance",
33
+ "Transformer",
34
+ "Gyrator",
35
+ "BondGraph",
36
+ "IntegratedEffortSensor",
37
+ "IntegratedFlowSensor",
38
+ ]