PLANT MODELING GUIDELINES USING MATLAB® and Simulink® Version 2.1 Japan MATLAB Automotive Advisory Board (JMAAB) December 2, 2008 © Copyright 2008 JMAAB. All rights reserved. 1 Revision History ........................................................................................................................................... 4 Abbreviations ............................................................................................................................................... 5 Introduction .................................................................................................................................................. 6 Background ................................................................................................................................................ 6 Definition of MBD ..................................................................................................................................... 6 Motivation .................................................................................................................................................. 6 Guideline Life-Cycle.................................................................................................................................. 7 1. Outline ....................................................................................................................................................... 8 1.1. Purpose of the PM Guidelines............................................................................................................. 8 1.2. General Policy of PM Guidelines........................................................................................................ 8 1.3. Guideline Template ............................................................................................................................. 8 1.3.1. ID ................................................................................................................................................. 8 1.3.2. Title .............................................................................................................................................. 8 1.3.3. Reference ...................................................................................................................................... 8 1.3.4. Priority ......................................................................................................................................... 8 1.3.5. Scope ............................................................................................................................................ 9 1.3.6. MATLAB Version ......................................................................................................................... 9 1.3.7. Prerequisites ................................................................................................................................ 9 1.3.8. Description ................................................................................................................................... 9 1.3.9. Rationale .................................................................................................................................... 10 1.3.10. Last change .............................................................................................................................. 10 2. General Rules ......................................................................................................................................... 11 2.1. General Rules .................................................................................................................................... 11 JP2101: Execution of Model ........................................................................................................................... 11 JP2102: Optimization Parameters for Boolean Data Types ........................................................................ 11 JP2103: Diagnostic Parameter Settings ......................................................................................................... 11 2.2. Overall Configuration ....................................................................................................................... 12 JP2201: Files Required to Run Simulation ................................................................................................... 12 JP2202: Information Required for Delivering Model .................................................................................. 12 JP2203: Workflow of Model Delivery ........................................................................................................... 13 2.3. Guidelines on Names/Naming .......................................................................................................... 13 JP2303: Display of Block Names .................................................................................................................... 13 JP2304: Port Block Name Visibility in Simulink Models............................................................................. 14 JP2305: Icon Display for Port Block ............................................................................................................. 15 JP2306: Port Block Names in Simulink Models ........................................................................................... 15 JP2307: Display of Labels on Signals ............................................................................................................ 16 JP2309: Entry vs. Propagation of Signal Labels........................................................................................... 17 JP2310: Block Resizing ................................................................................................................................... 17 JP2311: Position of Block Names ................................................................................................................... 18 JP2312: Triggered, Enabled Subsystems, Conditional and Iterative Subsystems ..................................... 19 JP2313: Display of Basic Block Parameters in Attributes Format String .................................................. 19 JP2314: Naming of Trigger Port Block and Enable Port Block .................................................................. 20 JP2315: Unconnected Signals and Block Inputs / Outputs .......................................................................... 20 2.4. Guidelines for Format ....................................................................................................................... 21 JP2402: Simulink Font and Font Size ........................................................................................................... 21 JP2403: Simulink Model Appearance ........................................................................................................... 21 2.5. Guidelines for Usable Characters ...................................................................................................... 22 JP2503: Usable Characters for Subsystem Names ....................................................................................... 22 JP2505: Usable Characters in Signal Label .................................................................................................. 23 JP2507: Use of local language in Simulink and Stateflow............................................................................ 23 JP2509: Usable Characters for Block Names ............................................................................................... 25 JP2510: Usable Characters for Inport Block and Outport Block ............................................................... 25 2.6. Guidelines for Usable Blocks............................................................................................................ 26 JP2602: Use of the Sum block ........................................................................................................................ 26 JP2603: Port Block in Simulink Models ........................................................................................................ 27 JP2604: Use of Two-Way Connection Port Block ........................................................................................ 28 JP2605: Use of Relational Operator Block.................................................................................................... 29 3. Model Architecture ................................................................................................................................ 30 3.1. Overall Structure ............................................................................................................................... 30 JP3001: Plant Model Architecture................................................................................................................. 30 © Copyright 2008 JMAAB. All rights reserved. 2 3.2. Description of Each Layer................................................................................................................. 31 JP3101: 1st Layer Structure............................................................................................................................ 31 JP3102: 2nd Layer (Vehicle) Structure .......................................................................................................... 31 JP3103: 3rd Layer (Vehicle) Structure ........................................................................................................... 32 JP3104: 4th Layer (Powertrain) Structure .................................................................................................... 32 JP3105: 4th Layer (Chassis) Structure ........................................................................................................... 33 JP3106: 5th Layer (Powertrain) Structure .................................................................................................... 34 JP3107: 5th Layer (Chassis) Structure ........................................................................................................... 35 4. How to Write Signal Line ...................................................................................................................... 36 JP4001: Simulink Signal Appearance ........................................................................................................... 36 JP4002: Signal Types ...................................................................................................................................... 36 JP4003: Model Signal Flow ............................................................................................................................ 37 JP4004: Visual Depiction of Signal Flow When Using Goto and From Blocks .......................................... 38 JP4005 : Scope of Goto and From Blocks .................................................................................................... 39 JP4007: Position of Labels and Label Instances for Signals and Busses .................................................... 39 JP4009: Grouping Data Flows into Signals ................................................................................................... 40 JP4010: Use of Block Connection Line .......................................................................................................... 41 JP4011: Distribution of Two-Way Connection Signal ................................................................................. 42 5. Data Type ................................................................................................................................................ 44 JP5001: Data Type .......................................................................................................................................... 44 JP5002: Use of Switch Block .......................................................................................................................... 44 JP5003: Use of Multiport Switch Block......................................................................................................... 45 6. Controller for HILS/SILS ..................................................................................................................... 47 JP6001: Description of Controller Model for HILS/SILS Use .................................................................... 47 JP6002: Structure of Controller Model for HILS/SILS Use........................................................................ 47 7. Rules for Coordinate System, Unit System and Constants................................................................. 48 7.1. Rules for Coordinate System............................................................................................................. 48 JP7101: Vehicle Coordinate System .............................................................................................................. 48 JP7102: Tire Coordinate System ................................................................................................................... 48 JP7103: Engine / Power Train Coordinate System ...................................................................................... 49 7.2. Rules for Unit System ....................................................................................................................... 50 JP7201: Unit System ....................................................................................................................................... 50 7.3. Rules for Constants ........................................................................................................................... 51 JP7301: Constants ........................................................................................................................................... 51 8. Block Parameters of Model ................................................................................................................... 53 JP8001: Setting of Parameter Data for Model Files ..................................................................................... 53 JP8003: Parameter File Configuration.......................................................................................................... 53 JP8004: Description of Parameter Data ........................................................................................................ 53 JP8005: Standardization of Parameter Names ............................................................................................. 53 JP8006: Dialog Parameters in Basic Blocks .................................................................................................. 54 9. Use of Input/Output-Data for Model .................................................................................................... 55 JP9001: Setting of Input/Output Data ........................................................................................................... 55 JP9002: Explanation of Input/Output Data .................................................................................................. 55 10. Appendix A: Recommendations for Automation Tools .................................................................... 56 11. Appendix B: Table: Information Required for Delivering Model ................................................... 57 © Copyright 2008 JMAAB. All rights reserved. 3 Revision History Date Editor Description Version December 2, 2008 Members of the JMAAB Plant Modeling WG (PMWG3) 2.1 Release 2.1 (English) Changed the name of company of JMAAB Office from Cybernet Systems to MathWorks Japan. 2.1 (English) June 28, 2010 JMAAB Office © Copyright 2008 JMAAB. All rights reserved. 4 Abbreviations CM Guidelines …CONTROL ALGORITHM MODELING GUIDELINES USING MATLAB, Simulink and Stateflow Version 2.0 JMAAB … Japan MATLAB Automotive Advisory Board MAAB … MathWorks Automotive Advisory Board MBD … Model-Based Development PM Guidelines … PLANT MODELING GUIDELINES USING MATLAB and Stimulink Version 2.1 PM-WG … Physical/Plant Modeling Working Group TMW … The MathWorks © Copyright 2008 JMAAB. All rights reserved. 5 Introduction Background In the automotive industry, Model-Based Development (MBD) using MATLAB / Simulink / Stateflow is becoming the norm to streamline the control system development. However, due to the lack of common architectures and style guidelines for plant models, anticipated efficiency is often not achieved. Automotive industry formed MathWorks Automotive Advisory Board (MAAB) where they discuss the efficient control system development process in order to identify and prioritize missing features in MATLAB / Simulink / Stateflow and to realize them. MAAB consists of major automakers, ECU suppliers and The MathWorks (TMW). Based on discussion results, MAAB requests TMW to develop new features. JMAAB is a regional entity of MAAB in Japan. The plant modeling guidelines were compiled through two working group activities in JMAAB: Physical Modeling Working Group (2005) and Plant Modeling Working Group (2006 and 2007). Member companies of the Physical Modeling WG (PM-WG1, 2005): AISIN AW Co., Ltd.; Honda Motor Co., Ltd.; JATCO Ltd.; Mazda Motor Corporation; Nissan Motor Co., Ltd.; Toyota Motor Corporation (Alphabetical Order). Member companies of the Plant Modeling WG (PM-WG2, 2006): AISIN AW Co., Ltd.; DENSO Corporation; Hitachi, Ltd.; Honda Motor Co., Ltd.; Isuzu Motors Ltd.; JATCO Ltd.; Mazda Motor Corporation; Mitsubishi Electric Corporation; Toyota Motor Corporation (Alphabetical Order). Member companies of the Plant Modeling WG (PM-WG3, 2007): AISIN AW Co., Ltd.; Hitachi, Ltd.; Isuzu Motors Ltd.; JATCO Ltd.; Mazda Motor Corporation; MITSUBA Corporation; Mitsubishi Electric Corporation; Mitsubishi Fuso Truck and Bus Corporation; Toyota Motor Corporation; Yamaha Motor Co., Ltd. (Alphabetical Order). Definition of MBD MBD is, in today’s ever increasing complexity of automotive control systems engineering, a way of development for better product quality throughout the whole product life cycle and for improved development efficiency, and exploits models of both controller and plant from the early design phase as well as in other development phases. Function Assurance Virtual World Specification of Functional Requirement SILS Specification of Functional Requirement Integration Plant Model Controller Model Rapid Prototype Control Unit HILS Plant Engine Actuator Controller Sensor Hardware Software Integration Real World Function Assurance Fig 1, Correspondence between Virtual and Real Control Systems The primary focus of Physical/Plant Modeling Working Group within the scope of MBD is a process to build, exchange and (re)use plant models. Motivation These guidelines were defined for the purpose of facilitating common understanding about automotive plant models by both authors and users of models built with MATLAB / Simulink / Stateflow. However, the guidelines have no legal enforcement for any purpose. © Copyright 2008 JMAAB. All rights reserved. 6 Guideline Life-Cycle Revision is made as needed. A working group is formed for revision activity as needed. JMAAB secretariat (MathWorks Japan) maintains the guidelines. © Copyright 2008 JMAAB. All rights reserved. 7 1.Outline 1.1. Purpose of the PM Guidelines To allow authors and users of automotive plant models to efficiently share common understanding about models, JMAAB defined important, essential rules on the description of plant models built with MATLAB / Simulink / Stateflow. Major goals of the PM guidelines include ・ define model architecture ・ make model exchange easy ・ set guidelines for model development ・ share modeling language and tool 1.2. General Policy of PM Guidelines Upon defining guidelines, the following general policies were set: Set standardized architecture and description rules of automotive plant models. Follow entity-specific rules for items not present in the PM guidelines. 1.3. Guideline Template Guidelines are described with the following template. Entities who wish to create additional guidelines are encouraged to use the template. ID: Title JP nnnn: Title of Guideline (should be unique and short) Reference Corresponding ID and Title of CM Guidelines Priority One of “Mandatory”, “Strongly Recommended” or “Recommended” Scope MAAB / JMAAB / Entity name (in case adding entity specific rule) All RX,RY,RZ MATLAB RX and newer Version RX and older RX through RY Prerequisites Link to prerequisite guidelines (ID + Title) Description Description of the guideline (text, images) Rationale Reason behind the guideline Last change Version number of the last change 1.3.1. ID ID consists of a sting “JP” and 4-digit numbers. ID cannot be duplicated. Previously used ID cannot be assigned to another guideline. ID cannot be changed. ID is used for referring a specific guideline. ID is not necessarily numbered in sequence. 1.3.2. Title Title is a short, unique description of a guideline, and is used when referring to the guideline. 1.3.3. Reference show an ID and title of corresponding CM Guideline if any. explain the difference with the corresponding guideline. 1.3.4. Priority Priorities are classified into "Mandatory", "Strongly Recommended" or "Recommended". Priority not only describes the importance of the guideline, but also considers the ramification of violation. © Copyright 2008 JMAAB. All rights reserved. 8 Strongly Recommended DEFINITION Mandatory guidelines that all entities conform to 100% guidelines that help improve quality guidelines that entities should conform to whenever possible Recommended guidelines that are preferred to be conformed, but not critical the appearance will not conform with other projects CONSEQUENCES If the guideline is violated essential information is lost the model may not work properly the quality and the appearance will deteriorate there is a greater risk of consequences in maintainability, portability, and reusability WAIVER POLICY If the guideline is intentionally ignored document the reason of violation 1.3.5. Scope Scope is set to any one of the followings. MAAB: Guidelines in CM Guidelines that are considered applicable to plant modeling and quoted as it is in this PM Guidelines. JMAAB: Guidelines that were agreed by JMAAB only. MAAB is a group of automotive manufactures and suppliers, which work closely with TMW. MAAB includes the sub-groups JMAAB and NA-MAAB. JMAAB is a regional sub-group in Japan. This edition of guidelines was compiled by JMAAB for plant models. The scope of the guidelines quoted from CM Guidelines and revised by JMAAB is treated as JMAAB. 1.3.6. MATLAB Version PM Guidelines are effective for MATLAB R2006b or newer. To further limit the version scope, specify the version(s) by selecting one of the following formats, where X, Y, Z are MATLAB release numbers. All : all versions of MATLAB RX, RY, RZ : specific versions RX, RY and RZ of MATLAB RX and older: all versions of MATLAB until version RX RX and newer: all versions of MATLAB from version RX to the current version RX through RY: all versions of MATLAB between RX and RY 1.3.7. Prerequisites The Prerequisite field is used to indicate the dependency on other guideline items. The guideline ID (for consistency) and the title (for readability) have to be used for the links. 1.3.8. Description The Description field contains a detailed description of the guideline. Images and tables may be used for clarity. © Copyright 2008 JMAAB. All rights reserved. 9 1.3.9. Rationale One or more of the following reasons behind the guideline is/are selected in the Rationale field. Readability: Easily understood as a plant model Readable models Uniform appearance of models, code and document Clean interfaces Professional documentation Workflow: Effective Development Process/Workflow Ease of maintenance Rapid model changes Reusable components Problem-free exchange of models Model portability Simulation: Efficient Simulation and Analysis Simulation speed Simulation memory Model instrumentation Verification & Validation Requirements Traceability Testing Problem-free system integration Clean interfaces Code generation: Efficient/effective embedded code generation Fast software changes Robustness of generated code 1.3.10. Last change The “Last Change” field contains the document version number. © Copyright 2008 JMAAB. All rights reserved. 10 2.General Rules 2.1. General Rules ID:Title Reference Priority Scope MATLAB Version Prerequisites Description Rationale Last Change ID:Title Reference Priority Scope MATLAB Version Prerequisites JP2101: Execution of Model Mandatory JMAAB All JP2103: Model Diagnostic Settings Simulink model should be executable. (It operates with appropriate inputs.) No warning message appears while simulation is run with appropriate inputs. Readability Verification and Validation Workflow Code Generation Simulation V2.0 JP2102: Optimization Parameters for Boolean Data Types (No Change) jc_0011: Optimization parameters for Boolean data types Strongly Recommended MAAB All na_0002: Appropriate implementation of fundamental logical and numerical operations JP5001: Data Type The optimization option for Boolean data types must be enabled (on). MATLAB Version Description Parameter Name R13SP2 and older Boolean logic signals R14 and newer Use logic signals as Boolean data. (vs. double) Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID:Title Reference Priority Scope MATLAB Version Prerequisites JP2103: Model Diagnostic Settings (No Change) jc_0021: Model diagnostic settings Strongly Recommended MAAB All © Copyright 2008 JMAAB. All rights reserved. 11 The following diagnostics must be enabled. An enabled diagnostic is set to either “warning” or “error”. Setting the diagnostic option to “none” is not permitted. Diagnostics that are not listed can be set to any value (none, warning or error). Solver Diagnostics Algebraic loop Minimize algebraic loop Sample Time Diagnostics Multitask rate transition Data Validity Diagnostics Inf or NaN block output Duplicate data store names Connectivity Unconnected block input ports Unconnected block output ports Unconnected line Unspecified bus object at root Outport block Mux blocks used to create bus signals Invalid function-call connection Element name mismatch Description Readability Workflow Simulation Rationale Last Change Verification and Validation Code Generation V2.0 2.2. Overall Configuration ID: Title JP2201: Files Required to Run Simulation Reference Priority Mandatory Scope JMAAB MATLAB Version All Prerequisites Description The following files are required. Model files (mdl, lib, dll, C files etc.) Parameter files (m, mat files etc.) Input/output data file (for testing) Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2202: Information Required for Delivering Model Reference Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites Description When delivering a model, include pieces of information shown in a separate table © Copyright 2008 JMAAB. All rights reserved. 12 (Appendix B) for efficient delivery. Select necessary pieces of the information, preferably by those who receive a model, to meet a specific purpose. [E.g.] Delivery of a model whose content is concealed (black box model). Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2203: Workflow of Model Delivery Reference Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites Both parties should agree the way a model is delivered beforehand. Description 1. How to maintain confidentiality Encryption level, Mask password etc. 2. How to hand over FTP server, Media (DVD, CD) etc. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 2.3. Guidelines on Names/Naming ID: Title JP2303: Display of Block Names Reference (Revised) jc_0061: Display of block names (Added “Connection Port”) Priority Recommended Scope JMAAB MATLAB Version All Prerequisites The block name should be displayed when it provides descriptive information. The block name should not be displayed if the block function is known from its appearance. Description © Copyright 2008 JMAAB. All rights reserved. 13 Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2304: Port Block Name Visibility in Simulink Models Reference (No Change) na_0005: Port block name visibility in Simulink models Priority Strongly Recommended Scope MAAB MATLAB Version All Prerequisites For some items while it is not possible to define a single approach that is applicable to all organizations’ internal processes, it is important that at least within a given organization a single consistent approach is followed. An organization applying the guidelines must select one of these alternatives to enforce. Organizationally-Scoped Alternatives (follow one practice): 1. The name of an Inport or Outport is not hidden. ("Format / Hide Name" is not allowed.) Description 2. The name of an Inport or Outport must be hidden. ("Format / Hide Name" is used.) Exception: inside library subsystem blocks, the names may not be hidden. Rationale Readability Workflow Simulation Verification and Validation Code Generation Last Change V2.0 © Copyright 2008 JMAAB. All rights reserved. 14 ID: Title JP2305: Icon Display for Port Block Reference (No Change) jc_0081: Icon display for Port block Priority Recommended Scope MAAB MATLAB Version R14 and newer Prerequisites The ‘Icon display’ setting should be set to ‘Port number’ for Inport and Outport blocks. Correct Description Incorrect Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2306: Port Block Names in Simulink Models Reference (No Change) jm_0010: Port block names in Simulink models Priority Strongly Recommended Scope MAAB MATLAB Version All db_0042: Ports in Simulink models JP2603: Ports in Simulink Models Prerequisites na_0005: Port block name visibility in Simulink models JP2304: Port Block Name Visibility in Simulink Models For some items while it is not possible to define a single approach that is applicable to all organizations’ internal processes, it is important that at least within a given organization a single consistent approach is followed. An organization applying the guidelines must select one of these alternatives to enforce. Description 1. The names of Inport blocks and Outport blocks must match the corresponding signal or bus names. Exceptions: o When any combination of an Inport block, an Outport block, and any other block have the same block name, a suffix or prefix should be used on the Inport and Outport blocks. o One common suffix / prefix is “_in” for Inports and “_out” for Outports. o Any suffix or prefix can be used on the ports, however the selected prefix should be consistent. o Library blocks and reusable subsystems that encapsulate generic functionality. © Copyright 2008 JMAAB. All rights reserved. 15 2. When the names of Inport and Outport blocks are hidden, the user should apply a consistent naming practice for these blocks. Suggested practices include leaving the names as their default names (e.g., Out1), giving them the same name as the associated signal or giving them a shortened or mangled version of the name of the associated signal. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2307: Display of Labels on Signals Reference (No Change) na_0008: Display of labels on signals Priority Recommended Scope MAAB MATLAB Version All Prerequisites A label must be displayed on any signal originating from the following blocks: Inport block From block (block icon exception applies – see Note below) Data Store Read block (block icon exception applies) Subsystem block or Stateflow chart block (block icon exception applies) Constant block (block icon exception applies) Bus Selector block (the tool forces this to happen) Demux block Selector block A label must be displayed on any signal connected to the following destination blocks (directly or via a basic block that performs a non transformative operation): Description Outport block Goto block Data Store Write block Bus Creator block Mux block Subsystem block Chart block Note: Block icon exception (applicable only where called out above): If the signal label is visible in the originating block icon display, the connected signal need not also have the label displayed unless the signal label is needed elsewhere due to a destination-based rule. Rationale In addition, a label may be displayed on any other signal of interest to the user or the user’s customers. Readability Workflow Simulation © Copyright 2008 JMAAB. All rights reserved. Verification and Validation Code Generation 16 Last Change V2.0 ID: Title JP2309: Entry versus Propagation of Signal Labels Reference (No Change) na_0009: Entry versus propagation of signal labels Priority Strongly Recommended Scope MAAB MATLAB Version All Prerequisites na_0008: Display of labels on signals JP2307: Display of Labels on Signals Description If a label is present on a signal, the following rules define whether that label shall be created there (entered directly on the signal) or propagated from its true source (inherited from elsewhere in the model by using the ‘<’ character). 1. Any displayed label must be entered for signals that: a. Originate from an Inport at the Root (top) Level of a model b. Originate from a basic block that performs a transformative operation (For the purpose of interpreting this rule only, the Bus Creator block, Mux block and Selector block shall be considered to be included among the blocks that perform transformative operations.) 2. Any displayed signal label must be propagated for signals that: a. Originate from an Inport block in a nested subsystem Exception: If the nested subsystem is a library subsystem, a label may be entered on the signal coming from the Inport to accommodate reuse of the library block. b. Originate from a basic block that performs a non-transformative operation c. Originate from a Subsystem or Stateflow chart block Exception: If the connection originates from the output of a library subsystem block instance, a new label may be entered on the signal to accommodate reuse of the library block. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2310: Block Resizing Reference (No Change) jm_0002: Block resizing Priority Mandatory Scope MAAB MATLAB Version All © Copyright 2008 JMAAB. All rights reserved. 17 Prerequisites All blocks in a model must be sized such that their icon is completely visible and recognizable. In particular, any text displayed (e.g. tunable parameters, filenames, equations) in the icon must be readable. This guideline requires resizing of blocks with variable icons or blocks with a variable number of inputs and outputs. In some cases it may not be practical or desirable to resize the block icon of a subsystem block so that all of the input and output names within it are readable. In such cases, the user may hide the names in the icon by using a mask or by hiding the names in the subsystem associated with the icon. In this approach, the signal lines coming into and out of the subsystem block should be clearly labeled in close proximity to the block. Correct Description Incorrect Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2311: Position of Block Names Reference (Revised) db_0142: Position of block names (Priority Level Change) Priority Recommended Scope JMAAB MATLAB Version All Prerequisites If shown, the name of each block should be placed below the block. Description Rationale Readability © Copyright 2008 JMAAB. All rights reserved. Verification and Validation 18 Workflow Simulation Code Generation Last Change V2.0 ID: Title JP2312: Triggered, Enabled, Conditional Subsystems Reference (No Change) db_0146: Triggered, enabled, conditional Subsystems Priority Strongly Recommended Scope MAAB MATLAB Version All Prerequisites The blocks that define subsystems as either conditional or iterative should be located at a consistent location at the top of the subsystem diagram. These are: Function call Enabled Triggered If / Else Action Correct Description Incorrect Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2313: Display of Basic Block Parameters © Copyright 2008 JMAAB. All rights reserved. 19 Reference (No Change) db_0140: Display of basic block parameters Priority Recommended Scope MAAB MATLAB Version All Prerequisites Important parameters with values other than the block’s default values should be displayed. Note: The attribute string is one method to support this. The block annotation tab allows the users to add the desired attribute information. Correct Description Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2314: Naming of Trigger Port Block and Enable Port Block Reference (Revised) jc_0281: Naming of Trigger Port block and Enable Port block (Priority Level Change) Priority Recommended Scope JMAAB MATLAB Version All Prerequisites For Trigger port blocks and Enable port blocks The block name should match the name of the signal triggering the subsystem. Description Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2315: Unconnected Signals and Block Inputs / Outputs © Copyright 2008 JMAAB. All rights reserved. 20 Reference (No Change) db_0081: Unconnected signals and block inputs / outputs Priority Mandatory Scope MAAB MATLAB Version All Prerequisites A system must not have any: Unconnected subsystem or basic block inputs Unconnected subsystem or basic block outputs Unconnected signal lines An otherwise unconnected input should be connected to a ground block An otherwise unconnected output should be connected to a terminator block Correct Description Incorrect Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 2.4. Guidelines for Format ID: Title JP2402: Simulink Font and Font Size Reference (No Change) db_0043: Simulink font and font size Priority Strongly Recommended Scope MAAB MATLAB Version All Prerequisites Description All text elements (block names, block annotations and signal labels) except free text annotations within a model must have the same font style and font size. Fonts and font size should be selected for legibility. Note: The selected font should be directly portable (e.g. Simulink/Stateflow default font) or convertible between platforms (e.g. Arial/Helvetica 12pt). Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2403: Simulink Model Appearance Reference (No Change) na_0004: Simulink model appearance Priority Recommended © Copyright 2008 JMAAB. All rights reserved. 21 Scope MAAB MATLAB Version All Prerequisites The model appearance settings should conform to the following guidelines when the model is released. The user is free to change the settings during the development process. Description View Options Model Browser Screen color Status Bar Toolbar Zoom factor Setting unchecked white checked checked Normal (100%) Block Display Options Background Color Foreground Color Execution Context Indicator Library Link Display Linearization Indicators Model/Block I/O Mismatch Model Block Version Sample Time Colors Sorted Order Setting white black unchecked none checked unchecked unchecked unchecked unchecked Signal Display Options Port Data Types Signal Dimensions Storage Class Test point Indicators Viewer Indicators Wide Non-scalar Lines Setting unchecked unchecked unchecked checked checked checked Readability Workflow Simulation Rationale Last Change Verification and Validation Code Generation V2.0 2.5. Guidelines for Usable Characters ID: Title JP2503: Usable Characters for Subsystem Names Reference (Revised) jc_0201: Usable characters for Subsystem names (Addition of “should not have double-byte characters”) Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites The names of all Subsystem blocks should conform to the following constraints: FORM Description name: should not start with a number should not have blank spaces should not have double-byte characters © Copyright 2008 JMAAB. All rights reserved. 22 ALLOWED CHARACTERS name: abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789_ UNDERSCORES name: Readability Workflow Simulation Rationale underscores can be used to separate parts cannot have more than one consecutive underscore cannot start with an underscore cannot end with an underscore Verification and Validation Code Generation Last Change V2.0 ID: Title JP2505: Usable Characters in Signal Label Reference (Revised) jc_0221: Usable characters for Inport block and Outport block (Addition of “should not have double-byte characters”) Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites The names of all Inport blocks and Outport blocks should conform to the following constraints: Description FORM name: should not start with a number should not have blank spaces should not have double-byte characters ALLOWED CHARACTERS name: abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789_ UNDERSCORES name: Readability Workflow Simulation Rationale underscores can be used to separate parts cannot have more than one consecutive underscore cannot start with an underscore cannot end with an underscore Verification and Validation Code Generation Last Change V2.0 ID: Title JP2507: Use of Local Language in Simulink and Stateflow Reference Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites © Copyright 2008 JMAAB. All rights reserved. 23 The local language should be used only in descriptive fields. Descriptive fields are text entry points that do not affect code generation or simulation. Examples of descriptive fields include Simulink Example The Description field in the Block Properties Text annotation directly entered in the model Description: Local language can be used. Description Stateflow Example The Description field of the chart or state Properties Annotation description added using Add Note © Copyright 2008 JMAAB. All rights reserved. 24 Note: Simulink might not be able to open a model containing local language characters on different character encoding systems; thus, users must be careful to use such characters. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.1 ID: Title JP2509: Usable Characters for Block Names Reference (No Change) jc_0231: Usable characters for block names Priority Strongly Recommended Scope MAAB MATLAB Version All Prerequisites jc_0201: Usable characters for Subsystem names JP2503: Usable Characters for Subsystem Names All named blocks should conform to the following constraints: FORM name: should not start with a number should not start with a blank space o May use blank spaces in the name should not have double-byte characters carriage returns are allowed ALLOWED CHARACTERS name: abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789_ Description Note: this rule does not apply to Subsystem blocks. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2510: Usable Characters for Signal Line Names Reference (Revised) jc_0211: Usable characters for signal line names (Addition of Prerequisites and “should not have double-byte characters”) Priority Strongly Recommended Scope MAAB MATLAB Version All Prerequisites jc_0201: Usable characters for Subsystem names JP2503: Usable Characters for Subsystem Names © Copyright 2008 JMAAB. All rights reserved. 25 All named signals should conform to the following constraints: Description FORM name: should not start with a number should not have blank spaces should not have double-byte characters ALLOWED CHARACTERS name: abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789_ UNDERSCORES name: underscores can be used to separate parts cannot have more than one consecutive underscore cannot start with an underscore cannot end with an underscore Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 2.6. Guidelines for Usable Blocks ID: Title JP2602: Use of Sum Block Reference (No Change) jc_0121: Use of the Sum block Priority Recommended Scope MAAB MATLAB Version All Prerequisites Sum blocks should: Use the “rectangular” shape. Be sized so that the input signals do not overlap. Incorrect Correct Description The round shape can be used in feedback loops. There should be no more than 3 inputs. The inputs may be positioned at 90, 180, 270 degrees. The output should be positioned at 0 degrees. © Copyright 2008 JMAAB. All rights reserved. 26 Correct Incorrect Correct Incorrect Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2603: Port Block in Simulink Models Reference (Revised) db_0042: Port block in Simulink models (Edit in Description about ”Duplicate Inports”) Priority Strongly Recommended Scope MAAB MATLAB Version All Prerequisites Description In a Simulink model, the ports comply with the following rules: Inports should be placed on the left side of the diagram, but they can be moved in to prevent signal crossings. Outports should be placed on the right side, but they can be moved in to prevent signal crossings. Duplicate Inports at the subsystem level should be avoided whenever possible. o Duplicate Inports at the root level should never be used. Correct © Copyright 2008 JMAAB. All rights reserved. 27 Incorrect Notes on the incorrect model Inport 2 should be moved in so it does not cross the feed back loop line. Outport 1 should be moved to the far right of the diagram. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2604: Use of Two-Way Connection Port Block Reference Priority Strongly Recommended Scope JMAAB MATLAB Version R2008a and newer Prerequisites Description Two-way connection (TWC) port block should conform to the following constraints. TWC port block should be placed based on the connecting position at one layer up. (E.g. place it at the far right if connected at the far right.) However, it can be moved in to prevent line crossings. Subsystems containing TWC port block should not be flipped. © Copyright 2008 JMAAB. All rights reserved. 28 Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP2605: Use of Relational Operator Block Reference (No Change) jc_0131: Use of Relational Operator block Priority Recommended Scope JMAAB MATLAB Version All Prerequisites When the relational operator is used to compare a signal to a constant value, the constant input should be the second (lower) input. Correct Incorrect Description Rationale Readability Workflow Simulation Verification and Validation Code Generation Last Change V2.0 © Copyright 2008 JMAAB. All rights reserved. 29 3.Model Architecture 3.1. Overall Structure ID: Title JP3001: Plant Model Architecture Reference Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites The plant model architecture is described hierarchically as shown below. To define the hierarchy, alternatively put one layer for component partitioning and another layer for the pair of a controller and a plant. Partition components based on the actual vehicle parts arrangement whenever possible. 1st layer 2nd layer Split into controller and body Driver Vehicle TireRoad Vehicle Controller Environment Vehicle Body Description 3rd layer Split into component parts 4th layer Split into controller and body 5th layer Split into parts Rationale Readability Workflow Simulation Powertrain Powertrain Controller Engine Powertrain Body Differential Verification and Validation Code Generation Last Change V2.0 © Copyright 2008 JMAAB. All rights reserved. Transmission 30 Chassis 3.2. Description of Each Layer ID: Title JP3101: 1st Layer Structure Reference Priority Strongly Recommended Scope JMAAB MATLAB Version R2008a and newer Prerequisites The 1st layer is shown below, consisting of Driver, Vehicle, TireRoad and Environment. In the Vehicle, calculate the vehicle dynamics including engine and drivetrain. In the TireRoad, calculate the force and torque produced between the tire and road. Jmaab_pm_model.mdl Ver2.2 for SG Checkr MATLAB Ver 2008a Provided by J-MAAB activity This program is for only JMAAB activity . 2008.6.12 JMAAB Plant Model 1st Layer Description c_Vehicle c_Environment c_Vehicle c_Driver c_TypeRoad c_Vehicle c_Environment c_Tyre_Road Vehicle Tyre_road c_Environment1 c_Driver Environment Driver Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP3102: 2nd Layer (Vehicle) Structure Reference Priority Strongly Recommended Scope JMAAB MATLAB Version R2008a and newer Prerequisites The 2nd layer (inside the Vehicle) is shown below. Description In the Controller, driver operation and Vehicle sensor signal are taken as input, and Vehicle actuator signal is generated as output. If powertrain controller and chassis controller are separate, do nothing in the controller of this layer, and generate control signals two layers below. © Copyright 2008 JMAAB. All rights reserved. 31 JMAAB Plant Model 2nd Layer ( Vehicle ) d_from _Vehicle 1 d_to_Controller d_from_controller d_to_Vehicle c_Driver c_TyreRoad C 1 c_Driver controller c_Driver 2 c_Environment 2 c_Environment 2wayHub Vehicle Readability Workflow Simulation Rationale 3 c_TypeRoad Verification and Validation Code Generation Last Change V2.0 ID: Title JP3103: 3rd Layer (Vehicle) Structure Reference Priority Strongly Recommended Scope JMAAB MATLAB Version R2008a and newer Prerequisites The 3rd layer (inside the Vehicle) is shown below, consisting of Powertrain, Chassis and Electricity. In the Electricity, calculate the behavior of the body electronics. JMAAB Plant Model 3 rd Layer ( Vehicle ) d_to_cnt d_from _cnt <Chassis cnt> 1 d_from_controller 1 d_to _Controller c_chassis c_electricity ACC c_Enviromnent Powertrain d_to_cnt d_from_cnt <Chassis cnt> myu Description 1 steer c_TyreRoad c_Electricity c_powertrain c_Environment Chassis d_from _cnt <Electricity cnt> d_to_cnt c_powertrain c_Chassis c_Environment Electricity c 2 r c_Driver f d Subsystem Readability Workflow Simulation Rationale 5f r 2wayHub Verification and Validation Code Generation Last Change V2.0 ID: Title JP3104: 4th Layer (Powertrain) Structure © Copyright 2008 JMAAB. All rights reserved. 32 3 c_Environment Reference Priority Strongly Recommended Scope JMAAB MATLAB Version R2008a and newer Prerequisites The 4th layer (inside the Powertrain) is shown below. In the Controller, generate control signals for the Powertrain. If engine controller and transmission controller are separate, do nothing in the controller of this layer, and generate control signals two layers below. JMAAB Plant Model 4 th Layer( Power Train ) 1 d_to_cnt d_from_Powertrain Description LU d_to_Powertrain 1 d_to _cnt d_to_cnt 1 d_from_cnt d_from_cnt c_chassis Controller 1 c_chassis acc 2 ACC c_electricity 2 c_Enviromnent Powertrain c_electricity 3 c_Enviromnent Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP3105: 4th Layer (Chassis) Structure Reference Priority Strongly Recommended Scope JMAAB MATLAB Version R2008a and newer Prerequisites The 4th layer (inside the Chassis) is shown below. Description In the Controller, generate control signals for the chassis. If ABS controller and TRC controller are separate, do nothing in the controller of this layer, and generate control signals two layers below. © Copyright 2008 JMAAB. All rights reserved. 33 JMAAB Plant Model 4th Layer (Chassis ) f_from _chassis 1 d_from _cnt d_to_chassis_cnt d_from _cnt d_to_chassisi f_from _cont d_to_cnt 1 d_to _cnt Controller steer 2 c_Environment 4 c_Environment steer myu 2 myu c_powertrain 1 c_Electricity c_powertrain 3 c_Electricity Chassis Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP3106: 5th Layer (Powertrain) Structure Reference Priority Strongly Recommended Scope JMAAB MATLAB Version R2008a and newer Prerequisites The 5th layer (inside the Powertrain) is shown below. In this particular figure, differential is included since FF vehicle is considered. For other cases such as FR vehicle, 4WD vehicle or motorcycle, define another architecture to put the differential into, say, chassis. JMAAB Plant Model 5 th Layer ( Power Train ) tyre_r tyre_l LU 1 c_electricity c_electricity LU c_engine c_transmission Description 2 acc shaft shaft shaft c_Enviromnent C 5C C 1 c_chassis 2wayHub c_Enviromnent diff torque _con c_engine_mount Te c_electricity C 5C C c_Enviromnent 2 c_electricity 2wayHub 1 engine C 5C C 3 c_Enviromnent 2wayHub 2 1 d_to _cnt 2 d_to _cnt 1 Rationale Readability Workflow © Copyright 2008 JMAAB. All rights reserved. Verification and Validation Code Generation 34 Simulation Last Change V2.1 ID: Title JP3107: 5th Layer (Chassis) Structure Reference Priority Strongly Recommended Scope JMAAB MATLAB Version R2008a and newer Prerequisites The 5th layer (inside the Chassis) is shown below. In this particular figure, FF vehicle is considered. For other cases such as FR vehicle, 4WD vehicle or motorcycle, define another architecture. JMAAB Plant Model 5 th Layer( Chassis ) st_fr 2 steer steer st_fl steer _system steer road sus diff Tyre_fl Chas_fl FR RR sus _fr Chas_fl Tyre_fl sus road sus _rr tyre _rr tyre _fr R mount yc 1 c_powertrain Description RL l Chas_fl Tyre_fl veh road sus _rl tyre _rl Branch steer road veh diff Tyre_fl Chas_fl FL EN 2 c_Environment sus _fl tyre _fl 4 3 2 1 C Chassis _body 3 myu Conn 1 TWC Grand Terminator 4 c_Electricity 1 1 d_from_cnt d_to _chassis _cnt 2 d_to _cnt Rationale Readability Workflow Simulation Verification and Validation Code Generation Last Change V2.0 © Copyright 2008 JMAAB. All rights reserved. 35 4.How to Write Signal Line ID: Title JP4001: Simulink Signal Appearance Reference (No Change) db_0032: Simulink signal appearance Priority Strongly Recommended Scope MAAB MATLAB Version All Prerequisites Signal lines should not cross each other, if possible. are drawn with right angles. are not drawn one upon the other. do not cross any blocks. should not split into more than two sub-lines at a single branching point. Description Incorrect Correct Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP4002: Signal Types Reference Priority Mandatory Scope JMAAB MATLAB Version R2008a and newer Prerequisites Description The types of describing plant models are the 6 types listed below. ① Dataflow signal ② Two-Way Connection signal ③ SimMechanics signal ④ SimDriveline signal ⑤ SimPowerSystems signal ⑥ SimHydraulics signal ① Dataflow signal ② Two-Way Connection signal © Copyright 2008 JMAAB. All rights reserved. 36 ③ SimMechanics signal ④ SimDriveline signal ⑤ SimPowerSystems signal ⑥ SimHydraulics signal Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP4003: Model Signal Flow Reference (Revised) db_0141: Signal flow in Simulink models (Addition of Description about Two-Way Connection Signals) Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites Description The signal flow in a model is from left to right. Exception: Feedback loops, Two-Way Connection signals Sequential blocks or subsystems are arranged from left to right. Exception: Feedback loops, Two-Way Connection signals © Copyright 2008 JMAAB. All rights reserved. 37 Parallel blocks or subsystems are arranged from top to bottom. Signal flow should be drawn from left to right Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP4004: Visual Depiction of Signal Flow When Using Goto and From Blocks Reference (Revised) jc_0171: Maintaining signal flow when using Goto and From blocks (Edit in Title and Description) Priority Strongly Recommended Scope MAAB MATLAB Version All Prerequisites To clarify the operation order among subsystems, use of Goto and From blocks should conform to the following constraints. All subsystems in one layer should be directly connected with at least one signal line. If the subsystems are connected both in a feedforward and feedback loop, then at least one signal line for each direction must be connected. Correct Description Incorrect © Copyright 2008 JMAAB. All rights reserved. 38 Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP4005: Scope of Goto and From Blocks Reference (Revised) na_0011: Scope of Goto and From blocks (Added a Rule for Monitoring and HILS) Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites For signal flows the following rules apply: From and Goto blocks must use local scope. Control flow signals may use global scope. Connection signal with external monitor or HILS etc. may use global scope. Description Readability Workflow Simulation Rationale Verification and Validation Code generation Last Change V2.0 ID: Title JP4007: Position of Labels for Signals and Busses Reference (No Change) db_0097: Position of labels for signals and busses Priority Strongly Recommended Scope MAAB MATLAB Version All Prerequisites Description The labels must be visually associated with the corresponding signal and not © Copyright 2008 JMAAB. All rights reserved. 39 overlap other labels, signals or blocks. Labels should be located consistently below horizontal lines and close to the corresponding source or destination block. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP4009: Grouping Data Flows into Signals Reference (Revised) na_0010: Grouping data flows into signals (Edit in Description, added Two-Way Connection) Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites JP2403: Simulink Model Appearance 1. Vectors The individual scalar signals composing a vector must have common functionality, data types, dimensions and units. The most common example of a vector signal is sensor or actuator data that is grouped into an array indexed by location. The output of a Mux block must always be a vector. The inputs to a Mux block must always be scalars. 2. Busses Signals that do not meet the vectorization criteria described above must only be grouped into bus signals. Bus selector blocks may only be used with a bus signal input. Bus selector blocks must not be used to extract scalar signals from vector signals. Bus signals can only be connected to the blocks shown below. Bus signal must be split by Bus Selector before connected to any other blocks. Description 3. In order to distinguish between bus, vector and scalar signals, select Wide nonscalar lines from the file menu / format / Simulink Preference / Display Defaults. Correct Bus Creator Various Subsystems Bus Selector Port Goto Two-Way Connection Incorrect © Copyright 2008 JMAAB. All rights reserved. 40 Output has turned into a vector Examples Some examples of vector signals include: Vector type Size Row vector [1 n] Column vector [n 1] Wheel speed vector [1 Number of wheels] Cylinder vector [1 Number of cylinders] Position vector based on 2Dcoordinates [1 2] Position vector based on 3Dcoordinates [1 3] Some examples of bus signals include: Bus Type Elements Force Vector [Fx, Fy, Fz] Position Wheel Speed Vector [Θlf, Θrf, Θlr, Θrr] Acceleration Sensor Bus Pressure Sensor Bus Controller Bus Actuator Bus Coolant Temperature Serial Data Bus Readability Workflow Simulation Rationale Engine Speed, Passenger Door Open Verification and Validation Code Generation Last Change V2.0 ID: Title JP4010: Use of Block Connection Line Reference Priority Strongly Recommended Scope JMAAB MATLAB Version R2008a and newer Prerequisites Description Use Two-Way Connection (TWC) signal to connect components of plant. However, for the architecture layers below those defined in Chapter 3, decide whether to use TWC signal by considering the readability and portability of the model. Use data flow signal to connect plant and controller. [Correct] [Incorrect] © Copyright 2008 JMAAB. All rights reserved. 41 Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP4011: Distribution of Two-Way Connection Signal Reference Priority Recommended Scope JMAAB MATLAB Version R2008a and newer Prerequisites For the distribution and integration of Two-Way Connection signals, create and use Two-Way Hub block shown below having necessary number ports for one-to-many connection. Fig. Two-Way Hub Subsystem Description sig 1 sig_Aa sig_Ab sig 1 sig_Aa sig_Ab sig 2 sig_Ba sig_Bb sig_Bc sig 3 sig_Ca sig 2 sig_Ba sig_Bb sig_Bc sig 3 sig_Ca sig 4 sig_Da sig_Db sig 4 sig_Da sig_Db sig 5 sig_Ea sig_Eb sig_Ec sig 6 sig_Fa sig 5 sig_Ea sig_Eb sig_Ec sig 6 sig_Fa Fig. Signal Flows [Function] One-to-many is used to distribute one signal. Many-to-one is used to bundle up © Copyright 2008 JMAAB. All rights reserved. 42 multiple signal lines into one while retaining the original signals information. (See Fig. Signal Flows) [NOTE] These PM guidelines treat Two-Way Hub block as part of component library. Therefore, no name is assigned to signal lines within Two-Way Hub block. [Example] 3rd Layer (Vehicle) Rationale Readability Workflow Simulation Verification and Validation Code Generation Last Change V2.0 © Copyright 2008 JMAAB. All rights reserved. 43 5.Data Type ID: Title JP5001: Data Type Reference Priority Recommended Scope JMAAB MATLAB Version All Prerequisites When building a model, the following data types should be considered in addition to the MATLAB native data types*1. *1 “double”, “uint16”, “boolean”… etc. 1. Physical values: Values having a physical meaning or dimension. Do not use in logical operations. 2. Identifiers: Values with no physical meaning or dimension, such as an array index or ID number. Do not use in logical operations. [Example use of identifiers] Multiport Switch Block: First input signal Selector Block: Second input signal when the index source of element is set to “External”. Description 3. Logical values: Values representing true or false such as output signal from Logical Operator or Relational Operator. Do not use in arithmetic/comparison operation. [Examples use of logical values] Second input signal of Switch block Input signal to Enable Port of Enable Subsystem. [Correct] [Incorrect] Parameter Logical Value Readability Workflow Simulation Rationale Arithmetic on a logical value Verification and Validation Code Generation Last Change V2.0 ID: Title JP5002: Use of Switch Block Reference (Revised) jc_0141: Use of the Switch block (Partially Referred) Priority Strongly Recommended Scope JMAAB © Copyright 2008 JMAAB. All rights reserved. 44 MATLAB Version All Prerequisites The switch condition, input 2, must be a Boolean value. [Correct] Description [Incorrect] ・Threshold is not set to 0.5 ・2nd input is a numerical value Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP5003: Use of Multiport Switch Block Reference Priority Strongly Recommended Scope JMAAB MATLAB Version R13 and newer Prerequisites The parameter (on/off checkbox) of Multiport Switch block, “Use zero-based indexing” should be consistent throughout the model. Description Rationale Readability Workflow Simulation © Copyright 2008 JMAAB. All rights reserved. Verification and Validation Code Generation 45 Last Change V2.0 © Copyright 2008 JMAAB. All rights reserved. 46 6.Controller for HILS/SILS ID: Title JP6001: Description of Controller Model for HILS/SILS Use Reference Priority Recommended Scope JMAAB MATLAB Version All Prerequisites JP4010: Use of Block Connection Line Description There is no need to follow the CM Guidelines when building controller models for HILS/SILS use. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP6002: Structure of Controller Model for HILS/SILS Use Reference Priority Recommended Scope JMAAB MATLAB Version All Prerequisites Description If input/output processing is required to connect with plant model, controller model must contain the processing part. Rationale Readability Workflow Simulation Verification and Validation Code Generation Last Change V2.0 © Copyright 2008 JMAAB. All rights reserved. 47 7.Rules for Coordinate System, Unit System and Constants 7.1. Rules for Coordinate System ID: Title JP7101: Vehicle Coordinate System Reference Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites The vehicle coordinate system follows ISO 8855 standard. (In SAE standard, the positive direction is taken at the opposite for Y and Z-axes.) ISO Coordinate System z y x x y Description Plan View The origin is at the center between the front wheel centers. When setting the origin at another position, describe the position from the abovedefined position. Note Define as a worldwide coordinate system Need to harmonize with standards and regulations To convert the coordinate system, which is locally defined at each entity, prepare a tool for the conversion. Consider a possibility of providing it to other entities for model exchange. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP7102: Tire Coordinate System Reference © Copyright 2008 JMAAB. All rights reserved. 48 Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites To be consistent with the vehicle coordinate system, the tire coordinate system follows the ISO standard. Normal force Fz Alining torque Wh ee l to rqu e Ro llin g Description Lat era l fo rce regi Fy stan ce m om ent Mz Z Inclina tion ang γ l an e lp e e wh ce for g l n i a ad in l he ud ee ongit h vel w L x h eel tra of F n X o ti of w rec tion Di c e Dir Slip angle T Y α My Sp i nt me mo g in urn Mx ert v O Note Last Change ID: Title nA xi s Define as a worldwide coordinate system Need to harmonize with standards and regulations To convert the coordinate system, which is locally defined at each entity, prepare a tool for the conversion. Consider a possibility of providing it to other entities for model exchange. Readability Workflow Simulation Rationale le Verification and Validation Code Generation V2.0 JP7103: Engine / Power Train Coordinate System Reference Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites The engine/power train coordinate system is defined as follows. Description The origin of engine coordinate system is at the center of the bearing in the block between the pulley on the crank axis and the #1 cylinder, and the coordinate system is left-handed orthogonal. z-axis: The axis is in parallel with the #1 piston motion direction, and runs through the center of the crank. The positive direction is the direction from the center of the crank toward the piston. © Copyright 2008 JMAAB. All rights reserved. 49 Z y-axis: The crankshaft axis. The positive direction is the transmission side where power is out. TDC x-axis: The thumb on the left-handed coordinate system (the z axis for the middle finger, the y axis for the index). Rotation: Positive rotation is clockwise while looking toward the y axis from the origin. 0 degree is when the #1 piston is physically closest to the top of the #1 head (TDC). One cycle is 720 degrees. For engines that do not fit this description such as rotary engines and two-cycle engines, coordinate systems are defined separately. y X The power train coordinate system conforms to engine’s one. Depending on the installation arrangement, the axis and rotation directions may be different from those of a vehicle. Coordinate system conversion is required in such a case. Note Define as a worldwide coordinate system Need to harmonize with standards and regulations To convert the coordinate system, which is locally defined at each entity, prepare a tool for the conversion. Consider a possibility of providing it to other entities for model exchange. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.1 7.2. Rules for Unit System ID: Title JP7201: Unit System Reference Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites The unit system follows the ISO standard. (SI units) Use MKSA system as a basic system. SI units with special names follow the chart below. Description SI Derived Units with Special Names Quantity Plane Angle Solid Angle Frequency © Copyright 2008 JMAAB. All rights reserved. Unit radian steradian hertz 50 Symbol Other SI Unit rad sr Hz Basic SI Unit Notation 1/s Force newton N m·kg/s2 Pressure, Stress pascal Pa N/m2 1/m·kg/s2 Energy joule J N·m m2·kg/s2 Work, Heat Quantity Power, Electricty watt W J/s m2·kg/s3 Work Quantity, Electric coulomb C s·A Charge Voltage, Electric volt V W/A m2·kg/s3/A Potential Capacitance farad F C/V 1/m2/kg s4 A2 Electrical Resistance ohm Ω V/A m2·kg/s3/A2 Conductance siemens S A/V 1/m2/kg s3 A2 Magnetic Flux weber Wb V·s m2·kg/s2/A 2 Magnetic Flux Density tesla T Wb/m Kg/s2/A Inductance henry H Wb/A m2·kg/s2/A2 Celsius Temperature Celsius degree*1 °C K Luminous Flux lumen*2 lm cd·sr cd *3 2 Illuminance lux lx lm/m cd/m2 *4 Radioactivity becquerel Bcl 1/s Absorbed Dose gray*5 Gy J/kg m2/s2 Dose Equivalent sievert*6 Sv J/kg m2/s2 *1: The Celsius temperature θ is defined by the thermodynamic temperature T with the following equation. θ/°C = T/K - 273.15 *2: 1 lm = The luminous flux emitted in a 1 sr cube from a 1 cd isometric point of light. *3 1 lx = The light intensity when 1 lm of luminous flux uniformly illuminates 1 sq.m. of area. *4 1 Bq = Radioactivity that causes 1 atom to decay in 1 second. *5 1 Gy = The absorbed dose giving 1 J of energy to 1 Kg of matter by ionizing radiation. *6 1 Sv = A quantity that displays the strength of the biological effect of radiation. Note For computation within a model, SI units on the chart or dimensionless unit should be used. For other purposes such as monitoring, this rule does not apply in case there is inconvenience from a practical standpoint Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 7.3. Rules for Constants ID: Title JP7301: Constants Reference Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites Description For the constants shown below, use the values prescribed here. © Copyright 2008 JMAAB. All rights reserved. 51 Gravitational acceleration JP_g = 9.80665 m/s2 (as prescribed by the General Conference of Weights and Measures in 1901) Absolute gas constant JP_Ra = 8.314 J/(mol·K) Speed of light JP_c = 2.99792458 x 108 m/s Air average molecular weight Molecular weight of dry air JP_Ma = 28.967 Molecular weight of water vapor JP_Mw = 18.015 Base of natural logarithm JP_e = exp(1) Circular constant pi (Use the MATLAB function: pi) Physical constants must comply with the rules of the General Conference of Weights and Measures (and also with Chronological Scientific Tables). Rationale Readability Workflow Simulation Verification and Validation Code Generation Last Change V2.0 © Copyright 2008 JMAAB. All rights reserved. 52 8.Block Parameters of Model ID: Title JP8001: Setting of Parameter Data for Model Files Reference Priority Strongly Recommended Scope JMAAB MATLAB Version All Prerequisites Description Parameters such as physical constants and specifications must be set outside of the model and those values should not be entered directly within the blocks. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.1 ID: Title JP8003: Parameter File Configuration Reference Priority Recommended Scope JMAAB MATLAB Version All Prerequisites Description When there are multiple parameter files*, prepare one m-file that call the other files. * Files where model parameters are defined, or files to define model parameters as workspace parameters. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP8004: Description of Parameter Data Reference Priority Recommended Scope JMAAB MATLAB Version All Prerequisites JP8001: Setting of Parameter Data for Model Files Description Add explanation on the parameters in parameter file, if possible. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP8005: Standardization of Parameter Names Reference Priority Recommended © Copyright 2008 JMAAB. All rights reserved. 53 Scope JMAAB MATLAB Version All Prerequisites JP7301: Constants Description Standardized parameter names must be used for parameters such as physical constants etc. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP8006: Dialog Parameters in Basic Blocks Reference (Revised) db_0110: Tunable parameters in basic blocks (Change in Priority Level and Figure) Priority Recommended Scope JMAAB MATLAB Version All Prerequisites JP8001: Setting of Parameter Data for Model Files The dialog parameters must be entered in the basic block*1 Without any expression. Without a data type conversion. Without selection of the element of rows or columns. *1 Built-in blocks, other than a User-Defined Functions library blocks, in the standard Simulink library blocks. [Correct] Description [Incorrect] Rationale Readability Workflow Simulation Verification and Validation Code Generation Last Change V2.0 © Copyright 2008 JMAAB. All rights reserved. 54 9. Use of Input/Output-Data for Model ID: Title JP9001: Setting of Input/Output Data Reference Priority Recommended Scope JMAAB MATLAB Version All Prerequisites Description Input/output data*1 must be set by using input/output data files, and those values should not be entered directly in the blocks. *1 Time-series signals required for the execution of simulation as well as the validation of simulation results. Readability Workflow Simulation Rationale Verification and Validation Code Generation Last Change V2.0 ID: Title JP9002: Explanation of Input/Output Data Reference Priority Recommended Scope JMAAB MATLAB Version All Prerequisites JP9001: Setting of Input/Output Data Description The explanation of each data should be provided in input/output data file, if possible. Rationale Readability Workflow Simulation Verification and Validation Code Generation Last Change V2.0 © Copyright 2008 JMAAB. All rights reserved. 55 10.Appendix A: Recommendations for Automation Tools These recommendations are intended for any company that develops tools that automate checking of the Style Guidelines. These guidelines were developed by JMAAB, and it is expected that tool vendors will create tools that check models developed by MathWorks tools against these guidelines. In order to provide the maximum information to potential users of the tools, JMAAB strongly recommends that tool vendors provide a compliance matrix that is easily accessible when the tool is running. This information should be available without a need to purchase the tool first. The compliance matrix should include the following information: Version of the guidelines that are checked – shall include the complete title as found on the title page of this document. o The JMAAB Style Guidelines Title and Version document number will be included Table consisting of the following information for each guideline Guideline ID Guideline Title Level of Compliance Detail The Guideline ID and Title shall be exactly the same as included in this document. The Level of Compliance shall be one of the following. Correction – The tool checks and automatically or semi-automatically corrects the noncompliance. Check – The tool checks and flags non-compliances. It is the developer’s responsibility to make the correction. Partial – The tool checks a part of the guideline. The detail section should clearly identify what is and what is not checked. None – The guideline is not checked by the tool. It is highly recommended that the vendor provide a recommendation of how to manually check any guideline not checked by the tool. © Copyright 2008 JMAAB. All rights reserved. 56 11.Appendix B: Table: Information Required for Delivering Model Appendix (Appendix B) JMAAB PM-WG “Information required for model delivery” Sample Delivery Case Delivery of CASE1 encrypted model (Depends on each (Black Box entity) model) st 1 Classificati on 2 Classification Document List of Deliverables List of deliverables, with descriptions for each file if necessary Mandatory Change Log Change history and difference information between the previous and the current Mandatory Release Information Release number (to identify the release), issuer, date and contact information Mandatory Outline/Purpose Purpose, application, simulation environment (non-realtime or HILS) Mandatory Target Plant Information Information to clearly explain target plant Mandatory Applicability Scope Temperature range (e.g. hot only), assumed plant type (e.g. in-line four cylinder only) etc Mandatory Confidentiality Level Entity which can receive the model, confidentiality level - SG Compliant Status List of non-compliant guideline IDs and their reasons etc Mandatory Model Version Model version number (ID number etc.), date information Mandatory Model Architecture Description Structure/hierarchy information (model architecture), conformance level against chapter 3 of the PM guidelines - Physical Meaning Physical expressions, principles, operation instructions, literature, reference document, approximation method and its data - - nd General Information Model Specification Simulation Environment rd 3 Classification Description Fidelity Level Accuracy, fidelity level, comparison with experiments I/O and Model Parameter Information I/O signals table, parameter table (see JP8001 of this guideline for a rule on parameters) Mandatory Software Requirements ・Tool version (MATLAB/toolbox version, HILS tool version (vendor/software version) ) ・Recommended environment for the hardware ・Simulation settings (simulation parameters and configuration parameters) Mandatory Simulation How to run, assumptions, caveat, execution timing, connection examples, simulation examples Mandatory Examples of execution results, test results, results obtained from testing input and comparison with measured data (including measurement conditions etc). Known issues for running simulation, etc. Mandatory Execution Results © Copyright 2008 JMAAB. All rights reserved. 57