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

'create_curve' methods in Prototype.utilities.rb missing model argument #1326

Closed
eringold opened this issue Jun 1, 2022 · 0 comments
Closed

Comments

@eringold
Copy link
Collaborator

eringold commented Jun 1, 2022

Minor bug: create_curve_cubic and create_curve_exponent in Protoype.utilities.rb do not have 'model' as an argument, instead passing self to the curve constructor. But since the methods are part of the Standard class, this won't work, and trying to call the methods will throw a TypeError "Expected argument 0 of type openstudio::model::Model const &, but got [standard class]":

Note: these methods aren't currently used anywhere in the code base, but should at least be fixed so they could work.

def create_curve_cubic(coeffs, crv_name, min_x, max_x, min_out, max_out)
curve = OpenStudio::Model::CurveCubic.new(self)
curve.setName(crv_name)
curve.setCoefficient1Constant(coeffs[0])
curve.setCoefficient2x(coeffs[1])
curve.setCoefficient3xPOW2(coeffs[2])
curve.setCoefficient4xPOW3(coeffs[3])
curve.setMinimumValueofx(min_x) unless min_x.nil?
curve.setMaximumValueofx(max_x) unless max_x.nil?
curve.setMinimumCurveOutput(min_out) unless min_out.nil?
curve.setMaximumCurveOutput(max_out) unless max_out.nil?
return curve
end

def create_curve_exponent(coeffs, crv_name, min_x, max_x, min_out, max_out)
curve = OpenStudio::Model::CurveExponent.new(self)
curve.setName(crv_name)
curve.setCoefficient1Constant(coeffs[0])
curve.setCoefficient2Constant(coeffs[1])
curve.setCoefficient3Constant(coeffs[2])
curve.setMinimumValueofx(min_x) unless min_x.nil?
curve.setMaximumValueofx(max_x) unless max_x.nil?
curve.setMinimumCurveOutput(min_out) unless min_out.nil?
curve.setMaximumCurveOutput(max_out) unless max_out.nil?
return curve
end

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