Tutorial 1 - Using the materials library
This tutorial demonstrates how to manage material properties for power cable modeling using the package LineCableModels.jl. Accurate knowledge of electromagnetic properties is essential for reliable cable design and analysis.
Beyond showcasing the API, this guide serves as a practical reference by providing standard property values from recognized industry sources like CIGRE TB-531 [8] and IEC 60287 [9] that can be stored and consistently applied across multiple design iterations and simulation studies.
Tutorial outline
- Getting started
- Adding new materials
- Removing materials
- Saving the materials library to JSON
- Retrieving materials for use
- Conclusion
Getting started
Load the package:
using LineCableModels
using DataFramesThe MaterialsLibrary is a container for storing electromagnetic properties of different materials used in power cables. By default, it initializes with several common materials with their standard properties.
Initialize a MaterialsLibrary with default values:
materials = MaterialsLibrary()MaterialsLibrary with 12 materials:
├─ pe
├─ copper
├─ pec
├─ polyacrylate
└─ semicon1
└─ ... and 7 moreInspect the contents of the materials library:
materials_df = DataFrame(materials)| Row | name | rho | eps_r | mu_r | T0 | alpha |
|---|---|---|---|---|---|---|
| String | Float64 | Float64 | Float64 | Float64 | Float64 | |
| 1 | pe | 1.97e14 | 2.3 | 1.0 | 20.0 | 0.0 |
| 2 | copper | 1.7241e-8 | 1.0 | 0.999994 | 20.0 | 0.00393 |
| 3 | pec | 2.22045e-16 | 1.0 | 1.0 | 20.0 | 0.0 |
| 4 | polyacrylate | 5300.0 | 32.3 | 1.0 | 20.0 | 0.0 |
| 5 | semicon1 | 1000.0 | 1000.0 | 1.0 | 20.0 | 0.0 |
| 6 | xlpe | 1.97e14 | 2.5 | 1.0 | 20.0 | 0.0 |
| 7 | semicon2 | 500.0 | 1000.0 | 1.0 | 20.0 | 0.0 |
| 8 | aluminum | 2.8264e-8 | 1.0 | 1.00002 | 20.0 | 0.00429 |
| 9 | lead | 2.14e-7 | 1.0 | 0.999983 | 20.0 | 0.004 |
| 10 | air | Inf | 1.0 | 1.0 | 20.0 | 0.0 |
| 11 | pp | 1.0e15 | 2.8 | 1.0 | 20.0 | 0.0 |
| 12 | steel | 1.38e-7 | 1.0 | 300.0 | 20.0 | 0.0045 |
The function DataFrame returns a DataFrame with all materials and their properties, namely: electrical resistivity, relative permittivity, relative permeability, reference temperature, and temperature coefficient.
Adding new materials
It might be useful to add other conductor materials with corrected properties based on recognized standards [8] [9].
copper_corrected = Material(1.835e-8, 1.0, 0.999994, 20.0, 0.00393) # Copper with corrected resistivity from IEC 60287-3-2
add!(materials, "copper_corrected", copper_corrected)
aluminum_corrected = Material(3.03e-8, 1.0, 0.999994, 20.0, 0.00403) # Aluminum with corrected resistivity from IEC 60287-3-2
add!(materials, "aluminum_corrected", aluminum_corrected)MaterialsLibrary with 14 materials:
├─ pe
├─ aluminum_corrected
├─ copper
├─ pec
└─ polyacrylate
└─ ... and 9 morelead = Material(21.4e-8, 1.0, 0.999983, 20.0, 0.00400) # Lead or lead alloy add!(materials, "lead", lead) steel = Material(13.8e-8, 1.0, 300.0, 20.0, 0.00450) # Steel add!(materials, "steel", steel) bronze = Material(3.5e-8, 1.0, 1.0, 20.0, 0.00300) # Bronze add!(materials, "bronze", bronze)
stainless_steel = Material(70.0e-8, 1.0, 500.0, 20.0, 0.0) # Stainless steel
add!(materials, "stainless_steel", stainless_steel)MaterialsLibrary with 15 materials:
├─ pe
├─ aluminum_corrected
├─ copper
├─ pec
└─ polyacrylate
└─ ... and 10 moreWhen modeling cables for EMT analysis, one might be concerned with the impact of insulators and semiconductive layers on cable constants. Common insulation materials and semicons with different dielectric properties are reported in Table 6 of [8]. Let us include some of these materials in the MaterialsLibrary to help our future selves.
epr = Material(1e15, 3.0, 1.0, 20.0, 0.005) # EPR (ethylene propylene rubber)
add!(materials, "epr", epr)
pvc = Material(1e15, 8.0, 1.0, 20.0, 0.1) # PVC (polyvinyl chloride)
add!(materials, "pvc", pvc)
laminated_paper = Material(1e15, 2.8, 1.0, 20.0, 0.0) # Laminated paper propylene
add!(materials, "laminated_paper", laminated_paper)
carbon_pe = Material(0.06, 1e3, 1.0, 20.0, 0.0) # Carbon-polyethylene compound (semicon)
add!(materials, "carbon_pe", carbon_pe)
conductive_paper = Material(18.5, 8.6, 1.0, 20.0, 0.0) # Conductive paper layer (semicon)
add!(materials, "conductive_paper", conductive_paper)MaterialsLibrary with 20 materials:
├─ pe
├─ aluminum_corrected
├─ copper
├─ pec
└─ conductive_paper
└─ ... and 15 moreRemoving materials
Materials can be removed from the library with the delete! function.
Add a duplicate material by accident:
add!(materials, "epr_dupe", epr)MaterialsLibrary with 21 materials:
├─ pe
├─ aluminum_corrected
├─ copper
├─ pec
└─ conductive_paper
└─ ... and 16 moreAnd now remove it using the delete! function:
delete!(materials, "epr_dupe")[ Info: Material 'epr_dupe' removed from the library.Examine the updated library after removing the duplicate:
println("Material properties compiled from CIGRE TB-531 and IEC 60287:")
materials_df = DataFrame(materials)| Row | name | rho | eps_r | mu_r | T0 | alpha |
|---|---|---|---|---|---|---|
| String | Float64 | Float64 | Float64 | Float64 | Float64 | |
| 1 | pe | 1.97e14 | 2.3 | 1.0 | 20.0 | 0.0 |
| 2 | aluminum_corrected | 3.03e-8 | 1.0 | 0.999994 | 20.0 | 0.00403 |
| 3 | copper | 1.7241e-8 | 1.0 | 0.999994 | 20.0 | 0.00393 |
| 4 | pec | 2.22045e-16 | 1.0 | 1.0 | 20.0 | 0.0 |
| 5 | conductive_paper | 18.5 | 8.6 | 1.0 | 20.0 | 0.0 |
| 6 | laminated_paper | 1.0e15 | 2.8 | 1.0 | 20.0 | 0.0 |
| 7 | polyacrylate | 5300.0 | 32.3 | 1.0 | 20.0 | 0.0 |
| 8 | semicon1 | 1000.0 | 1000.0 | 1.0 | 20.0 | 0.0 |
| 9 | xlpe | 1.97e14 | 2.5 | 1.0 | 20.0 | 0.0 |
| 10 | semicon2 | 500.0 | 1000.0 | 1.0 | 20.0 | 0.0 |
| 11 | aluminum | 2.8264e-8 | 1.0 | 1.00002 | 20.0 | 0.00429 |
| 12 | carbon_pe | 0.06 | 1000.0 | 1.0 | 20.0 | 0.0 |
| 13 | lead | 2.14e-7 | 1.0 | 0.999983 | 20.0 | 0.004 |
| 14 | copper_corrected | 1.835e-8 | 1.0 | 0.999994 | 20.0 | 0.00393 |
| 15 | air | Inf | 1.0 | 1.0 | 20.0 | 0.0 |
| 16 | epr | 1.0e15 | 3.0 | 1.0 | 20.0 | 0.005 |
| 17 | pvc | 1.0e15 | 8.0 | 1.0 | 20.0 | 0.1 |
| 18 | pp | 1.0e15 | 2.8 | 1.0 | 20.0 | 0.0 |
| 19 | stainless_steel | 7.0e-7 | 1.0 | 500.0 | 20.0 | 0.0 |
| 20 | steel | 1.38e-7 | 1.0 | 300.0 | 20.0 | 0.0045 |
Saving the materials library to JSON
output_file = fullfile("materials_library.json")
save(materials, file_name = output_file);[ Info: Materials library saved to: materials_library.jsonRetrieving materials for use
To load from an existing JSON file, instantiate a new MaterialsLibrary followed by a call to the load! method. Materials can be retrieved from the library using the get function.
Initialize a new MaterialsLibrary and load from the JSON file:
materials_from_json = MaterialsLibrary()
load!(materials_from_json, file_name = output_file)MaterialsLibrary with 20 materials:
├─ pe
├─ aluminum_corrected
├─ copper
├─ pec
└─ conductive_paper
└─ ... and 15 moreRetrieve a material and display the object:
copper = get(materials_from_json, "copper_corrected")Material with properties: [rho=1.835e-8, eps_r=1.0, mu_r=1.0, T0=20.0, alpha=0.00393]Access the material properties:
println("Retrieved copper_corrected material properties:")
println("Resistivity: $(copper.rho) Ω·m")
println("Relative permittivity: $(copper.eps_r)")
println("Relative permeability: $(copper.mu_r)")
println("Reference temperature: $(copper.T0) °C")
println("Temperature coefficient: $(copper.alpha) 1/°C")Retrieved copper_corrected material properties:
Resistivity: 1.835e-8 Ω·m
Relative permittivity: 1.0
Relative permeability: 0.999994
Reference temperature: 20.0 °C
Temperature coefficient: 0.00393 1/°CConclusion
This tutorial has demonstrated how to:
- Initialize a
MaterialsLibrarywith defaultMaterialobjects. - Add new materials with specific properties.
- Remove duplicate materials.
- Save the library to a file for future use.
- Retrieve materials for use in cable modeling.
The MaterialsLibrary provides a flexible and traceable framework to manage material properties for accurate power cable modeling. Custom Material objects can be defined and used to match specific manufacturer data or standards requirements.
🏠 Back to Tutorials