Skip to content

Commit

Permalink
examples-fix (#247)
Browse files Browse the repository at this point in the history
* fixed inputs, manipulation

* examples fix: modelica conf 21, multiproc, multi instance

* added differentialequations (examples)

* fixed all examples

* version inc
  • Loading branch information
ThummeTo authored Sep 11, 2024
1 parent 01d4a8d commit b01f18f
Show file tree
Hide file tree
Showing 12 changed files with 373 additions and 116 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FMI"
uuid = "14a09403-18e3-468f-ad8a-74f8dda2d9ac"
authors = ["TT <[email protected]>", "LM <[email protected]>", "JK <[email protected]>"]
version = "0.14.0"
version = "0.14.1"

[deps]
FMIExport = "31b88311-cab6-44ed-ba9c-fe5a9abbd67a"
Expand All @@ -10,6 +10,6 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

[compat]
FMIExport = "0.4.0"
FMIImport = "1.0.0"
FMIImport = "1.0.6"
LinearAlgebra = "1"
julia = "1.6"
1 change: 1 addition & 0 deletions examples/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name = "Examples"

[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
FMI = "14a09403-18e3-468f-ad8a-74f8dda2d9ac"
FMICore = "8af89139-c281-408e-bce2-3005eb87462f"
FMIZoo = "724179cf-c260-40a9-bd27-cccc6fe2f195"
Expand Down
271 changes: 255 additions & 16 deletions examples/src/inputs.ipynb

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions examples/src/manipulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 45,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:14:08.404000Z",
Expand Down Expand Up @@ -56,7 +56,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 46,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:14:08.688000Z",
Expand All @@ -73,7 +73,8 @@
"using FMI: fmi2SetFctGetReal\n",
"using FMIZoo\n",
"using FMICore\n",
"using Plots"
"using Plots\n",
"using DifferentialEquations # for auto solver detection"
]
},
{
Expand Down Expand Up @@ -320,7 +321,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 55,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:16:06.065000Z",
Expand Down Expand Up @@ -354,15 +355,15 @@
"notebook_metadata_filter": "-all"
},
"kernelspec": {
"display_name": "Julia 1.9.1",
"display_name": "Julia 1.10.5",
"language": "julia",
"name": "julia-1.9"
"name": "julia-1.10"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.9.1"
"version": "1.10.5"
},
"nteract": {
"version": "0.28.0"
Expand Down
18 changes: 9 additions & 9 deletions examples/src/modelica_conference_2021.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:16:18.554000Z",
Expand Down Expand Up @@ -57,7 +57,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:16:18.843000Z",
Expand Down Expand Up @@ -165,7 +165,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 17,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:18:05.018000Z",
Expand Down Expand Up @@ -201,7 +201,7 @@
},
"outputs": [],
"source": [
"fmu = loadFMU(pathToFMU)"
"fmu = loadFMU(\"SpringFrictionPendulum1D\", \"Dymola\", \"2022x\")"
]
},
{
Expand Down Expand Up @@ -299,7 +299,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 22,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:18:05.822000Z",
Expand All @@ -311,7 +311,7 @@
"outputs": [],
"source": [
"fmi2Terminate(instanceFMU)\n",
"fmi2FreeInstance(instanceFMU)\n",
"fmi2FreeInstance!(instanceFMU)\n",
"unloadFMU(fmu)"
]
},
Expand All @@ -335,15 +335,15 @@
"notebook_metadata_filter": "-all"
},
"kernelspec": {
"display_name": "Julia 1.8.2",
"display_name": "Julia 1.10.5",
"language": "julia",
"name": "julia-1.8"
"name": "julia-1.10"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.8.2"
"version": "1.10.5"
},
"nteract": {
"version": "0.28.0"
Expand Down
38 changes: 19 additions & 19 deletions examples/src/multiple_instances.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 73,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:18:17.738000Z",
Expand Down Expand Up @@ -74,7 +74,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 74,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:18:18.025000Z",
Expand Down Expand Up @@ -173,9 +173,9 @@
},
"outputs": [],
"source": [
"comp1 = fmi2Instantiate!(myFMU; loggingOn=true)\n",
"comp1Address= comp1.compAddr\n",
"println(comp1)"
"c1 = fmi2Instantiate!(myFMU; loggingOn=true)\n",
"comp1Address = c1.addr\n",
"println(c1)"
]
},
{
Expand All @@ -199,7 +199,7 @@
"outputs": [],
"source": [
"param1 = Dict(\"spring.c\"=>10.0, \"mass_s0\"=>1.0)\n",
"data1 = simulate(comp1, (tStart, tStop); parameters=param1, recordValues=vrs, instantiate=false, freeInstance=false)\n",
"data1 = simulate(c1, (tStart, tStop); parameters=param1, recordValues=vrs, instantiate=false, freeInstance=false)\n",
"fig = plot(data1)"
]
},
Expand All @@ -212,7 +212,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 79,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:20:06.093000Z",
Expand All @@ -223,7 +223,7 @@
},
"outputs": [],
"source": [
"@assert comp1.compAddr === comp1Address"
"@assert c1.addr === comp1Address"
]
},
{
Expand All @@ -248,9 +248,9 @@
},
"outputs": [],
"source": [
"comp2 = fmi2Instantiate!(myFMU; loggingOn=true)\n",
"comp2Address= comp2.compAddr\n",
"println(comp2)"
"c2 = fmi2Instantiate!(myFMU; loggingOn=true)\n",
"comp2Address = c2.addr\n",
"println(c2)"
]
},
{
Expand All @@ -262,7 +262,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 81,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:20:06.145000Z",
Expand Down Expand Up @@ -297,7 +297,7 @@
"outputs": [],
"source": [
"param2 = Dict(\"spring.c\"=>1.0, \"mass.s\"=>2.0)\n",
"data2 = simulateCS(comp2, (tStart, tStop); parameters=param2, recordValues=vrs, instantiate=false, freeInstance=false)\n",
"data2 = simulateCS(c2, (tStart, tStop); parameters=param2, recordValues=vrs, instantiate=false, freeInstance=false)\n",
"plot!(fig, data2)"
]
},
Expand All @@ -310,7 +310,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 83,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:20:06.256000Z",
Expand All @@ -321,7 +321,7 @@
},
"outputs": [],
"source": [
"@assert comp2.compAddr === comp2Address"
"@assert c2.addr === comp2Address"
]
},
{
Expand All @@ -335,7 +335,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 84,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:20:06.260000Z",
Expand Down Expand Up @@ -369,15 +369,15 @@
"notebook_metadata_filter": "-all"
},
"kernelspec": {
"display_name": "Julia 1.8.2",
"display_name": "Julia 1.10.5",
"language": "julia",
"name": "julia-1.8"
"name": "julia-1.10"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.8.2"
"version": "1.10.5"
},
"nteract": {
"version": "0.28.0"
Expand Down
21 changes: 11 additions & 10 deletions examples/src/multiprocessing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:20:18.794000Z",
Expand Down Expand Up @@ -112,7 +112,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:20:27.186000Z",
Expand All @@ -126,6 +126,7 @@
"# imports\n",
"@everywhere using FMI\n",
"@everywhere using FMIZoo\n",
"@everywhere using DifferentialEquations\n",
"@everywhere using BenchmarkTools"
]
},
Expand Down Expand Up @@ -153,7 +154,7 @@
"\n",
"@everywhere println(\"Hello World!\")\n",
"\n",
"# The following lines can be uncommented for more advanced informations about the subprocesses\n",
"# The following lines can be uncommented for more advanced information about the subprocesses\n",
"# @everywhere println(pwd())\n",
"# @everywhere println(Base.active_project())\n",
"# @everywhere println(gethostname())\n",
Expand Down Expand Up @@ -201,7 +202,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:21:32.504000Z",
Expand All @@ -222,7 +223,7 @@
" tspan = (t_start, t_stop)\n",
" tData = collect(t_start:t_step:t_stop)\n",
"\n",
" model_fmu = FMIZoo.loadFMU(\"SpringPendulum1D\", \"Dymola\", \"2022x\")\n",
" model_fmu = loadFMU(\"SpringPendulum1D\", \"Dymola\", \"2022x\"; type=:ME)\n",
"end"
]
},
Expand All @@ -235,7 +236,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:21:40.054000Z",
Expand Down Expand Up @@ -344,7 +345,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-22T13:24:10.627000Z",
Expand All @@ -370,15 +371,15 @@
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.8.2",
"display_name": "Julia 1.10.5",
"language": "julia",
"name": "julia-1.8"
"name": "julia-1.10"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.8.2"
"version": "1.10.5"
}
},
"nbformat": 4,
Expand Down
Loading

2 comments on commit b01f18f

@ThummeTo
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/115002

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.14.1 -m "<description of version>" b01f18f91afbe4a80405dc6771a209dee95b75a8
git push origin v0.14.1

Please sign in to comment.