//2.1 仿真资源注册(公共频道)
{
"command": "RegisterResource", //命令名
"to": "controller", //接收方
"params": { //发布参数
"type": "show", //资源类型:资源类型1.显控服务(show);2.仿真控制器服务(control);3.仿真数据服务(data);4.fmu master1(fmumaster);5.matlab master1(matlabmaster);6.实时仿真master1(realmaster)
"port": "8080", //资源端口
"ip": "192.168.88.156", //资源标识
"objcapacity": "100", //可运行模块数量(-1,无限制)
"capacity": "100", //可运行任务数量
"resourcename": "XXXXX" //资源名
}
}
//2.2 仿真资源注册响应(公共频道)
{
"command": "RegisterResourceResponse", //命令名
"from": "controller", //发送方
"to": "0202ec7d7c7e4f72a1627063c295e4f5", //接收方
"params": { //发布参数
"result": "OK", //注册结果
"type": "show", //资源类型
"port": "8080", //资源端口
"ip": "192.168.88.156", //资源标识
"info": "Register OK" //信息说明
}
}
//2.3 心跳注册(公共频道)
{
"command": "Heartbeat", //命令名
"from": "0202ec7d7c7e4f72a1627063c295e4f5", //发送方
"to": "controller" //接收方
}
//2.4 心跳注册响应(公共频道)
{
"command": "HeartbeatResponse", //命令名
"from": "controller", //发送方
"to": "0202ec7d7c7e4f72a1627063c295e4f5", //接收方
"params": {
"result": "OK", //命令结果
"info": "Heartbeat Register OK" //信息说明
}
}
//2.5 仿真工程列表加载请求:
{
"command": "QueryProjectList", //命令名
"from": "controller", //发送方
"to": "0202ec7d7c7e4f72a1627063c295e4f5", //接收方
"params": {}
}
//2.6 仿真工程列表数据返回
{
"command": "QueryProjectListPesponse",
"from": "0202ec7d7c7e4f72a1627063c295e4f5",
"to": " controller ",
"params": {
"projectlist": {
"XXXXXX":"xxxxxx"
}
}
}
//2.7 仿真工程模型列表加载请求:
{
"command": "QueryProjectModelList", //命令名
"from": "controller", //发送方
"to": "0202ec7d7c7e4f72a1627063c295e4f5", //接收方
"params": {
"projectid":"XXXXXX"
}
}
//2.8 仿真工程模型列表数据返回
{
"command": "QueryProjectModelListResponse",
"from": "0202ec7d7c7e4f72a1627063c295e4f5",
"to": " controller ",
"params": {
" XXXXXX": {
"AAAAA":"aaaaa",
"BBBBB": "bbbbb"
}
}
}
//2.9 仿真工程模型配置加载请求:
{
"command": "QueryProjectModelConfig", //命令名
"from": "controller", //发送方
"to": "0202ec7d7c7e4f72a1627063c295e4f5", //接收方
"params": {
"projectid":"XXXXXX",
"modelid":"AAAAA"
}
}
//2.10 仿真工程模型配置数据返回
{
"command": "QueryProjectModelConfigResponse",
"from": "0202ec7d7c7e4f72a1627063c295e4f5",
"to": "controller",
"params": {
"project":"XXXXXX",
"modelid":"AAAAA",
"modelname":"BBBBB",
"modelconfig": {
"portid":"1",
"portname":"m",
"portmemo":"质量(kg)",
"defaultvalue":"1000",
"datatype":"double",
"paramtype":"parameter"
}
}
}
//2.11 仿真任务注册(公共频道)
{
"command": "RegisterSimuTask", //命令名
"from": "controller", //发送方
"to": "all", //接收方
"params": {
"taskid": "ABCDEFG", //仿真任务ID
"resourcelist": ["7e0dde5a880e49fcb57e01ff2839f1fa"], //使用资源ID列表
}
}
//2.12 仿真任务注册响应(公共频道)
{
"command": "RegisterSimuTaskResponse", //命令名
"from": "0202ec7d7c7e4f72a1627063c295e4f5", //发送方
"to": "controller", //接收方
"params": {
"result": "OK", //命令结果
"info": "仿真注册响应成功", //信息说明
"taskid": "ABCDEFG" //仿真任务ID
}
}
//2.13 仿真控制器启动(公共频道)
{
"command": "SimuControllerStart", //命令名
"from": "controller", //发送方
"to": "0202ec7d7c7e4f72a1627063c295e4f5", //接收方
"params": {
"taskid": "ABCDEFG" //仿真任务id
}
}
//2.14 仿真模型文件(键值对)
key : ABCDEFG.fmu.SF_1.SpringDamper_2 //FMU仿真文件
key : ABCDEFG.hw_config.SF_1 //硬件仿真文件
value : 文件字节流
//2.15 仿真设计设置(任务频道)
{
"command": "ProjectDesignConfig", //命令名
"from": "controller", //发送方
"to": "all", //接收方
"params": {
"logging": "false", //
"start_time": 0, //仿真开始时间
"final_time": 20, //仿真结束时间
"simumode": "real_time", //仿真模式:real_time(实时)、quasi_time(准实时)、super_real_time(超实时)
"subgraphinfo": { //子图设计
"7e0dde5a880e49fcb57e01ff2839f1fa": "SF_1" //仿真资源对应子图id
},
"modelinfo": { //模型设计
"SF_1": { //子图id
"SpringDamper_2": { //模型id
"modeltype": "fmu", //模型类型
"portconfig": { //参数设计
"portname":{ //参数名
"portid": "1", //参数id
"portname": "m", //参数名
"portmemo": "质量(kg)", //参数说明
"defaultvalue": "1000", //参数默认值
"datatype": "double", //参数值类型
"paramtype": "parameter", //参数类型
"link": "1", //参数连接线标记,parameter无该项:0.没有连接;1.有连接
"output": "1" //参数输出标记,有连接的参数必须输出:0.不输出;1.输出
}
}
}
}
},
"linkinfo": { //连接设计
"Graph": [{ //子图间连接
"fromsubgraph": "SF1", //输出子图id
"frommodel": "AI_2", //输出模型id
"fromport": "HParameter01010101", //输出参数名
"tosubgraph": "SF_1", //输入子图id
"tomodel": "add_sf_2", //输入模型id
"toport": "In2" //输入参数名
}],
"SF_1": [{ //子图内连接
"frommodel": "AI_2", //输出模型id
"fromport": "HParameter01010101", //输出参数名
"tomodel": "add_sf_2", //输入模型id
"toport": "In2" //输入参数名
}]
},
"simustep": { //仿真步长设计
"unitstep": 0.001, //通用步长
"SF_1": { //子图步长设计
"method": "B0", //仿真算法
"SpringDamper_2": 0.001, //模型仿真步长设计
"load1_2": 0.005
}
},
"communicatestep": { //通信步长设计
"SF_1": "0.0001" //子图通信步长设计
},
"startconfig": [ //仿真开始模型设计
[
"SF_1", //子图id
"SpringDamper_2", //模型id
"tau1" //参数名
]
],
"endconfig": [ //仿真结束模型设计
[
"SF_1", //子图id
"SpringDamper_2", //模型id
"tau1" //参数名
]
],
"delayconfig": { //仿真延时设计
"SF_1": { //子图id
"SpringDamper_2": { //模型id
"tau1": 0.001, //参数延时时间设计
"tau2": 0.05
}
}
}
}
}
//2.16 仿真初始化指令(任务频道)
{
"command": "InitSimulation", //命令名
"from": "controller", //发送方
"to": "all", //接收方
"params":{
"taskid": "ABCDEFG" //仿真任务ID
}
}
//2.17 仿真初始化指令响应(任务频道)
{
"command": "InitSimulationResponse", //命令名
"from": "7e0dde5a880e49fcb57e01ff2839f1fa", //发送方
"to": "controller", //接收方
"params":{
"taskid": "ABCDEFG", //仿真任务ID
"subgraphid": "SF_1", //仿真任务ID
"result": "OK", //结果
"info":"" //说明
}
}
//2.18 仿真开始指令(任务频道)
{
"command": "StartSimulation", //命令名
"from": "controller", //发送方
"to": "all", //接收方
"params":{
"taskid": "ABCDEFG" //仿真任务ID
}
}
//2.19 仿真控制指令(任务频道)
{
"command": "EndSimulation", //命令名:暂停:PauseSimulation,继续ContinueSimulation
"from": "controller", //发送方
"to": "all", //接收方
"params":{
"taskid": "ABCDEFG" //仿真任务ID
}
}
//2.20 仿真时间设置(任务频道)
{
"command": "SimTime", //命令名
"from": "controller", //发送方
"to": "all", //接收方
"params":{
"taskid": "ABCDEFG", //仿真任务ID
"simtime": 0.0005 //运行时间
}
}
//2.21 仿真数据发布(结果频道)
{
"command": "SimuResultData", //命令名
"from": "controller", //发送方
"to": "all", //接收方
"params":{
"taskid": "ABCDEFG", //仿真任务ID
"subgraphID": "SF_2", //子图ID
"simutime": 4.399, //运行时间
"datapackage": {
"SF_001": { //子图id
"DigitalSatellite_model0716_AOCC_0test_3": { //模型id
"y9": { //参数名
"value": ["0.5"], //参数值
"datatype":"double" //参数类型
}
}
}
}
}
}
//2.22 仿真交换数据发布(任务频道)
{
"command": "SimuExchangeData", //命令名
"from": "7e0dde5a880e49fcb57e01ff2839f1fa", //发送方
"to": "controller", //接收方
"params":{
"taskid": "ABCDEFG", //仿真任务ID
"subgraphID": "SF_2", //子图ID
"simutime": 4.399, //运行时间
"datapackage": {
"0.05": { //仿真步长
"DigitalSatellite_model0716_AOCC_0test_3":{ //模型id
"y9":{ //参数名
"value": ["0.5"], //参数值
"datatype":"double" //参数类型
},
"y[1]":{
"value": ["0.5"],
"datatype":"double"
}
}
},
"0.001": {
"DigitalSatellite_model0716_Sat_2":{
"attitude_w[1]": {
"value": ["0.019040185988009786"],
"datatype":"double"
},
"r_sat[1]": {
"value": ["0.019040185988009786"],
"datatype":"double"
}
},
"DigitalSatellite_model0716_environment_1":{
"r_sun[2]": {
"value": ["-132757421400.26662"],
"datatype":"double"
}
}
}
}
}
}
//2.23 仿真交换数据发布(任务频道)
{
"command": "SimuExchangeData", //命令名
"from": "controller", //发送方
"to": "all", //接收方
"params":{
"taskid": "ABCDEFG", //仿真任务ID
"simutime": 4.399, //运行时间
"datapackage": {
"SF_001": { //子图id
"DigitalSatellite_model0716_AOCC_0test_3": { //模型id
"y9": { //参数名
"value": "0.5", //参数值
"datatype":"double", //参数值类型
"fromsubgraph":"A", //数据来源子图id
"frommodel":"B", //数据来源模型id
"fromport":"C" //数据来源参数名
}
}
}
}
}
}
//2.24 参数注入指令(任务频道)
{
"command": "UpdateSimuParam", //命令名
"from": "controller", //发送方
"to": "all", //接收方
"params":{
"taskid": "ABCDEFG", //仿真任务ID
"simutime": 4.399, //仿真时间
"paramid":"1", //参数注入指令id
"SF_001": { //子图id
"mmrus": { //模型id
"phi2": { //参数名
"runtime":0.5, //注入时间,-1为立即注入
"holdstep": 100, //运行周期
"condition": "SF_001.mmrus.phi2 > 0.1", //注入条件判断脚本(需要讨论)
"basevalue": "0.5" //基础值,无为"none"
"overvalue": "0" //叠加值,无为"none"
"datatype":"double" //注入数据类型
}
}
}
}
}
//2.25 参数注入指令接收应答(任务频道)
{
"command": "ReceiveSimuParam", //命令名
"from": "7e0dde5a880e49fcb57e01ff2839f1fa", //发送方
"to": "controller", //接收方
"params":{
"taskid": "ABCDEFG", //仿真任务ID
"paramid":"1", //参数注入指令id
"result": "OK", //接收结果
"info":"" //接收说明
}
}
//2.26 参数注入执行应答(任务频道)
{
"command": "ExeSimuParam", //命令名
"from": "7e0dde5a880e49fcb57e01ff2839f1fa", //发送方
"to": "controller", //接收方
"params":{
"taskid": "ABCDEFG", //仿真任务ID
"paramid":"1", //参数注入指令id
"result": "OK", //执行结果
"info":"" //执行说明
}
}
//2.27 仿真状态上报(任务频道)
{
"command": "ReportSimuStatus", //命令名
"from": "7e0dde5a880e49fcb57e01ff2839f1fa", //发送方
"to": "controller", //接收方
"params":{
"taskid": "ABCDEFG", //仿真任务ID
"subgraphid":"SF_1", //子图id
"simutime": 4.399, //运行时间
"status": "quit task", //上报状态信息
}
}