diff --git a/Manifest.toml b/Manifest.toml index 56e0d00..b8fd5c2 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -1,6 +1,6 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.7.1" +julia_version = "1.7.2" manifest_format = "2.0" [[deps.ArgTools]] @@ -8,9 +8,9 @@ uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" [[deps.ArrayInterface]] deps = ["Compat", "IfElse", "LinearAlgebra", "Requires", "SparseArrays", "Static"] -git-tree-sha1 = "1ee88c4c76caa995a885dc2f22a5d548dfbbc0ba" +git-tree-sha1 = "c933ce606f6535a7c7b98e1d86d5d1014f730596" uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" -version = "3.2.2" +version = "5.0.7" [[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" @@ -20,15 +20,15 @@ uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" [[deps.BitTwiddlingConvenienceFunctions]] deps = ["Static"] -git-tree-sha1 = "5e98d6a6aa92e5758c4d58501b7bf23732699fa3" +git-tree-sha1 = "28bbdbf0354959db89358d1d79d421ff31ef0b5e" uuid = "62783981-4cbd-42fc-bca8-16325de8dc4b" -version = "0.1.2" +version = "0.1.3" [[deps.CPUSummary]] -deps = ["Hwloc", "IfElse", "Static"] -git-tree-sha1 = "ba19d1c8ff6b9c680015033c66802dd817a9cf39" +deps = ["CpuId", "IfElse", "Static"] +git-tree-sha1 = "baaac45b4462b3b0be16726f38b789bf330fcb7a" uuid = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9" -version = "0.1.7" +version = "0.1.21" [[deps.Calculus]] deps = ["LinearAlgebra"] @@ -38,9 +38,9 @@ version = "0.5.1" [[deps.ChainRulesCore]] deps = ["Compat", "LinearAlgebra", "SparseArrays"] -git-tree-sha1 = "f9982ef575e19b0e5c7a98c6e75ee496c0f73a93" +git-tree-sha1 = "9950387274246d08af38f6eef8cb5480862a435f" uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" -version = "1.12.0" +version = "1.14.0" [[deps.ChangesOfVariables]] deps = ["ChainRulesCore", "LinearAlgebra", "Test"] @@ -50,9 +50,9 @@ version = "0.1.2" [[deps.Compat]] deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"] -git-tree-sha1 = "44c37b4636bc54afac5c574d2d02b625349d6582" +git-tree-sha1 = "b153278a25dd42c65abbf4e62344f9d22e59191b" uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "3.41.0" +version = "3.43.0" [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] @@ -64,21 +64,27 @@ git-tree-sha1 = "f74e9d5388b8620b4cee35d4c5a618dd4dc547f4" uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" version = "1.3.0" +[[deps.CpuId]] +deps = ["Markdown"] +git-tree-sha1 = "fcbb72b032692610bfbdb15018ac16a36cf2e406" +uuid = "adafc99b-e345-5852-983c-f28acb93d879" +version = "0.3.1" + [[deps.Crayons]] git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15" uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" version = "4.1.1" [[deps.DataAPI]] -git-tree-sha1 = "cc70b17275652eb47bc9e5f81635981f13cea5c8" +git-tree-sha1 = "fb5f5316dd3fd4c5e7c30a24d50643b73e37cd40" uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" -version = "1.9.0" +version = "1.10.0" [[deps.DataFrames]] deps = ["Compat", "DataAPI", "Future", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrettyTables", "Printf", "REPL", "Reexport", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"] -git-tree-sha1 = "ae02104e835f219b8930c7664b8012c93475c340" +git-tree-sha1 = "6c19003824cbebd804a51211fd3bbd81bf1ecad5" uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" -version = "1.3.2" +version = "1.3.3" [[deps.DataStructures]] deps = ["Compat", "InteractiveUtils", "OrderedCollections"] @@ -111,9 +117,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" [[deps.Distributions]] deps = ["ChainRulesCore", "DensityInterface", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SparseArrays", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns", "Test"] -git-tree-sha1 = "2e97190dfd4382499a4ac349e8d316491c9db341" +git-tree-sha1 = "70f5bfdfbdc6c9d2b7a143d70ae88f4cb7b193b1" uuid = "31c24e10-a181-5473-b8eb-7969acd0382f" -version = "0.25.46" +version = "0.25.56" [[deps.DocStringExtensions]] deps = ["LibGit2"] @@ -127,9 +133,9 @@ uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" [[deps.FillArrays]] deps = ["LinearAlgebra", "Random", "SparseArrays", "Statistics"] -git-tree-sha1 = "8756f9935b7ccc9064c6eef0bff0ad643df733a3" +git-tree-sha1 = "246621d23d1f43e3b9c368bf3b72b2331a27c286" uuid = "1a297f60-69ca-5386-bcde-b61e274b549b" -version = "0.12.7" +version = "0.13.2" [[deps.Formatting]] deps = ["Printf"] @@ -143,9 +149,9 @@ uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" [[deps.HostCPUFeatures]] deps = ["BitTwiddlingConvenienceFunctions", "IfElse", "Libdl", "Static"] -git-tree-sha1 = "3965a3216446a6b020f0d48f1ba94ef9ec01720d" +git-tree-sha1 = "18be5268cf415b5e27f34980ed25a7d34261aa83" uuid = "3e5b6fbb-0976-4d2c-9146-d79de83f2fb0" -version = "0.1.6" +version = "0.1.7" [[deps.Hwloc]] deps = ["Hwloc_jll"] @@ -155,9 +161,9 @@ version = "2.0.0" [[deps.Hwloc_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "d8bccde6fc8300703673ef9e1383b11403ac1313" +git-tree-sha1 = "303d70c961317c4c20fafaf5dbe0e6d610c38542" uuid = "e33a78d0-f292-5ffc-b300-72abe9b543c8" -version = "2.7.0+0" +version = "2.7.1+0" [[deps.IfElse]] git-tree-sha1 = "debdd00ffef04665ccbb3e150747a77560e8fad1" @@ -170,9 +176,9 @@ uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" [[deps.InverseFunctions]] deps = ["Test"] -git-tree-sha1 = "a7254c0acd8e62f1ac75ad24d5db43f5f19f3c65" +git-tree-sha1 = "91b5dcf362c5add98049e6c29ee756910b03051d" uuid = "3587e190-3f89-42d0-90ee-14403ec27112" -version = "0.1.2" +version = "0.1.3" [[deps.InvertedIndices]] git-tree-sha1 = "bee5f1ef5bf65df56bdd2e40447590b272a5471f" @@ -197,9 +203,9 @@ version = "1.4.1" [[deps.LayoutPointers]] deps = ["ArrayInterface", "LinearAlgebra", "ManualMemory", "SIMDTypes", "Static"] -git-tree-sha1 = "6dd77ee76188b0365f7d882d674b95796076fa2c" +git-tree-sha1 = "b651f573812d6c36c22c944dd66ef3ab2283dfa1" uuid = "10f19ff3-798f-405d-979b-55457f8fc047" -version = "0.1.5" +version = "0.1.6" [[deps.LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] @@ -226,9 +232,9 @@ uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" [[deps.LogExpFunctions]] deps = ["ChainRulesCore", "ChangesOfVariables", "DocStringExtensions", "InverseFunctions", "IrrationalConstants", "LinearAlgebra"] -git-tree-sha1 = "e5718a00af0ab9756305a0392832c8952c7426c1" +git-tree-sha1 = "76c987446e8d555677f064aaac1145c4c17662f8" uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" -version = "0.3.6" +version = "0.3.14" [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" @@ -240,9 +246,9 @@ uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" version = "0.5.9" [[deps.ManualMemory]] -git-tree-sha1 = "9cb207b18148b2199db259adfa923b45593fe08e" +git-tree-sha1 = "bcaef4fc7a0cfe2cba636d84cda54b5e4e4ca3cd" uuid = "d125e4d3-2237-4719-b19c-fa641b8a4667" -version = "0.1.6" +version = "0.1.8" [[deps.Markdown]] deps = ["Base64"] @@ -254,9 +260,9 @@ uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" [[deps.Measurements]] deps = ["Calculus", "LinearAlgebra", "Printf", "RecipesBase", "Requires"] -git-tree-sha1 = "58390f5617544fb09d27244749484fee0cae6712" +git-tree-sha1 = "88cd033eb781c698e75ae0b680e5cef1553f0856" uuid = "eff96d63-e80a-5855-80a2-b1b0885c5ab7" -version = "2.7.0" +version = "2.7.1" [[deps.Missings]] deps = ["DataAPI"] @@ -269,9 +275,9 @@ uuid = "a63ad114-7e13-5084-954f-fe012c677804" [[deps.MonteCarloMeasurements]] deps = ["Distributed", "Distributions", "LinearAlgebra", "MacroTools", "Random", "RecipesBase", "Requires", "SLEEFPirates", "StaticArrays", "Statistics", "StatsBase", "Test"] -git-tree-sha1 = "a438746036111a49ba2cb435681aeef0f1d8e9bc" +git-tree-sha1 = "03619e255664666b352a5e5f6b45e8b00d439870" uuid = "0987c9cc-fe09-11e8-30f0-b96dd679fdca" -version = "1.0.6" +version = "1.0.8" [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" @@ -300,9 +306,9 @@ version = "1.4.1" [[deps.PDMats]] deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"] -git-tree-sha1 = "ee26b350276c51697c9c2d88a072b339f9f03d73" +git-tree-sha1 = "3114946c67ef9925204cc024a73c9e679cebe0d7" uuid = "90014a1f-27ba-587c-ab20-58faa44d9150" -version = "0.11.5" +version = "0.11.8" [[deps.Pkg]] deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] @@ -310,15 +316,15 @@ uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" [[deps.PooledArrays]] deps = ["DataAPI", "Future"] -git-tree-sha1 = "db3a23166af8aebf4db5ef87ac5b00d36eb771e2" +git-tree-sha1 = "a6062fe4063cdafe78f4a0a81cfffb89721b30e7" uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720" -version = "1.4.0" +version = "1.4.2" [[deps.Preferences]] deps = ["TOML"] -git-tree-sha1 = "2cf929d64681236a2e074ffafb8d568733d2e6af" +git-tree-sha1 = "47e5f437cc0e7ef2ce8406ce1e7e24d44915f88d" uuid = "21216c6a-2e73-6563-6e65-726566657250" -version = "1.2.3" +version = "1.3.0" [[deps.PrettyTables]] deps = ["Crayons", "Formatting", "Markdown", "Reexport", "Tables"] @@ -382,9 +388,9 @@ version = "0.1.0" [[deps.SLEEFPirates]] deps = ["IfElse", "Static", "VectorizationBase"] -git-tree-sha1 = "1410aad1c6b35862573c01b96cd1f6dbe3979994" +git-tree-sha1 = "ac399b5b163b9140f9c310dfe9e9aaa225617ff6" uuid = "476501e8-09a2-5ece-8869-fb82de89a1fa" -version = "0.6.28" +version = "0.6.32" [[deps.Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" @@ -408,42 +414,43 @@ uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [[deps.SpecialFunctions]] deps = ["ChainRulesCore", "IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] -git-tree-sha1 = "e6bf188613555c78062842777b116905a9f9dd49" +git-tree-sha1 = "5ba658aeecaaf96923dce0da9e703bd1fe7666f9" uuid = "276daf66-3868-5448-9aa4-cd146d93841b" -version = "2.1.0" +version = "2.1.4" [[deps.Static]] deps = ["IfElse"] -git-tree-sha1 = "7f5a513baec6f122401abfc8e9c074fdac54f6c1" +git-tree-sha1 = "91181e5820a400d1171db4382aa36e7fd19bee27" uuid = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" -version = "0.4.1" +version = "0.6.3" [[deps.StaticArrays]] deps = ["LinearAlgebra", "Random", "Statistics"] -git-tree-sha1 = "a635a9333989a094bddc9f940c04c549cd66afcf" +git-tree-sha1 = "cd56bf18ed715e8b09f06ef8c6b781e6cdc49911" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.3.4" +version = "1.4.4" [[deps.Statistics]] deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [[deps.StatsAPI]] -git-tree-sha1 = "d88665adc9bcf45903013af0982e2fd05ae3d0a6" +deps = ["LinearAlgebra"] +git-tree-sha1 = "c82aaa13b44ea00134f8c9c89819477bd3986ecd" uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0" -version = "1.2.0" +version = "1.3.0" [[deps.StatsBase]] deps = ["DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"] -git-tree-sha1 = "51383f2d367eb3b444c961d485c565e4c0cf4ba0" +git-tree-sha1 = "8977b17906b0a1cc74ab2e3a05faa16cf08a8291" uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" -version = "0.33.14" +version = "0.33.16" [[deps.StatsFuns]] deps = ["ChainRulesCore", "InverseFunctions", "IrrationalConstants", "LogExpFunctions", "Reexport", "Rmath", "SpecialFunctions"] -git-tree-sha1 = "f35e1879a71cca95f4826a14cdbf0b9e253ed918" +git-tree-sha1 = "5950925ff997ed6fb3e985dcce8eb1ba42a0bbe7" uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c" -version = "0.9.15" +version = "0.9.18" [[deps.SuiteSparse]] deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] @@ -460,10 +467,10 @@ uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c" version = "1.0.1" [[deps.Tables]] -deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "TableTraits", "Test"] -git-tree-sha1 = "bb1064c9a84c52e277f1096cf41434b675cd368b" +deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits", "Test"] +git-tree-sha1 = "5ce79ce186cc678bbb5c5681ca3379d1ddae11a1" uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" -version = "1.6.1" +version = "1.7.0" [[deps.Tar]] deps = ["ArgTools", "SHA"] @@ -482,15 +489,15 @@ uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" [[deps.Unitful]] deps = ["ConstructionBase", "Dates", "LinearAlgebra", "Random"] -git-tree-sha1 = "b95e0b8a8d1b6a6c3e0b3ca393a7a285af47c264" +git-tree-sha1 = "b649200e887a487468b71821e2644382699f1b0f" uuid = "1986cc42-f94f-5a68-af5c-568840ba703d" -version = "1.10.1" +version = "1.11.0" [[deps.VectorizationBase]] deps = ["ArrayInterface", "CPUSummary", "HostCPUFeatures", "Hwloc", "IfElse", "LayoutPointers", "Libdl", "LinearAlgebra", "SIMDTypes", "Static"] -git-tree-sha1 = "e9a35d501b24c127af57ca5228bcfb806eda7507" +git-tree-sha1 = "858e541ffc21873e45aeaf744e0d015966e0328e" uuid = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f" -version = "0.21.24" +version = "0.21.30" [[deps.Zlib_jll]] deps = ["Libdl"] diff --git a/Project.toml b/Project.toml index 78f01a9..b8c9d4f 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ModiaResult" uuid = "16a87621-1533-42f6-8e19-4a825980cec2" authors = ["Martin.Otter@dlr.de "] -version = "0.4.0" +version = "0.4.3" [deps] DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" diff --git a/docs/src/Functions.md b/docs/src/Functions.md index b93f02d..74e6a3f 100644 --- a/docs/src/Functions.md +++ b/docs/src/Functions.md @@ -1,5 +1,7 @@ # Functions +## Overview + ```@meta CurrentModule = ModiaResult ``` diff --git a/docs/src/index.md b/docs/src/index.md index b590ab8..e2cebd0 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -138,6 +138,23 @@ are different to the Python 2.x version. ## Release Notes +### Version 0.4.3 + +- Internal bug fixed. + + +### Version 0.4.2 + +- `printResultInfo(..)` and `resultInfo(..)` improved + (signals with one value defined with ModiaResult.OneValueVector are specially marked, + for example parameters). + + +### Version 0.4.1 + +- Update of Manifest.toml file + + ### Version 0.4.0 - Require Julia 1.7 diff --git a/src/ModiaResult.jl b/src/ModiaResult.jl index 5af69f9..cf3838e 100644 --- a/src/ModiaResult.jl +++ b/src/ModiaResult.jl @@ -2,12 +2,12 @@ module ModiaResult const path = dirname(dirname(@__FILE__)) +include("ResultViews.jl") include("AbstractInterface.jl") include("NoPlot.jl") include("SilentNoPlot.jl") include("Utilities.jl") include("OverloadedMethods.jl") #include("CompareResults.jl") -include("ResultViews.jl") end # module diff --git a/src/Utilities.jl b/src/Utilities.jl index 9c1b566..92a4f46 100644 --- a/src/Utilities.jl +++ b/src/Utilities.jl @@ -169,29 +169,50 @@ function resultInfo(result) return end - resultInfoTable = DataFrames.DataFrame(name=String[], unit=String[], nTime=String[], signalType=String[], valueSize=String[], eltype=String[]) - + name2 = String[] + unit2 = String[] + nTime2 = String[] + signalType2 = String[] + valueSize2 = String[] + eltype2 = String[] + timeSigName = timeSignalName(result) for name in signalNames(result) - (signalType, nTime, valueSize, elType, sigUnit) = signalInfo(result, name) + (signalType, nTime, valueSize, elType, sigUnit, oneSigValue) = signalInfo2(result, name) if isnothing(elType) - sigUnit2 = "???" - nTime2 = "???" - signalType2 = "???" - valueSize2 = "???" - elType2 = "???" + sigUnit3 = "???" + nTime3 = "???" + signalType3 = "???" + valueSize3 = "???" + eltype3 = "???" else - sigUnit2 = sigUnit isa Nothing ? "???" : string(sigUnit) - nTime2 = name==timeSigName && !hasOneTimeSignal(result) ? "---" : string(nTime) - signalType2 = signalTypeToString[Int(signalType)] - valueSize2 = valueSize isa Nothing ? "()" : string(valueSize) - elType2 = string(elType) + sigUnit3 = sigUnit isa Nothing ? "???" : string(sigUnit) + nTime3 = name==timeSigName && !hasOneTimeSignal(result) ? "---" : (oneSigValue ? string(nTime)*"*" : string(nTime)) + signalType3 = signalTypeToString[Int(signalType)] + valueSize3 = valueSize isa Nothing ? "()" : string(valueSize) + eltype3 = string(elType) end - push!(resultInfoTable, [name, sigUnit2, nTime2, signalType2, valueSize2, elType2] ) + if signalType3 == "Independent" + pushfirst!(name2 , name) + pushfirst!(unit2 , sigUnit3) + pushfirst!(nTime2 , nTime3) + pushfirst!(signalType2, signalType3) + pushfirst!(valueSize2 , valueSize3) + pushfirst!(eltype2 , eltype3) + else + push!(name2 , name) + push!(unit2 , sigUnit3) + push!(nTime2 , nTime3) + push!(signalType2, signalType3) + push!(valueSize2 , valueSize3) + push!(eltype2 , eltype3) + end end + resultInfoTable = DataFrames.DataFrame(name=name2, unit=unit2, nTime=nTime2, signalType=signalType2, valueSize=valueSize2, eltype=eltype2) + return resultInfoTable end @@ -209,7 +230,9 @@ using Unitful ModiaResult.@usingModiaPlot t = range(0.0, stop=10.0, length=100) -result = OrderedDict{String,Any}("time"=> t*u"s", "phi" => sin.(t)*u"rad") +result = OrderedDict{String,Any}("time"=> t*u"s", + "phi" => sin.(t)*u"rad", + "A" => OneValueVector(2.0, length(t))) printResultInfo(result) # Gives output: @@ -217,6 +240,8 @@ printResultInfo(result) ───┼─────────────────────────────────────────────────── 1 │ time s 100 Independent () Float64 2 │ phi rad 100 Continuous () Float64 + 3 | A 100* Continuous () Float64 + *: Signal stored as ModiaResult.OneValueVector (e.g. parameter) ``` """ @@ -224,6 +249,7 @@ function printResultInfo(result)::Nothing resultInfoTable = resultInfo(result) show(stdout, resultInfoTable, summary=false, rowlabel=Symbol("#"), allcols=true, eltypes=false, truncate=50) println(stdout) + println("*: Signal stored as ModiaResult.OneValueVector (e.g. parameter)\n") return nothing end @@ -386,19 +412,50 @@ If `name` is defined, but no signal is available (= nothing, missing or zero len return `nTime=0` and `nothing` for `sigSize, sigElType, sigUnit`. """ function signalInfo(result, name::AbstractString) + (sigType, nTime, valueSize, valueElType, valueUnit, oneSigValue) = signalInfo2(result,name) + return (sigType, nTime, valueSize, valueElType, valueUnit) +end + + +""" + (sigType, nTime, sigSize, sigElType, sigUnit, oneSigValue) = signalInfo2(result, name) + +Return information about a signal, given the `name` of the signal in `result`. +The difference to `signalInfo(..)` is that additionally the information is returned, +whether the signals consists only of one value. + +- `sigType::SignalType`: Ìnterpolation type of signal. + +- `nTime::Int`: Number of signal time points. + +- `sigSize`: size(signal[1][1]) + +- `sigElType`: ustrip( eltype(signal[1][1]) ), that is the element type of the signal without unit. + +- `sigUnit`: Unit of signal + +- `oneSigValue`: = true, at all time instants, the signal has identical values (e.g. if parameter defined with OneValueVector). + = false, signal has potentially different values at different time instants (which might be an array + +If `name` is defined, but no signal is available (= nothing, missing or zero length), +return `nTime=0` and `nothing` for `sigSize, sigElType, sigUnit, oneSigValue`. +""" +function signalInfo2(result, name::AbstractString) (timeSignal, signal, sigType) = rawSignal(result,name) if ismissing(signal) || isnothing(signal) || !(typeof(signal) <: AbstractArray) || signalLength(signal) == 0 hasDimensionMismatch(signal, name, timeSignal, timeSignalName(result)) - return (sigType, 0, nothing, nothing, nothing) + return (sigType, 0, nothing, nothing, nothing, nothing) end + oneSigValue = length(signal) == 1 && typeof(signal[1]) <: OneValueVector + value = signal[1][1] if value isa Number || value isa AbstractArray valueSize = size(value) valueUnit = unit(value[1]) else hasDimensionMismatch(signal, name, timeSignal, timeSignalName(result)) - return (sigType, signalLength(timeSignal), nothing, typeof(value), nothing) + return (sigType, signalLength(timeSignal), nothing, typeof(value), nothing, oneSigValue) end if typeof(value) <: MonteCarloMeasurements.Particles @@ -413,7 +470,7 @@ function signalInfo(result, name::AbstractString) valueElType = typeof( ustrip.(value) ) end nTime = signalLength(timeSignal) - return (sigType, nTime, valueSize, valueElType, valueUnit) + return (sigType, nTime, valueSize, valueElType, valueUnit, oneSigValue) end diff --git a/test/test_20_SeveralSignalsInOneDiagram.jl b/test/test_20_SeveralSignalsInOneDiagram.jl index 14fa454..0e0b145 100644 --- a/test/test_20_SeveralSignalsInOneDiagram.jl +++ b/test/test_20_SeveralSignalsInOneDiagram.jl @@ -14,10 +14,11 @@ result["phi"] = sin.(t)u"rad" result["phi2"] = 0.5 * sin.(t)u"rad" result["w"] = cos.(t)u"rad/s" result["w2"] = 0.6 * cos.(t)u"rad/s" +result["A"] = ModiaResult.OneValueVector(0.6, length(t)) println("\n... test_20_SeveralSignalsInOneDiagram:") ModiaResult.printResultInfo(result) -plot(result, ("phi", "phi2", "w", "w2"), heading="Several signals in one diagram") +plot(result, ("phi", "phi2", "w", "w2", "A"), heading="Several signals in one diagram") end