Skip to content

Commit

Permalink
Fixing ext_to_int and int_to_ext implementations and adding tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwl committed Sep 6, 2023
1 parent c3745d5 commit cfb7e08
Show file tree
Hide file tree
Showing 7 changed files with 254 additions and 125 deletions.
Binary file added casedata/t_case_ext.case
Binary file not shown.
Binary file added casedata/t_case_int.case
Binary file not shown.
7 changes: 5 additions & 2 deletions src/loadcase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ use anyhow::Result;
use casecsv::read::{read_dir, read_zip};
use std::path::PathBuf;

pub fn load_case_file(case_path: &PathBuf) -> Result<MPC> {
pub fn load_case(case_path: &PathBuf) -> Result<MPC> {
let is_case = match case_path.extension() {
None => false,
Some(os_str) => os_str.to_str() == Some("case"),
Some(os_str) => match os_str.to_str() {
Some("case") | Some("zip") => true,
_ => false,
},
};

let (case, bus, gen, branch, _gencost, _dcline) = if is_case {
Expand Down
4 changes: 1 addition & 3 deletions src/mpc.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use crate::order::Order;
use casecsv::*;
use casecsv::{Branch, Bus, Gen};
use sparsetools::csr::CSR;

/// MPC is a MATPOWER case that models a power system as a directed graph
/// structure.
#[derive(Clone, Default)]
pub struct MPC {
/// System MVA base used for converting power into per-unit quantities.
Expand Down
Loading

0 comments on commit cfb7e08

Please sign in to comment.