Skip to content
Snippets Groups Projects
Unverified Commit b49e5d01 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Clean up printing for BuildingBlock

parent 79f509b1
No related branches found
No related tags found
1 merge request!7Add variables as properties
...@@ -2,6 +2,7 @@ module Printing ...@@ -2,6 +2,7 @@ module Printing
import JuMP: value, AbstractJuMPScalar import JuMP: value, AbstractJuMPScalar
import Printf: @sprintf import Printf: @sprintf
import ..Variables: VariableType, variables, AbstractBlock, Variable import ..Variables: VariableType, variables, AbstractBlock, Variable
import ..Containers: BuildingBlock, waveform, events, start_time
function _robust_value(possible_number::VariableType) function _robust_value(possible_number::VariableType)
try try
...@@ -51,7 +52,22 @@ function show_block(io::IO, block::AbstractBlock, nspaces::Int64) ...@@ -51,7 +52,22 @@ function show_block(io::IO, block::AbstractBlock, nspaces::Int64)
end end
print(io, ",\n") print(io, ",\n")
end end
print(io, ")") print(io, repeat(' ', nspaces), ")")
end
function show_block(io::IO, block::BuildingBlock, nspaces::Int64)
print(io, nameof(typeof(block)), "(\n")
control_points = waveform(block)
print(io, repeat(' ', nspaces + 2), "duration=$(variables.duration(block)),\n")
for (key, event) in events(block)
print(io, repeat(' ', nspaces + 2), "t=$(start_time(block, key)): ")
show_block(io, event, nspaces + 2)
print(io, ",\n")
end
if !all(all(iszero.(grad)) for (_, grad) in control_points)
print(io, repeat(' ', npsaces + 2), "waveform=", control_points, ",\n")
end
print(io, repeat(' ', nspaces), ")")
end end
end end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment