# remove curve via openstudio measure

I have created a custom VRF systems & terminals measure for Daikin units. I have curves only where absolutely necessary, and where possible, I am referring to common curves. For example, two different AirConditioner:VariableRefrigerantFlow objects can have the same CoolCapFT curve, so there should not be a need to create a CoolCapFT 1 curve for one and CoolCapFT curve 2 for the other - it unnecessarily clutters the .osm file.

Nevertheless, it seems that upon creation of a, for example, AirConditioner:VariableRefrigerantFlow, OpenStudio automatically creates all kinds of curves, even though later on I reassign a consistent set of curves and these curves then become obsolete.

So I thought I'd just develop a curves clean-up measures. I noticed that these annoyance curves all have similar names and then an incremental counter appended to them, so I just look for curves that contain that common name sub-string and remove them. The curves are definitely recognized, but for some reason, not removed from the .osm file when I run the measure, though.

For example, in measure.rb, I do the following:

```
curve_names = []
curve_names << "VRFCoolCapFT"
curve_names << "VRFCoolCapFTBoundary"
curve_names << "VRFCoolCapFTHi"
curve_names << "VRFCoolEIRFT"
curve_names << "VRFCoolEIRFTBoundary"
curve_names << "VRFCoolEIRFTHi"
curve_names << "CoolingEIRLowPLR"
curve_names << "CoolingEIRHiPLR"
curve_names << "CoolingCombRatio"
curve_names << "CoolingLengthCorrectionFactor"
curve_names << "VRFHeatCapFT"
curve_names << "VRFHeatCapFTBoundary"
curve_names << "VRFHeatCapFTHi"
curve_names << "VRFHeatEIRFT"
curve_names << "VRFHeatEIRFTBoundary"
curve_names << "VRFHeatEIRFTHi"
curve_names << "HeatingEIRLowPLR"
curve_names << "HeatingEIRHiPLR"
curve_names << "HeatingCombRatio"
curve_names << "HeatingLengthCorrectionFactor"
curve_names << "VRFTUCoolCapFT"
curve_names << "VRFACCoolCapFFF"
curve_names << "VRFTUHeatCAPFT"
curve_names << "VRFACHeatCapFFF"
curve_names << "Fan On Off Power Curve"
curve_names << "Fan On Off Efficiency Curve"
deletecurves(runner, model, curve_names)
```

And that last function is defined as follows:

```
def deletecurves(runner, model, curve_names)
biquadratic_curves = model.getObjectsByType(OpenStudio::Model::CurveBiquadratic::iddObjectType)
biquadratic_curves.each do |biquadratic_curve|
biquadratic_curve_name = biquadratic_curve.name.get
curve_names.each do |curve_name|
if biquadratic_curve_name.include? curve_name then
puts "Will delete Biquadratic: #{biquadratic_curve.name}\n"
biquadratic_curve.remove
end
end
end
linear_curves = model.getObjectsByType(OpenStudio::Model::CurveLinear::iddObjectType)
linear_curves.each do |linear_curve|
linear_curve_name = linear_curve.name.get
curve_names.each do |curve_name|
if linear_curve_name.include? curve_name then
puts "Will delete Linear: #{linear_curve.name}\n"
linear_curve.remove
end
end
end
quadratic_curves = model.getObjectsByType(OpenStudio::Model::CurveQuadratic::iddObjectType)
quadratic_curves.each do |quadratic_curve|
quadratic_curve_name = quadratic_curve.name.get
curve_names.each do |curve_name|
if quadratic_curve_name.include? curve_name then
puts "Will delete Quadratic: #{quadratic_curve.name}\n"
quadratic_curve.remove
end
end
end
cubic_curves = model.getObjectsByType(OpenStudio::Model::CurveCubic::iddObjectType)
cubic_curves.each do |cubic_curve|
cubic_curve_name = cubic_curve.name.get
curve_names.each do |curve_name|
if cubic_curve_name.include? curve_name then
puts "Will delete Cubic: #{cubic_curve.name}\n"
cubic_curve.remove
end
end
end
exponent_curves = model.getObjectsByType(OpenStudio::Model::CurveExponent::iddObjectType)
exponent_curves.each do |exponent_curve|
exponent_curve_name = exponent_curve.name.get
curve_names.each do |curve_name|
if exponent_curve_name.include? curve_name then
puts "Will delete Exponent: #{exponent_curve.name}\n"
exponent_curve.remove
end
end
end
```

I'd appreciate any hints for resolving this issue.