hexaeder / blocksystems.jl Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hey,
When I calculate the derivative of an input i(t) BlockSystem automatically reduces the derivative idi(t). I think we should have a look at this! I have set up an MWE, which simply contains a block that squares the input and a derivative block:
using Pkg
Pkg.activate(@__DIR__)
using ModelingToolkit
using BlockSystems
@parameters t
dt = Differential(t)
@parameters x(t) i(t)
@variables x2(t) o(t) ii(t) idi(t)
square_block = IOBlock([x2 ~ x^2], [x], [x2], name = :square_block)
derivative_block = IOBlock([o ~ idi, ii ~ i, dt(ii) ~ idi], [i], [o, idi, ii], name = :derivative_block)
test = IOSystem([square_block.x2 => derivative_block.i],
[square_block, derivative_block],
outputs=[derivative_block.o],
name = :test)
connect_system(test, verbose=true)
This results in the following error. The internal states are incorrectly reduced which you can quickly see in the debugger.
ERROR: ArgumentError: inputs must be parameters
(Set(inputs) ⊆ Set(parameters(odes))) == false
├ (Set(inputs)) = Set(Term{Real, Base.ImmutableDict{DataType, Any}}[x(t)])
└ (Set(parameters(odes))) = Set{Any}()
But there is a workaround by explicitly using the derivative idi(t) and the internal state ii(t) so that it is not reduced. It works but becomes very messy once the IOSystem becomes bigger!
test = IOSystem([square_block.x2 => derivative_block.i],
[square_block, derivative_block],
outputs=[derivative_block.o, derivative_block.idi, derivative_block.ii],
name = :test)
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
if the removed superflous state equations contain explicit algebraic states in their rhs this will throw an error
show(io::IO, ::MIME"text/plain", ::T)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.