Class parameter_function.py is created
This commit is contained in:
parent
d6ee3d6e6b
commit
6ce82c52de
|
@ -0,0 +1,53 @@
|
|||
"""
|
||||
Energy System catalog heat generation system
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2023 Concordia CERC group
|
||||
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributors: Saeed Ranjbar saeed.ranjbar@concordia.ca
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from typing import Union
|
||||
|
||||
|
||||
class ParameterFunction:
|
||||
"""
|
||||
Parameter function class
|
||||
"""
|
||||
|
||||
def __init__(self, type, coefficients):
|
||||
self._type = type
|
||||
self._coefficients = coefficients
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""
|
||||
The type of the fit function from the following
|
||||
Linear =>>> y = a*x + b
|
||||
Exponential =>>> y = a*(b**x)
|
||||
Polynomial =>>> y = a*(x**2) + b*x + c
|
||||
Power =>>> y = a*(x**b)
|
||||
Second degree multivariable =>>> y = a*(x**2) + b*x + c*x*y + d*y + e*(y**2) + f
|
||||
|
||||
Get the type of function from ['linear', 'exponential', 'polynomial', 'power', 'second degree multivariable']
|
||||
:return: string
|
||||
"""
|
||||
return self._type
|
||||
|
||||
@property
|
||||
def coefficients(self):
|
||||
"""
|
||||
Get the coefficients of the functions as list
|
||||
:return: [coefficients]
|
||||
"""
|
||||
return self._coefficients
|
||||
|
||||
def to_dictionary(self):
|
||||
"""Class content to dictionary"""
|
||||
content = {'Parameter Function': {
|
||||
'type': self.type,
|
||||
'coefficients': self.coefficients,
|
||||
}
|
||||
}
|
||||
return content
|
||||
|
Loading…
Reference in New Issue
Block a user