Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 787 Bytes

serialize_data.md

File metadata and controls

32 lines (22 loc) · 787 Bytes

Serializing PowerSystem Data

Originally Contributed by: Clayton Barrows

Introduction

PowerSystems.jl supports serializing/deserializing data with JSON. This provides an example of how to write and read a System to/from disk.

Dependencies

Let's use a dataset from the tabular data parsing tutorial:

using PowerSystems
file_dir = joinpath(pkgdir(PowerSystems), "docs", "src", "tutorials", "tutorials_data"); #hide 
sys = System(joinpath(file_dir, "case5_re.m"))

Write data to a temporary directory

folder = mktempdir();
path = joinpath(folder, "system.json")
println("Serializing to $path")
to_json(sys, path)

Read the JSON file and create a new System

sys2 = System(path)