diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 700707ced..1e8a051e2 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,3 +5,6 @@ updates: directory: "/" # Location of package manifests schedule: interval: "weekly" + ignore: + - dependency-name: "crate-ci/typos" + update-types: ["version-update:semver-patch"] diff --git a/.github/workflows/SpellCheck.yml b/.github/workflows/SpellCheck.yml new file mode 100644 index 000000000..74af4eff7 --- /dev/null +++ b/.github/workflows/SpellCheck.yml @@ -0,0 +1,13 @@ +name: Spell Check + +on: [pull_request] + +jobs: + typos-check: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + - name: Check spelling + uses: crate-ci/typos@v1.16.23 \ No newline at end of file diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 000000000..9b079dcfc --- /dev/null +++ b/.typos.toml @@ -0,0 +1,4 @@ +[default.extend-words] +Nd = "Nd" +nin = "nin" +coul = "coul" \ No newline at end of file diff --git a/Project.toml b/Project.toml index 2e2261ddb..c4222f5af 100644 --- a/Project.toml +++ b/Project.toml @@ -12,14 +12,22 @@ ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78" Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" [compat] +Aqua = "0.8" ChainRulesCore = "1" +ControlSystemsBase = "1" +DataInterpolations = "4" DiffEqBase = "6" IfElse = "0.1" +LinearAlgebra = "1" ModelingToolkit = "8.67" +OrdinaryDiffEq = "6" +SafeTestsets = "0.1" Symbolics = "4.9, 5" +Test = "1" julia = "1.6" [extras] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e" DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -28,4 +36,4 @@ SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["LinearAlgebra", "OrdinaryDiffEq", "SafeTestsets", "Test", "ControlSystemsBase", "DataInterpolations"] +test = ["Aqua", "LinearAlgebra", "OrdinaryDiffEq", "SafeTestsets", "Test", "ControlSystemsBase", "DataInterpolations"] diff --git a/README.md b/README.md index 52e6f84e9..973f252a4 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ the documentation, which contains the unreleased features. ## Libraries -The following are the constituant libraries of the ModelingToolkit Standard Library. +The following are the constituent libraries of the ModelingToolkit Standard Library. - [Basic Blocks](https://docs.sciml.ai/ModelingToolkitStandardLibrary/stable/API/blocks/) - [Mechanical Components](https://docs.sciml.ai/ModelingToolkitStandardLibrary/stable/API/mechanical/) diff --git a/docs/src/index.md b/docs/src/index.md index e6e05c0c4..b0319ca60 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -21,7 +21,7 @@ Pkg.add("ModelingToolkitStandardLibrary") ## Libraries -The following are the constituant libraries of the ModelingToolkit Standard Library. +The following are the constituent libraries of the ModelingToolkit Standard Library. - [Basic Blocks](https://docs.sciml.ai/ModelingToolkitStandardLibrary/stable/API/blocks/) - [Mechanical Components](https://docs.sciml.ai/ModelingToolkitStandardLibrary/stable/API/mechanical/) diff --git a/docs/src/tutorials/input_component.md b/docs/src/tutorials/input_component.md index cb4f50041..7347c1213 100644 --- a/docs/src/tutorials/input_component.md +++ b/docs/src/tutorials/input_component.md @@ -47,7 +47,7 @@ prob = ODEProblem(sys, [], (0, time[end])) sol = solve(prob, ImplicitEuler()) ``` -If we want to run a new data set, this requires building a new `LinearInterpolation` and `ODESystem` followed by running `structural_simplify`, all of which takes time. Therefore, to run serveral pieces of data it's better to re-use an `ODESystem`. The next couple methods will demonstrate how to do this. +If we want to run a new data set, this requires building a new `LinearInterpolation` and `ODESystem` followed by running `structural_simplify`, all of which takes time. Therefore, to run several pieces of data it's better to re-use an `ODESystem`. The next couple methods will demonstrate how to do this. ## Custom Component with External Data @@ -105,7 +105,7 @@ Additional code could be added to resolve this issue, for example by using a `Re ## `SampledData` Component -To resolve the issues presented above, the `ModelingToolkitStandardLibrary.Blocks.SampledData` component can be used which allows for a resusable `ODESystem` and self contained data which ensures a solution which remains valid for it's lifetime. Now it's possible to also parallize the call to `solve()`. +To resolve the issues presented above, the `ModelingToolkitStandardLibrary.Blocks.SampledData` component can be used which allows for a resusable `ODESystem` and self contained data which ensures a solution which remains valid for it's lifetime. Now it's possible to also parallelize the call to `solve()`. ```julia function System(; name) @@ -146,4 +146,4 @@ sol2 = Ref{ODESolution}() end ``` -Note, in the above example, we can build the system with an empty `SampledData` component, only setting the expected data type: `@named src = SampledData(Float64)`. It's also possible to initialize the component with real sampled data: `@named src = SampledData(data, dt)`. Additionally note that before running an `ODEProblem` using the `SampledData` component, one must be careful about the parameter vector Type. The `SampledData` component contains a `buffer` parameter of type `Parameter`, therefore we must generate the problem using `tofloat=false`. This will initially give a parameter vector of type `Vector{Any}` with a mix of numbers and `Parameter` type. We can convert the vector to a uniform `Parameter` type by running `p = Parameter.(p)`. This will wrap all the single values in a `Parameter` which will be mathmatically equivalent to a `Number`. +Note, in the above example, we can build the system with an empty `SampledData` component, only setting the expected data type: `@named src = SampledData(Float64)`. It's also possible to initialize the component with real sampled data: `@named src = SampledData(data, dt)`. Additionally note that before running an `ODEProblem` using the `SampledData` component, one must be careful about the parameter vector Type. The `SampledData` component contains a `buffer` parameter of type `Parameter`, therefore we must generate the problem using `tofloat=false`. This will initially give a parameter vector of type `Vector{Any}` with a mix of numbers and `Parameter` type. We can convert the vector to a uniform `Parameter` type by running `p = Parameter.(p)`. This will wrap all the single values in a `Parameter` which will be mathematically equivalent to a `Number`. diff --git a/src/Blocks/analysis_points.jl b/src/Blocks/analysis_points.jl index e38402b38..b7690692d 100644 --- a/src/Blocks/analysis_points.jl +++ b/src/Blocks/analysis_points.jl @@ -52,7 +52,7 @@ eqs = [connect(P.output, C.input) connect(C.output, :plant_input, P.input)] sys = ODESystem(eqs, t, systems = [P, C], name = :feedback_system) -matrices_S, _ = get_sensitivity(sys, :plant_input) # Compute the matrices of a state-space representation of the (input) sensitivity funciton. +matrices_S, _ = get_sensitivity(sys, :plant_input) # Compute the matrices of a state-space representation of the (input) sensitivity function. matrices_T, _ = get_comp_sensitivity(sys, :plant_input) ``` diff --git a/src/Blocks/continuous.jl b/src/Blocks/continuous.jl index eb7a331da..2661c7124 100644 --- a/src/Blocks/continuous.jl +++ b/src/Blocks/continuous.jl @@ -572,7 +572,7 @@ To set the initial state, it's recommended to set the initial condition for `x`, # Parameters: - `b`: Numerator polynomial coefficients, e.g., `2s + 3` is specified as `[2, 3]` -- `a`: Denomenator polynomial coefficients, e.g., `s² + 2ωs + ω^2` is specified as `[1, 2ω, ω^2]` +- `a`: Denominator polynomial coefficients, e.g., `s² + 2ωs + ω^2` is specified as `[1, 2ω, ω^2]` # Connectors: - `input` diff --git a/src/Electrical/Digital/logic.jl b/src/Electrical/Digital/logic.jl index 675a0d7ce..ed6f52ffa 100644 --- a/src/Electrical/Digital/logic.jl +++ b/src/Electrical/Digital/logic.jl @@ -1,10 +1,10 @@ -@enum Logic Uninitialized=1 ForcingUnknown ForcingZero ForcingOne HighImpedence WeakUnknown WeakZero WeakOne DontCare +@enum Logic Uninitialized=1 ForcingUnknown ForcingZero ForcingOne HighImpedance WeakUnknown WeakZero WeakOne DontCare const U = Uninitialized const X = ForcingUnknown const F0 = ForcingZero const F1 = ForcingOne -const Z = HighImpedence +const Z = HighImpedance const W = WeakUnknown const L = WeakZero const H = WeakOne diff --git a/src/Hydraulic/IsothermalCompressible/components.jl b/src/Hydraulic/IsothermalCompressible/components.jl index 0ceab5f58..91f6bd54c 100644 --- a/src/Hydraulic/IsothermalCompressible/components.jl +++ b/src/Hydraulic/IsothermalCompressible/components.jl @@ -497,7 +497,7 @@ dm ────► │ │ area name) @assert(N>=0, "the Tube component must be defined with 0 or more segments (i.e. N>=0), found N=$N") - @assert (direction == +1)||(direction == -1) "direction arument must be +/-1, found $direction" + @assert (direction == +1)||(direction == -1) "direction argument must be +/-1, found $direction" #TODO: How to set an assert effective_length >= length ?? pars = @parameters begin diff --git a/src/ModelingToolkitStandardLibrary.jl b/src/ModelingToolkitStandardLibrary.jl index d764f8d81..07885fee4 100644 --- a/src/ModelingToolkitStandardLibrary.jl +++ b/src/ModelingToolkitStandardLibrary.jl @@ -8,7 +8,7 @@ Omits the check expression if the argument `J` is symbolic. """ macro symcheck(ex) ex.args[1].head === :call || - error("Expected an expresion on the form sym > val || error()") + error("Expected an expression on the form sym > val || error()") sym = ex.args[1].args[2] quote _issymbolic(x) = !(unwrap(x) isa Real) diff --git a/test/Blocks/continuous.jl b/test/Blocks/continuous.jl index 71add4554..8b28fbea5 100644 --- a/test/Blocks/continuous.jl +++ b/test/Blocks/continuous.jl @@ -7,7 +7,7 @@ using Test #= Testing strategy: -The general strategy is to test systems using simple intputs where the solution +The general strategy is to test systems using simple inputs where the solution is known on closed form. For algebraic systems (without differential variables), an integrator with a constant input is often used together with the system under test. =# diff --git a/test/Blocks/test_analysis_points.jl b/test/Blocks/test_analysis_points.jl index ccadd22ed..533265a5e 100644 --- a/test/Blocks/test_analysis_points.jl +++ b/test/Blocks/test_analysis_points.jl @@ -143,7 +143,7 @@ lsys = sminreal(ss(matrices...)) matrices_So, _ = get_sensitivity(sys_outer, :inner_plant_output) lsyso = sminreal(ss(matrices_So...)) -@test lsys == lsyso || lsys == -1 * lsyso * (-1) # Output and input sensitivites are equal for SISO systems +@test lsys == lsyso || lsys == -1 * lsyso * (-1) # Output and input sensitivities are equal for SISO systems ## A more complicated test case using ModelingToolkit, OrdinaryDiffEq, LinearAlgebra diff --git a/test/Electrical/digital.jl b/test/Electrical/digital.jl index 7b5740f4c..b4264031c 100644 --- a/test/Electrical/digital.jl +++ b/test/Electrical/digital.jl @@ -32,7 +32,7 @@ using OrdinaryDiffEq: ReturnCode.Success @test typeof(logic.logic) == Vector{Logic} @test get_logic_level(logic) == [1, 6, 2, 4] - # Predefiend logic vectors + # Predefined logic vectors @test std_ulogic.logic == [U, X, F0, F1, Z, W, L, H, DC] @test UX01.logic == [U, X, F0, F1] @test UX01Z.logic == [U, X, F0, F1, Z] diff --git a/test/qa.jl b/test/qa.jl new file mode 100644 index 000000000..5d580adc1 --- /dev/null +++ b/test/qa.jl @@ -0,0 +1,11 @@ +using ModelingToolkitStandardLibrary, Aqua +@testset "Aqua" begin + Aqua.find_persistent_tasks_deps(ModelingToolkitStandardLibrary) + Aqua.test_ambiguities(ModelingToolkitStandardLibrary, recursive = false) + Aqua.test_deps_compat(ModelingToolkitStandardLibrary) + Aqua.test_piracies(ModelingToolkitStandardLibrary) + Aqua.test_project_extras(ModelingToolkitStandardLibrary) + Aqua.test_stale_deps(ModelingToolkitStandardLibrary) + Aqua.test_unbound_args(ModelingToolkitStandardLibrary) + Aqua.test_undefined_exports(ModelingToolkitStandardLibrary) +end diff --git a/test/runtests.jl b/test/runtests.jl index e6ff5be77..ff6ed26d2 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,9 @@ using SafeTestsets +@safetestset "Quality Assurance" begin + include("qa.jl") +end + # Blocks @safetestset "Blocks: math" begin include("Blocks/math.jl")