How to Manage Design Variants in Simulink
From the series: Variant Manager
Do you deal with a large amount of variation during development of your systems? Introducing the Variant Manager for Simulink®, a way to combine variant management with Model-Based Design. You will discover a way to manage, configure, and analyze system variants within Simulink.
Published: 9 Feb 2024
Hello.
Hello, and welcome to today's live stream. My name is Govind, and I'm here with my colleague Teresa. And we'll cover how to manage design variants in Simulink. Let me quickly introduce myself. I work in the Simulink product marketing team. And my background is in the automotive industry. Teresa, do you want to introduce yourself?
Yeah. Hi, I'm Teresa. While Govind was in the automotive industry, I was working on Simulink. I've been at MathWorks now for 15 years. And really excited to talk about design variants in Simulink. So let's get started. We first of all wanted to motivate like, why is this topic important? And it really has to do with the product variation, right?
Absolutely.
Yeah. So if we go back to 1910, model T's were all one type. Everybody had the same car. Not too much customization on a model T. But nowadays, that's not the case, correct?
Yeah. Absolutely. So you're right. I think back in the day, every car was maybe painted black, and it had the exact same configuration. But that product variation has changed. And you can customize-- every person can customize the car the way they want today. And so on this slide, we get to see four different areas-- powertrain, audio communication equipment, and product line.
But there's more to it than just these, right? So yeah, maybe if you go to this slide so we can-- I can quickly talk through this. And so I was looking at a video last week, I guess, on Kelley Blue Book. And it was about the Toyota Highlander, wherein they had a couple of different powertrain options. So you could either have a straight internal combustion engine or you could have a hybrid configuration.
And then if you look at the transmission, it either had a front-wheel drive or an all-wheel drive transmission. That's just a couple of different areas within the vehicle. But as you see on the slide, the product has just increased in complexity. And so you can see we have a manufacturer who's making four different types of vehicles. So that's four different types of systems. And then if you look at the subsystems-- and this is not supposed to be a representative of everything that's in a vehicle today, but just a few things that came to our head right.
So there's powertrain. There's transmission, body chassis, cabin. And then you have features and packages. And so if you see the boxes on the left where we have, OK, there's four systems. There's five subsystems. And then if you look at the components on the third vertical, there's more than 15 components. And then the options just explode. And so you multiply all of them, you have hundreds of combinations.
Yeah. Exactly.
And then I think the part that I wanted to add here was that the variation is not just on the hardware. The variation is even on the software on the electronic control system package. And so that's where this session today is really useful because we are trying to figure out, how do you design and how do you manage variants in Simulink?
Yeah. So you know what I did? I took your diagram here, and I made a Simulink model of it. So let me just-- I mean, it's kind of a toy model. But what it's got are the types in here. And if I dig into this sedan, you'll notice, first of all, that it's not grayed out. So this graying out, what this is this is showing active and inactive. So something black like this is the active variant, and the gray ones are the inactive variants.
So I could keep digging in and see, oh, here's my powertrain, transmission, chassis choices, and keep going like that. But what we're here, really, to look at is the Variant Manager. So let me bring that up. So the Variant Manager is actually a support package. It's coming out in 22B. Oh, maybe it's already open. Sorry.
Yeah.
Whoops. Let me go here. Oh, there-- it was actually open. OK. So the Variant Manager is-- you can tell it's alive. The Variant Manager came out in 22B. And it's a support package, but you might recognize it. You won't recognize it because it didn't look like this, but there was a Variant Manager in Simulink prior to this.
That's right. Yeah. It came out in the prior release, I think, in '22, right?
Well, it's been in the product for a while. But we transitioned it into a support package because we've completely changed it. So it's really quite different. But why the Variant Manager is so great is it helps you understand you can get a picture of what all your choices are. So it's a little hard to see here because it's grayed out, but I could see that I have a coupe. I have chassis options and powertrain options. And I can see what the active one is currently. It's that sedan. And it has these features and packages, like in your diagram, we have that extra special ADAS level. That's currently the active one. On the powertrain, it's the hybrid option. And in the transmission, let's see. It must be four wheel.
Front-wheel drive, maybe.
Front. OK. So front-wheel drive. Four-wheel drive. So that would be interesting. OK. So here we go. This is where we're at right now. But let's say I want a different configuration. How easy is that to change? Well, in the Variant Manager, it's really easy to change. So I can create a new configuration. What do you want to make?
Yeah, let's call it performance car.
Yeah, let's make a super fast coupe.
Super fast coupe. OK.
Yeah, let's make it the fast coupe. OK.
All right.
So I'm going to go ahead and set up my fast coupe. So I've seen I have the coupe. So probably first of all I've got to choose the coupe. So I can see-- it's a little grayed out, but I can see that product equals two. So that's the first one I want. And then for the chassis, which one should I pick?
Let's pick chassis one with the limited slip differential.
OK. And then what should I pick for the powertrain? Yeah.
Let's pick the six cylinder.
OK.
Yeah, you want more cylinders for more power.
Yeah. OK, so power-- good point, if it's going to be super fast, right? So there we go. So now I've created my fast coupe configuration. I can choose that. I can choose to activate it. Boom, boom, boom.
Did you save it?
Not yet.
Not yet. OK. All right.
So there we go. We've got the product line choice of coupe, the limited slip differential, and--
The six-cylinder engine.
Six cylinder. Yeah. So as you can see, this can be really powerful. I can save it, like you said. So I can give this a configuration data a name, like fast coupe. Or usually this is a set, so if I had a set of them here, like super cool pickup or whatever, then I could go ahead and put my configuration data here with those. And then I can say this is my configuration data that I have. Then I can go ahead and apply the changes. I can import and export to a file.
This thing is, if I want to auto-generate my configurations, which I'm kind of picky, so I'm making them myself. And then these two are new features-- the variant reducer and the variant analyzer. There used to be kind of capabilities for this in the--
The Simulink Design Verifier.
Yeah, Simulink Design Verifier. Thank you. And you could choose to reduce your model or analyze it. I'll be talking more about this in a minute, but these were capabilities that we had in that product. But we've now moved it into this support package.
OK. So it's-- in a way, you can say maybe it's on the next slide, right? So you're combining capabilities that were previously there, as well as some new features that's been added. And all of them have been packaged together in the support package. And so just to be clear, this is not a new product. It's just a support package that anybody could access.
And download. Yeah.
And download.
So you can download it yourself. We kept that variant manager button in Simulink, even if you don't have it downloaded. If you click on that, it's going to prompt you to download it. So we'll talk a little bit more about that in a minute. But like I said, this is new for 22b. There's a new UI. It has a lot of improvements to it. Particularly, it has a lot of guidance to help you learn it faster. Sometimes these big gooeys can--
Yeah.
And there's a better layout. And it has that ability to generate the configurations for you.
OK.
Yeah. That's a cool thing, but maybe you're saying, look, Teresa, you moved way too fast. I don't understand what Simulink variants are. Why would I-- what is this in Simulink? So in Simulink, what this really means is that you have one model for many systems. It's really cool. It's saving you time. So you could reuse components. So things that are common, you can just stay common. Things that are different, you can make different.
So we call it a 150% model. I think that thing you specify is, like, a 400% model. But it's a lot. Your model contains more than just the variants in it, or more than just the system. It's capturing multiple systems.
So that brings up a good point, right? So what you saw there was somebody trying to manage variants at a company level.
Right. Right.
Whether you're a tier one supplier or an OEM, you have so many things to manage. But I think typically, you're dealing with a project at a time. And so you could be working on just the sedan program or just the coupe program. And so it's very normal for you to develop-- just because you have so many variations, you want to develop that 150% or that superset model that's going to help you both in your simulation for your testing, verification, validation work. And it's also going to help you, I think, even on the codegen side where you generate code for whatever variant that you're wanting to deploy to that control unit on some program. Right?
Right. Right. Yeah. So yeah, the idea is that you want to have streamlined development, maintenance, testing, and deployment. So you will have code that can have multiple choices in it. So it's a great way to manage Simulink. So what we're going to talk about is how to do this. So we're going to get very basic here. But we're going to show you how to create variants and how to switch them, both for simulation and code generation. Do you have an example of doing this, by the way?
Yeah.
OK.
So the one-- well, OK. So the one I can think of is in-- OK, let's take the example of something called fan control. Maybe I'll just give a little bit of background. So this is on internal combustion engines. To ensure that the engine doesn't get too hot, you have sensors. And based on some thresholds being exceeded, you trigger the fan to be turned on to cool the engine and thereby cool the entire system down. So maybe we can try that, something really simple.
Yeah. Did you have variants of that system?
Oh, yeah. Absolutely.
OK.
So maybe if you're somebody like a tier one supplier wherein you are trying to-- you're developing an engine and you're sending it to different vehicle makers, different OEMs, so each of them may have a different type of fan that they've chosen for their own reasons. And so if you're a supplier, then you want to implement the fan control algorithms to cater to all the different ones in one single place. So that's your 150% superset model, and then you deploy whatever is needed depending on how you want to manage that complexity and those configurations. So it's always a trade-off.
Yeah. Cool.
Maybe we'll do that.
Yeah. Yeah. Cool. So let me-- oh, sorry. OK. Let me go ahead and create a variant subsystem to represent that fan that you described about, or you described.
There should be another way to get this, as well--
Right. Right. Right. Yeah, let me show you that. So in Simulink, we have something called a library browser. It's containing the block choices. I just typed in to get that block choice, but I could have used the library browser under ports and subsystems, because this is a subsystem type, and then go to the variant.
I think you just--
I just passed it. I went too fast.
There you go. There you go.
The variant subsystem. So if I go to the variant subsystem, that's the block I just put in here. So here we have the variant subsystem. I'm going to name this. Well, let me make it bigger so everybody can see.
All right.
Oh, I just gave it a space in there. So here's my fans. OK, so this is my fans subsystem.
And it has two of them.
Yeah, it already has two of them. It already put one as a default active one. So let's just name them. This is going to be fan A. Let me move that up a little bit. Fan B. All right. Cool. So going back here. OK, I've got two things, fan A and fan B. But how do I set up which one's active? Let's say I don't--
Yeah, what if you want to switch from A to B, right? How do you do that?
Exactly. So I'm going here, and I'm going to right click on this double badge. So this thing in the corner is telling me it's a variant block. And if I click on it, I can get to these block parameters. And here is where I'm determining-- I'm setting up the block, essentially.
OK.
So there's a few things to think about here. One-- let me see if I can make this bigger. There we go. So for the variant control mode-- there's different ways to do this, setting it up. So I could do an expression, which would be something like, it's usually a conditional statement, like fan type equals 1. In fact, I'll probably use that. And then label would be-- I'll show you what a label is. So if I just call this fan A, fan B, I can go ahead and use the label mode active choice to just pick it.
So I can say, well, I want fan B to be active. This is great if it's very simple. If it's not simple, though-- like let's say that choice affects a bunch of things in your design. Like suddenly the controller is going to be different because you have fan A. You don't want to do that. You want the expression. So the expression-- oh, I've actually already defined them.
Yeah, you already--
So I have fan type equal to 1 and fan type equal to 2. I'll show you where I define that at. That was a little bit of a cheat because I had it done. But I could have also-- the sim code switching is when I have one implementation for simulation and another one for code gen. That's kind of-- yeah, some people do that, too. You could set that up here, as well.
This thing, the variant activation time, is actually-- it sounds like, I don't know why I need to worry about it. You do need to worry about it. So what this-- you know what I mean? So this is, when do I determine what's the active variant? Do I do it when I update the diagram? So update the diagram, if you don't know, is compiling the model. At that point it would choose.
You could say-- actually, though, maybe I want to choose it at update diagram, but I want to look at all the choices, especially like catching errors, that kind of thing. So I might want to say analyze all choices. I could do it at code compile. So this is cool because what this is doing is this is when I'm going to get those pound-- I'm going to get pound if statements in my generated code.
And so that my generated code has all the choices. And then when I put it-- it could be later that I would choose which one I want to have. So that's pretty cool for deployment. And then you could do it on startup. You could also inherit this from some other variant control. But right now I'm not going to do that. I'm going to go ahead and say update diagram. And this is all set up. So if I say this let's-- oh.
But before we go on, I just noticed something in the icons on the left. So one of them-- I think the second one seems like it's a model reference.
Yes. I skipped this, and I shouldn't have.
OK.
Let me click it and show you the magic that's happening here. So if I click this, it's going to create a new one. So yeah, it's cool. I got a new one here. I could make fan C.
OK. So that's how you would add an extra variant to your model, right? And then how would you-- suppose you wanted to get rid of a variant. How would you do that?
Well, let me apply it, just to make sure it's something--
So that you don't lose it. Yeah.
Oh, I want it to pick up that name. OK. There we go. OK. Sorry.
So you want to change-- OK, you want to do the--
Sorry, what was your question again?
So my question was, so you clicked on that button, and through that you were able to add a variant, right? But what if you wanted to delete a variant? So would you just remove it from the-- go to the model and then delete the block?
Just delete it. Yeah. It's actually kind of-- deleting is easier than creating sometimes. So this one, though-- you brought this up, model reference. So this is really important for the situation in which I want to-- let's say you, me, and one of our colleagues, Weiwu. The three of us are working on fans. And maybe we want to split up this project. I work on fan A, you work on fan B, he works--
He works on fan C.
Then you can use model reference. And what that does is it sets up those things to be separate model files. And then you can split up the work pretty easily. It's a nice way to collaborate.
It's a collaborative work approach.
Yeah. And it's also good for reuse. So say fan A gets reused somewhere else. Like I don't know where you'd reuse fan A, but let's say we had some sort of component in this system where we would reuse it. Model reference is a great way for component reuse because then I have one model, and it's referred to, and can be parameterized differently in different parts of the car.
OK. And then I think one of the other buttons that was active and went inactive, I think, was edit button there. Oh, there you go.
Yeah. So yeah, let's click on this. So this is where I'm setting up the condition. These were actually pre set up so, they already existed when I typed in fan B. But I could have written-- this is where you write the conditional statement that's associated with this variant control expression. So if I say fan B, it'll just know that's fan type equal to two.
But it's setting it up in the base workspace-- excuse me-- which we'll talk about in a minute. This is just opening it up. This is refreshing it.
Maybe I could apply first before--
You can tell this went wrong in some other practice sessions. So I'm also going to click to propagate the conditions outside the variant subsystem. And I'll talk about that in a minute. So let me go to my crowded Matlab space. So what I've got here is way too much, but I could see here that I've got fan A. So if I click on fan A, what I defined at that point was this. So this is my variant, my Simulink variant object, that's defining that condition.
So this is all set up for me, which is great. But if I want to change it to C, like let's say I want to make-- yeah, fan type equal to three. Yeah, that should make--
Previously you had fan A as active, right? And that was the blacked-out version. And the others were grayed out, right?
Your memory is better than mine, but I knew that fan C wasn't because we just created it.
OK. So maybe--
Yeah, I'm going to go here. I'm going to do an update. So it's checking which one is active. Oh. Well, OK. Sorry. I haven't quite hooked everything up yet.
But there you go.
Yeah. So this one's now active. So now we have the three fans that are working. Also, you saw that error. So let's talk about that error a bit. Yeah. Sorry.
But just a point. So I think the other thing that was interesting to note was the annotation at the top of the block. It changed from-- so if you maybe go back up one level?
Yeah.
So yeah, there you go. So now it shows fan C. Previously it was fan A, and now it's showing fan C.
Yeah. Yeah. So you can check which one's active. So let's go in here quickly. We're going to just make some simple algorithms, but I want to show variant propagation a bit. So on here-- let me make these bigger. Maybe we could have two inputs into these fans. What are you thinking? Coolant?
Typically it's temperature sensors. So yeah, maybe one is coolant temperature. And then maybe another one, you know what-- OK, let's pick cabin temperature. Maybe those two are our input conditions to trigger turning on the fan.
OK.
Yeah.
So we've got these two. Should we just sum them?
Yeah, let's just do a simple weighted average, maybe like a 0.5.
Sorry. There we go.
Maybe a couple of-- yeah, sum.
I'm just going to sum them. Sorry.
Yeah, that's OK. That's OK. We're not trying to--
Oops. Oh, I should use this mouse. I was like, oh, I'm having so much trouble because I'm using the tracker.
So if you're seeing this and you see all of these things here, we're trying to take a very simple--
It's a super duper simple--
You're not expecting this to be running in somebody's car tomorrow.
Can you imagine? So no. This would not-- so let's go ahead and put the same thing here. Whoops, I meant to get rid of these. So I'm basically repeating that here and deleting that.
OK.
But what if we change it up? So you want to-- so maybe we'll say like cab and-- this isn't including the cabin temp. It's just looking at that--
So maybe one of them could be using just the coolant temperature. And then maybe the last one, we could say that's using just cabin temperature.
OK.
That way we get three different variants.
Yeah. I'm just sticking this in here for fun.
OK.
Not a gain of one. That's silly, but I don't know. I'll do 30%. Who knows? OK, this is finally our-- this is currently our active choice. So it's got both. OK, so we have two inputs on this one, two inputs on this one, and one on this one.
So we need to now define one input, right?
Oh, whoops. Oh, yeah. Yeah. Yeah, we need the other input. So let me put the other input here. This one's our cabin temp.
All right.
And OK, let's go up to the top. Yeah. So I'm just going to make this super simple. I'm going to just stick some inputs on here. Well, actually, maybe on the cabin, I'm going to stick something a little more. Let me zoom out a little. Let's stick a gain on here. This is just to show something. OK, here we go. The live demo. Here we go.
And then also put an output, right?
Yeah. Right.
I'm hoping this is going to get rid of--
I think it will get rid of our error.
OK.
OK. So here we go. We've got fan C. Fan C also has the two inputs, but maybe we want to see what happens when it's just the one. So we're going to go here, change our fan type. Two, right?
Two. Yeah.
I think that's the right one. So now we've made it-- we think we've made a B. So let's update our diagram again. Oop.
There you go.
Oh. Let's see. The name of-- oh, OK. What did we do? It didn't say-- it said the outport, right?
Do we need to just call it?
Oh, one?
Yeah.
OK. Now you know it's live. So here we go. But we can see it's active, and it had an error. OK. So great. We got the-- well-- oh. Oh, I see what I did. So I got rid of the coolant temp, but I had the cabin temp. I'm glad I did this because now that's not what I wanted at the time. But now I see that this is the one that's active.
Yeah.
But here's the thing. So propagation suddenly makes this inactive. And the reason why this is important has to do with speed. I get this question a lot. So if I have an extremely large model and I don't want the simulation engine to consider everything that's inactive, I just want it to consider, how do I make it faster, this is your way-- propagation.
So what it's doing is it's taking the variant condition out. And I thought this game was going to be here, but it's going to be-- it'll apply to this and anything that's kind of connected to it. So the variant condition goes out of the subsystem and into other things if you click that checkbox.
I do have a question. I just had a thought. So what we're dealing with here is a very simple design. We've got a couple of inputs. We've got one output and very simple logic. That's not what we typically see customers doing. And so how do we-- so once you have a much more complicated variant system, is there any kind of annotation or legend that you can apply that you can-- that's going to help you from a troubleshooting perspective.
Yeah. So we have this debug tab in this section, this tool strip here, for debugging for Simulink. And then in this information overlays section, we have a lot of choices for things that can help you. It'll add legends and annotations so that you can see what's going on. So one of them is this variant conditions thing. And what it's going to do is it will tell you, what are the variant conditions being applied here?
So we see fan A's being applied. Fan B, fan C. We would expect that. And then we see this false. So this false is coming out to be three. And anything that would be connected to this that's being affected by that propagation would have the same annotation.
OK.
So it's a pretty cool-- it's necessary, actually. So it's a cool feature that helps you figure out how propagation is working.
OK. I do have-- so if you can open up the-- I think it's a block dialogue, I think, for configuring the variant subsystem. I do have another question there.
Sure. Yeah. Let's bring that back up. Yeah.
Oh, yeah. So we covered all of-- maybe if you can expand that a little bit. So we covered everything here, but what about the-- I know there's another tab there for reference.
Yeah. Glad you brought this up.
You can talk about that, as well.
Yeah. Oh, right here.
Right there. Yeah. Yeah.
Sorry, guys. I should look here. It was a little easier to see that tab on here. What we have here is this reference tab. Now, this is a cool choice. So it says, instead of me specifying each one individually and having blocks in here-- well, it still would show up as blocks. But what it's doing is it's saying, rather than pulling it from the way I diagrammed it, I can put it into a directory. And then if I say, OK, everything with the-- every model in this directory, those are my variant choices. So that's a cool-- like if we were doing that fan A, fan B, fan C-- yeah, we could--
Our models could be in that folder.
Yeah, exactly. So we could set up a folder so that we put whatever variant changes we have in it, and this will pick it up. So that's the variant assembly subsystem. So I'm going to go back to my slides.
Yeah.
Here we go. Let's go back here. OK, so we talked about switching the variants for simulation and code generation. We talked about having different I/O. And then we also-- you brought up the variant assembly subsystem. So yeah, this is a new feature for 22B. Super exciting. Yeah, lets you choose from files on a disk for the variant subsystem rather than having to--
So this is that. So essentially this one is one of the other blocks that we saw in the library browser, right?
Yeah.
Variant assembly subsystem, right?
Right.
OK.
Yeah. But you could also, like you saw, you could get to it from the variant subsystem tab, as well.
OK. OK.
Oh, I didn't bring this up. You also can specify-- in some cases, say that propagation goes out through the out port. That could cause some issues in some way. So you can sort of say, I want to specify a signal to be sent, even if it's if it's unconnected. So I just want to call that out.
So it's almost a model-based-- it's a design best practice.
Yeah, it's a design best practice.
OK.
And also want to say that there are other types of variants in Simulink. So I just showed only one, like tip of the iceberg kind of thing. So I did talk about the model reference blocks. So yeah, there is the model reference blocks. We have these-- I put the picture in here for this because I think it's worth calling out the variant source and sink blocks where that's kind of changing what comes in and what goes out. Or the destination, I should say. The source and the destination change on that. I see those used a lot.
Variant parameters. That's really popular. So a variant parameter is on that-- like the gain value. I could say, well, I want to change up that gain value. And so I could make that associated with a variant, as well. And then we also have event-based variants. I think this is near and dear to your heart because this is a service-oriented architecture stuff, right?
Yeah. So you remember I was telling you about the superset and the subset way of doing things, right? So yeah, if you have something like memory constraints that you only have so much space in your control unit, typical electronic control unit on a vehicle, if you want to avoid putting everything in there, then you then have the challenge of managing all these different software configurations, depending on literally every make and every option.
And so I think event-based variants seem to be one of those things that would be very helpful if you are employing something like a service-oriented architecture wherein your software architecture is such that you can use over-the-air updates to just modify certain blocks of code, so features, functions. And so this is where something like this would come in very handy wherein you can just update for that specific line of products.
Right. Right. Yeah. So how these show up in Simulink is as Simulink functions and functions for initialize, reset, and terminate. So those are some event-based variants that you can use. Oh, state flow. So for those of you who use state flow, we do have variant transitions in state flow. We have dimension variants. And then we also have AUTOSAR variants.
That's important for the automotive industry, particularly because they have specific ways of doing variation. And we support the way that they've specified to do that.
So one thing I just wanted to note was, so if you have any questions, folks calling in and listening to us today, if you have any questions on something like event-based variance, service-oriented architecture, feel free to reach out to us. We'd love to talk to you.
Yeah. Anything Simulink, really.
Yeah. Anything Simulink related.
You don't have--
Yeah, it doesn't have to be unique to service-oriented architecture.
Yeah. OK, so we kind of went over this, but just to reemphasize it-- why do you need to manage variants in Simulink? Part of this is to be able to create those configurations that I showed, to be able to reduce the model, which I'll show you-- I'll show you that magic in a minute. And what that means is I'm going to create a model with just the variant choices that I want. That would be important for your supplier.
I can already think of a use case. But you know what, we'll talk about that use case once we go back to the Variant Manager and cover the reducer and analyzer.
OK. Yeah. And then we also have the analysis capabilities to look at coverage for testing. So how do you find that support package? In the modeling tab in Simulink, if you click on Variant Manager, it's going to prompt you to add. Whoops. Sorry. I want to go to the-- oh, I did some magic here, too. So let me show this. Oh, that's the product line choices. I want to use a different one because based on the fan, I think this is the one.
Yeah.
So I created this one to make it a little more fun. There's two choices here. Oops. Let me use the mouse. Oh, you can barely read it. But there's-- let me zoom in. There's two vendors. There's one vendor and then a second vendor with the same sort of choices. So you can imagine in this situation, I don't want vendor two to see vendor one's--
Yeah, the algorithm.
I don't want them to see that. So I would want to reduce this model. So let me go into the Variant Manager again. So it's-- oh. Yeah, so here we go. So we have vendor one and their choices, and vendor two and their choices. And I've created two kind of fun configurations, one called my favorite, and one called cheaper, which a lot of times is my favorite. But there's a cheaper configuration with the fan value being two, and then another one with one vendor being one.
So what I want to show is like, what if I have to send this to vendor two. I'm going to send it my favorite out. OK, whoops. OK. So this happens sometimes. When you do-- oh, yeah. When you do reduction, you do have to-- let me make sure this is the right one. Yeah. You do have to save the model ahead of time so you don't lose things. So I'm going to go back here, hit my Variant Reducer. OK, great.
So now I've got the Variant Reducer dialog. It's allowing me to specify the reduction mode in different ways and when to do it. I'm going to just choose that favorite configuration. So I only want to ship the favorite configuration. I'm going to go ahead and click reduce model. Hope there's no errors in this model. It looks like it's going fine.
So the use case I wanted to mention was, yeah, this is exactly the case. So if you're a-- it doesn't matter, right? If you're an OEM and if you're working with two different tier one suppliers for getting the same component-- maybe it's a part of your dual sourcing strategy. Who knows, right?
But then if you-- you got the part from them, and then you're doing some development in-house, and then you're running into some issue, and you want to pass whatever you have developed specific to that back to the supplier so that they can do the testing at their end to confirm whether-- essentially it's a duplication of problem or issue so that you can go about fixing it, depending on where you need to fix it. This is going to come in handy in that kind of a situation wherein you can just send them that specific. So you're working on fan A. You don't need to send them the model for fan B and fan C.
No.
You just say, fan A, help me figure out what's going on. Let's work together to figure out what's going on.
Yeah.
Right?
Right. Yeah. Exactly. So it's allowing you to send that piece. So yeah, this is my reduced model. I'm going to go-- the other thing I wanted to show was, we go back to this one. I want to go to the Variant Manager again because I want to show analysis. So let's say I'm the one who set up these configurations, favorite and cheaper. But all three of us worked on it, me, you, and Leilu. So we have three fans here, not two fans. But I've only set up two configurations.
And let's say I'm the I'm the test engineer. I'm going to go ahead, and I created scripts based on favorite and cheaper. These are the only two configurations I created. Let me just double check that my tests are going to be fine based on those two configurations. So I can go here and see-- I hit the Variant Analyzer. So really good tool to look at coverage.
And then I want to say, well, of these two, what does it look like if I just cover those two configurations in my simulation in my test scripts?
There you go.
And then I see. So what I'm seeing here is that I had an input called variable speed. And while favorite configuration would cover it, cheaper configuration is not going to do that. And then also-- which is OK because favorite caught it. But look at this, out two.
Yeah. It's not covered.
It's not covered at all.
So I might want to-- I might want to create another configuration or consider it in my test cases because I could see that I'm going to not cover that case in my testing.
It's almost-- when I look at this and when I looked at it previously and when I saw it again here, it reminded me of, it's some sort of a-- it seems like it's some kind of a contrast or comparison tool not in the sense it's comparing models, but it's comparing your coverage.
Right. Right. Yeah.
And if you did not-- if you did not do something like this, you could very well have shipped your algorithms which haven't been tested. It's highly unlikely that that would happen in the real world, but there's--
You never know.
You never know. Yeah. Yeah.
But we know that we have a case out here where it's floating around. It could possibly not be covered.
Yeah.
So there we go. Let's go back to the slides.
I think that was it in terms of the reducer as well as the analyzer.
Yeah.
OK.
OK. So yeah, that was the main thing. So I think what we want to make sure that you know is how to get this. So the other thing to say about where to get it at is the Simulink home page. So we're in product marketing, so we do like to talk about our work on marketing materials. So we have a Simulink home page. If you go to variant system design, you can find what we covered and way more information on this page. So that's one place you can go. Oops, sorry, not the academia site, but the-- oh, wait.
If you go back to-- I think if you go back to products--
Somehow got lost there.
There you go.
Go to the support package. This is how you can get to the support package, as well. You can go from that button on the tool strip. But you also can go here and get the support package directly, as well. Oh, one more little tip on where to get things. Let's say you're interested in support packages in general, like you're like, I didn't know you guys had these support packages.
You can go to apps. Say get add-ons. And let me go here. And this is going to bring up the add-on explorer. And you could see things I can add to Simulink or to Matlab. And from here I can say, I want to do Variant Manager for Simulink. There we go. This says manage right now because I have it installed, but if I didn't have it installed, it would say to install. You tried installing it, right? How long did it take you?
Yes, I did. It took me maybe about five minutes, but it's going to depend on your internet speed.
Yeah. I mean, he's probably got the best speed because he's here at MathWorks. But anyway, you can try downloading it and installing it. We would love to hear comments.
Yeah. Before I forget, so if you can go back to the web page, I just wanted to highlight another thing. So if you can go back to the solutions page. Oh, yeah. So we are here. So you can click on that, and you can get to the-- you can download the package, right? Now, if you scroll all the way to the bottom-- OK, yeah. So again, if you do have any questions later on, feel free to email us.
Yeah. Actually, I think that goes to me, those emails.
OK. All right.
I mean, I shouldn't say that in case it doesn't. But yeah, I think it does. So anyway, yeah, you can always reach out to us that way or look us up on LinkedIn. I think we're both there on LinkedIn, as well.
Yeah.
So yeah, any questions that you guys have at this point, we would love to have them.
Let's check if we have any questions on chat.
OK. Otherwise I can go on to another topic.
Let me see if I have some other items that were interesting.
Let me go on.
Oh, that's one question that I did have. It's about-- so if you have a really large system, a large, complicated system, and you have all these different configurations, how do you handle the different configurations? Do you use something like the data dictionary? Or do you use something like the workspace?
Right. So we did talk about, where it's going to put it by default is in your base workspace. But this is not such a great place if you're handling a large amount of model references. So all of these can be put into data dictionaries. It's fine. And data dictionaries, if you don't know what they are, you might be confused because there's a-- I think there's a dictionary type in Matlab now, too.
Data dictionaries in Simulink are really different. That's a place where you would-- it's essentially having a place where you're holding your design data for Simulink. So this would count as design data variance. And capturing that and being able to package it in a project and being able to manage your models and your data together. So the design data dictionary is something you probably should check out if you haven't already.
The other one, the other thought which I almost missed, was if you have-- so when you have these inactive configurations, or I'm sorry, when you have these inactive variants, when you're trying to generate code automatically using Simulink code or Matlab code or embedded coder, what happens to that inactive variant? Are you going to be generating code even for that?
That's a great question. So if it's the case-- it will just generate code for the active variant if you have that-- let me--
OK, so the update, analyze, and update all.
Yeah. So the different choices matter here for activation time. So let me go-- whoa. That was unexpected for me. Like a mouse error. So if we-- here, this activation time is going to determine what's available. So in the case-- if it's update diagram, it may not be available for code compilation. But if I've got it here on code compile all the choices-- let's see. So this is going to allow me to put it in. And it'll have pound if statements so that I can-- and all those choices would be in the generated code then.
OK. Perfect. So it's not that they have just disappeared. You can still get code for those inactive blocks.
Yeah.
OK. I think that may have been the last of the things I was thinking of covering today.
Cool Let's wait to see if there's any questions in chat.
Any Simulink questions?
Yeah. So yeah, I know we covered the Variant Manager today, but if you have any questions, be it Matlab, Simulink, Stateflow, any other product that you're using, now's the time. We're going to be here for maybe another few minutes.
Actually, maybe we aren't because it's saying--
Yeah. OK. All right.
But anyway.
So thank you.
Thank you so much.
Thank you so much.
Yeah. And remember, you can do variant management in Simulink. It's not that intimidating to do. And you can always reach us for questions.
Yeah.
Yeah.
Thank you very much.
Thank you.
Happy Friday, and enjoy your weekend.