slreq.structToObj

Convert link source or destination information from structure to model object type

Description

ot = slreq.structToObj(linkinfo) converts the source or destination link information in linkinfo to ot the appropriate object type. Examples of object types include Simulink® blocks and Simulink Test™ test cases.

Examples

collapse all

This example shows how to get the structure containing unique requirement source and destination information, then convert the structure information to the specific source and destination model entity.

Load Model, Requirement Set, and Links

load_system('reqs_validation_property_proving_original_model');
rq = slreq.load('original_thrust_reverser_requirements.slreqx');
lk = slreq.load('reqs_validation_property_proving_original_model.slmx');

For a LinkSet

Get sources from a LinkSet, get a single source, and convert the structure to the model entity.

lksrcs = sources(lk);
lksrc1 = lksrcs(1)
lksrc1 = struct with fields:
      domain: 'linktype_rmi_simulink'
    artifact: '/tmp/Bdoc20a_1326390_25025/tp0a96d147/slrequirements-ex49678366/reqs_validation_property_proving_original_model.slx'
          id: ':16:151'

ot1 = slreq.structToObj(lksrc1)
ot1 =

                         Path: 'reqs_validation_property_proving_original_model/ThrustReverserDeployLogic'
                           Id: 180
                      Machine: [1x1 Stateflow.Machine]
                   SSIdNumber: 151
                         Name: 'closeEnough'
                  Description: ''
                  LabelString: 'isclose = closeEnough(n1,n2,tol)'
                     FontSize: 12
                    ArrowSize: 8
                        Chart: [1x1 Stateflow.Chart]
              BadIntersection: 0
                    Subviewer: [1x1 Stateflow.Chart]
                     Document: ''
                          Tag: []
              RequirementInfo: ''
                     Position: [185.9681 288.5187 196.9130 44.0190]
                       Script: 'function isclose = closeEnough(n1,n2,tol)...'
                  InputFimath: 'fimath(......'
             EmlDefaultFimath: 'Other:UserSpecified'
    SaturateOnIntegerOverflow: 1
       ConstantFoldingTimeOut: 40000
                 InlineOption: 'Auto'
        IsExplicitlyCommented: 0
        IsImplicitlyCommented: 0
                  CommentText: ''

For a Link

Get a link from the link set, and get the source and destination for that link. Convert the source and destination structure to the model entity.

sl = getLinks(lk);
sl2 = sl(2);
sl2src = source(sl2)
sl2src = struct with fields:
      domain: 'linktype_rmi_simulink'
    artifact: '/tmp/Bdoc20a_1326390_25025/tp0a96d147/slrequirements-ex49678366/reqs_validation_property_proving_original_model.slx'
          id: ':16:31'

sl2dest = destination(sl2)
sl2dest = struct with fields:
      reqSet: 'original_thrust_reverser_requirements.slreqx'
         sid: 2
     summary: 'Thrust Reverser Undeployment Conditions'
     details: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">...'
      domain: 'linktype_rmi_slreq'
    artifact: '/tmp/Bdoc20a_1326390_25025/tp0a96d147/slrequirements-ex49678366/original_thrust_reverser_requirements.slreqx'
          id: 'R2'

ot2s = slreq.structToObj(sl2src)
ot2s =

                     Path: 'reqs_validation_property_proving_original_model/ThrustReverserDeployLogic/thrustReversers'
                       Id: 30
                  Machine: [1x1 Stateflow.Machine]
               SSIdNumber: 31
                IsVariant: 0
              Description: ''
              LabelString: '[!throttleOK(SensorData.throttlePositions)]'
            LabelPosition: [69 293 276 15]
                 FontSize: 12
                ArrowSize: 8
                 MidPoint: [182.9860 245.0717]
                    Chart: [1x1 Stateflow.Chart]
                Subviewer: [1x1 Stateflow.State]
           ExecutionOrder: 1
                    Debug: [1x1 Stateflow.TransDebug]
                 Document: ''
                      Tag: []
           SourceEndpoint: [313.6784 279.3770]
      DestinationEndpoint: [120.3894 150.1259]
                   Source: [1x1 Stateflow.State]
             SourceOClock: 9.4825
              Destination: [1x1 Stateflow.State]
        DestinationOClock: 6.1593
          RequirementInfo: ''
    IsExplicitlyCommented: 0
    IsImplicitlyCommented: 0
              CommentText: ''
ot2d = slreq.structToObj(sl2dest)
ot2d = 
  Requirement with properties:

            Type: 'Functional'
              Id: 'R2'
         Summary: 'Thrust Reverser Undeployment Conditions'
     Description: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">...'
        Keywords: {}
       Rationale: ''
       CreatedOn: 25-Mar-2019 14:52:41
       CreatedBy: 'asriram'
      ModifiedBy: 'asriram'
             SID: 2
    FileRevision: 1
      ModifiedOn: 25-Mar-2019 14:58:14
           Dirty: 0
        Comments: [0x0 struct]

Close Files

slreq.discardLinkSet('reqs_validation_property_proving_original_model.slmx');
close_system('reqs_validation_property_proving_original_model')

Input Arguments

collapse all

linkinfo contains source artifact and unique identification information for particular links, as returned by

Example: struct with fields

Data Types: struct

Output Arguments

collapse all

ot is the requirement, model, or data entity corresponding to the source artifact and unique identification in linkinfo. The value of ot depends on the type of entity the Link has as source or destination.