mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-05 23:38:52 -06:00
Fix import/export of default values
This commit is contained in:
@@ -62,7 +62,7 @@ const computeTotalInitialAmount = (prod) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const importList = (args, R = 1) => {
|
export const importList = (args, R = 1) => {
|
||||||
if (!args) return "";
|
if (args === undefined) return "";
|
||||||
if (Array.isArray(args) && args.length > 0) {
|
if (Array.isArray(args) && args.length > 0) {
|
||||||
let isConstant = true;
|
let isConstant = true;
|
||||||
for (let i = 1; i < args.length; i++) {
|
for (let i = 1; i < args.length; i++) {
|
||||||
@@ -180,6 +180,9 @@ export const exportPlant = (original, parameters) => {
|
|||||||
// Copy time series values
|
// Copy time series values
|
||||||
["energy (GJ/tonne)"].forEach((key) => {
|
["energy (GJ/tonne)"].forEach((key) => {
|
||||||
result[key] = exportValue(original[key], T);
|
result[key] = exportValue(original[key], T);
|
||||||
|
if (result[key] === undefined) {
|
||||||
|
delete result[key];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Copy scalar dicts
|
// Copy scalar dicts
|
||||||
@@ -379,6 +382,9 @@ export const importPlant = (original) => {
|
|||||||
// Import timeseries values
|
// Import timeseries values
|
||||||
["energy (GJ/tonne)"].forEach((key) => {
|
["energy (GJ/tonne)"].forEach((key) => {
|
||||||
plant[key] = importList(original[key]);
|
plant[key] = importList(original[key]);
|
||||||
|
if (plant[key] === "") {
|
||||||
|
delete plant[key];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Import dicts
|
// Import dicts
|
||||||
|
|||||||
@@ -184,9 +184,8 @@ const samplePlantsOriginal = [
|
|||||||
"outputs (tonne/tonne)": {
|
"outputs (tonne/tonne)": {
|
||||||
"Hydrogen gas": 0.095,
|
"Hydrogen gas": 0.095,
|
||||||
"Carbon dioxide": 1.164,
|
"Carbon dioxide": 1.164,
|
||||||
Tar: 0.06,
|
Tar: 0,
|
||||||
},
|
},
|
||||||
"energy (GJ/tonne)": "50",
|
|
||||||
locations: {
|
locations: {
|
||||||
"Washakie County": {
|
"Washakie County": {
|
||||||
"latitude (deg)": 43.8356,
|
"latitude (deg)": 43.8356,
|
||||||
@@ -331,9 +330,8 @@ const samplePlantsExported = [
|
|||||||
"outputs (tonne/tonne)": {
|
"outputs (tonne/tonne)": {
|
||||||
"Hydrogen gas": 0.095,
|
"Hydrogen gas": 0.095,
|
||||||
"Carbon dioxide": 1.164,
|
"Carbon dioxide": 1.164,
|
||||||
Tar: 0.06,
|
Tar: 0,
|
||||||
},
|
},
|
||||||
"energy (GJ/tonne)": [50, 50, 50],
|
|
||||||
locations: {
|
locations: {
|
||||||
"Washakie County": {
|
"Washakie County": {
|
||||||
"latitude (deg)": 43.8356,
|
"latitude (deg)": 43.8356,
|
||||||
|
|||||||
Reference in New Issue
Block a user