Skip to content

Commit 27887ac

Browse files
authored
Merge branch 'main' into analysis_points
2 parents cfb5aea + a8bb688 commit 27887ac

File tree

18 files changed

+512
-73
lines changed

18 files changed

+512
-73
lines changed

.github/workflows/Documentation.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ jobs:
2121
env:
2222
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
2323
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
24-
run: julia --project=docs/ docs/make.jl
24+
run: julia --project=docs/ --code-coverage=user docs/make.jl
25+
- uses: julia-actions/julia-processcoverage@v1
26+
- uses: codecov/codecov-action@v1
27+
with:
28+
file: lcov.info
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Invalidations
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
# Skip intermediate builds: always.
8+
# Cancel intermediate builds: always.
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
evaluate:
14+
# Only run on PRs to the default branch.
15+
# In the PR trigger above branches can be specified only explicitly whereas this check should work for master, main, or any other default branch
16+
if: github.base_ref == github.event.repository.default_branch
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: julia-actions/setup-julia@v1
20+
with:
21+
version: '1'
22+
- uses: actions/checkout@v3
23+
- uses: julia-actions/julia-buildpkg@v1
24+
- uses: julia-actions/julia-invalidations@v1
25+
id: invs_pr
26+
27+
- uses: actions/checkout@v3
28+
with:
29+
ref: ${{ github.event.repository.default_branch }}
30+
- uses: julia-actions/julia-buildpkg@v1
31+
- uses: julia-actions/julia-invalidations@v1
32+
id: invs_default
33+
34+
- name: Report invalidation counts
35+
run: |
36+
echo "Invalidations on default branch: ${{ steps.invs_default.outputs.total }} (${{ steps.invs_default.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY
37+
echo "This branch: ${{ steps.invs_pr.outputs.total }} (${{ steps.invs_pr.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY
38+
- name: Check if the PR does increase number of invalidations
39+
if: steps.invs_pr.outputs.total > steps.invs_default.outputs.total
40+
run: exit 1

Project.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@ version = "1.5.0"
77
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"
88
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
99
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
10-
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
1110
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
1211

1312
[compat]
1413
IfElse = "0.1"
1514
ModelingToolkit = "8"
1615
OffsetArrays = "1"
17-
OrdinaryDiffEq = "5.56, 6"
18-
Symbolics = "0.1, 1, 2, 3, 4"
16+
Symbolics = "4.9"
1917
julia = "1.6"
2018

2119
[extras]
2220
ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e"
21+
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
2322
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
2423
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2524

2625
[targets]
27-
test = ["SafeTestsets", "Test", "ControlSystemsBase"]
26+
test = ["OrdinaryDiffEq", "SafeTestsets", "Test", "ControlSystemsBase"]

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# ModelingToolkitStandardLibrary.jl
22

3-
[![CI](https://github.com/SciML/ModelingToolkitStandardLibrary.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/SciML/ModelingToolkitStandardLibrary.jl/actions/workflows/CI.yml)
3+
[![Join the chat at https://julialang.zulipchat.com #sciml-bridged](https://img.shields.io/static/v1?label=Zulip&message=chat&color=9558b2&labelColor=389826)](https://julialang.zulipchat.com/#narrow/stream/279055-sciml-bridged)
44
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](http://mtkstdlib.sciml.ai/stable/)
5-
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](http://mtkstdlib.sciml.ai/dev/)
5+
[![Global Docs](https://img.shields.io/badge/docs-SciML-blue.svg)](https://docs.sciml.ai/dev/modules/ModelingToolkitStandardLibrary/)
6+
7+
[![codecov](https://codecov.io/gh/SciML/ModelingToolkitStandardLibrary.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/SciML/ModelingToolkitStandardLibrary.jl)
8+
[![Build Status](https://github.com/SciML/ModelingToolkitStandardLibrary.jl/workflows/CI/badge.svg)](https://github.com/SciML/ModelingToolkitStandardLibrary.jl/actions?query=workflow%3ACI)
9+
10+
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
11+
[![SciML Code Style](https://img.shields.io/static/v1?label=code%20style&message=SciML&color=9558b2&labelColor=389826)](https://github.com/SciML/SciMLStyle)
612

713
The ModelingToolkit Standard Library is a standard library of components to model the world and beyond.
814

docs/src/API/mechanical.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,21 @@ Inertia
3434
Spring
3535
Damper
3636
IdealGear
37+
RotationalFriction
3738
```
3839

3940
### Rotational Sources
4041

4142
```@docs
4243
Torque
43-
```
44+
Speed
45+
```
46+
47+
### Rotational Sensors
48+
49+
```@docs
50+
AngleSensor
51+
SpeedSensor
52+
TorqueSensor
53+
RelSpeedSensor
54+
```

docs/src/tutorials/custom_component.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ connections = [
9999
connect(Ro.n, Gnd.g)
100100
]
101101
102-
@named model = ODESystem(connections, t, systems=[L, Ro, G, C1, C2, Nr])
102+
@named model = ODESystem(connections, t, systems=[L, Ro, G, C1, C2, Nr, Gnd])
103103
nothing # hide
104104
```
105105

src/Blocks/Blocks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
The module `Blocks` contains common input-output components, referred to as blocks.
33
"""
44
module Blocks
5-
using ModelingToolkit, Symbolics, OrdinaryDiffEq
5+
using ModelingToolkit, Symbolics
66
using IfElse: ifelse
77

88
@parameters t

src/Blocks/continuous.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Critical damping corresponds to `d=1`, which yields the fastest step response wi
111111
112112
# Parameters:
113113
- `k`: Gain
114-
- `w`: Angular frequency
114+
- `w`: [`rad/s`] Angular frequency
115115
- `d`: Damping
116116
- `x_start`: Initial value of state (output)
117117
- `xd_start`: Initial value of derivative of state (output)
@@ -305,7 +305,7 @@ where the transfer function for the derivative includes additional filtering, se
305305
- `wd`: [0,1] Set-point weighting in the derivative part.
306306
- `Nd`: [1/s] Derivative limit, limits the derivative gain to Nd/Td. Reasonable values are ∈ [8, 20]. A higher value gives a better approximation of an ideal derivative at the expense of higher noise amplification.
307307
- `Ni`: `Ni*Ti` controls the time constant `Ta` of anti-windup tracking. A common (default) choice is `Ta = √(Ti*Td)` which is realized by `Ni = √(Td / Ti)`. Anti-windup can be effectively turned off by setting `Ni = Inf`.
308-
` `gains`: If `gains = true`, `Ti` and `Td` will be interpreted as gains with a fundamental PID transfer function on parallel form `ki=Ti, kd=Td, k + ki/s + kd*s`
308+
- `gains`: If `gains = true`, `Ti` and `Td` will be interpreted as gains with a fundamental PID transfer function on parallel form `ki=Ti, kd=Td, k + ki/s + kd*s`.
309309
310310
# Connectors:
311311
- `reference`
@@ -438,7 +438,7 @@ function StateSpace(; A, B, C, D = nothing, x_start = zeros(size(A, 1)), name)
438438
end
439439
@named input = RealInput(nin = nu)
440440
@named output = RealOutput(nout = ny)
441-
@variables x[1:nx](t) = x_start
441+
@variables x(t)[1:nx] = x_start
442442
# pars = @parameters A=A B=B C=C D=D # This is buggy
443443
eqs = [ # FIXME: if array equations work
444444
[Differential(t)(x[i]) ~ sum(A[i, k] * x[k] for k in 1:nx) +

src/Blocks/utils.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
if nin == 1
33
@variables u(t)=u_start [input = true]
44
else
5-
@variables u[1:nin](t)=u_start [input = true]
5+
@variables u(t)[1:nin]=u_start [input = true]
66
u = collect(u)
77
end
88
ODESystem(Equation[], t, [u...], []; name = name)
@@ -24,7 +24,7 @@ Connector with one input signal of type Real.
2424
if nout == 1
2525
@variables u(t)=u_start [output = true]
2626
else
27-
@variables u[1:nout](t)=u_start [output = true]
27+
@variables u(t)[1:nout]=u_start [output = true]
2828
u = collect(u)
2929
end
3030
ODESystem(Equation[], t, [u...], []; name = name)
@@ -45,7 +45,7 @@ Connector with one output signal of type Real.
4545
"""
4646
SISO(;name, u_start=0.0, y_start=0.0)
4747
48-
Single Input Single Output continuous control block.
48+
Single input single output (SISO) continuous system block.
4949
5050
# Parameters:
5151
- `u_start`: Initial value for the input
@@ -66,7 +66,7 @@ end
6666
"""
6767
MIMO(;name, nin=1, nout=1, u_start=zeros(nin), y_start=zeros(nout))
6868
69-
Base class for a multiple Input multiple Output continuous control block.
69+
Base class for a multiple input multiple output (MIMO) continuous system block.
7070
7171
# Parameters:
7272
- `nin`: Input dimension
@@ -78,8 +78,8 @@ function MIMO(; name, nin = 1, nout = 1, u_start = zeros(nin), y_start = zeros(n
7878
@named input = RealInput(nin = nin, u_start = u_start)
7979
@named output = RealOutput(nout = nout, u_start = y_start)
8080
@variables begin
81-
u[1:nin](t) = u_start
82-
y[1:nout](t) = y_start
81+
u(t)[1:nin] = u_start
82+
y(t)[1:nout] = y_start
8383
end
8484
eqs = [
8585
[u[i] ~ input.u[i] for i in 1:nin]...,

src/Electrical/Electrical.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This library contains electrical components to build up analog circuits.
44
"""
55
module Electrical
66

7-
using ModelingToolkit, Symbolics, IfElse, OrdinaryDiffEq
7+
using ModelingToolkit, Symbolics, IfElse
88
using OffsetArrays
99

1010
@parameters t

0 commit comments

Comments
 (0)