diff --git a/docs/Manifest.toml b/docs/Manifest.toml index 9752204..0574865 100644 --- a/docs/Manifest.toml +++ b/docs/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.9.1" manifest_format = "2.0" -project_hash = "802978382ea37f5cc71ba488b34f39d75e534523" +project_hash = "d7be50ff01e3cc91c96d7b9f8edaa162fd007a28" [[deps.ANSIColoredPrinters]] git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c" @@ -16,9 +16,68 @@ version = "1.1.1" [[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +[[deps.AssetRegistry]] +deps = ["Distributed", "JSON", "Pidfile", "SHA", "Test"] +git-tree-sha1 = "b25e88db7944f98789130d7b503276bc34bc098e" +uuid = "bf4720bc-e11a-5d0c-854e-bdca1663c893" +version = "0.1.0" + [[deps.Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" +[[deps.BitFlags]] +git-tree-sha1 = "43b1a4a8f797c1cddadf60499a8a077d4af2cd2d" +uuid = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35" +version = "0.1.7" + +[[deps.Blink]] +deps = ["Base64", "Distributed", "HTTP", "JSExpr", "JSON", "Lazy", "Logging", "MacroTools", "Mustache", "Mux", "Pkg", "Reexport", "Sockets", "WebIO"] +git-tree-sha1 = "b1c61fd7e757c7e5ca6521ef41df8d929f41e3af" +uuid = "ad839575-38b3-5650-b840-f874b8c74a25" +version = "0.12.8" + +[[deps.CSV]] +deps = ["CodecZlib", "Dates", "FilePathsBase", "InlineStrings", "Mmap", "Parsers", "PooledArrays", "PrecompileTools", "SentinelArrays", "Tables", "Unicode", "WeakRefStrings", "WorkerUtilities"] +git-tree-sha1 = "44dbf560808d49041989b8a96cae4cffbeb7966a" +uuid = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" +version = "0.10.11" + +[[deps.CodecZlib]] +deps = ["TranscodingStreams", "Zlib_jll"] +git-tree-sha1 = "02aa26a4cf76381be7f66e020a3eddeb27b0a092" +uuid = "944b1d66-785c-5afd-91f1-9de20f533193" +version = "0.7.2" + +[[deps.ColorSchemes]] +deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"] +git-tree-sha1 = "d9a8f86737b665e15a9641ecbac64deef9ce6724" +uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4" +version = "3.23.0" + +[[deps.ColorTypes]] +deps = ["FixedPointNumbers", "Random"] +git-tree-sha1 = "eb7f0f8307f71fac7c606984ea5fb2817275d6e4" +uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" +version = "0.11.4" + +[[deps.ColorVectorSpace]] +deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "Requires", "Statistics", "TensorCore"] +git-tree-sha1 = "a1f44953f2382ebb937d60dafbe2deea4bd23249" +uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4" +version = "0.10.0" + + [deps.ColorVectorSpace.extensions] + SpecialFunctionsExt = "SpecialFunctions" + + [deps.ColorVectorSpace.weakdeps] + SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" + +[[deps.Colors]] +deps = ["ColorTypes", "FixedPointNumbers", "Reexport"] +git-tree-sha1 = "fc08e5930ee9a4e03f84bfb5211cb54e7769758a" +uuid = "5ae59095-9a9b-59fe-a467-6f913c188581" +version = "0.12.10" + [[deps.Compat]] deps = ["UUIDs"] git-tree-sha1 = "e460f044ca8b99be31d35fe54fc33a5c33dd8ed7" @@ -34,6 +93,12 @@ deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" version = "1.0.2+0" +[[deps.ConcurrentUtilities]] +deps = ["Serialization", "Sockets"] +git-tree-sha1 = "5372dbbf8f0bdb8c700db5367132925c0771ef7e" +uuid = "f0e56b4a-5159-44fe-b623-3e5288b988bb" +version = "2.2.1" + [[deps.Crayons]] git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15" uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" @@ -65,6 +130,16 @@ version = "1.0.0" deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" +[[deps.DelimitedFiles]] +deps = ["Mmap"] +git-tree-sha1 = "9e2f36d3c96a820c678f2f1f1782582fcf685bae" +uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" +version = "1.9.1" + +[[deps.Distributed]] +deps = ["Random", "Serialization", "Sockets"] +uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" + [[deps.DocStringExtensions]] deps = ["LibGit2"] git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d" @@ -82,13 +157,55 @@ deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" version = "1.6.0" +[[deps.ExceptionUnwrapping]] +deps = ["Test"] +git-tree-sha1 = "e90caa41f5a86296e014e148ee061bd6c3edec96" +uuid = "460bff9d-24e4-43bc-9d9f-a8973cb893f4" +version = "0.1.9" + +[[deps.FilePathsBase]] +deps = ["Compat", "Dates", "Mmap", "Printf", "Test", "UUIDs"] +git-tree-sha1 = "e27c4ebe80e8699540f2d6c805cc12203b614f12" +uuid = "48062228-2e41-5def-b9a4-89aafe57970f" +version = "0.9.20" + [[deps.FileWatching]] uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" +[[deps.FixedPointNumbers]] +deps = ["Statistics"] +git-tree-sha1 = "335bfdceacc84c5cdf16aadc768aa5ddfc5383cc" +uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" +version = "0.8.4" + +[[deps.FunctionalCollections]] +deps = ["Test"] +git-tree-sha1 = "04cb9cfaa6ba5311973994fe3496ddec19b6292a" +uuid = "de31a74c-ac4f-5751-b3fd-e18cd04993ca" +version = "0.5.0" + [[deps.Future]] deps = ["Random"] uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" +[[deps.HTTP]] +deps = ["Base64", "CodecZlib", "ConcurrentUtilities", "Dates", "ExceptionUnwrapping", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "OpenSSL", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"] +git-tree-sha1 = "cb56ccdd481c0dd7f975ad2b3b62d9eda088f7e2" +uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" +version = "1.9.14" + +[[deps.Hiccup]] +deps = ["MacroTools", "Test"] +git-tree-sha1 = "6187bb2d5fcbb2007c39e7ac53308b0d371124bd" +uuid = "9fb69e20-1954-56bb-a84f-559cc56a8ff7" +version = "0.2.2" + +[[deps.HypertextLiteral]] +deps = ["Tricks"] +git-tree-sha1 = "c47c5fa4c5308f27ccaac35504858d8914e102f9" +uuid = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2" +version = "0.9.4" + [[deps.IOCapture]] deps = ["Logging", "Random"] git-tree-sha1 = "d75853a0bdbfb1ac815478bacd89cd27b550ace6" @@ -121,17 +238,35 @@ git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca" uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" version = "1.5.0" +[[deps.JSExpr]] +deps = ["JSON", "MacroTools", "Observables", "WebIO"] +git-tree-sha1 = "b413a73785b98474d8af24fd4c8a975e31df3658" +uuid = "97c1335a-c9c5-57fe-bc5d-ec35cebe8660" +version = "0.5.4" + [[deps.JSON]] deps = ["Dates", "Mmap", "Parsers", "Unicode"] git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a" uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" version = "0.21.4" +[[deps.Kaleido_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "43032da5832754f58d14a91ffbe86d5f176acda9" +uuid = "f7e6163d-2fa5-5f23-b69c-1db539e41963" +version = "0.2.1+0" + [[deps.LaTeXStrings]] git-tree-sha1 = "f2355693d6778a178ade15952b7ac47a4ff97996" uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" version = "1.3.0" +[[deps.Lazy]] +deps = ["MacroTools"] +git-tree-sha1 = "1370f8202dac30758f3c345f9909b97f53d87d3f" +uuid = "50d2b5c4-7a5e-59d5-8109-a42b560f39c0" +version = "0.15.1" + [[deps.LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" @@ -173,10 +308,28 @@ uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" +[[deps.LoggingExtras]] +deps = ["Dates", "Logging"] +git-tree-sha1 = "a03c77519ab45eb9a34d3cfe2ca223d79c064323" +uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36" +version = "1.0.1" + +[[deps.MacroTools]] +deps = ["Markdown", "Random"] +git-tree-sha1 = "9ee1618cbf5240e6d4e0371d6f24065083f60c48" +uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" +version = "0.5.11" + [[deps.Markdown]] deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" +[[deps.MbedTLS]] +deps = ["Dates", "MbedTLS_jll", "MozillaCACerts_jll", "Random", "Sockets"] +git-tree-sha1 = "03a9b9718f5682ecb107ac9f7308991db4ce395b" +uuid = "739be429-bea8-5141-9913-cc70e7f3736d" +version = "1.1.7" + [[deps.MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" @@ -195,6 +348,18 @@ uuid = "a63ad114-7e13-5084-954f-fe012c677804" uuid = "14a3606d-f60d-562e-9121-12d972cd8159" version = "2022.10.11" +[[deps.Mustache]] +deps = ["Printf", "Tables"] +git-tree-sha1 = "821e918c170ead5298ff84bffee41dd28929a681" +uuid = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70" +version = "1.0.17" + +[[deps.Mux]] +deps = ["AssetRegistry", "Base64", "HTTP", "Hiccup", "MbedTLS", "Pkg", "Sockets"] +git-tree-sha1 = "0bdaa479939d2a1f85e2f93e38fbccfcb73175a5" +uuid = "a975b10e-0019-58db-a62f-e48ff68538c9" +version = "1.0.1" + [[deps.NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" version = "1.2.0" @@ -205,27 +370,90 @@ path = ".." uuid = "0f4fe800-344e-11e9-2949-fb537ad918e1" version = "0.2.1" +[[deps.Observables]] +git-tree-sha1 = "6862738f9796b3edc1c09d0890afce4eca9e7e93" +uuid = "510215fc-4207-5dde-b226-833fc4488ee2" +version = "0.5.4" + [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" version = "0.3.21+4" +[[deps.OpenSSL]] +deps = ["BitFlags", "Dates", "MozillaCACerts_jll", "OpenSSL_jll", "Sockets"] +git-tree-sha1 = "51901a49222b09e3743c65b8847687ae5fc78eb2" +uuid = "4d8831e6-92b7-49fb-bdf8-b643e874388c" +version = "1.4.1" + +[[deps.OpenSSL_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "e78db7bd5c26fc5a6911b50a47ee302219157ea8" +uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" +version = "3.0.10+0" + [[deps.OrderedCollections]] git-tree-sha1 = "2e73fe17cac3c62ad1aebe70d44c963c3cfdc3e3" uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" version = "1.6.2" +[[deps.PackageExtensionCompat]] +git-tree-sha1 = "f9b1e033c2b1205cf30fd119f4e50881316c1923" +uuid = "65ce6f38-6b18-4e1d-a461-8949797d7930" +version = "1.0.1" +weakdeps = ["Requires", "TOML"] + +[[deps.Parameters]] +deps = ["OrderedCollections", "UnPack"] +git-tree-sha1 = "34c0e9ad262e5f7fc75b10a9952ca7692cfc5fbe" +uuid = "d96e819e-fc66-5662-9728-84c9c7592b0a" +version = "0.12.3" + [[deps.Parsers]] deps = ["Dates", "PrecompileTools", "UUIDs"] git-tree-sha1 = "716e24b21538abc91f6205fd1d8363f39b442851" uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" version = "2.7.2" +[[deps.Pidfile]] +deps = ["FileWatching", "Test"] +git-tree-sha1 = "2d8aaf8ee10df53d0dfb9b8ee44ae7c04ced2b03" +uuid = "fa939f87-e72e-5be4-a000-7fc836dbe307" +version = "1.3.0" + [[deps.Pkg]] deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" version = "1.9.0" +[[deps.PlotlyBase]] +deps = ["ColorSchemes", "Dates", "DelimitedFiles", "DocStringExtensions", "JSON", "LaTeXStrings", "Logging", "Parameters", "Pkg", "REPL", "Requires", "Statistics", "UUIDs"] +git-tree-sha1 = "56baf69781fc5e61607c3e46227ab17f7040ffa2" +uuid = "a03496cd-edff-5a9b-9e67-9cda94a718b5" +version = "0.8.19" + +[[deps.PlotlyDocumenter]] +deps = ["Downloads", "HypertextLiteral", "PackageExtensionCompat", "Random"] +git-tree-sha1 = "c42bc5883983a4da70961123a257e09bf2210802" +uuid = "9b90f1cd-2639-4507-8b17-2fbe371ceceb" +version = "0.1.2" + + [deps.PlotlyDocumenter.extensions] + PlotlyBaseExt = "PlotlyBase" + PlotlyJSExt = "PlotlyJS" + PlotlyLightExt = "PlotlyLight" + + [deps.PlotlyDocumenter.weakdeps] + PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5" + PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a" + PlotlyLight = "ca7969ec-10b3-423e-8d99-40f33abb42bf" + +[[deps.PlotlyJS]] +deps = ["Base64", "Blink", "DelimitedFiles", "JSExpr", "JSON", "Kaleido_jll", "Markdown", "Pkg", "PlotlyBase", "REPL", "Reexport", "Requires", "WebIO"] +git-tree-sha1 = "7452869933cd5af22f59557390674e8679ab2338" +uuid = "f0f68f2c-4968-5e81-91da-67840de0976a" +version = "0.18.10" + [[deps.PooledArrays]] deps = ["DataAPI", "Future"] git-tree-sha1 = "a6062fe4063cdafe78f4a0a81cfffb89721b30e7" @@ -267,6 +495,12 @@ git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" uuid = "189a3867-3050-52da-a836-e630ba90ab69" version = "1.2.2" +[[deps.Requires]] +deps = ["UUIDs"] +git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7" +uuid = "ae029012-a4dd-5104-9daa-d747884805df" +version = "1.3.0" + [[deps.SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" version = "0.7.0" @@ -280,6 +514,11 @@ version = "1.4.0" [[deps.Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" +[[deps.SimpleBufferStream]] +git-tree-sha1 = "874e8867b33a00e784c8a7e4b60afe9e037b74e1" +uuid = "777ac1f9-54b0-4bf8-805c-2214025038e7" +version = "1.1.0" + [[deps.Sockets]] uuid = "6462fe0b-24de-5631-8697-dd941f90decc" @@ -330,17 +569,73 @@ deps = ["ArgTools", "SHA"] uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" version = "1.10.0" +[[deps.TensorCore]] +deps = ["LinearAlgebra"] +git-tree-sha1 = "1feb45f88d133a655e001435632f019a9a1bcdb6" +uuid = "62fd8b95-f654-4bbd-a8a5-9c27f68ccd50" +version = "0.1.1" + [[deps.Test]] deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +[[deps.TranscodingStreams]] +deps = ["Random", "Test"] +git-tree-sha1 = "9a6ae7ed916312b41236fcef7e0af564ef934769" +uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" +version = "0.9.13" + +[[deps.Tricks]] +git-tree-sha1 = "aadb748be58b492045b4f56166b5188aa63ce549" +uuid = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775" +version = "0.1.7" + +[[deps.URIs]] +git-tree-sha1 = "b7a5e99f24892b6824a954199a45e9ffcc1c70f0" +uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" +version = "1.5.0" + [[deps.UUIDs]] deps = ["Random", "SHA"] uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" +[[deps.UnPack]] +git-tree-sha1 = "387c1f73762231e86e0c9c5443ce3b4a0a9a0c2b" +uuid = "3a884ed6-31ef-47d7-9d2a-63182c4928ed" +version = "1.0.2" + [[deps.Unicode]] uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" +[[deps.WeakRefStrings]] +deps = ["DataAPI", "InlineStrings", "Parsers"] +git-tree-sha1 = "b1be2855ed9ed8eac54e5caff2afcdb442d52c23" +uuid = "ea10d353-3f73-51f8-a26c-33c1cb351aa5" +version = "1.4.2" + +[[deps.WebIO]] +deps = ["AssetRegistry", "Base64", "Distributed", "FunctionalCollections", "JSON", "Logging", "Observables", "Pkg", "Random", "Requires", "Sockets", "UUIDs", "WebSockets", "Widgets"] +git-tree-sha1 = "0eef0765186f7452e52236fa42ca8c9b3c11c6e3" +uuid = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29" +version = "0.8.21" + +[[deps.WebSockets]] +deps = ["Base64", "Dates", "HTTP", "Logging", "Sockets"] +git-tree-sha1 = "4162e95e05e79922e44b9952ccbc262832e4ad07" +uuid = "104b5d7c-a370-577a-8038-80a2059c5097" +version = "1.6.0" + +[[deps.Widgets]] +deps = ["Colors", "Dates", "Observables", "OrderedCollections"] +git-tree-sha1 = "fcdae142c1cfc7d89de2d11e08721d0f2f86c98a" +uuid = "cc8bc4a8-27d6-5769-a93b-9d913e69aa62" +version = "0.6.6" + +[[deps.WorkerUtilities]] +git-tree-sha1 = "cd1659ba0d57b71a464a29e64dbc67cfe83d54e7" +uuid = "76eceee3-57b5-4d4a-8e66-0e911cebbf60" +version = "1.6.1" + [[deps.XML2_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Pkg", "Zlib_jll"] git-tree-sha1 = "93c41695bc1c08c46c5899f4fe06d6ead504bb73" diff --git a/docs/Project.toml b/docs/Project.toml index a33bb22..650d88b 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,6 +1,10 @@ [deps] +CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" +DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" OMJulia = "0f4fe800-344e-11e9-2949-fb537ad918e1" +PlotlyDocumenter = "9b90f1cd-2639-4507-8b17-2fbe371ceceb" +PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a" [compat] Documenter = "^0.27" diff --git a/docs/src/assets/logo-large-dark.svg b/docs/src/assets/logo-large-dark.svg new file mode 100644 index 0000000..46806be --- /dev/null +++ b/docs/src/assets/logo-large-dark.svg @@ -0,0 +1,133 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/assets/logo.svg b/docs/src/assets/logo.svg new file mode 100644 index 0000000..9f861ff --- /dev/null +++ b/docs/src/assets/logo.svg @@ -0,0 +1,116 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/quickstart.md b/docs/src/quickstart.md index 4d3b5dc..3bc3a98 100644 --- a/docs/src/quickstart.md +++ b/docs/src/quickstart.md @@ -2,7 +2,12 @@ ## ModelicaSystem -To simulate Modelica model `BouncingBall` +To simulate Modelica model `BouncingBall` start a new [`OMJulia.OMCSession`](@ref) and create a +new [`ModelicaSystem`](@ref) to build the BouncingBall model. + +!!! info + The BouncingBall.mo file can be found in your OpenModelica installation directory in + `/share/doc/omc/testmodels/BouncingBall.mo` ```modelica model BouncingBall @@ -30,31 +35,39 @@ equation end BouncingBall; ``` -!!! info - The BouncingBall.mo file can be found in your OpenModelica installation directory in - `/share/doc/omc/testmodels/BouncingBall.mo` - - -start a new [`OMCSession`](@ref) and create a new [`ModelicaSystem`](@ref) to build the -BouncingBall model. - -```@repl +```@repl ModelicaSystem-example using OMJulia +using CSV, DataFrames, PlotlyJS +using PlotlyDocumenter # hide mod = OMJulia.OMCSession() -omcWorkDoir = mkpath(joinpath("docs", "omc-temp")) # hide -mkpath(omcWorkDoir) # hide -sendExpression(mod, "cd(\"$(omcWorkDoir)\")") # hide ModelicaSystem(mod, joinpath("docs", "testmodels", "BouncingBall.mo"), "BouncingBall") +simulate(mod, + resultfile = "BouncingBall_ref.csv", + simflags = "-override=outputFormat=csv,stopTime=3") + +resultfile = joinpath(getWorkDirectory(mod), "BouncingBall_ref.csv") +df = DataFrame(CSV.File(resultfile)); + +plt = plot(df, + x=:time, y=:h, + mode="lines", + Layout(title="Bouncing Ball", height = 700)) + +sendExpression(mod, "quit()", parsed=false) +``` + +```@example ModelicaSystem-example +PlotlyDocumenter.to_documenter(plt) # hide ``` ## Scripting API with sendExpression -Start a new `OMCSession` and send +Start a new [`OMJulia.OMCSession`](@ref) and send [scripting API](https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/scripting_api.html) -expressions to the omc session with `sendExpression()`. +expressions to the omc session with [`sendExpression()`](@ref). ```@repl using OMJulia @@ -66,19 +79,5 @@ mkpath(omcWorkDoir) # hide sendExpression(omc, "cd(\"$(omcWorkDoir)\")") # hide sendExpression(omc, "model a Real s; equation s=sin(10*time); end a;") sendExpression(omc, "simulate(a)") -OMJulia.sendExpression(omc, "quit()", parsed=false) +sendExpression(omc, "quit()", parsed=false) ``` - -!!! info - Special characters in string arguments need to be escaped. E.g. `"` becomes `\"`. - For example scripting API call - - ```modelica - loadFile("/path/to/M.mo") - ``` - - will translate to - - ```julia - sendExpression(omc, "loadFile(\"/path/to/M.mo\")") - ``` diff --git a/docs/src/sendExpression.md b/docs/src/sendExpression.md index 4ed91f3..e6695cb 100644 --- a/docs/src/sendExpression.md +++ b/docs/src/sendExpression.md @@ -7,3 +7,12 @@ expressions to the omc session with `sendExpression()`. ```@docs sendExpression ``` + +## Examples + +```@repl +using OMJulia # hide +omc = OMCSession() # hide +version = OMJulia.sendExpression(omc, "getVersion()") +sendExpression(omc, "quit()", parsed=false) # hide +``` diff --git a/src/sendExpression.jl b/src/sendExpression.jl index de428cb..c9023a3 100644 --- a/src/sendExpression.jl +++ b/src/sendExpression.jl @@ -34,8 +34,8 @@ See [OpenModelica User's Guide Scripting API](https://openmodelica.org/doc/OpenM for a complete list of all functions. !!! note - Special characters in argument `expr` need to be escaped. - E.g. `"` becomes `\"`. + Some characters in argument `expr` need to be escaped. + E.g. `"` becomes `\\"`. For example scripting API call ```modelica @@ -45,8 +45,31 @@ for a complete list of all functions. will translate to ```julia - sendExpression(omc, "loadFile(\"/path/to/M.mo\")") + sendExpression(omc, "loadFile(\\"/path/to/M.mo\\")") ``` + +!!! warn + On Windows path separation symbol `\\` needs to be escaped and doubled `\\\\` to + prevent warnings. + + ```modelica + loadFile("C:\\\\path\\\\to\\\\M.mo") + ``` + + translate to + + ```julia + sendExpression(omc, "loadFile(\\"C:\\\\\\\\path\\\\\\\\to\\\\\\\\M.mo\\")") # Windows + sendExpression(omc, "loadFile(\\"/c/path/to/M.mo\\")") # Windows + ``` + +## Example + +```julia +using OMJulia +omc = OMJulia.OMCSession() +OMJulia.sendExpression(omc, "getVersion()") +``` """ function sendExpression(omc, expr; parsed=true) if (process_running(omc.omcprocess)) diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000..802f8c9 --- /dev/null +++ b/test/.gitignore @@ -0,0 +1 @@ +/test-*/ diff --git a/test/Manifest.toml b/test/Manifest.toml new file mode 100644 index 0000000..b371ee2 --- /dev/null +++ b/test/Manifest.toml @@ -0,0 +1,124 @@ +# This file is machine-generated - editing it directly is not advised + +julia_version = "1.9.1" +manifest_format = "2.0" +project_hash = "9042cdb9122bd0327898aff0f2e2ca16784d4306" + +[[deps.ANSIColoredPrinters]] +git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c" +uuid = "a4c015fc-c6ff-483c-b24f-f7ea428134e9" +version = "0.0.1" + +[[deps.Base64]] +uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" + +[[deps.Dates]] +deps = ["Printf"] +uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" + +[[deps.DocStringExtensions]] +deps = ["LibGit2"] +git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d" +uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" +version = "0.9.3" + +[[deps.Documenter]] +deps = ["ANSIColoredPrinters", "Base64", "Dates", "DocStringExtensions", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"] +git-tree-sha1 = "39fd748a73dce4c05a9655475e437170d8fb1b67" +uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +version = "0.27.25" + +[[deps.IOCapture]] +deps = ["Logging", "Random"] +git-tree-sha1 = "d75853a0bdbfb1ac815478bacd89cd27b550ace6" +uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89" +version = "0.2.3" + +[[deps.InteractiveUtils]] +deps = ["Markdown"] +uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" + +[[deps.JSON]] +deps = ["Dates", "Mmap", "Parsers", "Unicode"] +git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a" +uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +version = "0.21.4" + +[[deps.LibGit2]] +deps = ["Base64", "NetworkOptions", "Printf", "SHA"] +uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" + +[[deps.Logging]] +uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" + +[[deps.Markdown]] +deps = ["Base64"] +uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" + +[[deps.Mmap]] +uuid = "a63ad114-7e13-5084-954f-fe012c677804" + +[[deps.NetworkOptions]] +uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" +version = "1.2.0" + +[[deps.Parsers]] +deps = ["Dates", "PrecompileTools", "UUIDs"] +git-tree-sha1 = "716e24b21538abc91f6205fd1d8363f39b442851" +uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" +version = "2.7.2" + +[[deps.PrecompileTools]] +deps = ["Preferences"] +git-tree-sha1 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f" +uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" +version = "1.2.0" + +[[deps.Preferences]] +deps = ["TOML"] +git-tree-sha1 = "7eb1686b4f04b82f96ed7a4ea5890a4f0c7a09f1" +uuid = "21216c6a-2e73-6563-6e65-726566657250" +version = "1.4.0" + +[[deps.Printf]] +deps = ["Unicode"] +uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" + +[[deps.REPL]] +deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] +uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" + +[[deps.Random]] +deps = ["SHA", "Serialization"] +uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" + +[[deps.SHA]] +uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" +version = "0.7.0" + +[[deps.SafeTestsets]] +git-tree-sha1 = "81ec49d645af090901120a1542e67ecbbe044db3" +uuid = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" +version = "0.1.0" + +[[deps.Serialization]] +uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" + +[[deps.Sockets]] +uuid = "6462fe0b-24de-5631-8697-dd941f90decc" + +[[deps.TOML]] +deps = ["Dates"] +uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" +version = "1.0.3" + +[[deps.Test]] +deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] +uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[[deps.UUIDs]] +deps = ["Random", "SHA"] +uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" + +[[deps.Unicode]] +uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" diff --git a/test/Project.toml b/test/Project.toml new file mode 100644 index 0000000..df0b0dd --- /dev/null +++ b/test/Project.toml @@ -0,0 +1,4 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/omcTest.jl b/test/omcTest.jl new file mode 100644 index 0000000..b7df6f7 --- /dev/null +++ b/test/omcTest.jl @@ -0,0 +1,62 @@ +#= +This file is part of OpenModelica. +Copyright (c) 1998-2023, Open Source Modelica Consortium (OSMC), +c/o Linköpings universitet, Department of Computer and Information Science, +SE-58183 Linköping, Sweden. + +All rights reserved. + +THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE +GPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2. +ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES +RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, +ACCORDING TO RECIPIENTS CHOICE. + +The OpenModelica software and the OSMC (Open Source Modelica Consortium) +Public License (OSMC-PL) are obtained from OSMC, either from the above +address, from the URLs: http://www.openmodelica.org or +http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica +distribution. GNU version 3 is obtained from: +http://www.gnu.org/copyleft/gpl.html. The New BSD License is obtained from: +http://www.opensource.org/licenses/BSD-3-Clause. + +This program is distributed WITHOUT ANY WARRANTY; without even the implied +warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS +EXPRESSLY SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE +CONDITIONS OF OSMC-PL. +=# + +using Test +import OMJulia + +@testset "OpenModelica" begin + @testset "OMCSession" begin + olddir = pwd() + try + workdir = abspath(joinpath(@__DIR__, "test-session")) + rm(workdir, recursive=true, force=true) + mkpath(workdir) + cd(workdir) + + omc = OMJulia.OMCSession() + version = OMJulia.sendExpression(omc, "getVersion()") + @test startswith(version, "v1.") + a = OMJulia.sendExpression(omc, "model a end a;") + @test a == [:a] + + classNames = OMJulia.sendExpression(omc, "getClassNames()") + @test classNames == [:a] + @test true == OMJulia.sendExpression(omc, "loadModel(Modelica)") + res = OMJulia.sendExpression(omc, "simulate(Modelica.Electrical.Analog.Examples.CauerLowPassAnalog)") + @test isfile(res["resultFile"]) + @test occursin("The simulation finished successfully.", res["messages"]) + + @test 3 == OMJulia.sendExpression(omc, "1+2") + + ret = OMJulia.sendExpression(omc, "quit()", parsed=false) + @test ret == "quit requested, shutting server down\n" + finally + cd(olddir) + end + end +end diff --git a/test/parserTest.jl b/test/parserTest.jl new file mode 100644 index 0000000..6ce5f96 --- /dev/null +++ b/test/parserTest.jl @@ -0,0 +1,56 @@ +#= +This file is part of OpenModelica. +Copyright (c) 1998-2023, Open Source Modelica Consortium (OSMC), +c/o Linköpings universitet, Department of Computer and Information Science, +SE-58183 Linköping, Sweden. + +All rights reserved. + +THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE +GPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2. +ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES +RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, +ACCORDING TO RECIPIENTS CHOICE. + +The OpenModelica software and the OSMC (Open Source Modelica Consortium) +Public License (OSMC-PL) are obtained from OSMC, either from the above +address, from the URLs: http://www.openmodelica.org or +http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica +distribution. GNU version 3 is obtained from: +http://www.gnu.org/copyleft/gpl.html. The New BSD License is obtained from: +http://www.opensource.org/licenses/BSD-3-Clause. + +This program is distributed WITHOUT ANY WARRANTY; without even the implied +warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS +EXPRESSLY SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE +CONDITIONS OF OSMC-PL. +=# + +using OMJulia + +function check(string, expected_value, expected_type) + value = OMJulia.Parser.parseOM(string) + expected_value == value && expected_type == typeof(value) +end + +@testset "Parser" begin + @test check("123.0", 123.0, Float64) + @test check("123", 123, Int) + @test check("1.", 1.0, Float64) + @test check(".2", 0.2, Float64) + @test check("1e3", 1e3, Float64) + @test check("1e+2", 1e+2, Float64) + @test check("tRuE", true, Bool) + @test check("false", false, Bool) + @test check("\"ab\\nc\"", "ab\nc", String) + @test check("{\"abc\"}", ["abc"], Array{String,1}) + @test check("{1}", [1], Array{Int,1}) + @test check("{1,2,3}", [1,2,3], Array{Int,1}) + @test check("(1,2,3)", (1,2,3), Tuple{Int,Int,Int}) + @test check("NONE()", nothing, Nothing) + @test check("SOME(1)", 1, Int) + @test check("abc_2", :abc_2, Symbol) + @test check("record ABC end ABC;", Dict(), Dict{String,Any}) + @test check("record ABC a = 1, 'b' = 2,\n c = 3\nend ABC;", Dict("a" => 1, "'b'" => 2, "c" => 3), Dict{String,Int}) + @test check("", nothing, Nothing) +end diff --git a/test/runtests.jl b/test/runtests.jl index 00f95f3..b651927 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,38 +1,35 @@ -module TestOMJulia - using OMJulia - using Test +#= +This file is part of OpenModelica. +Copyright (c) 1998-2023, Open Source Modelica Consortium (OSMC), +c/o Linköpings universitet, Department of Computer and Information Science, +SE-58183 Linköping, Sweden. - function check(string, expected_value, expected_type) - value = OMJulia.Parser.parseOM(string) - expected_value == value && expected_type == typeof(value) - end +All rights reserved. - @testset "OMJulia" begin - @testset "Parser" begin - @test check("123.0", 123.0, Float64) - @test check("123", 123, Int) - @test check("1.", 1.0, Float64) - @test check(".2", 0.2, Float64) - @test check("1e3", 1e3, Float64) - @test check("1e+2", 1e+2, Float64) - @test check("tRuE", true, Bool) - @test check("false", false, Bool) - @test check("\"ab\\nc\"", "ab\nc", String) - @test check("{\"abc\"}", ["abc"], Array{String,1}) - @test check("{1}", [1], Array{Int,1}) - @test check("{1,2,3}", [1,2,3], Array{Int,1}) - @test check("(1,2,3)", (1,2,3), Tuple{Int,Int,Int}) - @test check("NONE()", nothing, Nothing) - @test check("SOME(1)", 1, Int) - @test check("abc_2", :abc_2, Symbol) - @test check("record ABC end ABC;", Dict(), Dict{String,Any}) - @test check("record ABC a = 1, 'b' = 2,\n c = 3\nend ABC;", Dict("a" => 1, "'b'" => 2, "c" => 3), Dict{String,Int}) - @test check("", nothing, Nothing) - end +THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE +GPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2. +ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES +RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, +ACCORDING TO RECIPIENTS CHOICE. - @testset "OpenModelica" begin - omc = OMJulia.OMCSession() - @test 3==OMJulia.sendExpression(omc, "1+2") - end - end +The OpenModelica software and the OSMC (Open Source Modelica Consortium) +Public License (OSMC-PL) are obtained from OSMC, either from the above +address, from the URLs: http://www.openmodelica.org or +http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica +distribution. GNU version 3 is obtained from: +http://www.gnu.org/copyleft/gpl.html. The New BSD License is obtained from: +http://www.opensource.org/licenses/BSD-3-Clause. + +This program is distributed WITHOUT ANY WARRANTY; without even the implied +warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS +EXPRESSLY SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE +CONDITIONS OF OSMC-PL. +=# + +using SafeTestsets +using Test + +@testset "OMJulia" begin + @safetestset "Parsing" begin include("parserTest.jl") end + @safetestset "OMCSession" begin include("omcTest.jl") end end