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

Code generation: unit scaling for rate computation is the other way round #1240

Closed
agarny opened this issue Jul 3, 2024 · 0 comments · Fixed by #1241
Closed

Code generation: unit scaling for rate computation is the other way round #1240

agarny opened this issue Jul 3, 2024 · 0 comments · Fixed by #1241
Assignees

Comments

@agarny
Copy link
Contributor

agarny commented Jul 3, 2024

Say that the VOI is defined in seconds in a component called environment and that a state , x expressed in metres, has its rate computed in a component called main using the VOI expressed in milliseconds. Right now, our code generator would generate something like:

rate[0] = 0.001*...;

while it should generate something like:

rate[0] = 1000.0*...;

Indeed, the rate of x in main is expressed in metres per milliseconds, but to compute the model we need it to be expressed in metres per seconds, hence we need to multiply the calculation of the rate of x by 1000.0 and not by 0.001.

To multiply by 0.001 would be needed if x had been expressed in kiloseconds (!!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant