This guide shows how to try the FRET-to-Simulink translator with example requirements.
The LMCPS benchmark provides 10 Simulink® models with natural-language requirements created by Lockheed Martin Skunk Works. The models and requirements are publicly available. This example uses the Finite State Machine (Challenge 1) with 13 FRETish requirements.
git clone https://github.com/hbourbouh/lm_challenges.gitIn FRET, export the FSM project using "Export with variables" to produce fsm_reqts_and_vars.json. This file contains both the requirements (with compiled semantics) and the variable mapping (Input/Output/Internal types with constant assignments).
addpath('helpers');
rtBlk = fretJsonToRT('fsm_reqts_and_vars.json', 'FSM_RT');The function will report:
- Number of requirements loaded and converted
- Which requirements were skipped (e.g., unsupported templates)
- Symbols added to the RT block
opts = sldvoptions;
opts.Mode = 'DesignErrorDetection';
[status, files] = sldvrun('FSM_RT', opts);taBlk = fretJsonToTA('fsm_reqts_and_vars.json', 'FSM_TA');open_system('fsm_12B');
sltest.harness.create('fsm_12B/fsm', ...
'Name', 'FRET_TA_Harness', ...
'SeparateAssessment', true);Then populate the harness TA block with the generated assessments and run the test.
The full LMCPS benchmark contains 97 requirements across 10 challenge sets and 13 FRET components. Because the JSON contains multiple component_name values, the pipeline creates a separate model per component by default.
addpath('helpers');
rtBlks = fretJsonToRT('LM_requirements.json', 'LMCPS_RT');This creates 13 models: LMCPS_RT_Autopilot.slx, LMCPS_RT_Euler.slx, LMCPS_RT_Tustin_Integrator.slx, etc.
% Verify all models compile (Update Diagram)
models = dir('LMCPS_RT_*.slx');
for i = 1:numel(models)
mdlName = models(i).name(1:end-4);
load_system(mdlName);
set_param(mdlName, 'SimulationCommand', 'update');
close_system(mdlName, 0);
end- 97 requirements loaded, 71 renderable to RT, 26 skipped
- Skipped reasons: external function calls, complex
prev()expressions,persisted()temporal operators, persistence patterns - 13 separate models created (one per FRET component)
- All 13 models compile successfully
- Vector signals (e.g., NLGuidance) automatically get correct dimensions
- Dot products rewritten as transpose form for scalar postconditions
The LiquidMixer case study has 12 requirements in a single component. Since there's only one component_name, the pipeline creates a single model regardless of the PerComponent setting.
rtBlk = fretJsonToRT('LM_reqts_and_vars.json', 'LiquidMixer_RT');- 12 requirements loaded, 9 renderable to RT, 3 TA-only (
weak_untilpatterns) - Single model created:
LiquidMixer_RT.slx - Compiles successfully
The input JSON must have this structure (FRET's "Export with variables" format):
{
"requirements": [
{
"reqid": "REQ-001",
"fulltext": "the controller shall always satisfy output >= 0",
"semantics": {
"scope": {"type": "null"},
"condition": "null",
"timing": "always",
"post_condition": "output >= 0",
"component_name": "controller"
}
}
],
"variables": [
{
"variable_name": "output",
"idType": "Output",
"dataType": "double"
},
{
"variable_name": "THRESHOLD",
"idType": "Internal",
"assignment": "10.0",
"dataType": "double"
}
]
}Key points:
Internalvariables withassignmentvalues are mechanically substituted (constant replacement)Inputvariables become RT Input symbolsOutputvariables become RT Input symbols withIsDesignOutput = true- The
semanticsfield must contain FRET's compiled formalization output
- NASA FRET — Formal Requirements Elicitation Tool
- LMCPS Benchmark — Lockheed Martin Cyber-Physical Systems challenges
- Simulink Agentic Toolkit — MCP server, tools, and skills for AI coding agents working with MATLAB and Simulink