Skip to content

Interface for Model manipulation #83

@skeating

Description

@skeating

Remaining items from this section of #21

  • Look up variable(s) by RDF annotation
    • Actually by cmeta:id - RDF library will handle finding the ID from property + object
    • No variable found - can be OK or not (chosen by caller)
    • One variable found
    • Multiple variables found - can be OK or not (chosen by caller)
  • Look up RDF annotation(s) for a given variable
  • Get the free variable
  • Iterate over state variables
  • Iterate over all variables
  • Get the equation defining a variable / derivative
    • Get the RHS of the equation
  • Get variables referenced by an equation
  • Get equations needed to compute a set of variables, recursively
    • Where 'variables' can include ODE RHSs, i.e. the definition of a derivative
  • Given an equation, tell easily if it's an ODE or simple assignment
    • Get the variable assigned to, state var, or free var
  • Add a variable (optionally with units, annotations) Model.add_number and add_variable now allow unit objects as well as strings #172 allows adding a variable with units
    • Add an annotation for a variable
    • Units may be unknown when variable is first added, and calculated later from its definition. We need to be able to find all such variables easily.
  • Remove an equation from the system Replaced Model.set_equation(lhs, rhs) with Model.remove_equation(equation) #171 adds this functionality
  • Add an equation to the system Replace a variable's equation #118
    • Variable names in new equations can be things like oxmeta:membrane_voltage - these need to be mapped to names suitable for code generation at some point, and identified with other variables having that annotation Replace a variable's equation #118
  • Replace part of an equation
    • E.g. to replace an 'original_definition' symbol with the equation originally defining it
    • This needs to be a 'clone' of the inserted equation
  • Allow 'special' operations, so we can represent 'linear interpolation on a data file'
  • Handle time units conversion issue (Adding unit conversion for code generation #77 should deal with this)
    • RHS gets assigned to new variable with original units; change references to original derivative to this new variable; add another version of this variable with desired units, assigned from this one; use that to define the ODE.
  • Handle [state] variable units conversion (Adding unit conversion for code generation #77 should deal with this)
    • See _replace_variable logic, and perhaps _add_converted_variable - should be able to merge these
  • Construct an equation on the fly
  • Track which equations were added to the system
  • Redo model consistency checks & units conversions after all modifications done

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions