SciML / ModelingToolkitStandardLibrary.jl

A standard library of components to model the world and beyond
https://docs.sciml.ai/ModelingToolkitStandardLibrary/stable/
MIT License
122 stars 39 forks source link

Several components specify defaults instead of guesses #282

Open avinashresearch1 opened 7 months ago

avinashresearch1 commented 7 months ago

Describe the bug 🐞 Several components e.g., https://github.com/SciML/ModelingToolkitStandardLibrary.jl/blob/02a134cd430b035e43c8c43596d32ecbff1a08d5/src/Electrical/utils.jl#L35 https://github.com/SciML/ModelingToolkitStandardLibrary.jl/blob/02a134cd430b035e43c8c43596d32ecbff1a08d5/src/Electrical/utils.jl#L72 https://github.com/SciML/ModelingToolkitStandardLibrary.jl/blob/02a134cd430b035e43c8c43596d32ecbff1a08d5/src/Electrical/Analog/sensors.jl#L152 https://github.com/SciML/ModelingToolkitStandardLibrary.jl/blob/02a134cd430b035e43c8c43596d32ecbff1a08d5/src/Blocks/continuous.jl#L548 https://github.com/SciML/ModelingToolkitStandardLibrary.jl/blob/02a134cd430b035e43c8c43596d32ecbff1a08d5/src/Blocks/continuous.jl#L621

specify variables with defaults instead of guesses. Specifying a default in MTK v9 would mean that an explicit constraint is added to the initialization problem which often makes the problem infeasible or extremely overdetermined. This would be the equivalent of setting fix = true and specifying astart` value in Modelica.

avinashresearch1 commented 7 months ago

https://github.com/SciML/ModelingToolkitStandardLibrary.jl/pull/281 fixes for some Thermal and Blocks components.

avinashresearch1 commented 6 months ago

Also: should the x passes into FirstOrder be a guess not a default: https://github.com/SciML/ModelingToolkitStandardLibrary.jl/blob/3a8fb0a043ceba9aa5e4dbf49ca6ad3de2e035dc/src/Blocks/continuous.jl#L119

similar for SecondOrder