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