diff --git a/cse/cse.go b/cse/cse.go index 993f5bac..89870072 100644 --- a/cse/cse.go +++ b/cse/cse.go @@ -643,6 +643,7 @@ func executeCommand(cmd []string, sim *Simulation, status *structs.SimulationSta var message = "No feedback implemented for this command" switch cmd[0] { case "load": + status.Loading = true var configDir string success, message, configDir = initializeSimulation(sim, cmd[1], cmd[2]) if success { @@ -653,6 +654,7 @@ func executeCommand(cmd []string, sim *Simulation, status *structs.SimulationSta scenarios := findScenarios(status) shorty.Scenarios = &scenarios } + status.Loading = false case "teardown": status.Loaded = false status.Status = "stopped" @@ -806,6 +808,7 @@ func GetSignalValue(module string, cardinality string, signal string) int { func GenerateJsonResponse(status *structs.SimulationStatus, sim *Simulation, feedback structs.CommandFeedback, shorty structs.ShortLivedData) structs.JsonResponse { var response = structs.JsonResponse{ + Loading: status.Loading, Loaded: status.Loaded, Status: status.Status, } @@ -854,7 +857,7 @@ func StateUpdateLoop(state chan structs.JsonResponse, simulationStatus *structs. func addFmu(execution *C.cse_execution, fmuPath string) (*C.cse_slave, error) { baseName := filepath.Base(fmuPath) instanceName := strings.TrimSuffix(baseName, filepath.Ext(baseName)) - fmt.Printf("Creating instance %s from %s", instanceName, fmuPath) + fmt.Printf("Creating instance %s from %s\n", instanceName, fmuPath) localSlave := createLocalSlave(fmuPath, instanceName) if localSlave == nil { printLastError() diff --git a/structs/structs.go b/structs/structs.go index 157ef975..7305c176 100644 --- a/structs/structs.go +++ b/structs/structs.go @@ -19,6 +19,7 @@ type ManipulatedVariable struct { } type JsonResponse struct { + Loading bool `json:"loading"` Loaded bool `json:"loaded"` ExecutionState string `json:"executionState"` LastErrorCode string `json:"lastErrorCode"` @@ -72,6 +73,7 @@ type ShortLivedData struct { } type SimulationStatus struct { + Loading bool Loaded bool ConfigDir string Module string