I am trying to read "fig8_30.mat" (from Electric Machinery and Power Systems by S.J. Chapman) from a Julia file. I need the values to be {Float64} and not as Strings!
How can I do this using Julia v1.6 ?
Julia file: shunt_ts_curve.jl
Create a plot of the torque-speed curve of the
DC motor with armature reaction in Example 8-3.
using Plots, MAT, Interpolations, Dierckx
Get the magnetisation curve. This file contains the
three variables if_value, ea_value, and n_0.
if_values, ea_values, n_0 = matread(fig8_30.mat)
if_values = matopen("fig8_30.mat", if_values)
varnames = names(file)
close(file)
fileIn = matopen("fig8_30.mat") ### Here is where the file is read.
if_values,ea_values,n_0 = read(fileIn) ###
close(fileIn) ###
=
First, initialise the values needed in this program.
v_t = 250 # Terminal voltage (V)
r_f = 50 # Field resistance (ohms)
r_a = 0.06 # Armature resistance (ohms)
i_l = collect(10:10:300) # Line currents (A)
n_f = 1200 # Number of turns on Field
f_ar0 = 600 # Armature reaction @ 200 A (A-t/m)
Calculate the armature current for each load.
i_a = i_l .- v_t / r_f
Now calculate the internal generated voltage for
each armature current
e_a = v_t .- i_a * r_a
Calculate the armature reaction MMF for each armature
current.
f_ar = (i_a / 200) * f_ar0
Calculate the effective field current.
i_f = v_t / r_f .- f_ar / n_f
Calculate the resulting internal generated voltage at
1200 rpm by interpolating the motor's magnetisation
I am trying to read "fig8_30.mat" (from Electric Machinery and Power Systems by S.J. Chapman) from a Julia file. I need the values to be {Float64} and not as Strings! How can I do this using Julia v1.6 ?
Julia file: shunt_ts_curve.jl
Create a plot of the torque-speed curve of the
DC motor with armature reaction in Example 8-3.
using Plots, MAT, Interpolations, Dierckx
Get the magnetisation curve. This file contains the
three variables if_value, ea_value, and n_0.
if_values, ea_values, n_0 = matread(fig8_30.mat)
if_values = matopen("fig8_30.mat", if_values)
varnames = names(file)
close(file)
fileIn = matopen("fig8_30.mat") ### Here is where the file is read. if_values,ea_values,n_0 = read(fileIn) ### close(fileIn) ###
=
First, initialise the values needed in this program.
v_t = 250 # Terminal voltage (V) r_f = 50 # Field resistance (ohms) r_a = 0.06 # Armature resistance (ohms) i_l = collect(10:10:300) # Line currents (A) n_f = 1200 # Number of turns on Field f_ar0 = 600 # Armature reaction @ 200 A (A-t/m)
Calculate the armature current for each load.
i_a = i_l .- v_t / r_f
Now calculate the internal generated voltage for
each armature current
e_a = v_t .- i_a * r_a
Calculate the armature reaction MMF for each armature
current.
f_ar = (i_a / 200) * f_ar0
Calculate the effective field current.
i_f = v_t / r_f .- f_ar / n_f
Calculate the resulting internal generated voltage at
1200 rpm by interpolating the motor's magnetisation
curve.
itp_cubic = CubicSplineInterpolation(if_values,ea_values) e_a0 = itp_cubic(i_f)
Calculate the resulting speed from Equation (8-42)
n = ( e_a ./ e_a0 ) * n_0 =#
The values of the variables if_values, ea_values, and n_0 produced are:-
julia> if_values Pair{String, Any}("ea_values", [0.0; 21.0; … ; 289.0; 289.25])
julia> ea_values Pair{String, Any}("n_0", 1200.0)
julia> n_0 Pair{String, Any}("if_values", [0.0; 0.3333; … ; 9.6666; 10.0])
How should I make them be {Float64} ?