Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typecast inst.t_offset #16

Merged
merged 4 commits into from
Jul 17, 2024
Merged

typecast inst.t_offset #16

merged 4 commits into from
Jul 17, 2024

Conversation

halentin
Copy link
Contributor

@halentin halentin commented Jul 5, 2024

This is necessary for 32-Bit Support, because Julia defaults to Float64 for floating point numbers even on 32-Bit-Systems

@ThummeTo
Copy link
Owner

can you pls check for similar issues in the other files?

@halentin
Copy link
Contributor Author

I changed 2 more instances that were not strictly necessary / leading to crashes, but nice to have for consistency and type-stability in the returns. If i understand it correctly FMI3 can handle Float64 even on 32-Bit, so typecasting isnt really strictly necessary there.

FMIBase.jl/src/setup.jl

Lines 18 to 27 in f66ff52

t_start = 0.0
warn(fmu, "No `t_start` given, no `t_start` available in the FMU model description, auto-picked `t_start=0.0`.")
end
end
if isnothing(t_stop)
t_stop = getDefaultStopTime(fmu)
if isnothing(t_stop)
t_stop = 1.0

Might be a bit trickier, because it applies to both FMI2 and FMI3. This should be fine if those times dont ever get passed into the FMU without typecasting or promote anything that gets passed. It looks like DifferentialEquations should also work with 32-Bit timespans: SciML/OrdinaryDiffEq.jl#1955

Do you think fixing this is relevant?

@ThummeTo
Copy link
Owner

ThummeTo commented Jul 17, 2024

as far as I know (I am not 100% sure however) time is always 64bit in FMI3 (so fmi3Float64 which always refers to Float64) and 32-bit/64-bit in FMI2 (fmi2Real refers to Float32/Float64 depending on architecture)

according to the signatures in the FMI spec

@ThummeTo ThummeTo merged commit bf8289c into ThummeTo:main Jul 17, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants