Skip to content
Snippets Groups Projects
Select Git revision
  • a500a7b6dd577016ed103c083000e19f193bf21a
  • master default protected
  • Rpc
3 results

ModeliProtocol.fbs

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ModeliProtocol.fbs 2.36 KiB
    // This protocol is used by the ModeliChart backend to transfer data to the frontend
    namespace Network.Protocol;
    
    // The TCP is 52062
    
    // The commands
    enum CommandEnum : int { 
      KeepAlive,	// Send this command to check if the connection is still alive, do nothing in the backend
      Play,		// Start simulating
      PlayFast, 	// Simulate as quick as possible 
      Pause,	// Pause simulation
      Stop,		// Stop and reset simulation
      AddFmu,	// Receive the binary
      RemoveFmu,	// Remove a model
      ValueRefs,	// Receive the default ValueRefs used for simulation
      AddChannelLinks,	// Add ChannelLinks
      RemoveChannelLinks,	// Remove ChannelLinks
      Feedback,	// Send a fmi2Status & msg (optional 0 as size) to the frontend
      IntValues,	// Integer values, to backend: set values in fmu, to frontend: latest values from simulation
      RealValues,	// Real values, to backend: set values in fmu, to frontend: latest values from simulation
      BoolValues,	// Boolean values, to backend: set values in fmu, to frontend: latest values from simulation
      StringValues,	// String, to backend: set values in fmu, to frontend: latest values from simulation
      Log		// Send a log message to the frontend
    }	
    
    // Contains the information to execute the command
    union DataUnion { 
      Time, FmuFile, ValueRefs, ChannelLink, 
      IntValues, RealValues, BoolValues, StringValues, Feedback, Log 
    }
    
    // For message management
    table ModeliMessage {
      Command:CommandEnum;
      JobNr:int;
      Data:DataUnion;
    }
    
    table Time {
      Value:double;
    }
    
    table FmuFile{
      InstanceName:string;
      BinarySize:int;
    }
    
    table ValueRefs {
      InstanceName:string;
      IntVrs:[uint];
      RealVrs:[uint];
      BoolVrs:[uint];
      StringVrs:[uint];
    }
    
    table ChannelLink {
      MasterInstanceName:string;
      SlaveInstanceName:string;
      MasterVr:uint;
      SlaveVr:uint;
      Factor:double;
      Shift:double;
    }
    
    table IntValues {
      InstanceName:string;
      Timestamp:double;
      ValueRefs:[uint];
      Values:[int];
    }
    
    table RealValues {
      InstanceName:string;
      Timestamp:double;
      ValueRefs:[uint];
      Values:[double];
    }
    
    table BoolValues {
      InstanceName:string;
      Timestamp:double;
      ValueRefs:[uint];
      Values:[int];	// fmistandard: stored as 1(true) or 0(false) int
    }
    
    table StringValues {
      InstanceName:string;
      Timestamp:double;
      ValueRefs:[uint];
      Values:[string];
    }
    
    table Feedback {
      Result:int;
      Message:string;
    }
    
    table Log {
      InstanceName:string;
      Message:string;
    }
    
    root_type ModeliMessage;