Compare commits
No commits in common. '49214cdb2050e132d518931fcb72ad51426a8e30' and 'eb3d39b1abc1db6682c92da38532f2244672fe21' have entirely different histories.
49214cdb20
...
eb3d39b1ab
Binary file not shown.
@ -1,7 +0,0 @@
|
|||||||
node_modules
|
|
||||||
npm-debug.log
|
|
||||||
Dockerfile
|
|
||||||
.dockerignore
|
|
||||||
.git
|
|
||||||
.gitignore
|
|
||||||
.env
|
|
@ -1,13 +0,0 @@
|
|||||||
# Build Stage
|
|
||||||
FROM node:18-alpine AS build
|
|
||||||
WORKDIR /app
|
|
||||||
COPY package*.json ./
|
|
||||||
RUN npm install
|
|
||||||
COPY . .
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# Production Stage
|
|
||||||
FROM nginx:stable-alpine AS production
|
|
||||||
COPY --from=build /app/build /usr/share/nginx/html
|
|
||||||
EXPOSE 80
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
|
@ -1,186 +0,0 @@
|
|||||||
/*
|
|
||||||
* UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import SectionHeader from "../Common/SectionHeader/SectionHeader";
|
|
||||||
import SectionButton from "../Common/Buttons/SectionButton";
|
|
||||||
import {
|
|
||||||
faDownload,
|
|
||||||
faPlus,
|
|
||||||
faUpload,
|
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
|
||||||
import DataTable, {
|
|
||||||
ColumnSpec,
|
|
||||||
generateCsv,
|
|
||||||
generateTableColumns,
|
|
||||||
generateTableData,
|
|
||||||
parseCsv,
|
|
||||||
} from "../Common/Forms/DataTable";
|
|
||||||
import { ColumnDefinition } from "tabulator-tables";
|
|
||||||
import FileUploadElement from "../Common/Buttons/FileUploadElement";
|
|
||||||
import { useRef } from "react";
|
|
||||||
import { ValidationError } from "../../core/Data/validate";
|
|
||||||
import { CaseBuilderSectionProps } from "./CaseBuilder";
|
|
||||||
import {
|
|
||||||
changeTransmissionLineData,
|
|
||||||
createTransmissionLine,
|
|
||||||
deleteTransmissionLine,
|
|
||||||
renameTransmissionLine,
|
|
||||||
} from "../../core/Operations/transmissionOps";
|
|
||||||
import { offerDownload } from "../Common/io";
|
|
||||||
import { UnitCommitmentScenario } from "../../core/Data/types";
|
|
||||||
|
|
||||||
export const TransmissionLinesColumnSpec: ColumnSpec[] = [
|
|
||||||
{
|
|
||||||
title: "Name",
|
|
||||||
type: "string",
|
|
||||||
width: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "Source bus",
|
|
||||||
type: "busRef",
|
|
||||||
width: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "Target bus",
|
|
||||||
type: "busRef",
|
|
||||||
width: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "Susceptance (S)",
|
|
||||||
type: "number",
|
|
||||||
width: 60,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "Normal flow limit (MW)",
|
|
||||||
type: "number?",
|
|
||||||
width: 60,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "Emergency flow limit (MW)",
|
|
||||||
type: "number?",
|
|
||||||
width: 60,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "Flow limit penalty ($/MW)",
|
|
||||||
type: "number",
|
|
||||||
width: 60,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const generateTransmissionLinesData = (
|
|
||||||
scenario: UnitCommitmentScenario,
|
|
||||||
): [any[], ColumnDefinition[]] => {
|
|
||||||
const columns = generateTableColumns(scenario, TransmissionLinesColumnSpec);
|
|
||||||
const data = generateTableData(
|
|
||||||
scenario["Transmission lines"],
|
|
||||||
TransmissionLinesColumnSpec,
|
|
||||||
scenario,
|
|
||||||
);
|
|
||||||
return [data, columns];
|
|
||||||
};
|
|
||||||
|
|
||||||
const TransmissionLinesComponent = (props: CaseBuilderSectionProps) => {
|
|
||||||
const fileUploadElem = useRef<FileUploadElement>(null);
|
|
||||||
|
|
||||||
const onDownload = () => {
|
|
||||||
const [data, columns] = generateTransmissionLinesData(props.scenario);
|
|
||||||
const csvContents = generateCsv(data, columns);
|
|
||||||
offerDownload(csvContents, "text/csv", "transmission.csv");
|
|
||||||
};
|
|
||||||
|
|
||||||
const onUpload = () => {
|
|
||||||
fileUploadElem.current!.showFilePicker((csv: any) => {
|
|
||||||
const [newLines, err] = parseCsv(
|
|
||||||
csv,
|
|
||||||
TransmissionLinesColumnSpec,
|
|
||||||
props.scenario,
|
|
||||||
);
|
|
||||||
if (err) {
|
|
||||||
props.onError(err.message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const newScenario = {
|
|
||||||
...props.scenario,
|
|
||||||
"Transmission lines": newLines,
|
|
||||||
};
|
|
||||||
props.onDataChanged(newScenario);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const onAdd = () => {
|
|
||||||
const [newScenario, err] = createTransmissionLine(props.scenario);
|
|
||||||
if (err) {
|
|
||||||
props.onError(err.message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
props.onDataChanged(newScenario);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onDelete = (name: string): ValidationError | null => {
|
|
||||||
const newScenario = deleteTransmissionLine(name, props.scenario);
|
|
||||||
props.onDataChanged(newScenario);
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onDataChanged = (
|
|
||||||
name: string,
|
|
||||||
field: string,
|
|
||||||
newValue: string,
|
|
||||||
): ValidationError | null => {
|
|
||||||
const [newScenario, err] = changeTransmissionLineData(
|
|
||||||
name,
|
|
||||||
field,
|
|
||||||
newValue,
|
|
||||||
props.scenario,
|
|
||||||
);
|
|
||||||
if (err) {
|
|
||||||
props.onError(err.message);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
props.onDataChanged(newScenario);
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onRename = (
|
|
||||||
oldName: string,
|
|
||||||
newName: string,
|
|
||||||
): ValidationError | null => {
|
|
||||||
const [newScenario, err] = renameTransmissionLine(
|
|
||||||
oldName,
|
|
||||||
newName,
|
|
||||||
props.scenario,
|
|
||||||
);
|
|
||||||
if (err) {
|
|
||||||
props.onError(err.message);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
props.onDataChanged(newScenario);
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<SectionHeader title="Transmission Lines">
|
|
||||||
<SectionButton icon={faPlus} tooltip="Add" onClick={onAdd} />
|
|
||||||
<SectionButton
|
|
||||||
icon={faDownload}
|
|
||||||
tooltip="Download"
|
|
||||||
onClick={onDownload}
|
|
||||||
/>
|
|
||||||
<SectionButton icon={faUpload} tooltip="Upload" onClick={onUpload} />
|
|
||||||
</SectionHeader>
|
|
||||||
<DataTable
|
|
||||||
onRowDeleted={onDelete}
|
|
||||||
onRowRenamed={onRename}
|
|
||||||
onDataChanged={onDataChanged}
|
|
||||||
generateData={() => generateTransmissionLinesData(props.scenario)}
|
|
||||||
/>
|
|
||||||
<FileUploadElement ref={fileUploadElem} accept=".csv" />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default TransmissionLinesComponent;
|
|
@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { UnitCommitmentScenario } from "./types";
|
|
||||||
|
|
||||||
export interface Buses {
|
|
||||||
[busName: string]: { "Load (MW)": number[] };
|
|
||||||
}
|
|
||||||
|
|
||||||
export const BLANK_SCENARIO: UnitCommitmentScenario = {
|
|
||||||
Parameters: {
|
|
||||||
Version: "0.4",
|
|
||||||
"Power balance penalty ($/MW)": 1000.0,
|
|
||||||
"Time horizon (h)": 24,
|
|
||||||
"Time step (min)": 60,
|
|
||||||
},
|
|
||||||
Buses: {},
|
|
||||||
Generators: {},
|
|
||||||
"Transmission lines": {},
|
|
||||||
};
|
|
@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import assert from "node:assert";
|
|
||||||
import fs from "node:fs";
|
|
||||||
import pako from "pako";
|
|
||||||
import { migrateToV03, migrateToV04 } from "./migrate";
|
|
||||||
|
|
||||||
function readJsonGz(filename: string) {
|
|
||||||
const compressedData = fs.readFileSync(filename);
|
|
||||||
const decompressedData = pako.inflate(compressedData, { to: "string" });
|
|
||||||
return JSON.parse(decompressedData);
|
|
||||||
}
|
|
||||||
|
|
||||||
test("migrateToV03", () => {
|
|
||||||
const jsonData = readJsonGz("../test/fixtures/ucjl-0.2.json.gz");
|
|
||||||
migrateToV03(jsonData);
|
|
||||||
assert.deepEqual(jsonData.Reserves, {
|
|
||||||
r1: {
|
|
||||||
"Amount (MW)": 100,
|
|
||||||
"Shortfall penalty ($/MW)": 1000,
|
|
||||||
Type: "spinning",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test("migrateToV04", () => {
|
|
||||||
const jsonData = readJsonGz("../test/fixtures/ucjl-0.3.json.gz");
|
|
||||||
migrateToV04(jsonData);
|
|
||||||
assert.equal(jsonData.Generators["g1"].Type, "Thermal");
|
|
||||||
});
|
|
@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
* UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { ValidationError } from "./validate";
|
|
||||||
|
|
||||||
export const migrate = (json: any): ValidationError | null => {
|
|
||||||
const version = json.Parameters?.Version;
|
|
||||||
if (!version) {
|
|
||||||
return {
|
|
||||||
message:
|
|
||||||
"The provided input file cannot be loaded because it does not " +
|
|
||||||
"specify what version of UnitCommitment.jl it was written for.",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (!["0.2", "0.3", "0.4"].includes(version)) {
|
|
||||||
return { message: `Unsupported file version: ${version}` };
|
|
||||||
}
|
|
||||||
if (version < "0.3") migrateToV03(json);
|
|
||||||
if (version < "0.4") migrateToV04(json);
|
|
||||||
json.Parameters.Version = "0.4";
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const migrateToV03 = (json: any): void => {
|
|
||||||
if (json.Reserves && json.Reserves["Spinning (MW)"] != null) {
|
|
||||||
const amount = json.Reserves["Spinning (MW)"];
|
|
||||||
json.Reserves = {
|
|
||||||
r1: {
|
|
||||||
Type: "spinning",
|
|
||||||
"Amount (MW)": amount,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
if (json.Generators) {
|
|
||||||
for (const genName in json.Generators) {
|
|
||||||
const gen = json.Generators[genName];
|
|
||||||
if (gen["Provides spinning reserves?"] === true) {
|
|
||||||
gen["Reserve eligibility"] = ["r1"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const migrateToV04 = (json: any): void => {
|
|
||||||
if (json.Generators) {
|
|
||||||
for (const genName in json.Generators) {
|
|
||||||
const gen = json.Generators[genName];
|
|
||||||
if (gen.Type == null) {
|
|
||||||
gen.Type = "Thermal";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { Buses } from "./fixtures";
|
|
||||||
|
|
||||||
export interface Generators {
|
|
||||||
[name: string]: ProfiledUnit | ThermalUnit;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProfiledUnit {
|
|
||||||
Bus: string;
|
|
||||||
Type: "Profiled";
|
|
||||||
"Minimum power (MW)": number[];
|
|
||||||
"Maximum power (MW)": number[];
|
|
||||||
"Cost ($/MW)": number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ThermalUnit {
|
|
||||||
Bus: string;
|
|
||||||
Type: "Thermal";
|
|
||||||
"Production cost curve (MW)": number[];
|
|
||||||
"Production cost curve ($)": number[];
|
|
||||||
"Startup costs ($)": number[];
|
|
||||||
"Startup delays (h)": number[];
|
|
||||||
"Ramp up limit (MW)": number | null;
|
|
||||||
"Ramp down limit (MW)": number | null;
|
|
||||||
"Startup limit (MW)": number | null;
|
|
||||||
"Shutdown limit (MW)": number | null;
|
|
||||||
"Minimum downtime (h)": number;
|
|
||||||
"Minimum uptime (h)": number;
|
|
||||||
"Initial status (h)": number;
|
|
||||||
"Initial power (MW)": number;
|
|
||||||
"Must run?": boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TransmissionLine {
|
|
||||||
"Source bus": string;
|
|
||||||
"Target bus": string;
|
|
||||||
"Susceptance (S)": number;
|
|
||||||
"Normal flow limit (MW)": number | null;
|
|
||||||
"Emergency flow limit (MW)": number | null;
|
|
||||||
"Flow limit penalty ($/MW)": number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface UnitCommitmentScenario {
|
|
||||||
Parameters: {
|
|
||||||
Version: string;
|
|
||||||
"Power balance penalty ($/MW)": number;
|
|
||||||
"Time horizon (h)": number;
|
|
||||||
"Time step (min)": number;
|
|
||||||
};
|
|
||||||
Buses: Buses;
|
|
||||||
Generators: Generators;
|
|
||||||
"Transmission lines": {
|
|
||||||
[name: string]: TransmissionLine;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const getTypedGenerators = <T extends any>(
|
|
||||||
scenario: UnitCommitmentScenario,
|
|
||||||
type: string,
|
|
||||||
): {
|
|
||||||
[key: string]: T;
|
|
||||||
} => {
|
|
||||||
const selected: { [key: string]: T } = {};
|
|
||||||
for (const [name, gen] of Object.entries(scenario.Generators)) {
|
|
||||||
if (gen["Type"] === type) selected[name] = gen as T;
|
|
||||||
}
|
|
||||||
return selected;
|
|
||||||
};
|
|
||||||
export const getProfiledGenerators = (
|
|
||||||
scenario: UnitCommitmentScenario,
|
|
||||||
): { [key: string]: ProfiledUnit } =>
|
|
||||||
getTypedGenerators<ProfiledUnit>(scenario, "Profiled");
|
|
||||||
export const getThermalGenerators = (
|
|
||||||
scenario: UnitCommitmentScenario,
|
|
||||||
): { [key: string]: ThermalUnit } =>
|
|
||||||
getTypedGenerators<ThermalUnit>(scenario, "Thermal");
|
|
@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { TEST_DATA_1 } from "../Data/fixtures.test";
|
|
||||||
import assert from "node:assert";
|
|
||||||
import {
|
|
||||||
changeTransmissionLineData,
|
|
||||||
createTransmissionLine,
|
|
||||||
deleteTransmissionLine,
|
|
||||||
renameTransmissionLine,
|
|
||||||
} from "./transmissionOps";
|
|
||||||
import { ValidationError } from "../Data/validate";
|
|
||||||
|
|
||||||
test("createTransmissionLine", () => {
|
|
||||||
const [newScenario, err] = createTransmissionLine(TEST_DATA_1);
|
|
||||||
assert(err === null);
|
|
||||||
assert.equal(Object.keys(newScenario["Transmission lines"]).length, 2);
|
|
||||||
assert("l2" in newScenario["Transmission lines"]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("renameTransmissionLine", () => {
|
|
||||||
const [newScenario, err] = renameTransmissionLine("l1", "l3", TEST_DATA_1);
|
|
||||||
assert(err === null);
|
|
||||||
assert.deepEqual(newScenario["Transmission lines"]["l3"], {
|
|
||||||
"Source bus": "b1",
|
|
||||||
"Target bus": "b2",
|
|
||||||
"Susceptance (S)": 29.49686,
|
|
||||||
"Normal flow limit (MW)": 15000.0,
|
|
||||||
"Emergency flow limit (MW)": 20000.0,
|
|
||||||
"Flow limit penalty ($/MW)": 5000.0,
|
|
||||||
});
|
|
||||||
assert.equal(Object.keys(newScenario["Transmission lines"]).length, 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("changeTransmissionLineData", () => {
|
|
||||||
let scenario = TEST_DATA_1;
|
|
||||||
let err: ValidationError | null;
|
|
||||||
[scenario, err] = changeTransmissionLineData(
|
|
||||||
"l1",
|
|
||||||
"Source bus",
|
|
||||||
"b3",
|
|
||||||
scenario,
|
|
||||||
);
|
|
||||||
assert.equal(err, null);
|
|
||||||
[scenario, err] = changeTransmissionLineData(
|
|
||||||
"l1",
|
|
||||||
"Normal flow limit (MW)",
|
|
||||||
"99",
|
|
||||||
scenario,
|
|
||||||
);
|
|
||||||
assert.equal(err, null);
|
|
||||||
[scenario, err] = changeTransmissionLineData(
|
|
||||||
"l1",
|
|
||||||
"Target bus",
|
|
||||||
"b1",
|
|
||||||
scenario,
|
|
||||||
);
|
|
||||||
assert.equal(err, null);
|
|
||||||
assert.deepEqual(scenario["Transmission lines"]["l1"], {
|
|
||||||
"Source bus": "b3",
|
|
||||||
"Target bus": "b1",
|
|
||||||
"Susceptance (S)": 29.49686,
|
|
||||||
"Normal flow limit (MW)": 99,
|
|
||||||
"Emergency flow limit (MW)": 20000.0,
|
|
||||||
"Flow limit penalty ($/MW)": 5000.0,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test("deleteTransmissionLine", () => {
|
|
||||||
const newScenario = deleteTransmissionLine("l1", TEST_DATA_1);
|
|
||||||
assert.equal(Object.keys(newScenario["Transmission lines"]).length, 0);
|
|
||||||
});
|
|
@ -1,89 +0,0 @@
|
|||||||
/*
|
|
||||||
* UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {
|
|
||||||
assertBusesNotEmpty,
|
|
||||||
changeData,
|
|
||||||
generateUniqueName,
|
|
||||||
renameItemInObject,
|
|
||||||
} from "./commonOps";
|
|
||||||
import { ValidationError } from "../Data/validate";
|
|
||||||
import { TransmissionLinesColumnSpec } from "../../components/CaseBuilder/TransmissionLines";
|
|
||||||
import { TransmissionLine, UnitCommitmentScenario } from "../Data/types";
|
|
||||||
|
|
||||||
export const createTransmissionLine = (
|
|
||||||
scenario: UnitCommitmentScenario,
|
|
||||||
): [UnitCommitmentScenario, ValidationError | null] => {
|
|
||||||
const err = assertBusesNotEmpty(scenario);
|
|
||||||
if (err) return [scenario, err];
|
|
||||||
const busName = Object.keys(scenario.Buses)[0]!;
|
|
||||||
const name = generateUniqueName(scenario["Transmission lines"], "l");
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
...scenario,
|
|
||||||
"Transmission lines": {
|
|
||||||
...scenario["Transmission lines"],
|
|
||||||
[name]: {
|
|
||||||
"Source bus": busName,
|
|
||||||
"Target bus": busName,
|
|
||||||
"Susceptance (S)": 1.0,
|
|
||||||
"Normal flow limit (MW)": 1000,
|
|
||||||
"Emergency flow limit (MW)": 1500,
|
|
||||||
"Flow limit penalty ($/MW)": 5000.0,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
null,
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
export const renameTransmissionLine = (
|
|
||||||
oldName: string,
|
|
||||||
newName: string,
|
|
||||||
scenario: UnitCommitmentScenario,
|
|
||||||
): [UnitCommitmentScenario, ValidationError | null] => {
|
|
||||||
const [newLine, err] = renameItemInObject(
|
|
||||||
oldName,
|
|
||||||
newName,
|
|
||||||
scenario["Transmission lines"],
|
|
||||||
);
|
|
||||||
if (err) return [scenario, err];
|
|
||||||
return [{ ...scenario, "Transmission lines": newLine }, null];
|
|
||||||
};
|
|
||||||
|
|
||||||
export const changeTransmissionLineData = (
|
|
||||||
line: string,
|
|
||||||
field: string,
|
|
||||||
newValueStr: string,
|
|
||||||
scenario: UnitCommitmentScenario,
|
|
||||||
): [UnitCommitmentScenario, ValidationError | null] => {
|
|
||||||
const [newLine, err] = changeData(
|
|
||||||
field,
|
|
||||||
newValueStr,
|
|
||||||
scenario["Transmission lines"][line]!,
|
|
||||||
TransmissionLinesColumnSpec,
|
|
||||||
scenario,
|
|
||||||
);
|
|
||||||
if (err) return [scenario, err];
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
...scenario,
|
|
||||||
"Transmission lines": {
|
|
||||||
...scenario["Transmission lines"],
|
|
||||||
[line]: newLine as TransmissionLine,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
null,
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
export const deleteTransmissionLine = (
|
|
||||||
name: string,
|
|
||||||
scenario: UnitCommitmentScenario,
|
|
||||||
): UnitCommitmentScenario => {
|
|
||||||
const { [name]: _, ...newLines } = scenario["Transmission lines"];
|
|
||||||
return { ...scenario, "Transmission lines": newLines };
|
|
||||||
};
|
|
@ -0,0 +1,179 @@
|
|||||||
|
/*
|
||||||
|
* UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
||||||
|
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
* Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface Buses {
|
||||||
|
[busName: string]: { "Load (MW)": number[] };
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Generators {
|
||||||
|
[name: string]: ProfiledUnit | ThermalUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProfiledUnit {
|
||||||
|
Bus: string;
|
||||||
|
Type: "Profiled";
|
||||||
|
"Minimum power (MW)": number[];
|
||||||
|
"Maximum power (MW)": number[];
|
||||||
|
"Cost ($/MW)": number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ThermalUnit {
|
||||||
|
Bus: string;
|
||||||
|
Type: "Thermal";
|
||||||
|
"Production cost curve (MW)": number[];
|
||||||
|
"Production cost curve ($)": number[];
|
||||||
|
"Startup costs ($)": number[];
|
||||||
|
"Startup delays (h)": number[];
|
||||||
|
"Ramp up limit (MW)": number | "";
|
||||||
|
"Ramp down limit (MW)": number | "";
|
||||||
|
"Startup limit (MW)": number | "";
|
||||||
|
"Shutdown limit (MW)": number | "";
|
||||||
|
"Minimum downtime (h)": number;
|
||||||
|
"Minimum uptime (h)": number;
|
||||||
|
"Initial status (h)": number;
|
||||||
|
"Initial power (MW)": number;
|
||||||
|
"Must run?": boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UnitCommitmentScenario {
|
||||||
|
Parameters: {
|
||||||
|
Version: string;
|
||||||
|
"Power balance penalty ($/MW)": number;
|
||||||
|
"Time horizon (h)": number;
|
||||||
|
"Time step (min)": number;
|
||||||
|
};
|
||||||
|
Buses: Buses;
|
||||||
|
Generators: Generators;
|
||||||
|
}
|
||||||
|
|
||||||
|
const getTypedGenerators = <T extends any>(
|
||||||
|
scenario: UnitCommitmentScenario,
|
||||||
|
type: string,
|
||||||
|
): {
|
||||||
|
[key: string]: T;
|
||||||
|
} => {
|
||||||
|
const selected: { [key: string]: T } = {};
|
||||||
|
for (const [name, gen] of Object.entries(scenario.Generators)) {
|
||||||
|
if (gen["Type"] === type) selected[name] = gen as T;
|
||||||
|
}
|
||||||
|
return selected;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getProfiledGenerators = (
|
||||||
|
scenario: UnitCommitmentScenario,
|
||||||
|
): { [key: string]: ProfiledUnit } =>
|
||||||
|
getTypedGenerators<ProfiledUnit>(scenario, "Profiled");
|
||||||
|
|
||||||
|
export const getThermalGenerators = (
|
||||||
|
scenario: UnitCommitmentScenario,
|
||||||
|
): { [key: string]: ThermalUnit } =>
|
||||||
|
getTypedGenerators<ThermalUnit>(scenario, "Thermal");
|
||||||
|
|
||||||
|
export const BLANK_SCENARIO: UnitCommitmentScenario = {
|
||||||
|
Parameters: {
|
||||||
|
Version: "0.4",
|
||||||
|
"Power balance penalty ($/MW)": 1000.0,
|
||||||
|
"Time horizon (h)": 24,
|
||||||
|
"Time step (min)": 60,
|
||||||
|
},
|
||||||
|
Buses: {},
|
||||||
|
Generators: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const TEST_SCENARIO: UnitCommitmentScenario = {
|
||||||
|
Parameters: {
|
||||||
|
Version: "0.4",
|
||||||
|
"Power balance penalty ($/MW)": 1000.0,
|
||||||
|
"Time horizon (h)": 36,
|
||||||
|
"Time step (min)": 60,
|
||||||
|
},
|
||||||
|
Buses: {
|
||||||
|
b1: {
|
||||||
|
"Load (MW)": [
|
||||||
|
35.79534, 34.38835, 33.45083, 32.89729, 33.25044, 33.93851, 35.8654,
|
||||||
|
37.27098, 38.08378, 38.99327, 38.65134, 38.83212, 37.60031, 37.27939,
|
||||||
|
37.11823, 37.73063, 40.951, 44.77115, 43.67527, 44.40959, 44.33812,
|
||||||
|
42.29071, 40.07654, 37.42093, 35.61175, 34.28185, 32.74174, 33.17336,
|
||||||
|
33.5181, 35.63558, 38.12722, 39.61689, 40.80105, 42.55277, 42.76017,
|
||||||
|
42.12535,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
b2: {
|
||||||
|
"Load (MW)": [
|
||||||
|
14.03739, 13.48563, 13.11797, 12.9009, 13.03939, 13.30922, 14.06486,
|
||||||
|
14.61607, 14.93482, 15.29148, 15.15739, 15.22828, 14.74522, 14.61937,
|
||||||
|
14.55617, 14.79633, 16.05921, 17.55731, 17.12756, 17.41553, 17.3875,
|
||||||
|
16.58459, 15.71629, 14.67487, 13.96539, 13.44386, 12.8399, 13.00916,
|
||||||
|
13.14435, 13.97474, 14.95185, 15.53603, 16.00041, 16.68736, 16.76869,
|
||||||
|
16.51974,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
b3: {
|
||||||
|
"Load (MW)": [
|
||||||
|
27.3729, 26.29698, 25.58005, 25.15675, 25.4268, 25.95298, 27.42649,
|
||||||
|
28.50134, 29.12289, 29.81839, 29.55691, 29.69515, 28.75318, 28.50777,
|
||||||
|
28.38453, 28.85284, 31.31547, 34.23676, 33.39874, 33.96028, 33.90562,
|
||||||
|
32.33996, 30.64676, 28.61601, 27.23252, 26.21553, 25.0378, 25.36786,
|
||||||
|
25.63149, 27.25074, 29.15611, 30.29527, 31.2008, 32.54035, 32.69895,
|
||||||
|
32.2135,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
b4: {
|
||||||
|
"Load (MW)": [
|
||||||
|
27.5, 26.29698, 25.58005, 25.15675, 25.4268, 25.95298, 27.42649,
|
||||||
|
28.50134, 29.12289, 29.81839, 29.55691, 29.69515, 28.75318, 28.50777,
|
||||||
|
28.38453, 28.85284, 31.31547, 34.23676, 33.39874, 33.96028, 33.90562,
|
||||||
|
32.33996, 30.64676, 28.61601, 27.23252, 26.21553, 25.0378, 25.36786,
|
||||||
|
25.63149, 27.25074, 29.15611, 30.29527, 31.2008, 32.54035, 32.69895,
|
||||||
|
32.2135,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Generators: {
|
||||||
|
pu1: {
|
||||||
|
Bus: "b1",
|
||||||
|
Type: "Profiled",
|
||||||
|
"Minimum power (MW)": [
|
||||||
|
52.05076909, 14.57829614, 75.43577222, 67.33346472, 75.36556352,
|
||||||
|
21.57017795, 38.57431892, 46.71083643, 97.87434963, 95.12592361,
|
||||||
|
82.00040834, 25.97388027, 14.87169082, 8.68106053, 43.67452089,
|
||||||
|
18.95280541, 85.59390327, 59.62398136, 81.30530633, 83.61173632,
|
||||||
|
10.07929569, 87.96736565, 84.65719304, 30.57367207, 27.39181212,
|
||||||
|
78.27367461, 6.81518238, 68.40723311, 19.616812, 60.20940984,
|
||||||
|
58.57199889, 89.50587265, 65.26434981, 78.57656542, 52.20154156,
|
||||||
|
42.79584818,
|
||||||
|
],
|
||||||
|
"Maximum power (MW)": [
|
||||||
|
260.25384545, 72.89148068, 377.17886108, 336.66732361, 376.82781758,
|
||||||
|
107.85088974, 192.8715946, 233.55418217, 489.37174815, 475.62961804,
|
||||||
|
410.00204171, 129.86940137, 74.35845412, 43.40530267, 218.37260447,
|
||||||
|
94.76402706, 427.96951634, 298.11990681, 406.52653167, 418.05868161,
|
||||||
|
50.39647843, 439.83682824, 423.28596522, 152.86836035, 136.95906058,
|
||||||
|
391.36837307, 34.0759119, 342.03616557, 98.08406001, 301.04704921,
|
||||||
|
292.85999447, 447.52936326, 326.32174903, 392.88282708, 261.0077078,
|
||||||
|
213.9792409,
|
||||||
|
],
|
||||||
|
"Cost ($/MW)": 50.0,
|
||||||
|
},
|
||||||
|
g1: {
|
||||||
|
Bus: "b1",
|
||||||
|
Type: "Thermal",
|
||||||
|
"Production cost curve (MW)": [100.0, 110.0, 130.0, 135.0],
|
||||||
|
"Production cost curve ($)": [1400.0, 1600.0, 2200.0, 2400.0],
|
||||||
|
"Startup costs ($)": [300.0, 400.0],
|
||||||
|
"Startup delays (h)": [1, 4],
|
||||||
|
"Ramp up limit (MW)": 232.68,
|
||||||
|
"Ramp down limit (MW)": 232.68,
|
||||||
|
"Startup limit (MW)": 232.68,
|
||||||
|
"Shutdown limit (MW)": 232.68,
|
||||||
|
"Minimum downtime (h)": 4,
|
||||||
|
"Minimum uptime (h)": 4,
|
||||||
|
"Initial status (h)": 12,
|
||||||
|
"Initial power (MW)": 115,
|
||||||
|
"Must run?": false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
Loading…
Reference in new issue