Time-Domain System Equivalent logoTime-Domain System EquivalentLinear dynamics, solved faster.Discuss Integration

RAW Import

RAW power system data format import, validation, and conversion to netlist.

This is the canonical customer workflow for importing supported PSS/E RAW data into TDSE Circuit. It records conversion policy, diagnostics, approximations, and the handoff to Circuit authoring or ModelSpace.

RAW Import

Not every circuit starts as a SPICE netlist. In power systems, the starting point is often a PSS/E RAW case file - a grid description with buses, generators, branches, loads, and transformers. RAW Import converts these files into circuit netlists that Circuit SDK can compile, then validates them against the original case data.

The conversion process reads the RAW file, builds an equivalent circuit model for each power-system element, stitches them together, and writes out a SPICE netlist. Base- frequency validation runs automatically - the generated netlist is solved at the nominal system frequency and the resulting bus voltages and branch flows are compared against the original RAW data.

RAW import lives inside Circuit SDK. It is not a standalone workflow - use it as the entry point when your starting artifact is a PSS/E case, then continue through the normal compile-and-compute pipeline described in this chapter.

CLI

For most users, the first successful path is:

tdse circuit raw-to-netlist \
  --raw-kind file --raw case.raw \
  --out-netlist ./case_from_raw.cir \
  --out-report-json ./raw_report.json \
  --json-out -

If that command succeeds, the usual next step is to run tdse circuit matrix on the generated netlist and then hand the result to Builder.

The key flags:

FlagMeaningDefault
--raw-kind file|text|stdinHow the RAW input is provided(required)
--raw <path_or_text>RAW source(required)
--out-netlist <path|->Output netlist path-
--out-report-json <path|->Output validation report-
--unit pu|siPer-unit or SI outputpu
--transformer-model series_only|ideal_tap_series|tap_split_shuntEquivalent circuit modelideal_tap_series
--load-model shunt|series|zip_splitLoad equivalent modelshunt
--include-generator-sources 0|1Include generator Norton equivalents1
--include-fallback-source 0|1Add fallback source for unexcited buses1
--include-tran 0|1Emit .tran directive1
--include-options 0|1Emit .options directive1
--dt <sec>Time step for .tran directive5e-5
--tstop <sec>Stop time for .tran directive0.4
--freq-hz|--nominal-frequency-hz <hz>Base frequency in Hz60
--global-bus-shunt-c-f <farad>Global bus shunt capacitance0
--include-inactive-bus 0|1Include inactive buses in validation0
--ac-adjust-from-sine 0|1Adjust AC phasors from sine reference1
--mag-tol-pu <x>Magnitude tolerance for validation0.03
--ang-tol-deg <x>Angle tolerance in degrees3.0
--complex-tol-pu <x>Complex tolerance for validation0.08
--report-top-k <N>Top-K worst-case buses in the report20

C API

The C API uses the standard size-then-fill pattern. Call once with NULL output buffers to get sizes (returns TDSE_STATUS_BUFFER_TOO_SMALL), allocate, then call again:

#include <tdse/circuit.h>

int convert_raw_file(const char* raw_path) {
    tdse_circuit_raw_options_t raw_opt =
        tdse_circuit_raw_options_init();
    raw_opt.import_options.load_model = TDSE_CIRCUIT_RAW_LOAD_SHUNT;
    raw_opt.import_options.transformer_model =
        TDSE_CIRCUIT_RAW_TRANSFORMER_IDEAL_TAP_SERIES;

    tdse_circuit_raw_request_t req =
        tdse_circuit_raw_request_init();
    req.source_kind = TDSE_CIRCUIT_RAW_SOURCE_FILE;
    req.raw_path = raw_path;
    req.options = &raw_opt;
    req.report_mode = TDSE_CIRCUIT_REPORT_BUFFER;

    tdse_circuit_raw_result_t result =
        tdse_circuit_raw_result_init();
    int rc = tdse_circuit_raw_to_netlist(&req, &result);

    if (rc == TDSE_STATUS_BUFFER_TOO_SMALL) {
        char* netlist_buf = malloc(result.required_netlist_count);
        char* report_buf  = malloc(result.required_report_count);
        req.out_netlist = netlist_buf;
        req.out_netlist_len = result.required_netlist_count;
        req.out_report_json = report_buf;
        req.out_report_json_len = result.required_report_count;

        rc = tdse_circuit_raw_to_netlist(&req, &result);
        // ... use netlist_buf and report_buf ...
        free(netlist_buf);
        free(report_buf);
    }
    return rc;
}

For in-memory RAW text, set source_kind = TDSE_CIRCUIT_RAW_SOURCE_TEXT and pass raw_text / raw_text_len. The rest of the pattern is identical.

For the full RAW-to-pack pipeline in a single call, use tdse_circuit_workflow_raw_to_pack() which chains RAW import, compilation, frequency sweep (or adaptive planning), and Builder handoff.

Transformer Models

Transformers in PSS/E RAW files have tap ratios and phase shifts. The model you choose determines how these are represented in the circuit netlist:

ModelEnum constantDescription
series_onlyRAW_TRANSFORMER_SERIES_ONLYOnly series impedance, ignores tap ratio. Simplest
ideal_tap_seriesRAW_TRANSFORMER_IDEAL_TAP_SERIESIdeal tap in series with leakage impedance
tap_split_shuntRAW_TRANSFORMER_TAP_SPLIT_SHUNTTap split into series + shunt. Most physical, more nodes

Two-winding transformers are converted directly. Three-winding transformers are decomposed into three two-winding equivalents connected at a star point.

Load Models

RAW import converts PSS/E load records into circuit-domain equivalents. Three models are available:

SHUNT (default): Each load becomes an admittance from the load bus to ground, computed from the load's MW/MVAR at the system base voltage. Use when you care about impedance loading effects and are not modeling load dynamics separately.

SERIES: Each load becomes a series RL impedance to ground that preserves real and reactive power draw at nominal voltage. Use for transient or fault studies where the shunt approximation is too coarse.

ZIP_SPLIT: The load is decomposed into constant-impedance (Z), constant-current (I), and constant-power (P) components using ZIP coefficients from the RAW data. Use when the case contains ZIP coefficients and you need faithful reproduction across varying bus voltages.

ModelFidelityComplexityBest for
SHUNTLowMinimalQuick screening, topology checks
SERIESMediumLowTransient and fault studies
ZIP_SPLITHighMediumVoltage-sensitive studies with ZIP data

Validation Report

After conversion, the import result includes a raw_import_report_t with counts of every entity found and converted:

FieldMeaning
bus_countTotal buses in the RAW case
branch_countTotal branches (lines + transformers)
generator_countGenerator/machine records
load_countLoad records found
fixed_shunt_countFixed shunt devices
switched_shunt_countSwitched shunt devices
two_winding_transformer_countTwo-winding transformers converted
three_winding_transformer_countThree-winding transformers (decomposed into 2W)
unsupported_record_countRecords that could not be converted
validation_warning_countValidation warnings generated
base_freq_hzSystem base frequency read from the case
system_mva_baseSystem MVA base from the case

The JSON report (when report_mode = BUFFER) contains the same counts plus per-bus and per-branch detail. Use it to audit what was converted before handing the netlist to Builder.

Error Recovery

RAW import returns the unified tdse_status_t values. Decode them with tdse_circuit_status_message() or tdse_status_message().

StatusCauseFix
TDSE_STATUS_INVALID_ARGMissing struct_size, NULL file path, or bad source kindInitialize every versioned struct and verify source kind
TDSE_STATUS_PARSEMalformed RAW file or unexpected sectionCheck the supported PSS/E RAW format and reduce the case
TDSE_STATUS_IOFile not found or unreadableVerify path and permissions
TDSE_STATUS_UNSUPPORTEDRAW feature not supported by this SDK versionInspect unsupported-record counts and the report
TDSE_STATUS_BUFFER_TOO_SMALLSize query or caller buffer too smallAllocate the reported sizes and retry
TDSE_STATUS_INTERNALUnexpected internal errorReport with the case file and command line
TDSE_STATUS_VALIDATION_FAILEDGenerated netlist failed validationInspect the validation report and smallest failing subset

Thread-local detail text is available via tdse_circuit_raw_get_last_error_text().

Support Boundary

RAW import is a conversion path, not a promise of perfect one-to-one replay of every original study environment. Treat the generated netlist as a new engineering handoff point - validate it before sending it to production Builder flows:

AreaWhat to expectWhat to validate next
buses and branch topologyDirect structural mapping into a circuit netlistNode naming, connectivity, port selection
generators and source injectionsConverted to circuit-domain equivalentsSource polarity, port response, drive conditions
transformersDepends on model selectionTap behavior, shunt/series interpretation
loadsDepends on model (shunt, series, zip_split)Chosen approximation matches study intent
base-frequency semanticsValidated and recorded in the reportReport matches expected system base
unsupported recordsAppear as warnings or omissionsImport report first, then matrix/probe comparison