A pure rust implementation of the IEC61850 protocol.
This crate provides a client that implements the IEC61850 MMS part of the protocol. Goose and sv parts may come in the future. A server implementation may also come in the future. Basic tests where done using a test server but some error may still arise. Despite the client being already working this is still a work in progress and the interfaces may change.
A more complete example of how to use the client can be found on the examples folder.
use iec61850::{ ClientConfig, Iec61850Client, mms::ReportCallback, }; /// A test report callback that will print the report to the console. struct TestReportCallback; #[async_trait::async_trait] impl ReportCallback for TestReportCallback { async fn on_report(&self, report: Report) { println!("Report: {:?}", report); } } #[tokio::main] async fn main() -> Result<(), dyn std::error::Error> { // Connects to a server at localhost:102. Configurations like the serve ip and port can be changed using the ClientConfig let client = Iec61850Client::new(ClientConfig::default(), Box::new(TestReportCallback)).await?; let model = client.model(); println!("Ied model: {model:#?}"); let data = client .read_data_from_ld("SampleIEDDevice1", &["DGEN1$ST$Mod", "DGEN1$MX$TotWh"]) .await?; println!("Data: {data:#?}"); }
Contributions are welcome and encourage!
If a bug is found open and issue explaining the problem and, if possible, attach some package captures to help understanding the problem.
A set of pre-commits hooks are provided to help keep the code nice and tidy
- If not installed, install with your package manager, or
pip install --user pre-commit - Run
pre-commit autoupdateto update the pre-commit config to use the newest template - Run
pre-commit installto install the pre-commit hooks to your local environment