8000 Include functionality for modifying parameters · Issue #350 · opencor/libopencor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Include functionality for modifying parameters #350

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

Open
FinbarArgus opened this issue Nov 18, 2024 · 1 comment
Open

Include functionality for modifying parameters #350

FinbarArgus opened this issue Nov 18, 2024 · 1 comment
Assignees
Labels
Milestone

Comments

@FinbarArgus
Copy link
FinbarArgus commented Nov 18, 2024

For replacing the Python OpenCOR API with LibOpenCOR, we need to be able to run the following commands:

self.simulation = oc.open_simulation(cellml_path)
self.simulation.valid():
self.simulation.data()
self.data.odeSolverProperties():
self.data.set_ode_solver_property(key, value)
self.data.set_point_interval(self.dt)  # time interval for data storage
self.data.set_starting_point(0)
self.data.set_ending_point(self.stop_time)

self.simulation.run()
self.simulation.reset()
self.simulation.release_all_values()
self.simulation.clear_results()
self.simulation.reset(False) # True resets everything, False resets only the states

self.simulation.results().states():
self.simulation.results().states()[variable_name].values()[-self.n_steps - 1:].copy())
self.simulation.results().algebraic():
self.simulation.results().algebraic()[variable_name].values()[-self.n_steps-1:].copy())
self.data.constants():
self.data.constants()[variable_name])

self.data.states()[param_name] = param_vals[JJ]
self.data.constants()[param_name] = param_vals[JJ]

Or equivalent commands.

For context see https://github.com/FinbarArgus/circulatory_autogen/blob/devel/src/utilities/opencor_helper.py

@agarny agarny self-assigned this Nov 18, 2024
@agarny agarny added the Feature label Nov 18, 2024
@agarny agarny added this to the 0.1 milestone Nov 18, 2024
@agarny
Copy link
Contributor
agarny commented Nov 18, 2024

FTR, for ISAN 2024, we quickly added a way to change model parameters by adding removeAllInitialConditions() and addInitialCondition(const std::string &pParameter, double pValue) to SedInstance. Corresponding methods were also added in the private implementation of SedInstanceTask, as well as applyInitialConditions() which was called during the initialisation of a model during a uniform time course (only supported case at this stage).

It was done this way in the interest of time since the values for the states, rates, constants, computed constants, and algebraic variables are all stored in the private implementation of SedInstanceTask. So, we probably ought to have some API on SedInstanceTask to modify the value of those different types of variables.

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

No branches or pull requests

2 participants
0