Skip to content

Allow a constant, a computed constant, or a state variable (but not an algebraic variable) to be used as an initial value #1322

@chrispbradley

Description

@chrispbradley

[And now in the right place!]

In the attached file (rename it .cellml), I attemt to initialise a state variable with a computed constant variable i.e., something along the lines of

var time: second {pub:in};
var state: second {pub: in};
var initial_value: dimensionless;
initial_value = 2.0{per_second}*state;
var state_variable: dimensionless {init: initial_value};
ode(state_variable,time) = 0.005{per_second} * state_variable;

This was previously possible in the old OpenCOR (and, as I understand it, you can also use state variables to initialise other state variables). However, in the new OpenCOR web app (version 0.20250714.0) I get the error

"Variable 'state_variable' in component 'test_component' is initialied using variable 'initial_value' which is not a constant."

It would be useful to allow state variables to by initialised by computed constant (and other state variables) variables as well as constant variables as in the old OpenCOR.

test_initial.txt

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions