Pd = Pd_max.*load_rat

Pdm = sum(Pd, dims=1)

Pg_Dict = Dict{Pair{Int16,Int16}, Float16}()

Pd_Dict = Dict{Int16, Float16}()

for i =1:n_bus

for j =1:n_scenarios

key = Pair(i,j)

Pd_Dict[j] = Pdm[j]

value = Pg[i,j]

Pg_Dict[key] = value

end

end

struct Ld

PG::Dict{Pair{Int16,Int16}, Float16}

PL::Dict{Int16, Float16}

dur::Matrix{Int16}

end

Load = Ld(Pg_Dict, Pd_Dict, dur)

Here Pg is a matrix of (24, 4)

I am getting following error.

MethodError: Cannot `convert`

an object of type Dict{Pair{Int16, Int16}, Float16} to an object of type Matrix{Float16}

Closest candidates are:

convert(::Type{T}, ::LinearAlgebra.Factorization) where T<:AbstractArray at C:\Users\Admin\AppData\Local\Programs\Julia-1.8.5\share\julia\stdlib\v1.8\LinearAlgebra\src\factorization.jl:58

convert(::Type{Array{T, N}}, ::StaticArraysCore.SizedArray{S, T, N, N, Array{T, N}}) where {S, T, N} at C:\Users\Admin.julia\packages\StaticArrays\VLqRb\src\SizedArray.jl:88

convert(::Type{Array{T, N}}, ::StaticArraysCore.SizedArray{S, T, N, M, TData} where {M, TData<:AbstractArray{T, M}}) where {T, S, N} at C:\Users\Admin.julia\packages\StaticArrays\VLqRb\src\SizedArray.jl:82

â€¦