{"id":182872,"date":"2024-07-22T07:40:56","date_gmt":"2024-07-22T07:40:56","guid":{"rendered":"https:\/\/innovationspace.ansys.com\/knowledge\/?post_type=topic&#038;p=182872"},"modified":"2024-07-22T12:25:47","modified_gmt":"2024-07-22T12:25:47","slug":"scade-one-variant-types","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/scade-one-variant-types\/","title":{"rendered":"Scade One Variant Types"},"content":{"rendered":"<h3  id=\"INTRODUCTION\">Introduction<\/h3>\n<p>This blog entry is special: we have a video for you!<\/p>\n<p>Aubanel, our director of Ansys Customer Excellence, demonstrates a new construct in Swan, the modeling language used in Scade One, called variant types.<\/p>\n<h3  id=\"VARIANT-TYPES\">Variant types?<\/h3>\n<p>A variant type defines a data structure holding a value that can take on several different, but fixed, types. The generated C code uses union in a safe, MISRA-compatible way, by using a tag field to know which type is in use<a href=\"https:\/\/innovationspace.ansys.com\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/07\/scade-017-techno-babble.gif\">.<\/a><\/p>\n<p>In short, a variant type is a type that can be <em>this or that or something else<\/em>.<\/p>\n<p>In the video, Aubanel showcases this with a <code>shape<\/code> type that can be <em>either<\/em> a rectangle, a circle or a polygon.<\/p>\n<p>This makes it easy to design generic operators that perform calculations on shapes, with no need to duplicate our logic to handle various cases for various shape types:<\/p>\n<p style=\"text-align: center;\">\n    <img decoding=\"async\" src=\"https:\/\/innovationspace.ansys.com\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/07\/scade-017-variant-type-operator.png\" style=\"max-height: 500px !important;\" \/><br \/>\n    <em><\/em>\n<\/p>\n<h3  id=\"DEMO-TIME-%F0%9F%8E%AC\">Demo time \ud83c\udfac<\/h3>\n<p><iframe loading=\"lazy\" title=\"Scade One - Compute the perimeter of a shape with variant types\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/jEizl7JcvXQ?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<h3  id=\"WANT-TO-KNOW-MORE\">Want to know more?<\/h3>\n<p>In this video, you saw how variant types can power cleaner, easier-to-maintain models.<\/p>\n<p>If you&#8217;d like to find out more about Scade One, request a demo today over at <a href=\"https:\/\/www.ansys.com\/products\/embedded-software\/ansys-scade-one\">https:\/\/www.ansys.com\/products\/embedded-software\/ansys-scade-one<\/a>.<\/p>\n","protected":false},"template":"","class_list":["post-182872","topic","type-topic","status-publish","hentry","topic-tag-embedded-software","topic-tag-mbse","topic-tag-model-based-software-engineering","topic-tag-programming","topic-tag-scade-one","topic-tag-tagged-unions","topic-tag-variant-types"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Introduction This blog entry is special: we have a video for you! Aubanel, our director of Ansys Customer Excellence, demonstrates a new construct in Swan, the modeling language used in Scade One, called variant types. Variant types? A variant type defines a data structure holding a value that can take on several different, but fixed,\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/scade-one-variant-types\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Ansys Knowledge | Ansys Innovation Space\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Scade One Variant Types | Ansys Knowledge\" \/>\n\t\t<meta property=\"og:description\" content=\"Introduction This blog entry is special: we have a video for you! Aubanel, our director of Ansys Customer Excellence, demonstrates a new construct in Swan, the modeling language used in Scade One, called variant types. Variant types? A variant type defines a data structure holding a value that can take on several different, but fixed,\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/scade-one-variant-types\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2024-07-22T07:40:56+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2024-07-22T12:25:47+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Scade One Variant Types | Ansys Knowledge\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Introduction This blog entry is special: we have a video for you! Aubanel, our director of Ansys Customer Excellence, demonstrates a new construct in Swan, the modeling language used in Scade One, called variant types. Variant types? A variant type defines a data structure holding a value that can take on several different, but fixed,\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic\\\/scade-one-variant-types\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/topics\\\/#listItem\",\"name\":\"Topics\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/topics\\\/#listItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/topics\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic-tag\\\/embedded-software\\\/#listItem\",\"name\":\"Embedded Software\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic-tag\\\/embedded-software\\\/#listItem\",\"position\":3,\"name\":\"Embedded Software\",\"item\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic-tag\\\/embedded-software\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic\\\/scade-one-variant-types\\\/#listItem\",\"name\":\"Scade One Variant Types\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/topics\\\/#listItem\",\"name\":\"Topics\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic\\\/scade-one-variant-types\\\/#listItem\",\"position\":4,\"name\":\"Scade One Variant Types\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic-tag\\\/embedded-software\\\/#listItem\",\"name\":\"Embedded Software\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/#organization\",\"name\":\"Ansys Knowledge\",\"description\":\"Ansys Innovation Space\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic\\\/scade-one-variant-types\\\/#webpage\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic\\\/scade-one-variant-types\\\/\",\"name\":\"Scade One Variant Types | Ansys Knowledge\",\"description\":\"Introduction This blog entry is special: we have a video for you! Aubanel, our director of Ansys Customer Excellence, demonstrates a new construct in Swan, the modeling language used in Scade One, called variant types. Variant types? A variant type defines a data structure holding a value that can take on several different, but fixed,\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic\\\/scade-one-variant-types\\\/#breadcrumblist\"},\"datePublished\":\"2024-07-22T07:40:56+00:00\",\"dateModified\":\"2024-07-22T12:25:47+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/#website\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/\",\"name\":\"Ansys Knowledge\",\"description\":\"Ansys Innovation Space\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Scade One Variant Types | Ansys Knowledge","description":"Introduction This blog entry is special: we have a video for you! Aubanel, our director of Ansys Customer Excellence, demonstrates a new construct in Swan, the modeling language used in Scade One, called variant types. Variant types? A variant type defines a data structure holding a value that can take on several different, but fixed,","canonical_url":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/scade-one-variant-types\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/scade-one-variant-types\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge#listItem","position":1,"name":"Home","item":"https:\/\/innovationspace.ansys.com\/knowledge","nextItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/topics\/#listItem","name":"Topics"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/topics\/#listItem","position":2,"name":"Topics","item":"https:\/\/innovationspace.ansys.com\/knowledge\/topics\/","nextItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic-tag\/embedded-software\/#listItem","name":"Embedded Software"},"previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic-tag\/embedded-software\/#listItem","position":3,"name":"Embedded Software","item":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic-tag\/embedded-software\/","nextItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/scade-one-variant-types\/#listItem","name":"Scade One Variant Types"},"previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/topics\/#listItem","name":"Topics"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/scade-one-variant-types\/#listItem","position":4,"name":"Scade One Variant Types","previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic-tag\/embedded-software\/#listItem","name":"Embedded Software"}}]},{"@type":"Organization","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/#organization","name":"Ansys Knowledge","description":"Ansys Innovation Space","url":"https:\/\/innovationspace.ansys.com\/knowledge\/"},{"@type":"WebPage","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/scade-one-variant-types\/#webpage","url":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/scade-one-variant-types\/","name":"Scade One Variant Types | Ansys Knowledge","description":"Introduction This blog entry is special: we have a video for you! Aubanel, our director of Ansys Customer Excellence, demonstrates a new construct in Swan, the modeling language used in Scade One, called variant types. Variant types? A variant type defines a data structure holding a value that can take on several different, but fixed,","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/innovationspace.ansys.com\/knowledge\/#website"},"breadcrumb":{"@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/scade-one-variant-types\/#breadcrumblist"},"datePublished":"2024-07-22T07:40:56+00:00","dateModified":"2024-07-22T12:25:47+00:00"},{"@type":"WebSite","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/#website","url":"https:\/\/innovationspace.ansys.com\/knowledge\/","name":"Ansys Knowledge","description":"Ansys Innovation Space","inLanguage":"en-US","publisher":{"@id":"https:\/\/innovationspace.ansys.com\/knowledge\/#organization"}}]},"og:locale":"en_US","og:site_name":"Ansys Knowledge | Ansys Innovation Space","og:type":"article","og:title":"Scade One Variant Types | Ansys Knowledge","og:description":"Introduction This blog entry is special: we have a video for you! Aubanel, our director of Ansys Customer Excellence, demonstrates a new construct in Swan, the modeling language used in Scade One, called variant types. Variant types? A variant type defines a data structure holding a value that can take on several different, but fixed,","og:url":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/scade-one-variant-types\/","article:published_time":"2024-07-22T07:40:56+00:00","article:modified_time":"2024-07-22T12:25:47+00:00","twitter:card":"summary_large_image","twitter:title":"Scade One Variant Types | Ansys Knowledge","twitter:description":"Introduction This blog entry is special: we have a video for you! Aubanel, our director of Ansys Customer Excellence, demonstrates a new construct in Swan, the modeling language used in Scade One, called variant types. Variant types? A variant type defines a data structure holding a value that can take on several different, but fixed,"},"aioseo_meta_data":{"post_id":"182872","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2025-10-18 03:11:17","updated":"2026-07-31 04:12:21","ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/innovationspace.ansys.com\/knowledge\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/innovationspace.ansys.com\/knowledge\/topics\/\" title=\"Topics\">Topics<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic-tag\/embedded-software\/\" title=\"Embedded Software\">Embedded Software<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tScade One Variant Types\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/innovationspace.ansys.com\/knowledge"},{"label":"Topics","link":"https:\/\/innovationspace.ansys.com\/knowledge\/topics\/"},{"label":"Embedded Software","link":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic-tag\/embedded-software\/"},{"label":"Scade One Variant Types","link":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/scade-one-variant-types\/"}],"acf":[],"custom_fields":[{"0":{"_edit_lock":["1722325164:181"],"_edit_last":["181"],"filter_by_optics_product":["Lumerical"],"_filter_by_optics_product":["field_64fb192ba3121"],"application_name":[""],"_application_name":["field_64a80903c8e15"],"family":[""],"_family":["field_64a809229a857"],"siebel_km_number":[""],"_siebel_km_number":["field_63ecbffce60db"],"salesforce_km_number":[""],"_salesforce_km_number":["field_63ecc018e60dc"],"km_published_date":[""],"_km_published_date":["field_64c77704499dd"],"product_version":[""],"_product_version":["field_64c776cb4fd2e"],"_bbp_forum_id":["27825"],"_bbp_topic_id":["182876"],"_bbp_author_ip":["192.104.24.227"],"_bbp_last_reply_id":["0"],"_bbp_last_active_id":["182873"],"_bbp_last_active_time":["2024-07-22 07:40:56"],"_bbp_reply_count":["0"],"_bbp_reply_count_hidden":["0"],"_bbp_voice_count":["0"],"_yoast_wpseo_estimated-reading-time-minutes":["2"],"_yoast_wpseo_wordproof_timestamp":[""],"_yoast_wpseo_content_score":["90"],"_oembed_10466edc2b39c558d8918ad5ba342f13":["<iframe title=\"Scade One - Compute the perimeter of a shape with variant types\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/jEizl7JcvXQ?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>"],"_oembed_time_10466edc2b39c558d8918ad5ba342f13":["1721634103"],"_btv_view_count":["770"],"_wp_old_slug":["scade-one-variant-types-2"],"_bbp_likes_count":["7"]},"test":"solution"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics\/182872","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":4,"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics\/182872\/revisions"}],"predecessor-version":[{"id":182876,"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics\/182872\/revisions\/182876"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/media?parent=182872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}