Message Boards Message Boards

0
|
10077 Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:
GROUPS:

Automate routines in SystemModeler?

Posted 8 years ago

Hi everyone,

Is there any way, perhaps through an API, to automate some routines such as test cases generation. For instance, let's define a simple block containing a RealInput interface and an assertion function that is violated when the RealInput is greater than 5. Thus, after having manually defined the assertion block, I would like to automatically :

  • generate a source of type RealExpression whose value is randomly set, and
  • connect the RealExpression source to the RealInput interface of the assertion block.

Do you see any solution to automate such operations? The reason why I want to achieve such a thing is because I have numerous assertion blocks and just want to generate various test scenarios.

Cheers,

Romain

POSTED BY: Romain Pinquié
5 Replies

Hi everyone,

I am getting back to my first question regarding the automatic generation of validation scenarios. Let specify the requirements of a system using logical conditions (>, <, =, <=, >=, etc.) on properties (force, velocity, etc.) combined using logical operators (and, or, xor, etc.), and each requirement owns a Boolean assertion function. When this assertion is false, the requirement is not satisfied. For instance, the elements contained in the green rectangle of the attached diagram is the model of the requirement "When the temperature is greater than 5 °C, the pressure shall be greater than 50 Pa" (simplified model since I am only using real signals). In the blue rectangle it is a validation scenario. When we specify a system-of-interest, there are hundreds of such requirements with more or less complicated logical structures. Thus, the automated generation of validation scenarios is of interest to validate that we have specified the right system before designing the system right. As you explained in your previous post, we can use Mathematica to generate random stimulus, but to be exhaustive we need to generate many uniformly distributed random stimulus that cover the entire range of allowed values. The simulation of such models is the only way to provide some evidence that the specification is not only complete (all scenarios are covered) but also consistent (no contradiction or redundancy between requirements). Tools like Simulink Design Verifier have an engine for finding counter-examples of proofs with basic data types (although in practice domains can be more complicated) using Bounded Model Checking, K-Induction rule and SAT solver. Does Wolfram offers such a capability?

Attachments:
POSTED BY: Romain Pinquié

Hi Romain,

This on-demand video can help you get started with SystemModeler and the Wolfram Language: http://www.wolfram.com/training/courses/eng022.html.

POSTED BY: Jan Brugard

Just for clarity, this requires that you have Mathematica too. This page, http://www.wolfram.com/system-modeler/features/analysis-mathematica.html, shows different ways of using the SystemModeler link in Mathematica.

POSTED BY: Jan Brugard
Posted 8 years ago

Romain,

Yes. What you do is you create the block you need (maybe by using the assert() keyword in Modelica), and then use that block in this type of construct:

Needs["WSMLink`"]
WSMConnectComponents["newmodel",{"c1"\[Element]"RealExpression","c2"\[Element]"RealOutput"},{"c1.y"->"c2"}];
WSMSetValues["newmodel",{"c1.y"->RandomReal[]}]

Now you can change the input to be different random real for each model. You can use WSMConnectComponents with any components, here I'm using the Modelica.Blocks.Sources.RealExpression and Modelica.Blocks.Interfaces.RealOutput, but can be anything you like. You can use all the Wolfram Language symbols to generate a large set of these models, just wrap the two commands here with Table, For or any such construct.

POSTED BY: Johan Rhodin

Thanks Johan, I'll give it a try this week-end. Although the Wolfram language looks very powerful, I am not familiar with it yet, I will have to get my hands dirty ;).

POSTED BY: Romain Pinquié
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract