Skip to content

Comments

Enable an initial state for individual and expression parameters#2729

Merged
rwmcintosh merged 5 commits intoV13from
2728-enable-an-initial-state-for-individual-and-expression-parameters
Jan 9, 2026
Merged

Enable an initial state for individual and expression parameters#2729
rwmcintosh merged 5 commits intoV13from
2728-enable-an-initial-state-for-individual-and-expression-parameters

Conversation

@rwmcintosh
Copy link
Member

Fixes #2728

Description

We need a spot to store original values as set by PK-Sim so they can be reverted when changed in MoBi.

Type of change

Please mark relevant options with an x in the brackets.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires documentation changes (link at least one user or developer documentation issue):
  • Algorithm update - updates algorithm documentation/questions/answers etc.
  • Other (please describe):

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Integration tests
  • Unit tests
  • Manual tests
  • No tests required

Reviewer checklist

Mark everything that needs to be checked before merging the PR.

  • Check if the code is well documented
  • Check if the behavior is what is expected
  • Check if the code is well tested
  • Check if the code is readable and well formatted
  • Additional checks (document below if any)
  • Check if documentation update issue(s) are created if the option This change requires a documentation update above is selected

Screenshots (if appropriate):

Questions (if appropriate):

@rwmcintosh rwmcintosh self-assigned this Jan 8, 2026
Copilot AI review requested due to automatic review settings January 8, 2026 17:51
@rwmcintosh rwmcintosh added this to v13 Jan 8, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds initial state tracking capabilities to IndividualParameter and ExpressionParameter classes by introducing a new abstract base class ParameterValueWithInitialState. This enables storing original values set by PK-Sim for later reversion in MoBi.

Key changes:

  • New abstract class ParameterValueWithInitialState with properties for InitialValue, InitialFormulaId, and InitialUnit
  • Updated IndividualParameter and ExpressionParameter to inherit from the new base class
  • Added serialization support for the new initial state properties

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/OSPSuite.Core/Domain/Builder/ParameterValueWithInitialState.cs New abstract base class that tracks initial state for parameters with properties for value, formula ID, and unit
src/OSPSuite.Core/Domain/Builder/IndividualParameter.cs Updated to inherit from ParameterValueWithInitialState
src/OSPSuite.Core/Domain/Builder/ExpressionParameter.cs Updated to inherit from ParameterValueWithInitialState
src/OSPSuite.Core/Serialization/Xml/ParameterValueXmlSerializer.cs Added ParameterValueWithInitialStateSerializer to serialize/deserialize initial state properties
src/OSPSuite.Core/Domain/Constants.cs Added INITIAL_UNIT constant for serialization attribute
tests/OSPSuite.Core.Tests/Domain/ExpressionParameterSpecs.cs Added unit tests for HasInitialState property behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…e.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 8, 2026 18:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings January 9, 2026 15:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 9, 2026 15:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rwmcintosh rwmcintosh merged commit 08d4dbc into V13 Jan 9, 2026
6 of 7 checks passed
@rwmcintosh rwmcintosh deleted the 2728-enable-an-initial-state-for-individual-and-expression-parameters branch January 9, 2026 15:48
@github-project-automation github-project-automation bot moved this to Done in v13 Jan 9, 2026
protected override XElement TypedSerialize(T pathAndValueEntity, SerializationContext serializationContext)
{
var element = base.TypedSerialize(pathAndValueEntity, serializationContext);
if (pathAndValueEntity.InitialUnit is not null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not != lol. What's teh point of this is not syntax?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not? It reads nice.

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants