View Source VacEngine.Simulation (Vac Engine v1.1.1)

Provides the model for the blueprint simulation. Simulation is used to assess whether a ruleset meets business requirements.

A blueprint simulation is a collection of input/output definitions. The output corresponds to the expected outcome of the blueprint for the given input.

Simulation runner

The input descriptions are processed a case runner (similar to the main processor) in order to determine if the corresponding output expectations are met.

Stacks, layers, cases

The description passed to the runner is actually a "stack" of simple descriptions called "cases" where the higher case's values overwrite the lower case's ones. Cases are refenced as "layer" in the "stack" and may be referenced in several stacks. Only input is composed this way. Lower cases are not intended to describe output.

Two-layers "Basic stacks" and "Templates"

In the current implementation of the simulation. Stacks are limited to two level. The bottom layer is called a "Template" where the top one is called a "Runnable case".

Blueprint templates and basic stacks

Each blueprint simulation has a collection of templates (a many to many relation between cases and blueprints) that can be used as bottom layer cases. Each simulation also has a collection fo "Basic stacks", each containing a runnable case and optionally a template. The editor allows to pick the template of the basic cases among the simulation's templates, but technically, a template can be any case of the workspace.

Case sharing

Blueprints can share cases. This automatically occurs when a blueprint is duplicated, but not when a blueprint is exported and reimported where each case is duplicated.

When cases are shared, they can be modified at one for every blueprint. This is useful when you want to fix an error.

Workspace cases collections

Cases

Cases are grouped in a multi-layer stack. Each layer is a single case.

The content of a case can be used as a base for another case, forming a stack (technically, even a single case is part of a stack).

The basic stack is a two-layered stack (used as the only existing stack structure)

Cases are created workspace-wide whereas case stacks are limited to the blueprint scope. This structure allows to share cases among several blueprints.

Link to this section Summary

Functions

Creates a new stack with an empty runnable case and no template case.

Create a new blank template for the given blueprint with the given name.

Create a new input entry for the given case, key with the given value.

Create a new output entry for the given case, key and variable.

Create a new simulation setting for the given blueprint.

Creates a new stack using the given attributes.

Delete the given input entry.

Delete given output entry.

Deletes the stack with the given id. Layers are also deleted. Cases not.

Delete the template of the given simple stack.

Delete the template with the given id.

Fork the runnable case of the given simple stack, i.e. create a copy to use in the given stack.

For the template case, i.e. create a copy to use in the template and all cases using this template.

Get the blueprint name and ids that share the runnable case of the given simple (two-layer) stack.

Returns the name and ids of the blueprints with which the case is shared.

Retrieve the cases (stacks) using the given template.

Get the first stack associated to the given blueprint.

Get the simulation settings.

Retrieve a stack corresponding to the given id.

Retrieve a stack corresponding to the given id (throw! version).

Retrieve all the stack names for the given blueprint.

Get the runnable case of the given simple stack.

Get the template case of the given simple stack.

Get all stacks for the given blueprint.

Retrieve the template with the given id.

Get all the given blueprint's template names.

Get all the given blueprint's templates.

Import all cases from a path (used for bulk importation).

Add the case entries (input and output) to the stacks retrieved by the given query.

Add the setting attribute to the stacks retrieved by the given query.

Queue a case to be runned by the simulation runner.

Sets whether the case expects an error to occur (mostly when the complete element is not used).

Set the "expected" value of the given output entry.

Set the case with the given id as template case for the given simple stack.

Set the forbidden flag of the given output entry. If forbidden is set to true, the corresponding output variable is expected to be absent of the output in the current case.

Update given input entry value.

Update setting with the given options. Currently, the only option is the datetime env_now.

Validate given input entry for the given variable.

Validate the setting.

Get the default value for a variable of the given type. If the type is string, the enum must me passed if it exists.

Link to this section Functions

Link to this function

create_blank_stack(blueprint, name)

View Source

Creates a new stack with an empty runnable case and no template case.

Link to this function

create_blank_template(blueprint, name)

View Source

Create a new blank template for the given blueprint with the given name.

Link to this function

create_input_entry(kase, key, value \\ "-")

View Source

Create a new input entry for the given case, key with the given value.

Link to this function

create_output_entry(kase, key, variable)

View Source

Create a new output entry for the given case, key and variable.

Link to this function

create_setting(blueprint)

View Source

Create a new simulation setting for the given blueprint.

The default "now" time used here is "2000-01-01" (0h).

Link to this function

create_stack(blueprint, attrs \\ %{})

View Source

Creates a new stack using the given attributes.

Link to this function

delete_input_entry(input_entry)

View Source

Delete the given input entry.

Link to this function

delete_output_entry(output_entry)

View Source

Delete given output entry.

Deletes the stack with the given id. Layers are also deleted. Cases not.

Link to this function

delete_stack_template(stack)

View Source

Delete the template of the given simple stack.

Link to this function

delete_template(template_id)

View Source

Delete the template with the given id.

Link to this function

fork_runnable_case(stack, name)

View Source

Fork the runnable case of the given simple stack, i.e. create a copy to use in the given stack.

This is useful when the runnable case is shared among stacks of several blueprints, e.g. when a blueprint has been duplicated.

Link to this function

fork_template_case(template, name)

View Source

For the template case, i.e. create a copy to use in the template and all cases using this template.

This is useful when the template case is shared among templates of several blueprints, e.g. when a blueprint has been duplicated.

Link to this function

get_blueprints_sharing_runnable_case(stack)

View Source

Get the blueprint name and ids that share the runnable case of the given simple (two-layer) stack.

Link to this function

get_blueprints_sharing_template_case(template)

View Source

Returns the name and ids of the blueprints with which the case is shared.

Link to this function

get_cases_using_template(template)

View Source

Retrieve the cases (stacks) using the given template.

Link to this function

get_first_stack(blueprint)

View Source

Get the first stack associated to the given blueprint.

Get the simulation settings.

Retrieve a stack corresponding to the given id.

Link to this function

get_stack!(stack_id, queries)

View Source

Retrieve a stack corresponding to the given id (throw! version).

Link to this function

get_stack_names(blueprint)

View Source

Retrieve all the stack names for the given blueprint.

Typically used to build the list of available stacks.

Link to this function

get_stack_runnable_case(stack)

View Source

Get the runnable case of the given simple stack.

Link to this function

get_stack_template_case(stack)

View Source

Get the template case of the given simple stack.

Get all stacks for the given blueprint.

Link to this function

get_template(template_id)

View Source

Retrieve the template with the given id.

Link to this function

get_template_names(blueprint)

View Source

Get all the given blueprint's template names.

Link to this function

get_templates(blueprint)

View Source

Get all the given blueprint's templates.

Import all cases from a path (used for bulk importation).

Link to this function

load_stack_layers_case_entries(query)

View Source

Add the case entries (input and output) to the stacks retrieved by the given query.

Link to this function

load_stack_setting(query)

View Source

Add the setting attribute to the stacks retrieved by the given query.

Queue a case to be runned by the simulation runner.

Link to this function

set_expect_run_error(kase, expect_run_error)

View Source

Sets whether the case expects an error to occur (mostly when the complete element is not used).

Link to this function

set_expected(entry, expected)

View Source

Set the "expected" value of the given output entry.

Link to this function

set_stack_template(stack, template_case_id)

View Source

Set the case with the given id as template case for the given simple stack.

Link to this function

toggle_forbidden(entry, forbidden)

View Source

Set the forbidden flag of the given output entry. If forbidden is set to true, the corresponding output variable is expected to be absent of the output in the current case.

Link to this function

update_input_entry(input_entry, value, variable)

View Source

Update given input entry value.

Link to this function

update_setting(setting, options)

View Source

Update setting with the given options. Currently, the only option is the datetime env_now.

Link to this function

validate_input_entry(changeset, variable)

View Source

Validate given input entry for the given variable.

Link to this function

validate_setting(changeset)

View Source

Validate the setting.

Link to this function

variable_default_value(type, enum)

View Source

Get the default value for a variable of the given type. If the type is string, the enum must me passed if it exists.