How jbarberia/psse34to33 works
Project Type and Purpose
• This is a Python library/package whose sole purpose is to read PSSE version-34 .raw case files, convert them into the PSSE-33 data model provided by the grg_pssedata package, and optionally write them back out as PSSE-33 .raw files.
• There is no UI or microservice layer; it’s purely a parsing/conversion tool (an open-source utility library).
File Structure Analysis
• Top-level packaging and configuration:
• setup.py, requirements.txt → package installation
• README.md → usage and high-level description
• Core library (PSSE34to33/):
• readfiles.py → routines to read and tokenize the PSSE-34 .raw text
• dataformat.py → classes or functions that map raw tokens into in-memory structures
• psse33conversion.py → conversion logic that transforms these in-memory structures into a grg_pssedata.struct.Case instance
• __init__.py → public API (exports conversion_to_33)
• Tests (tests/):
• tests/data/*.raw → sample input files
• tests/test_00.py → unit tests that drive read → convert → write and verify outcomes
README Insights
• The public API is a single function: conversion_to_33(filename) -> Case
• The target of conversion is the grg_pssedata.struct.Case class.
• Writing back to .raw relies on the .to_psse() method on that Case instance.
Key Components
a. PSSE34to33 Package
• Module: readfiles
• Module: dataformat
• Module: psse33conversion
• Public API wrapper (in __init__.py)
b. External Library
• grg_pssedata (provides the Case data structure)
c. File I/O Layers
• Input: PSSE-34 .raw files
• Output: PSSE-33 .raw files via Case.to_psse()
Relationships & Data Flow
• Raw Input File → readfiles.parse_raw() → Intermediate Tokens
→ dataformat.build_structures() → Raw-version Data Models
→ psse33conversion.conversion_to_33() → grg_pssedata.struct.Case
→ Case.to_psse() → Raw Output File
• Packaging & Installation: setup.py installs the PSSE34to33 package and its dependency on grg_pssedata.
Architectural Patterns & Principles
• Single Responsibility per module:
• readfiles only reads and tokenizes
• dataformat only builds in-memory raw structures
• psse33conversion only transforms raw structures to target model
• Clear layering: I/O Layer → Parsing Layer → Conversion Layer → Output Layer
• Dependency inversion: high-level conversion logic depends on an abstract data model (grg_pssedata.struct.Case) rather than raw file details.