pandapipes icon indicating copy to clipboard operation
pandapipes copied to clipboard

Re-formulation of PolynomialProperty

Open dlohmeier opened this issue 2 years ago • 0 comments

Problem description There is a fluid property called FluidPropertyPolynominal. In the constructor, a list of x- and y-values is required. It then converts it to a set of parameters for a polynomial through a fit:

    const = np.polyfit(x_values, y_values, polynominal_degree)
    self.prop_getter = np.poly1d(const)

I think that this is not exactly the preferred behavior for this property, as we would like to hand over the parameters to the constructor.

Possible solution My suggestions:

  • change the constructor such that it receives the polynomial parameters (the const) directly
  • create a @classmethod that does the polynomial fit for x- and y-values and hands the result over to the constructor
  • it might make sense to integrate the linear property into the polynomial property (or make it inherit from it)

Could we make such a change? Especially @jkisse @SimonRubenDrauz

dlohmeier avatar Mar 14 '22 12:03 dlohmeier