{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "schema-modelica.json", "type": "array", "title": "JSON parsed Modelica file", "description": "Json representation of a Modelica model", "$comment": "Version 1", "definitions": { "coordinates": { "description": "Coordinates on a 2d plan", "type": "array", "additionalItems": false, "items": { "type": "object", "additionalProperties": false, "required": [ "x", "y" ], "properties": { "x": { "type": "number" }, "y": { "type": "number" } } } }, "dynExtent": { "description": "extents to be selected dynamically", "type": "object", "additionalItems": false, "items": { "type": "object", "required": [ "points", "dynPoints" ], "additionalProperties": false, "properties": { "points": { "$ref": "#/definitions/coordinates" }, "dynPoints": { "type": "string" } } } }, "points": { "description": "points on a 2d plan", "type": "array", "additionalItems": false, "items": { "type": "object", "required": [ "x", "y" ], "additionalProperties": false, "properties": { "x": { "type": "number" }, "y": { "type": "number" } } } }, "dynPoints": { "description": "points to be selected dynamically", "type": "object", "additionalItems": false, "items": { "type": "object", "required": [ "points", "dynPoints" ], "additionalProperties": false, "properties": { "points": { "$ref": "#/definitions/points" }, "dynPoints": { "type": "string" } } } }, "rgbcolors": { "type": "string", "oneOf": [ { "pattern": "^(rgb[(])[0-9]{1,3},[0-9]{1,3},[0-9]{1,3}[)]$" }, { "pattern": "^none$" } ] }, "color": { "description": "RGB colors", "type": "object", "required": [ "r", "g", "b" ], "additionalProperties": false, "properties": { "r": { "type": "number", "minimum": 0, "maximum": 255 }, "g": { "type": "number", "minimum": 0, "maximum": 255 }, "b": { "type": "number", "minimum": 0, "maximum": 255 } } }, "dynColor": { "description": "colors to be selected dynamically", "type": "object", "additionalItems": false, "items": { "type": "object", "required": [ "color", "dynColor" ], "additionalProperties": false, "properties": { "color": { "$ref": "#/definitions/color" }, "dynColor": { "type": "string" } } } }, "dynFillPattern": { "description": "patterns to be selected dynamically", "type": "object", "additionalItems": false, "items": { "type": "object", "required": [ "firstOpt", "secondOpt" ], "additionalProperties": false, "properties": { "firstOpt": { "type": "string" }, "secondOpt": { "type": "string" } } } }, "value": { "type": "object", "required": [ "value" ], "additionalProperties": false, "properties": { "prefix": { "type": "string", "pattern": "^([a-zA-Z0-9._ *]*)$" }, "value": { "type": "string" } } }, "textElement": { "type": "array", "additionalItems": true, "items": { "type": "object", "required": [ "font", "fontSize", "xStart", "yStart", "fill", "moreLines", "tSpan" ], "additionalProperties": true, "properties": { "font": { "type": "string", "pattern": "[a-zA-Z]*", "examples": [ "helvetica" ] }, "fontSize": { "type": "number", "minimum": 0 }, "xStart": { "type": "number" }, "yStart": { "type": "number" }, "fill": { "$ref": "#/definitions/rgbcolors" }, "moreLines": { "type": "boolean" }, "tSpan": { "type": "array", "additionalItems": true, "items": { "type": "object", "additionalProperties": true, "properties": { "xSpan": { "type": "number" }, "dy": { "type": "number" }, "textString": { "type": "string" } } } }, "textAnchor": { "type": "string", "enum": [ "middle", "start", "end" ] } } } }, "graphicalElement": { "type": "array", "additionalItems": true, "required": [ "lineColor", "fillColor", "fillPattern", "points" ], "items": { "type": "object", "additionalProperties": true, "properties": { "color": { "$ref": "#/definitions/color" }, "points": { "$ref": "#/definitions/points" }, "pattern": { "type": "string", "pattern": "^([a-zA-Z0-9._*]*)$" }, "thickness": { "type": "number", "minimum": 0 }, "lineColor": { "$ref": "#/definitions/color" }, "dynLineColor": { "$ref": "#/definitions/dynColor" }, "fillColor": { "$ref": "#/definitions/color" }, "dynFillColor": { "$ref": "#/definitions/dynColor" }, "fillPattern": { "type": "string", "pattern": "^([a-zA-Z0-9._*]*)$" }, "dynFillPattern": { "$ref": "#/definitions/dynFillPattern" }, "extent": { "$ref": "#/definitions/coordinates" }, "dynExtent": { "$ref": "#/definitions/dynExtent" }, "textString": { "type": "string" }, "dynTextString": { "$ref": "#/definitions/dynFillPattern" }, "preserveAspectRatio": { "type": "boolean" }, "fontSize": { "type": "number", "minimum": 0 }, "horizontalAlignment": { "type": "string", "pattern": "^([a-zA-Z0-9._*]*)$" }, "visible": { "type": "boolean" }, "origin": { "type": "object", "additionalProperties": false, "properties": { "x": { "type": "number" }, "y": { "type": "number" } } }, "rotation": { "type": "number" }, "lineThickness": { "type": "number", "minimum": 0 }, "borderPattern": { "type": "string", "pattern": "^([a-zA-Z0-9._*]*)$" }, "fontName": { "type": "string", "pattern": "[a-zA-Z]*", "examples": [ "helvetica", "Arial" ] }, "textColor": { "$ref": "#/definitions/color" }, "smooth": { "type": "string", "pattern": "^([a-zA-Z0-9._*]*)$" }, "startAngle": { "type": "number" }, "endAngle": { "type": "number" }, "radius": { "type": "number" } } } }, "classElement": { "type": "array", "additionalItems": false, "items": { "type": "object", "additionalProperties": true, "required": [ "rx", "ry", "hasFill", "fill", "hasPattern", "stroke", "strokeDasharray", "strokeWidth" ], "properties": { "cx": { "type": "number" }, "cy": { "type": "number" }, "rx": { "type": "number" }, "ry": { "type": "number" }, "hasFill": { "type": "boolean" }, "fill": { "oneOf": [ { "$ref": "#/definitions/rgbcolors" }, { "const": null } ] }, "hasPattern": { "type": "boolean" }, "stroke": { "oneOf": [ { "$ref": "#/definitions/rgbcolors" }, { "const": null } ] }, "strokeDasharray": { "oneOf": [ { "type": "string" }, { "const": null } ] }, "strokeWidth": { "oneOf": [ { "type": "number", "minimum": 0 }, { "const": null } ] } } } }, "polygons": { "type": "array", "additionalItems": false, "items": { "type": "object", "required": [ "fill", "stroke", "strokeWidth" ], "additionalProperties": true, "properties": { "points": { "type": "string", "pattern": "[0-9, ]*" }, "hasFill": { "type": "boolean" }, "fill": { "oneOf": [ { "$ref": "#/definitions/rgbcolors" }, { "const": null } ] }, "stroke": { "$ref": "#/definitions/rgbcolors" }, "strokeWidth": { "type": "number", "minimum": 0 }, "strokeDasharray": { "type": "string", "pattern": "[0-9, ]*" }, "hasStroke": { "type": "boolean" }, "x": { "type": "number" }, "y": { "type": "number" }, "width": { "type": "number", "minimum": 0 }, "height": { "type": "number", "minimum": 0 }, "font": { "type": "string", "pattern": "[a-zA-Z]*", "examples": [ "helvetica" ] } } } }, "GraphicalBlock": { "type": "object", "additionalProperties": true, "properties": { "graphics": { "type": "object", "additionalProperties": true, "properties": { "polygon": { "allOf": [ { "$ref": "#/definitions/graphicalElement" }, { "required": [ "lineColor", "fillColor", "fillPattern", "points" ] } ] }, "line": { "allOf": [ { "$ref": "#/definitions/graphicalElement" }, { "required": [ "points", "color", "pattern", "thickness" ] } ] }, "rectangle": { "allOf": [ { "$ref": "#/definitions/graphicalElement" }, { "required": [ "lineColor", "fillColor", "fillPattern", "extent" ] } ] }, "text": { "allOf": [ { "$ref": "#/definitions/graphicalElement" }, { "required": [ "lineColor", "textString", "extent", "fontSize", "horizontalAlignment" ] } ] }, "ellipse": { "allOf": [ { "$ref": "#/definitions/graphicalElement" }, { "required": [ "origin", "visible", "lineColor", "fillColor", "fillPattern", "extent", "pattern" ] } ] }, "bitmap": { "type": "array", "additionalItems": true, "items": { "type": "object", "properties": { "extent": { "$ref": "#/definitions/graphicalElement/items/properties/extent" }, "fileName": { "type": "string", "pattern": "^([a-zA-Z0-9._ \"\\:/]*)$" }, "rotation": { "$ref": "#/definitions/graphicalElement/items/properties/rotation" }, "origin": { "$ref": "#/definitions/graphicalElement/items/properties/origin" }, "visible": { "type": "boolean" } } } } } }, "coordinateSystem": { "type": "object", "additionalProperties": true, "properties": { "extent": { "$ref": "#/definitions/graphicalElement/items/properties/extent" }, "preserveAspectRatio": { "$ref": "#/definitions/graphicalElement/items/properties/preserveAspectRatio" }, "initialScale": { "type": "number", "minimum": 0 } } }, "drawing": { "type": "string", "pattern": "^(<(svg|SVG))(.|\n)*()$" }, "extent": { "$ref": "#/definitions/coordinates" }, "coordinate": { "$ref": "#/definitions/coordinates" }, "preserveAspectRatio": { "type": "boolean" }, "initialScale": { "type": "number", "minimum": 0 }, "items": { "type": "object", "required": [ "width", "height" ], "additionalProperties": true, "properties": { "width": { "type": "number", "minimum": 0 }, "height": { "type": "number", "minimum": 0 }, "hasDots": { "type": "boolean" }, "layerPolygons": { "$ref": "#/definitions/polygons" }, "classPolygons": { "$ref": "#/definitions/polygons" }, "intPolygons": { "$ref": "#/definitions/polygons" }, "connectionPolylines": { "$ref": "#/definitions/polygons" }, "classRectangles": { "allOf": [ { "$ref": "#/definitions/polygons" }, { "required": [ "x", "y", "hasStroke" ] } ] }, "layerRectangles": { "allOf": [ { "$ref": "#/definitions/polygons" }, { "required": [ "x", "y", "hasStroke" ] } ] }, "layerPolylines": { "allOf": [ { "$ref": "#/definitions/polygons" }, { "required": [ "x", "y", "hasStroke", "fill" ] } ] }, "layerTexts": { "$ref": "#/definitions/textElement" }, "connectionLineDots": { "$ref": "#/definitions/classElement" }, "classEllipses": { "$ref": "#/definitions/classElement" }, "classPolylines": { "$ref": "#/definitions/polygons" }, "classTexts": { "$ref": "#/definitions/textElement" }, "layerEllipses": { "$ref": "#/definitions/classElement" } } } } }, "ModelicaBlock": { "description": "Info of a modelica block: model, parameter, input or output", "type": "array", "additionalItems": true, "items": { "type": "object", "required": [ "className" ], "additionalProperties": true, "properties": { "start": { "type": "object", "additionalProperties": true, "properties": { "value": { "type": "string" } } }, "basePrefix": { "type": "string", "pattern": "^([a-zA-Z0-9._*]*)$" }, "unit": { "$ref": "#/definitions/value" }, "displayUnit": { "$ref": "#/definitions/value" }, "quantity": { "$ref": "#/definitions/value" }, "max": { "$ref": "#/definitions/value" }, "min": { "$ref": "#/definitions/value" }, "prefix": { "type": "string" }, "className": { "description": "Name of the class: no special characters or spaces", "type": "string", "pattern": "^([a-zA-Z0-9._*]*)$" }, "name": { "description": "Name of the block: no special characters or spaces", "type": "string", "pattern": "^([a-zA-Z0-9._*]*)$" }, "comment": { "description": "comment on the block: no special characters or spaces", "type": "string" }, "value": { "description": "value of the block, if applicable", "type": "string" }, "enable": { "description": "Condition of enabling the block, if applicable", "type": "string" }, "annotation": { "type": "object", "additionalProperties": true, "properties": { "dialog": { "type": "object", "additionalProperties": true, "properties": { "tab": { "type": "string", "examples": [ "General" ] }, "group": { "type": "string", "examples": [ "Parameters" ] }, "enable": { "type": "string", "pattern": "^([(\n)a-zA-Z0-9._ =\\*]*)$" }, "connectorSizing": { "type": "string", "pattern": "^([a-z*]*)$" } } }, "__cdl": { "type": "object", "additionalProperties": true, "properties": { "haystack": { "type": "object", "additionalProperties": true, "properties": { "dis": { "type": "string" }, "area": { "type": "string" } } }, "brick": { "type": "string" }, "point": { "type": "string" } } }, "__Dymola_Commands": { "type": "object", "properties": { "file": { "type": "string", "pattern": "^([a-zA-Z0-9._ \"\\:/]*)$" } } } } }, "modifications": { "oneOf": [ { "type": "object", "additionalProperties": true, "properties": { "value": { "type": "string" }, "isFinal": { "type": "boolean" }, "name": { "type": "string" } } }, { "properties": { "modifications": { "$ref": "#/definitions/ModelicaBlock" } } } ] }, "placement": { "type": "object", "additionalProperties": true, "properties": { "transformation": { "type": "object", "additionalProperties": true, "required": [ "extent" ], "properties": { "extent": { "$ref": "#/definitions/graphicalElement/items/properties/extent" }, "rotation": { "$ref": "#/definitions/graphicalElement/items/properties/rotation" }, "origin": { "$ref": "#/definitions/graphicalElement/items/properties/origin" } } }, "iconTransformation": { "type": "object", "additionalProperties": true, "required": [ "extent" ], "properties": { "extent": { "$ref": "#/definitions/graphicalElement/items/properties/extent" }, "rotation": { "$ref": "#/definitions/graphicalElement/items/properties/rotation" }, "origin": { "$ref": "#/definitions/graphicalElement/items/properties/origin" } } }, "visible": { "type": "boolean" } } }, "type": { "type": "string", "oneOf": [ { "enum": [ "Real", "Boolean", "Integer", "String" ] }, { "pattern": "(.*)CDL.Types.(.*)" } ] } } } } }, "additionalItems": false, "items": { "type": "object", "required": [ "within", "topClassName" ], "additionalProperties": true, "properties": { "modelicaFile": { "decription": "Name of the Modelica file. Ends with '.mo'", "type": "string", "pattern": ".*.(mo|MO)" }, "within": { "description": "Within statement from the Modelica file : no special characters or spaces. If empty string, it may be a package file.", "type": "string", "pattern": "^([a-zA-Z0-9._*]*)$" }, "topClassName": { "description": "Name of the top class of the Modelica model: no special characters or spaces ", "type": "string", "pattern": "^([a-zA-Z0-9._*]*)$" }, "comment": { "description": "Comment on the model", "type": "string" }, "defaultName": { "description": "Default model name", "type": "string" }, "public": { "type": "object", "description": "Public part of the modelica file", "additionalProperties": true, "properties": { "parameters": { "$ref": "#/definitions/ModelicaBlock" }, "models": { "$ref": "#/definitions/ModelicaBlock" }, "inputs": { "$ref": "#/definitions/ModelicaBlock" }, "outputs": { "$ref": "#/definitions/ModelicaBlock" } } }, "protected": { "type": "object", "description": "Protected part of the modelica file", "additionalProperties": true, "properties": { "parameters": { "$ref": "#/definitions/ModelicaBlock" }, "models": { "$ref": "#/definitions/ModelicaBlock" } } }, "connections": { "type": "array", "additionalItems": true, "items": { "type": "array", "additionalItems": true, "items": { "type": "object", "additionalProperties": true, "properties": { "instance": { "type": "string" }, "connector": { "type": "string" }, "points": { "$ref": "#/definitions/coordinates" }, "color": { "$ref": "#/definitions/color" }, "pattern": { "type": "string", "pattern": "^([a-zA-Z0-9._*]*)$" }, "thickness": { "type": "number", "minimum": 0 }, "portLinkTarget": { "type": "string", "pattern": "^([a-zA-Z0-9. _[]*]*)$" } } } } }, "info": { "description": "Informations of the model must be in html format", "type": "string", "pattern": "^(<(html|HTML)>)(.|\n)*()$" }, "extends": { "$ref": "#/definitions/ModelicaBlock" }, "icon": { "$ref": "#/definitions/GraphicalBlock" }, "diagram": { "$ref": "#/definitions/GraphicalBlock" }, "vendorAnnotation": { "$ref": "#/definitions/ModelicaBlock/items/properties/annotation" }, "svg": { "type": "object", "additionalProperties": true, "properties": { "icon": { "allOf": [ { "$ref": "#/definitions/GraphicalBlock" }, { "required": [ "items", "initialScale", "preserveAspectRatio", "drawing" ] } ] }, "diagram": { "allOf": [ { "$ref": "#/definitions/GraphicalBlock" }, { "required": [ "items", "preserveAspectRatio", "drawing" ] } ] } } } } } }