Closed kyllingstad closed 5 years ago
Ser bra ut! Petimeter'en i meg synes vel kanskje ikke at man trenger å prepende kommandoen med mr, men progress i seg selv er nok. Antar at dette er for at noen ikke ønsker å se @progress?
To grunner. For det første følger jeg *NIX-prinsippet om at et kommandolinjeprogram ikke bør ha noe output med mindre:
For det andre er akkurat denne outputen spesifikt laget for å være maskinlesbar, og må anses for å være en del av programmets API. Dette til forskjell fra den "menneske-lesbare" outputen som kommer via den vanlige loggemekanismen (PR #13), som vi kan endre så mye og ofte vi ønsker. Sammenlign:
> cse run-single cse-core/test/data/ssp/demo/KnuckleBoomCrane.fmu
> cse run-single cse-core/test/data/ssp/demo/KnuckleBoomCrane.fmu --mr-progress
@progress 1 0.100000 0.100000
@progress 2 0.200000 0.200000
@progress 3 0.300000 0.300000
@progress 4 0.400000 0.400000
@progress 5 0.500000 0.500000
@progress 6 0.600000 0.600000
@progress 7 0.700000 0.700000
@progress 8 0.800000 0.800000
@progress 9 0.900000 0.900000
@progress 10 1.000000 1.000000
> cse run-single cse-core/test/data/ssp/demo/KnuckleBoomCrane.fmu --log-level=info
info: [FMI Library: FMILIB] Loading 'win64' binary with 'default' platform types
info: 10% complete, t=0.100000
info: 20% complete, t=0.200000
info: 30% complete, t=0.300000
info: 40% complete, t=0.400000
info: 50% complete, t=0.500000
info: 60% complete, t=0.600000
info: 70% complete, t=0.700000
info: 80% complete, t=0.800000
info: 90% complete, t=0.900000
info: 100% complete, t=1.000000
This resolves issue #12. If the
--mr-progress
option is given to eithercse run
orcse run-single
, it prints lines on the formto standard output, where
n
is the progress in increments of a given resolution (e.g.--mr-progress=100
, default is 10 if not specified),t
is the current simulation time, andd
is the simulation time that has passed since the start of the simulation. A new line is printed each timen
increases by 1.I did not include the resolution, the total time or total duration in the output, as the calling program/user has this information already.
I envision this as the first of several
--mr-xxx
options to come, wheremr
stands for "machine readable", and lines are printed as@xxx <info>
.~This PR is targeted on #13 to avoid unnecessary conflict and noise. I'll retarget on master once #13 is merged.~