Skip to content

Commit

Permalink
ENH: Alter property name for power, thrust to be dimensionally ambiguous
Browse files Browse the repository at this point in the history
  • Loading branch information
thclark committed Aug 21, 2024
1 parent f13956b commit 53bbae7
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 47 deletions.
8 changes: 4 additions & 4 deletions power-curve-schema/examples/generic-117-3.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@
]
}
],
"cp_is_coefficient": false,
"ct_is_coefficient": true,
"cp": [
"power_is_coefficient": false,
"thrust_is_coefficient": true,
"power": [
[
22000.0, 78000.0, 150000.0, 237000.0, 340000.0, 466000.0, 617000.0,
796000.0, 1006000.0, 1247000.0, 1522000.0, 1871000.0, 2178000.0,
Expand All @@ -259,7 +259,7 @@
3450000.0, 3450000.0
]
],
"ct": [
"thrust": [
[
0.873, 0.849, 0.834, 0.828, 0.827, 0.825, 0.82, 0.816, 0.805, 0.804,
0.794, 0.79, 0.789, 0.772, 0.733, 0.666, 0.58, 0.494, 0.421, 0.362,
Expand Down
24 changes: 12 additions & 12 deletions power-curve-schema/examples/generic-274-20.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@
]
}
],
"cp_is_coefficient": false,
"ct_is_coefficient": true,
"cp": [
"power_is_coefficient": false,
"thrust_is_coefficient": true,
"power": [
[
76000.0, 310666.667, 641333.333, 1073333.3299999998,
1601333.3299999998, 2228000.0, 2972000.0, 3850666.67, 4892000.0,
Expand Down Expand Up @@ -290,7 +290,7 @@
12541333.3, 12445333.3, 12406666.7
]
],
"ct": [
"thrust": [
[
0.817, 0.815, 0.813, 0.812, 0.809, 0.807, 0.805, 0.804, 0.802, 0.8,
0.796, 0.792, 0.786, 0.781, 0.771, 0.731, 0.674, 0.594, 0.508,
Expand Down Expand Up @@ -414,9 +414,9 @@
]
}
],
"cp_is_coefficient": false,
"ct_is_coefficient": true,
"cp": [
"power_is_coefficient": false,
"thrust_is_coefficient": true,
"power": [
[
64000.0, 290666.667, 612000.0, 1030666.67, 1560000.0, 2182666.67,
2924000.0, 3789333.33, 4813333.33, 5981333.33, 7309333.33,
Expand Down Expand Up @@ -522,7 +522,7 @@
12986666.7, 12718666.7, 12541333.3, 12445333.3, 12406666.7
]
],
"ct": [
"thrust": [
[
0.745, 0.744, 0.742, 0.741, 0.741, 0.741, 0.744, 0.744, 0.742,
0.739, 0.736, 0.732, 0.727, 0.723, 0.723, 0.715, 0.671, 0.594,
Expand Down Expand Up @@ -648,9 +648,9 @@
]
}
],
"cp_is_coefficient": false,
"ct_is_coefficient": true,
"cp": [
"power_is_coefficient": false,
"thrust_is_coefficient": true,
"power": [
[
73333.33330000001, 308000.0, 637333.333, 1064000.0, 1592000.0,
2218666.67, 2962666.67, 3838666.67, 4877333.33, 6062666.67,
Expand Down Expand Up @@ -765,7 +765,7 @@
12986666.7, 12718666.7, 12541333.3, 12445333.3, 12406666.7
]
],
"ct": [
"thrust": [
[
0.793, 0.79, 0.789, 0.786, 0.785, 0.783, 0.783, 0.783, 0.781, 0.779,
0.775, 0.771, 0.766, 0.761, 0.755, 0.729, 0.673, 0.594, 0.508,
Expand Down
32 changes: 16 additions & 16 deletions power-curve-schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1052,10 +1052,10 @@
"design_bases",
"cuts",
"parameters",
"cp_is_coefficient",
"ct_is_coefficient",
"cp",
"ct",
"power_is_coefficient",
"thrust_is_coefficient",
"power",
"thrust",
"overrides"
],
"properties": {
Expand Down Expand Up @@ -1321,19 +1321,19 @@
]
}
},
"cp_is_coefficient": {
"power_is_coefficient": {
"type": "boolean",
"title": "Cp is Coefficient",
"description": "True if the `cp` array is in nondimensional coefficient form, False if the `cp` array contains Power [W]."
"title": "Power Dimensionality",
"description": "True if the `power` array is in nondimensional coefficient form, False if the `power` array contains dimensional Power [W]."
},
"ct_is_coefficient": {
"thrust_is_coefficient": {
"type": "boolean",
"title": "Ct is Coefficient",
"description": "True if the `ct` array is in nondimensional coefficient form, False if the `ct` array contains Thrust [kgms^-2]."
"title": "Thrust Dimensionality",
"description": "True if the `thrust` array is in nondimensional coefficient form, False if the `thrust` array contains dimensional Thrust [kgms^-2]"
},
"cp": {
"title": "Power Curve [cp]",
"description": "The coefficient of power, defined as an N-D array (where N is the number of independent parameters) at the sample points described in 'Parameters'",
"power": {
"title": "Power Curve",
"description": "Electrical power expressed as dimensional values or as nondimensional coefficients (as determined by the `power_is_coefficient` property), defined as an N-D array (where N is the number of independent parameters) at the sample points described in the `parameters` property.",
"oneOf": [
{
"title": "2 Parameters (2D Array, e.g. air-density and wind-speed)",
Expand All @@ -1352,9 +1352,9 @@
}
]
},
"ct": {
"title": "Thrust Curve [ct]",
"description": "The coefficient of thrust, defined as an N-D array (where N is the number of independent parameters) at the sample points described in 'Parameters'",
"thrust": {
"title": "Thrust Curve",
"description": "Thrust expressed as dimensional values or as coefficients (as determined by the `thrust_is_coefficient` property), defined as an N-D array (where N is the number of independent parameters) at the sample points described in the `parameters` property. This array should be the same size and shape as the `power` value. Where coefficient values are provided for a single air density or other parameter, singleton dimensions should be expanded (ie repeat columns to match the size of the `power` array).",
"oneOf": [
{
"title": "2 Parameters (2D Array, e.g. air-density and wind-speed)",
Expand Down
16 changes: 8 additions & 8 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ def one_dimensional_mode(valid_cuts):
]
}
],
"cp_is_coefficient": False,
"ct_is_coefficient": True,
"cp": [
"power_is_coefficient": False,
"thrust_is_coefficient": True,
"power": [
[22000.0, 78000.0, 150000.0, 237000.0, 340000.0, 466000.0, 617000.0, 796000.0, 1006000.0, 1247000.0, 1522000.0, 1871000.0, 2178000.0, 2544000.0, 2905000.0, 3201000.0, 3374000.0, 3435000.0, 3448000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0, 3450000.0,3450000.0, 3450000.0]
],
"ct": [
"thrust": [
[0.873, 0.849, 0.834, 0.828, 0.827, 0.825, 0.82, 0.816, 0.805, 0.804, 0.794, 0.79, 0.789, 0.772, 0.733, 0.666, 0.58, 0.494, 0.421, 0.362, 0.316, 0.281, 0.249, 0.223, 0.199, 0.18, 0.164, 0.149, 0.137, 0.125, 0.115, 0.107, 0.098, 0.091, 0.085, 0.079, 0.074, 0.07, 0.066, 0.062, 0.058, 0.055, 0.052, 0.049, 0.046]
],
"overrides": {}
Expand Down Expand Up @@ -189,10 +189,10 @@ def two_dimensional_mode(valid_cuts):
"values": [3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 8.0, 8.5, 9.0, 9.5, 10.0, 10.5, 11.0, 11.5, 12.0, 12.5, 13.0, 13.5, 14.0, 14.5, 15.0, 15.5, 16.0, 16.5, 17.0, 17.5, 18.0, 18.5, 19.0, 19.5, 20.0, 20.5, 21.0, 21.5, 22.0, 22.5, 23.0, 23.5, 24.0, 24.5, 25.0, 25.5, 26.0, 26.5, 27.0, 27.5, 28.0, 28.5, 29.0, 29.5, 30.0]
}
],
"cp_is_coefficient": False,
"ct_is_coefficient": True,
"power_is_coefficient": False,
"thrust_is_coefficient": True,
"overrides": {},
"cp": [
"power": [
[76000.0, 310666.667, 641333.333, 1073333.3299999998, 1601333.3299999998, 2228000.0, 2972000.0, 3850666.67, 4892000.0, 6081333.33, 7434666.67, 8954666.67, 10645333.3, 12428000.0, 14332000.0, 16380000.0, 18324000.0, 19516000.0, 19926666.700000003, 19993333.299999997, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 19940000.0, 19340000.0, 17600000.0, 15476000.0, 14133333.3, 13540000.0, 13406666.7, 13350666.7, 13185333.3, 12926666.7, 12677333.3, 12516000.0, 12432000.0, 12402666.7],
[80000.0, 321333.333, 660000.0, 1101333.3299999998, 1642666.6700000002, 2284000.0, 3045333.33, 3944000.0, 5009333.33, 6224000.0, 7606666.67, 9158666.67, 10881333.3, 12698666.7, 14633333.3, 16632000.0, 18585333.299999997, 19628000.0, 19950666.700000003, 19996000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 19952000.0, 19432000.0, 17752000.0, 15592000.0, 14178666.7, 13552000.0, 13409333.3, 13354666.7, 13190666.7, 12937333.3, 12684000.0, 12520000.0, 12434666.7, 12404000.0],
[84000.0, 333333.333, 678666.667, 1130666.6700000002, 1684000.0, 2341333.33, 3117333.33, 4037333.33, 5125333.33, 6368000.0, 7778666.67, 9362666.67, 11117333.3, 12969333.3, 14933333.3, 16882666.700000003, 18849333.299999997, 19740000.0, 19976000.0, 19997333.299999997, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 19964000.0, 19524000.0, 17904000.0, 15709333.3, 14224000.0, 13564000.0, 13410666.7, 13357333.3, 13197333.3, 12946666.7, 12690666.7, 12522666.7, 12436000.0, 12404000.0],
Expand All @@ -202,7 +202,7 @@ def two_dimensional_mode(valid_cuts):
[104000.0, 377333.333, 754666.667, 1248000.0, 1850666.6700000002, 2565333.33, 3409333.33, 4412000.0, 5590666.67, 6934666.67, 8460000.0, 10166666.7, 12052000.0, 14037333.3, 16073333.3, 18026666.700000003, 19426666.700000003, 19934666.700000003, 19997333.299999997, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 19989333.299999997, 19770666.700000003, 18498666.700000003, 16196000.0, 14412000.0, 13616000.0, 13416000.0, 13368000.0, 13220000.0, 12977333.3, 12714666.7, 12537333.3,12442666.7, 12405333.3],
[109333.333, 388000.0, 773333.333, 1277333.3299999998, 1892000.0, 2621333.33, 3482666.67, 4505333.33, 5708000.0, 7074666.67, 8628000.0, 10365333.3, 12282666.7, 14300000.0, 16346666.7, 18320000.0, 19533333.299999997, 19957333.299999997, 19997333.299999997, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 20000000.0, 19993333.299999997, 19817333.299999997, 18644000.0, 16317333.3, 14460000.0, 13636000.0, 13417333.3, 13370666.7, 13225333.3, 12986666.7, 12718666.7, 12541333.3, 12445333.3, 12406666.7]
],
"ct": [
"thrust": [
[0.817, 0.815, 0.813, 0.812, 0.809, 0.807, 0.805, 0.804, 0.802, 0.8, 0.796, 0.792, 0.786, 0.781, 0.771, 0.731, 0.674, 0.594, 0.508, 0.435, 0.377, 0.332, 0.294, 0.262, 0.235, 0.212, 0.192, 0.175, 0.16, 0.147, 0.135, 0.125, 0.115, 0.106, 0.099, 0.092, 0.086, 0.08, 0.075, 0.07, 0.067, 0.062, 0.057, 0.049, 0.041, 0.035, 0.032, 0.03, 0.029, 0.027, 0.025, 0.024, 0.022, 0.021, 0.02],
[0.817, 0.815, 0.813, 0.812, 0.809, 0.807, 0.805, 0.804, 0.802, 0.799, 0.796, 0.791, 0.785, 0.78, 0.768, 0.72, 0.664, 0.58, 0.495, 0.424, 0.368, 0.324, 0.287, 0.256, 0.23, 0.208, 0.188, 0.171, 0.156, 0.144, 0.132, 0.122, 0.112, 0.104, 0.097, 0.09, 0.084, 0.079, 0.074, 0.069, 0.065, 0.061, 0.056, 0.048, 0.04, 0.035, 0.032, 0.03, 0.028, 0.027, 0.025, 0.023, 0.022, 0.021, 0.02],
[0.817, 0.815, 0.813, 0.812, 0.809, 0.807, 0.804, 0.804, 0.802, 0.799, 0.795, 0.79, 0.784, 0.778, 0.765, 0.71, 0.654, 0.566, 0.481, 0.412, 0.359, 0.316, 0.281, 0.251, 0.225, 0.203, 0.184, 0.168, 0.153, 0.141, 0.13, 0.12, 0.11, 0.102, 0.095, 0.088, 0.083, 0.077, 0.072, 0.068, 0.064, 0.06, 0.055, 0.048, 0.04, 0.034, 0.031, 0.029, 0.028, 0.026, 0.025, 0.023, 0.022, 0.021, 0.02],
Expand Down
12 changes: 5 additions & 7 deletions test/test_power_curves.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ def test_blank_default_mode(subschema, one_dimensional_mode):
"""Validation should fail if default_operating_mode is blank"""
with pytest.raises(ValidationError) as e:
validate(
instance={
"power_curves": {"default_operating_mode": "", "operating_modes": [one_dimensional_mode]}
},
instance={"power_curves": {"default_operating_mode": "", "operating_modes": [one_dimensional_mode]}},
schema=subschema,
)
assert "does not match" in str(e)
Expand Down Expand Up @@ -98,10 +96,10 @@ def test_missing_mode_properties(subschema, one_dimensional_mode):
"overrides",
"cuts",
"parameters",
"cp",
"ct",
"cp_is_coefficient",
"ct_is_coefficient",
"power",
"thrust",
"power_is_coefficient",
"thrust_is_coefficient",
]:
partial = deepcopy(one_dimensional_mode)
partial.pop(required)
Expand Down

0 comments on commit 53bbae7

Please sign in to comment.