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

Snapshot/Individual: Dimension problems #726

Closed
Yuri05 opened this issue May 12, 2018 · 9 comments
Closed

Snapshot/Individual: Dimension problems #726

Yuri05 opened this issue May 12, 2018 · 9 comments

Comments

@Yuri05
Copy link
Member

Yuri05 commented May 12, 2018

Steps to reproduce described in #724

Similiar to #722

At least here all imported dimensions are set to Dimensionless :)

unbenannt

@msevestre
Copy link
Member

Snapshot do not set dimension. They only update unit. Very weird all that :)

@msevestre
Copy link
Member

Something is off in the comparison. Our parameters have exactly the same dimension....
image

@msevestre
Copy link
Member

ok those are FORMULA Dimensions that are not set in PKSim when CREATING an object. Instead they are set to parameter owner when the project is loaded

@msevestre
Copy link
Member

All right. Database dimension for formula rate is wrong!!
image

@msevestre
Copy link
Member

msevestre commented May 13, 2018

When loading from project, we do the following for constant formula


         var value = parameterElement.GetAttribute(Constants.Serialization.Attribute.VALUE).ConvertedTo<double>();
         var formula = serializationContext.ObjectFactory.Create<ConstantFormula>().WithValue(value).WithDimension(parameter.Dimension);
         parameter.Formula = formula;

The constant formula get's the dimension of the parameter. That's why it works

FIX 1:
Actually fix the database. This will also fix #722

FIX 2:
When creating a parameter, always setting formula.dimension to parameter.dimension

My vote would be to make it right and do fix 1. Hence assigned to you

@msevestre
Copy link
Member

FYI:
I just created following method in ParameterFactory

  private void synchronizeFormulaDimension(IParameter parameter)
      {
         if (parameter?.Formula == null)
            return;

         parameter.Formula.Dimension = parameter.Dimension;
      }

to ensure that formula dimension are always synchronized with Parameter.
No more difference

@msevestre
Copy link
Member

going to submit that as a fix. But feel free to fix it right :)

@msevestre
Copy link
Member

Also fixes #722 obviously

A lot of dimensions are wrong in the DB

@msevestre
Copy link
Member

luckily this is just for constant parameter that are defined as formula and this is always accurate as soon as a project is saved and loaded

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

No branches or pull requests

2 participants