Skip to content

Fixes for MTK v8 #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 91 commits into from
Apr 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
8986034
starts fixing things for MTK v8
ValentinKaisermayer Mar 21, 2022
a0f79e6
finishes sources
ValentinKaisermayer Mar 21, 2022
733be0f
seperates magnetic into own modules
ValentinKaisermayer Mar 21, 2022
2c0444b
changes hard to read Dt to D
ValentinKaisermayer Mar 21, 2022
60c4d6e
adds test to demo
ValentinKaisermayer Mar 22, 2022
066edaa
reverts breaking argument rename
ValentinKaisermayer Mar 22, 2022
0a4d3a3
adds comment
ValentinKaisermayer Mar 22, 2022
92fcf2c
fix D
ValentinKaisermayer Mar 22, 2022
9ef6e22
changes compat
ValentinKaisermayer Mar 22, 2022
fbf870d
removes parameter
ValentinKaisermayer Mar 22, 2022
08a8e20
analog tests work again
ValentinKaisermayer Mar 23, 2022
08fe5f1
starts to add real interface
ValentinKaisermayer Mar 23, 2022
11496eb
restructures runtests
ValentinKaisermayer Mar 23, 2022
ba646f5
renames ports
ValentinKaisermayer Mar 23, 2022
8fd1ecc
small fix
ValentinKaisermayer Mar 23, 2022
ae29d91
wraps in testset
ValentinKaisermayer Mar 23, 2022
25628c9
starts to switch to connections
ValentinKaisermayer Mar 23, 2022
8fa58a5
renames ports
ValentinKaisermayer Mar 23, 2022
a3699b9
changes non-linear blocks to use connectors
ValentinKaisermayer Mar 25, 2022
b42f0dd
fixes tests for math blocks
ValentinKaisermayer Apr 6, 2022
ba16b08
adds docs
ValentinKaisermayer Apr 7, 2022
604d69e
adds tests for continous blocks
ValentinKaisermayer Apr 7, 2022
1caecf1
small fix
ValentinKaisermayer Apr 8, 2022
b591719
adds comments
ValentinKaisermayer Apr 8, 2022
e65e51c
tries to fix test
ValentinKaisermayer Apr 8, 2022
e7d23cf
adds doc strings
ValentinKaisermayer Apr 11, 2022
28677ca
fixes tests
ValentinKaisermayer Apr 11, 2022
587f4e4
adds missind component
ValentinKaisermayer Apr 11, 2022
a95aee3
comments out PID and StateSpace
ValentinKaisermayer Apr 11, 2022
3d3edaf
improves doc strings of thermal componets; changes port names
ValentinKaisermayer Apr 13, 2022
344deb6
adds PI controller
ValentinKaisermayer Apr 13, 2022
0a6a4bc
adds demo to tests
ValentinKaisermayer Apr 13, 2022
4c8bc3c
adds LimPI
ValentinKaisermayer Apr 13, 2022
d9a9c17
fix LimPI
ValentinKaisermayer Apr 14, 2022
b27b4ff
adds sources
ValentinKaisermayer Apr 15, 2022
d552186
adds PID
ValentinKaisermayer Apr 15, 2022
8354b1b
renames Saturation into Limiter
ValentinKaisermayer Apr 16, 2022
596f412
adds SlewRateLimiter
ValentinKaisermayer Apr 16, 2022
f53f247
adds initial values
ValentinKaisermayer Apr 16, 2022
7678a1b
adds test
ValentinKaisermayer Apr 16, 2022
1bf36ea
fixes StateSpace
ValentinKaisermayer Apr 17, 2022
125955d
adds math blocks
ValentinKaisermayer Apr 17, 2022
862684a
exports math functions
ValentinKaisermayer Apr 17, 2022
c4f4db6
adds FIXME
ValentinKaisermayer Apr 17, 2022
cac978e
removes array eq
ValentinKaisermayer Apr 17, 2022
4938028
adds doc strings and ExpSine
ValentinKaisermayer Apr 17, 2022
7ea33b7
adds tests fr math blocks
ValentinKaisermayer Apr 17, 2022
83f1924
renames sources
ValentinKaisermayer Apr 17, 2022
bcdbd55
adds tests for sources
ValentinKaisermayer Apr 17, 2022
cf73214
adds test
ValentinKaisermayer Apr 17, 2022
a4b05ba
fixes tests
ValentinKaisermayer Apr 17, 2022
87856b6
adds doc strings
ValentinKaisermayer Apr 17, 2022
bbcdc3c
starts on magnetic components
ValentinKaisermayer Apr 17, 2022
0b7acda
fixes all tests
ValentinKaisermayer Apr 18, 2022
638d681
changes params for SlewRateLimiter test
ValentinKaisermayer Apr 20, 2022
29a0fe4
Update src/Blocks/sources.jl
ValentinKaisermayer Apr 20, 2022
084fe12
changes doc strings
ValentinKaisermayer Apr 20, 2022
00b19e7
Merge branch 'fix-MTK-v8' of https://github.com/ValentinKaisermayer/M…
ValentinKaisermayer Apr 20, 2022
97b5915
removes default value
ValentinKaisermayer Apr 20, 2022
7cf62ad
adds missing gain
ValentinKaisermayer Apr 20, 2022
838865c
check results
ValentinKaisermayer Apr 20, 2022
33aad40
extensinve test of sources
ValentinKaisermayer Apr 20, 2022
32b65bd
test math blocks explicitly
ValentinKaisermayer Apr 20, 2022
e22e7d5
adds LimPID test; skips old test
ValentinKaisermayer Apr 20, 2022
7e5bcb1
minor formatting changes
ValentinKaisermayer Apr 20, 2022
6581e22
export LimPID
ValentinKaisermayer Apr 20, 2022
a326553
changes LimPID
ValentinKaisermayer Apr 20, 2022
ef7f569
changes reference
ValentinKaisermayer Apr 20, 2022
bca3262
Apply suggestions from code review
ValentinKaisermayer Apr 20, 2022
a06235b
adds some signatures
ValentinKaisermayer Apr 20, 2022
b01aad6
Merge branch 'fix-MTK-v8' of https://github.com/ValentinKaisermayer/M…
ValentinKaisermayer Apr 20, 2022
627710b
allow for scalar zero
ValentinKaisermayer Apr 21, 2022
ebaadf2
changes to lowercase units; adds doc strings
ValentinKaisermayer Apr 21, 2022
f1241e8
Merge branch 'fix-MTK-v8' of https://github.com/ValentinKaisermayer/M…
ValentinKaisermayer Apr 21, 2022
71b4c55
adds StaticNonLinearity
ValentinKaisermayer Apr 21, 2022
9d76ce8
fixes names
ValentinKaisermayer Apr 21, 2022
684efb5
adds explicit output tests for first and second order system
ValentinKaisermayer Apr 21, 2022
724e9a5
I and D can be deactivated for normal PID as well
ValentinKaisermayer Apr 21, 2022
8c0d87f
adds tests for Limiter and DeadZone
ValentinKaisermayer Apr 22, 2022
92b584c
changes PI and LimPI to use blocks instead of explicit equations
ValentinKaisermayer Apr 22, 2022
9ea38fe
adds first magnetic test
ValentinKaisermayer Apr 22, 2022
715580f
adds missing signature
ValentinKaisermayer Apr 22, 2022
a9a8270
adds integrator test
ValentinKaisermayer Apr 22, 2022
4b7abeb
re-adds current and voltage source tests
ValentinKaisermayer Apr 22, 2022
4b79982
fixes some mistakes in test; adds explicit output checks for the sources
ValentinKaisermayer Apr 22, 2022
1988514
minor doc string additions
ValentinKaisermayer Apr 22, 2022
47bf2fa
marks test as broken
ValentinKaisermayer Apr 22, 2022
ddd6df1
comments out Plots
ValentinKaisermayer Apr 22, 2022
57ad5ff
Removes default frequency
ValentinKaisermayer Apr 22, 2022
b9b0cce
kwarg not assigned
ValentinKaisermayer Apr 23, 2022
0efcdbe
Adds missing t
ValentinKaisermayer Apr 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"

[compat]
IfElse = "0.1"
ModelingToolkit = "5.26, 6, 7"
ModelingToolkit = "8"
OffsetArrays = "1"
OrdinaryDiffEq = "5.56, 6"
Symbolics = "0.1, 1, 2, 3, 4"
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ type the name twice. The same principle applies to the other thermal components.
- `C`: heat capacity (zero or positive)

**State**:
- `T`: temperature (in Kelvin)
- `T`: temperature (in kelvin)

**Connectors**:
- heat port
Expand All @@ -233,7 +233,7 @@ type the name twice. The same principle applies to the other thermal components.

**States**:
- `Q_flow`: heat flow rate
- `T`: temperature (in Kelvin)
- `T`: temperature (in kelvin)

**Connectors**:
- two heat ports
Expand All @@ -249,7 +249,7 @@ type the name twice. The same principle applies to the other thermal components.

**States**:
- `Q_flow`: heat flow rate
- `T`: temperature (in Kelvin)
- `T`: temperature (in kelvin)

**Connectors**:
- two heat ports
Expand All @@ -265,7 +265,7 @@ type the name twice. The same principle applies to the other thermal components.

**States**:
- `Q_flow`: heat flow rate
- `dT`: temperature difference (in Kelvin)
- `dT`: temperature difference (in kelvin)

**Connectors**:
- two heat ports (for modeling of the fluid flow over the solid)
Expand All @@ -281,7 +281,7 @@ type the name twice. The same principle applies to the other thermal components.

**States**:
- `Q_flow`: heat flow rate
- `dT`: temperature difference (in Kelvin)
- `dT`: temperature difference (in kelvin)

**Connectors**:
- two heat ports (for modeling of the fluid flow over the solid)
Expand Down Expand Up @@ -314,7 +314,7 @@ to a singular heatport.

**States**:
- `Q_flow`: heat flow rate
- `T`: temperature (in Kelvin)
- `T`: temperature (in kelvin)

**Connectors**:
- `hp1...hpN`: the respective heatports
Expand All @@ -328,10 +328,10 @@ to a singular heatport.

**Function**: `TemperatureSensor(;name)`

**Description**: Ideal absolute temperature sensor which outputs the temperature (in Kelvin) of the connected port.
**Description**: Ideal absolute temperature sensor which outputs the temperature (in kelvin) of the connected port.

**States**:
- `T`: temperature (in Kelvin)
- `T`: temperature (in kelvin)

**Connectors**:
- heat port
Expand All @@ -340,10 +340,10 @@ to a singular heatport.

**Function**: `RelativeTemperatureSensor(;name)`

**Description**: The output of the sensor is the relative temperature, i.e., the difference of the two ports, given in Kelvin.
**Description**: The output of the sensor is the relative temperature, i.e., the difference of the two ports, given in kelvin.

**States**:
- `T`: temperature (in Kelvin)
- `T`: temperature (in kelvin)

**Connectors**:
- two heat ports
Expand Down Expand Up @@ -380,10 +380,10 @@ to a singular heatport.

**Function**: `FixedTemperature(;name, T = 0.0)`

**Description**: The model defines a fixed temperature (in Kelvin) at a given port.
**Description**: The model defines a fixed temperature (in kelvin) at a given port.

**Observables**:
- `T`: temperature (in Kelvin)
- `T`: temperature (in kelvin)

**Connectors**:
- heat port
28 changes: 14 additions & 14 deletions src/Blocks/Blocks.jl
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
"""
The module `Blocks` contains common input-output components, referred to as blocks.

In general, input-output blocks follow the convention
```
┌───────────┐
u │ ẋ=f(x,u) │ y
────►│ y=g(x,u) ├────►
│ │
└───────────┘
```
where `u` are inputs, `x` are state variables and `y` are outputs. `x,u,y` are all implemented as `@variables` internally, `u` are marked as `[input=true]` and `y` are marked `[output=true]`.
"""
module Blocks
using ModelingToolkit, Symbolics, IfElse, OrdinaryDiffEq
using IfElse: ifelse

@parameters t
Dₜ = Differential(t)
D = Differential(t)

export RealInput, RealOutput, SISO
include("utils.jl")

export Gain, Sum
export Gain, Sum, MatrixGain, Sum, Feedback, Add, Product, Division
export Abs, Sign, Sqrt, Sin, Cos, Tan, Asin, Acos, Atan, Atan2, Sinh, Cosh, Tanh, Exp
export Log, Log10
include("math.jl")

export Saturation, DeadZone
export Constant, Sine, Cosine, ContinuousClock, Ramp, Step, ExpSine
include("sources.jl")

export Limiter, DeadZone, SlewRateLimiter
include("nonlinear.jl")

export Constant, Integrator, Derivative, FirstOrder, SecondOrder, PID, StateSpace
export Integrator, Derivative, FirstOrder, SecondOrder, StateSpace
export PI, LimPI, PID, LimPID
include("continuous.jl")

end
Loading