Skip to content

Commit

Permalink
Stub vt rule for twospeed.
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-robertson committed Sep 21, 2022
1 parent c014de0 commit 9e2fe33
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 4 deletions.
2 changes: 1 addition & 1 deletion resources/model/OpenStudio.idd
Original file line number Diff line number Diff line change
Expand Up @@ -16993,7 +16993,7 @@ OS:Coil:Cooling:DX:TwoSpeed,
\type real
\autosizable
\units W
\ip-units W
\ip-units W
\minimum 0
N14, \field Low Speed Evaporative Condenser Effectiveness
\type real
Expand Down
33 changes: 33 additions & 0 deletions src/osversion/VersionTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7091,6 +7091,14 @@ namespace osversion {
// Now required fields
// ------------------------------------------------

// FIXME: don't we need to set values for all fields that were made required?
// * Rated COP * 5
// * Rated Evaporator Fan Power Per Volume Flow Rate * 7
// * Crankcase Heater Capacity * 25
// * Maximum Outdoor Dry-Bulb Temperature for Crankcase Heater Operation * 26
// * Basin Heater Capacity * 29
// * Basin Heater Setpoint Temperature * 30

// From blank to 0.0:
// * Nominal Time for Condensate Removal to Begin * 16
// * Ratio of Initial Moisture Evaporation Rate and Steady State Latent Capacity * 17
Expand All @@ -7117,6 +7125,31 @@ namespace osversion {
m_refactored.push_back(RefactoredObjectData(object, newObject));
ss << newObject;

} else if (iddname == "OS:Coil:Cooling:DX:TwoSpeed") {

auto iddObject = idd_3_4_1.getObject(iddname);
IdfObject newObject(iddObject.get());

// Now required fields
// ------------------------------------------------

// FIXME: don't we need to set values for all fields that were made required?
// * Rated High Speed COP * 5
// * Rated Low Speed COP * 17
// * High Speed Evaporative Condenser Effectiveness * 24
// * Low Speed Evaporative Condenser Effectiveness * 27
// * Basin Heater Capacity * 32
// * Basin Heater Setpoint Temperature * 33

for (size_t i = 0; i < object.numFields(); ++i) {
if ((value = object.getString(i))) {
newObject.setString(i, value.get());
}
}

m_refactored.push_back(RefactoredObjectData(object, newObject));
ss << newObject;

// No-op
} else {
ss << object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

m = Model.new

airWall = CoilCoolingDXSingleSpeed.new(m)
coil = CoilCoolingDXSingleSpeed.new(m)

m.save('test_vt_CoilCoolingDXSingleSpeed.osm', true)
139 changes: 139 additions & 0 deletions src/osversion/test/3_4_1/test_vt_CoilCoolingDXTwoSpeed.osm
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@

OS:Version,
{7f4f345a-16af-47d5-afd2-c02b9cd753f3}, !- Handle
3.4.0; !- Version Identifier

OS:Coil:Cooling:DX:TwoSpeed,
{9df267db-e9b4-44fb-a87f-69e481c35d6c}, !- Handle
Coil Cooling DX Two Speed 1, !- Name
{1975be96-4266-4a73-b3ee-54c2dc0c3677}, !- Availability Schedule Name
Autosize, !- Rated High Speed Total Cooling Capacity {W}
Autosize, !- Rated High Speed Sensible Heat Ratio
3, !- Rated High Speed COP {W/W}
Autosize, !- Rated High Speed Air Flow Rate {m3/s}
773.3, !- Unit Internal Static Air Pressure {Pa}
, !- Air Inlet Node Name
, !- Air Outlet Node Name
{b57d3c75-e460-42fa-a7b0-0cd64e2ada24}, !- Total Cooling Capacity Function of Temperature Curve Name
{89e76a74-523b-49aa-874e-6c31f96dba9e}, !- Total Cooling Capacity Function of Flow Fraction Curve Name
{e22be9a8-c597-4fe1-898d-0f1bc7e94a1f}, !- Energy Input Ratio Function of Temperature Curve Name
{a422bcbc-97e3-4622-acdb-ab39059a84c9}, !- Energy Input Ratio Function of Flow Fraction Curve Name
{298a48ce-0d57-4494-8929-1c31522aefd0}, !- Part Load Fraction Correlation Curve Name
Autosize, !- Rated Low Speed Total Cooling Capacity {W}
0.69, !- Rated Low Speed Sensible Heat Ratio
3, !- Rated Low Speed COP {W/W}
, !- Rated Low Speed Air Flow Rate {m3/s}
{c80a8221-215c-4af8-b6ad-3da249c2ee3e}, !- Low Speed Total Cooling Capacity Function of Temperature Curve Name
{2a1dc6a1-7e68-4ae0-b68b-e2e5b7380f29}, !- Low Speed Energy Input Ratio Function of Temperature Curve Name
, !- Condenser Air Inlet Node Name
AirCooled, !- Condenser Type
-25, !- Minimum Outdoor Dry-Bulb Temperature for Compressor Operation {C}
0, !- High Speed Evaporative Condenser Effectiveness {dimensionless}
Autosize, !- High Speed Evaporative Condenser Air Flow Rate {m3/s}
Autosize, !- High Speed Evaporative Condenser Pump Rated Power Consumption {W}
0, !- Low Speed Evaporative Condenser Effectiveness {dimensionless}
Autosize, !- Low Speed Evaporative Condenser Air Flow Rate {m3/s}
Autosize, !- Low Speed Evaporative Condenser Pump Rated Power Consumption {W}
, !- Supply Water Storage Tank Name
, !- Condensate Collection Water Storage Tank Name
10, !- Basin Heater Capacity {W/K}
2, !- Basin Heater Setpoint Temperature {C}
; !- Basin Heater Operating Schedule Name

OS:Schedule:Constant,
{1975be96-4266-4a73-b3ee-54c2dc0c3677}, !- Handle
Always On Discrete, !- Name
{e44aab7d-c4cf-43a5-9c8e-103933fd285f}, !- Schedule Type Limits Name
1; !- Value

OS:ScheduleTypeLimits,
{e44aab7d-c4cf-43a5-9c8e-103933fd285f}, !- Handle
OnOff, !- Name
0, !- Lower Limit Value
1, !- Upper Limit Value
Discrete, !- Numeric Type
Availability; !- Unit Type

OS:Curve:Biquadratic,
{b57d3c75-e460-42fa-a7b0-0cd64e2ada24}, !- Handle
Curve Biquadratic 1, !- Name
0.42415, !- Coefficient1 Constant
0.04426, !- Coefficient2 x
-0.00042, !- Coefficient3 x**2
0.00333, !- Coefficient4 y
-8e-05, !- Coefficient5 y**2
-0.00021, !- Coefficient6 x*y
17, !- Minimum Value of x
22, !- Maximum Value of x
13, !- Minimum Value of y
46; !- Maximum Value of y

OS:Curve:Quadratic,
{89e76a74-523b-49aa-874e-6c31f96dba9e}, !- Handle
Curve Quadratic 1, !- Name
0.77136, !- Coefficient1 Constant
0.34053, !- Coefficient2 x
-0.11088, !- Coefficient3 x**2
0.75918, !- Minimum Value of x
1.13877; !- Maximum Value of x

OS:Curve:Biquadratic,
{e22be9a8-c597-4fe1-898d-0f1bc7e94a1f}, !- Handle
Curve Biquadratic 2, !- Name
1.23649, !- Coefficient1 Constant
-0.02431, !- Coefficient2 x
0.00057, !- Coefficient3 x**2
-0.01434, !- Coefficient4 y
0.00063, !- Coefficient5 y**2
-0.00038, !- Coefficient6 x*y
17, !- Minimum Value of x
22, !- Maximum Value of x
13, !- Minimum Value of y
46; !- Maximum Value of y

OS:Curve:Quadratic,
{a422bcbc-97e3-4622-acdb-ab39059a84c9}, !- Handle
Curve Quadratic 2, !- Name
1.2055, !- Coefficient1 Constant
-0.32953, !- Coefficient2 x
0.12308, !- Coefficient3 x**2
0.75918, !- Minimum Value of x
1.13877; !- Maximum Value of x

OS:Curve:Quadratic,
{298a48ce-0d57-4494-8929-1c31522aefd0}, !- Handle
Curve Quadratic 3, !- Name
0.771, !- Coefficient1 Constant
0.229, !- Coefficient2 x
0, !- Coefficient3 x**2
0, !- Minimum Value of x
1; !- Maximum Value of x

OS:Curve:Biquadratic,
{c80a8221-215c-4af8-b6ad-3da249c2ee3e}, !- Handle
Curve Biquadratic 3, !- Name
0.42415, !- Coefficient1 Constant
0.04426, !- Coefficient2 x
-0.00042, !- Coefficient3 x**2
0.00333, !- Coefficient4 y
-8e-05, !- Coefficient5 y**2
-0.00021, !- Coefficient6 x*y
17, !- Minimum Value of x
22, !- Maximum Value of x
13, !- Minimum Value of y
46; !- Maximum Value of y

OS:Curve:Biquadratic,
{2a1dc6a1-7e68-4ae0-b68b-e2e5b7380f29}, !- Handle
Curve Biquadratic 4, !- Name
1.23649, !- Coefficient1 Constant
-0.02431, !- Coefficient2 x
0.00057, !- Coefficient3 x**2
-0.01434, !- Coefficient4 y
0.00063, !- Coefficient5 y**2
-0.00038, !- Coefficient6 x*y
17, !- Minimum Value of x
22, !- Maximum Value of x
13, !- Minimum Value of y
46; !- Maximum Value of y

9 changes: 9 additions & 0 deletions src/osversion/test/3_4_1/test_vt_CoilCoolingDXTwoSpeed.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#require '/usr/local/openstudio-3.4.0/Ruby/openstudio'

include OpenStudio::Model

m = Model.new

coil = CoilCoolingDXTwoSpeed.new(m)

m.save('test_vt_CoilCoolingDXTwoSpeed.osm', true)
20 changes: 18 additions & 2 deletions src/osversion/test/VersionTranslator_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2025,11 +2025,27 @@ TEST_F(OSVersionFixture, update_3_4_0_to_3_4_1_CoilCoolingDXSingleSpeed) {
std::vector<WorkspaceObject> coils = model->getObjectsByType("OS:Coil:Cooling:DX:SingleSpeed");
ASSERT_EQ(1u, coils.size());
WorkspaceObject coil = coils[0];

EXPECT_EQ(0.0, coil.getDouble(16).get());
EXPECT_EQ(0.0, coil.getDouble(17).get());
EXPECT_EQ(0.0, coil.getDouble(18).get());
EXPECT_EQ(0.0, coil.getDouble(19).get());
EXPECT_EQ(0.0, coil.getDouble(22).get());
EXPECT_EQ(0.0, coil.getDouble(26).get());
EXPECT_EQ(0.0, coil.getDouble(26).get());
}

TEST_F(OSVersionFixture, update_3_4_0_to_3_4_1_CoilCoolingDXTwoSpeed) {
openstudio::path path = resourcesPath() / toPath("osversion/3_4_1/test_vt_CoilCoolingDXTwoSpeed.osm");
osversion::VersionTranslator vt;
boost::optional<model::Model> model = vt.loadModel(path);
ASSERT_TRUE(model) << "Failed to load " << path;

openstudio::path outPath = resourcesPath() / toPath("osversion/3_4_1/test_vt_CoilCoolingDXTwoSpeed_updated.osm");
model->save(outPath, true);

std::vector<WorkspaceObject> coils = model->getObjectsByType("OS:Coil:Cooling:DX:TwoSpeed");
ASSERT_EQ(1u, coils.size());
WorkspaceObject coil = coils[0];

// TODO
}

0 comments on commit 9e2fe33

Please sign in to comment.