`
`REFERENCE GUIDE
`cass
`
`for the Product Configura
`
`ee
`
`1
`
`CONFIGIT 1005
`
`CONFIGIT 1005
`
`1
`
`
`
`——eee.
`
`Reference Guide for the Beologic® salesPLUS™ Product
`Configurator C Language API
`
`This Reference Guide describes the use of the Beologic® salesPLUS™
`Product Configurator C Language API
`
`Revision/Update Information:
`
`This is a manual for salesPLUS™-2.0
`
`Operating System and Version:
`
`MS Windows 3.1
`
`3 Sictshibtiotelet
`
`
`
`2
`
`
`
`iq
`
`Applicable Documents
`
`1. Concept Guide for the Beologic® salesPLUS™ Product Configurator.
`2.
`‘User's Guide for the Beologic® salesPLUS™ Definer.
`a.
`User's Guide for the Beologic® salesPLUS™ Customizer.
`
`November 1995
`
`The information in this document is subject to change without notice and should not be
`considered as a commitment by Beologic A/S.
`
`Beologic A/S assumes no responsibility for any errors that may appear in this
`document.
`
`The soltware described in this document may not be copied on magnetic tape, disks or
`any other medium for any purpose other than the purchaser's personal use.
`
`Copyright © 1995 Beologic A'S.
`
`All rights reserved.
`
`salesPLUS
`
`is a registered trade mark of Beologic A/S.
`
`
`
`3
`
`
`
`salesPLUS™
`
`
`
`c
`
`Contents
`
`Preface
`
`1
`
`2
`
`3
`
`4
`
`Introduction
`
`Brief Concept of salesPLUS™ Product Configurator
`241
`Overview of Concept
`22 Data Declarations
`2.3
`AP!| Functions
`
`Working wiih the APIs
`3.1
`Load and Start Up
`3.2
`Building the Menu-Hierarchy
`3.3 Resource Handling
`3.4
`Displaying Objects and Options
`3.5 Description of Objects
`3.6 Assigning Objects
`3.7 Mode and Status
`3.8
`Special Assignment Functions
`3.9 Optimization
`3.10 Explanatibn Features
`3.11 Ending a Configuration
`3.12 Load/Save Configurations
`
`C Language APILibrary Reference
`4.1
`Global Variables
`4.2
`Type Definitions & Constants
`4.3 Miscellaneous Functions
`ged_init
`aed_load
`ged_reset
`ged_version
`ged_model
`qed_time
`ged_restart
`qed_freeptr
`qed_total_list
`qed_operation_mode
`ged_save_configuration
`
`=:
`
`=
`
`simot
`=anoose
`
`
`
`ENSBEGHAERLISAIGGBSLARBSRS
`
`ii
`
`iii
`
`
`
`4
`
`
`
`BERSRBZSERSERSSSSSeeeceessaa
`
`4.8
`
`qed_minimum_off
`ged_get_limits
`ged_default
`Trace Functions
`ged_irace
`ged_trace_conclusion
`ged_nule_text
`
`Error Report Interpretation
`
`Explanation
`B.1
`Syntax of Explanation List
`B.2
`Explanation Codes
`B.3
`Explanation List Example
`
`Additional DLL
`C.1 Windows DLL
`C2 OS8/2 DLL
`
`Error Codes and Messages
`D.1
`Error Code Definitions
`
`Function Identification Definitions
`
`Result and Status Codes
`
`75
`175
`176
`VT
`
`179
`
`179
`
`181
`181
`
`183
`
`185
`
`i| salesPLUS™
`
`44
`
`45
`
`4.6
`
`at
`
`qed_load_configuration
`|_warnings
`ged_finish
`Resource Functions
`ged_load_resource
`ged_save_resource
`qed_clear_resource
`ged_get_resource
`ged_resource_value
`ged_get_resource_list
`ged_modify_resource
`ged_set_resource
`Declaration Functions
`qed_get_declaration
`ged_get_text
`ged_get_single
`ged_gel_enum
`ged_get_typeenum
`qed_get_type
`ged_get_oneof
`ged_get_atmostone
`ged_get_elem
`ged_get_id
`ged_get_logic
`ged_get_menu
`ged_set_deciaration_data
`ged_set_resource_data
`Selection Functions
`qged_status
`ged_free
`qged_select
`ged_discard
`ged_cancel
`ged_cancel_last
`ged_inference
`ged_consequence
`ged_alternatives
`ged_accept
`qed_set_type
`Optimize Functions
`ged_optimize
`qed_maximum_on
`ged_maximum_oft
`ged_minimum_on
`
`
`
`5
`
`
`
`salesPLUS™
`
`
`
`Preface
`
`Beologic salesPLUS™ Product Configurator
`Figure1-1
`Menu of Configuration System
`Figure 3-2-1
`Figure 3-6-1a & b Windows to Assign Objects/Elements
`Figure 3-8-1
`Impossible Selection
`Figure 3-8-2
`Alternatives for Impossible Selection
`Figure 3-9-1
`Minimize Menu
`Figure 3-9-2
`Resource Limits
`Figure 3-10+4
`Example of Object Trace
`Figure 3-10-2
`Trace of Negation
`Figure 3-10-3
`Trace all Conclusions.
`Figure 3-104
`Trace of Contradiction
`Figure 3-11-4
`Finish Unbound Object
`Figure 3-11-2
`Waming
`Figure 3-11-3
`Total List of Parts
`
`2
`i2
`26
`33
`34
`37
`3g
`41
`42
`43
`43
`aonot
`onofo=
`
`This manual is a detailed description of the Beologic® salesPLUS™ Product
`Configurators Application Programming Interface (API), its capabilities and
`usageincluded.It should be helpful to anyone who wants to use the
`salesPLUS™ APIs to build a coniiguration tool with a custom specific user
`interface.
`
`As introduction to the salesPLUS™ Product Configuratorit is recommended to
`read the document Concept Guide for the Beologic® salesPLUS™ Product
`Configurator.
`
`Chapter 1 - Introduction - and Chapter 2- Brief Concept of salesPLUS™
`Product Coniigurator- give a brief introduction to the Product Configurator
`application programming interface.
`
`Chapter 3 - Working with the APIs - gives practical hints and code for
`implementing various aspects of the custom interface.
`
`Chapter 4- C Language AP! Library Reference - includes a detailed
`description of each function thal can be found here.
`
`wi
`
`vii
`
`
`
`6
`
`
`
`Abbreviations:
`
`BPG
`API
`cs
`NP
`QED
`
`Beologic® salesPLUS™ Product Configurator
`Application Programming Interface
`Constraint Solver
`Non-Polynomial (Exponential)
`Quod Erat Demonstrandum
`
`1
`
`.
`Introduction
`
`This manualis a detailed reference quide to the Beologic® salesPLUS™
`Product Configurator API, which is the C-language Application Program
`Interface. The facilities described here enable a programmerto develop
`specific user interfaces with the same advanced functionalities as in the
`salesPLUS™ Customizer user interface, but presented differently to satisfy
`customer demands.
`
`The APIs consist of about 60 functions that enable a dynamic configuration
`environment to be designed. The APIs use configuration data which are
`designed, built and checked in salesPLUS™ Definer.
`
`The examples used in this document are from the SAAB $00 series. The
`example is described in the document Concept Guide for the Beotogic”
`salesPLUS™ Produtt Configurator,
`
`vili
`
`
`
`7
`
`
`
`salesPLUS™
`
`
`Beologic salesPLUS™ Product Confi
`or
`
`?
`
`pt
`
`f
`
`
`
`Brief Concept of salesPLUS™ Product Configurator
`
`Development-<: >| salesPLUS | salesPLUS&7i.
`User
`Definer
`| API
`ars posPad User
`pFrasa’K.: ‘
`er
`
`Compiler
`
`|
`
`i Ne it
`1
`
`nl
`—_——
`Knowledgebases
`
`~~:
`<a
`Configuration data
`and Resource values
`
`The APis are a set of commands to the salesPLUS™. They are used to design
`an interpretation of the user interlace generated in salesPLUS™ Definer and to
`provide the link to the inference engine. The API provides the application with
`facilities to dynamically construct valid configurations of products. These
`facilities are for example “OPTIMIZE”, "DEFAULT", etc.
`
`The following describes the dala concept of the salesPLUS™.
`
`
`Overview of Concept
`
`
`
`|All the APIfunctions in the library havethe symbolic prefix name QED.
`
`ofobjectsgovernedby constraints.
`
`=
`
`The subject (computer, car, kitchen ...) to configure is modelledbythi ncept
`
`i ah
`
`Beologic® salesPLUS™ Definer is available ona limited number of plattorms,
`and consequently a command line Compiler is included in the library tor all
`other platforms. Although the design of the product configuration data should
`still be made in salesPLUS™ Definer, the final generation of the binary files to
`be accessed by the library calls must be made by the platiorm dependent
`Compiler.
`
`The basic functionality of the Compiler is identical to that of salesPLUS™
`Definer. It takes the knowledge base ASCII files and compiles them into binary
`configuration data files, see Fig. 1.1.
`A platform dependent Resource Converterfor dynamic resources is included.
`The document Concept Guide for the Beologic” salesPLUS™ Product
`Configurator is highly recommended as an introduction to the salesPLUS™
`iools. It is also recommended to see a demonstration of the salesPLUS™
`Customizer tool prior to reading this technical document.
`
`Objects:
`disk, tu
`i
`.
`Are typically indivisible parts or items such as: floppy
`“ ee
`oak frame, etc.
`Properties may also be represented as objects such as: load device,
`metallic paint, comer, etc.
`
`.
`
`.
`"
`
`The objects are completely independent.
`Objects can be of different classes such as:
`
`Single
`Enum
`OneOf
`AtMostOne
`TypeEnum
`Info
`
`(Boolean)
`(Finite domain)
`(List of parts logically grouped)
`(List of parts logically grouped)
`(Finite domain with type)
`(Text only)
`
`*
`
`Objects can be associated to Resources (explanation follows).
`
`
`
`8
`
`
`
`salesPLUS™
`
`"
`
`Objects can be positioned in a menu-hierarchy.
`
`The only relations which can be made between objects are the constraints
`(rules).
`
`Constraints:
`.
`The constraints state the restrictions of the combinations of the objects.
`This is done either by stating whatis legal e.g.
`Saabim900] > AirCon,
`or by stating whatis illegal e.g.
`impossible( Modeljm30], CDROM).
`Logic constraintsbasically allow all expressions which can be stated in
`boolean algebra.
`Arithmetic constraints support a set of relational expressions over
`boolean and finite domain variable e.g.
`$712°550.4+ TLZ04°760 <= 1608.
`
`*
`
`.
`
`A resource is a property of some objects.
`
`‘|
`
`salesPLUS™ supports a menu-hierarchy.
`
`Menu:
`.&
`
`Two types of menus can be specified:
`-Box Menu (A box in a window)
`- Sub Menu (A menu ata lower level)
`
`The menus are linked in a parent/child concept.
`Objects can be positioned (X,Y) in a manu.
`
`Box Menus and Sub Menus can be positioned (X,¥) ina Menu.
`
`The object of the class TypeEnum has.a iype associated.
`
`Type:
`
`A type can be used to make a general presentation of physical devices.
`tha! are identical to the configuration model. E.g. a type could consist of
`two groups: field installed or factory installed. For a hard disk the only
`apparent difference is the identification code and the circumstances
`related to assembly. In the model only one object is handled and the
`choice of type does not affect the state of the configuration model.
`
`*
`
`"
`”
`
`Resources:
`.
`This property is Independantof the constraints gaveming the
`configuration model. Examples of a resource are: price, memory, weight,
`etc.
`An object can be attached to any defined resource if appropriate. E.g.
`software licence X is attached to price but not to weight.
`A resource has an associated unit.
`The resource is summed up dynamically during tne configuration
`process if its calculation meihod is Addition. An example: if 5 drawers
`are selected andit is specified that theweightof each drawer is 25 kg,
`the weight has increased with 125 kg-
`When the calculation method of the resource is Maximum the highest
`value of the objects is displayed.
`Objects may specify negative values for resources. E.g. an objectuses a
`certain amount of X whereas other objects provide available more X.
`Resources can be positioned (X,Y) in a menu.
`
`.
`
`.
`
`*
`
`
`
`9
`
`
`
`i|
`
`
`23
`API Functions
`
`All salesPLUS™ APIfunctions return a value that is interpreted in the following
`way:
`
`oO:
`1:
`
`QED_NOERROR
`QED_ERROR
`
`Function ok
`Error in the API
`
`library
`
`For an elaborate explanation of how to interpret an error in the APIlibrary,
`please see Appendix A.
`
`All function parameters can be supplied with a NULL pointer, in which case the
`C-function omits assigning this parameter. This is useful when one or more
`Parameters are irrelevant to the user.
`
`
`
`"Data Declarations
`
`The configuration data are:
`.
`Objects
`«
`Types
`*
`Menu-hierarchy
`.
`Resources:
`
`.
`
`Constraints
`
`In this manual we refer to Objects, Types, and the Menu-hierarchy as
`Declarations. These four declarations are completely Integrated. Each
`declaration has an unique index number. The first declaration has number 0
`and the following are serial numbers.
`
`The QED-API configuration data is designed on the fact that:
`
`.
`
`*
`
`.
`
`.
`.
`
`.
`
`Each declaration has a name.
`
`Each declaration |s located somewhere on a screen,i.¢. it has an X and
`a’ position and a parent menu.
`
`Each declaration has an additional explanation text attached.
`
`Each declaration has an additional graphic’s string attached.
`Each declaration has an additional free text attached.
`
`Each declaration has a type identifier.
`
`Most declarations include dedicated information. An example is a menu
`declaration which includes a list of children declarations.
`
`Some declarations also include an element. An example: ina OneOr
`declaration each possible value is referred to as an element.
`
`Resources are placed separately in the data structure. Resources have no
`menu information attached. They are referred to by unique index numbers, e.g.
`the first declared resource has number 0.
`Constraints are placed in binary rule bases. Their textual information can be
`accessed by index of the logical or arithmetic constraint. Both the logical and
`ihe arithmetic constraints are referred to by unique index numbers, 2.9. the first
`declared arithmetic and logical constraint has number0.
`
`
`
`
`
`10
`
`
`
`salesPLUS™
`
`i|
`
`Working with the APIs
`
`The examples of how the APIs are used come from the salesPLUS™
`Customizer demo application.
`
`Subjects:
`
`Load and Start Up
`3.1
`Building the Menu-Hierarchy
`3.2.
`Displaying Object and Options
`3.3
`Resource Handling
`3.4
`3.5 Descriptions of Objects
`3.6 Assigning Objects
`3.7 Mode and Status
`3.8
`Special Assignment Functions
`3.9 Optimization
`3.10 Explanation Features
`3.117 Ending a Configuration
`3.12 Load/Save of Configurations
`
`Functions defined in the examples may be used in succeeding examples
`without reference. The function "ERROR"is intended for errors in the
`program caused either by a library error or by the fact that illegal parameters
`have been specified. The function then writes an error message and exits the
`program without returning to the examples.
`
`
`3.1
`
`Load and Start Up
`
`This section describes how to initiate the salesPLUS™ AP!library and how to
`load configuration data. Configuration data is generated by the salesPLUS™
`Definer interactive program or the Compiler which is the command line based
`utility.
`
`
`
`11
`
`
`
`There are 2 functions to support load and start up:
`
`qed_init
`ged_load
`
`1.
`
`ged_get_atmostone
`ged_get_enum
`qed_get_typeenum
`ged_get_single
`qed_get_type
`qed_get_elem_name
`qed_get_menu
`
`‘The first interaction with the salesPLUS™ APIlibrary must be a call to
`the “qed_init" function.
`2.—_Cenfiguration data is loaded by calling the “qed_load" function. The
`The menu-hierarchy is basically made of 2 different types of containers. There
`second argument which is specified does not currently have any
`is no limit of nesting:
`imponance but itis reserved for new features. The configuration data
`*
`SUBMENU:
`consists of the following file <system>.B??. The second argument
`ged_load determines the extension number, which is used for different
`Defines a levelin the menu-hierarchy, The top level menuis also
`defined as a submenu. It includes an array of declarations (children)
`language versions of the same model. The call creates a new file
`which can be of any type.
`<system>.rul that must exist while using the configuration data.
`BOXMENU:
`Example 3.1.a illustrates how to start and load configuration data into the API
`Defines a level in the menu-hierarchy but is normally displayed directly
`library: The load function takes a configuration name parameter which must be
`without the '.B??' file extension.
`in the parent menu. tis normally surrounded by a frame and the
`children are placed in this frame.
`The boxmenuincludes an array of declarations (children) which can be
`of any type except BOXMENU.
`
`Example 3.1.2
`t
`void ioad { char *Name )
`aint
`i, oes
`short
`heap, expanded;
`hean = 40
`expanded = 0;
`ce = qged_init
`EF tec}
`ERROR I);
`
`(heap, exoanded) ¢
`
`ce = ged_load | Name, 0 Jy
`if { ce }
`ERROS |}:
`I
`
`
`3.2
`Building the Menu-Hierarchy
`
`This section describes how to access the menu-hierarchy. The following
`functions are covered in the explanation’example:
`
`qed_get_declaration
`ged_get_oneof
`
`10
`
`11
`
`
`
`12
`
`
`
`Each declaration (objects, menus, types,information)is identified by an unique
`number enumerated from zero. All declarations have a common set of menu
`information:
`= salesPLUS Customizer RPSLhs feiOytote|osMotebeltclBm LE
`
`“Name
`Declaration name
`File Utilities Options Help
`Type
`The type of declaration
`Graphics
`The graphic's element
`Free:
`The string free for usage
`Parent
`Where to display. 2 special values exist:
`QED_TOPLEVEL, QED_HIDDEN
`Relative location
`An application defined pointer
`
`
`
`
`
`Figure 3-2-1 shows an example of the top level menu of a configuration
`system. There are:
`"
`3 Boxmenus:
`
`1 Submenu:
`“Accessory at dealer"
`1 INFO;
`"Warranty”
`17 OBJECTS.
`
`.
`
`.
`
`.
`
`12
`
`A|
`
`XPos, YPos
`UserData
`
`The above information is returned by the “qed_get_declaration™ function.
`The interpretation of the XPos and YPos may depend only on the application
`program. It may be based onfield, character, pixel, etc. The only limit is the
`range (0 - 32767).
`
`Itis possible to access all the menu information in a flat or hierarchical form.
`The global variable <qed_no_declaration> contains the total number of
`declarations in the loaded configuration system.
`
`In order to allow the programmer to attach more information to the declaration,
`a pointer for each declaration 'UserData' can be set by calling the
`*qed_set_declaration_data" function. This pointer can now be accessed by the
`"handle" provided by, the menu-hierarchy. The change only takes place in the
`memory. An example of additional data which the programmer should want to
`insert is menu informationif the underlying system has different
`numbers/names for the windows of the objects.
`
`Depending on the type of declaration, additional information may be given by
`calling: “qed_get_oneof", "qed_get_atmostone", “qed_get_enum",
`"qed_get_typeenum", “qed_get_type", "qed_get_menu".
`
`Example 3.2.2
`
`This example shows how to access the menus without the hierarchy. The
`declarations are displayed in the same sequence as they are defined in ihe
`salesPLUS™ Definer program (or '".\bpc’ source).
`
`Declarations with parent == QED_HIDDEN should nat be displayed (the XPos
`and YPos will always retum the value -1 ).
`
`13
`
`
`
`13
`
`
`
`case OEDTYPE;
`printf |
`“TYPE declaration\n" |;
`ec = géd_get_type ( i, MULL, SNobles |;
`for { e = 0; e < NoElem;
`e@++
`)
`t
`
`cc = ged_gerelem j i, €,
`( cc ) ERROR i);
`
`printf { "Element name
`eek;
`EGE:
`case OED.
`“ONEOF declarationin" |;
`printf |
`oc = ged.cerc_oneoF {| i, NULL, ENoRiem |;
`iF ( ec ) ERROR);
`For
`| @ = 0; @ < Noklem; e++ |
`
`jr
`
`, NULL, WULL hy
`&Name, HUTS:
`1 3sin", Name
`|};
`
`= ged_igetelem { 4, &, bHame, WOLD , MULG, NOLD))
`{oce } ERROR (1;
`
`printf { “Blement name
`7 sin". Name is
`
`case. Q2DASMOSTONE;
`printf |
`“ATMOSTOWE declaration" };
`cc = geé_get_atmoestome [ i, NULL, &NoEles };
`Lf
`{ cc} ERROR);
`for
`|
`e = BD; @ < NoElem; e2+ }
` = gefogeteie= { i, © &Name, MULL , MULL, WELL };
`if [ oc | ERAOR ()3
`finett
`| "Element mame
`> Rein", Name
`)7
`
`break;
`
`case QED_POXMENY:
`case QED_SUBMENGD :
`i= ( type == QED_BOMMENT }
`printt {
`“BOXMEM! declarationinm"™ }3
`else
`
`printf (
`"SUBMEM) declearation'n"
`ec = get_get_mene [ i, &NcElem, &Children };
`LE { cc }) ERROR (I;
`for [| @ = 0; @ < NoElem; e++ }
`{
`** Translate Children index to declaration name */
`cc = ged_get_declararien {( Children[ = ], NULL,
`tame; NULL,
`BULGE, SULL,NULE, NUL, NULE 3
`
`: tin", Name |;
`
`LE { cc } ERROR();
`printf { "Children
`}
`breax;
`
`
`case QE0_INFO:
`rint& {
`“INFO declaration”
`break;
`
`}+4
`
`
`
`It is also possible to access the declarations by following the hierarchy. The top
`of the hierarchy is identified by the QED_TOPLEVEL symbol.
`void showlmen:
`[
`}
`1
`OEDDECLARATION
`int
`char
`snort
`short
`short
`for { & = 0;
`
`Type:
`i, @, oc
`“Name, “text
`
`Par
`. KPos, Yras, Value;
`
`RangeFrom, RangeTo, TypeDecl], CurType;
`NoElem, *NoChildreny;
`4 < qéd_no_declaration;
`i++ }
`
`i, &Type, éName, NOLL, WULS, &Parenc,
`{
`ec - ged_get_declarari
`&&Pos,&¥Pos, NULL
`);
`if { co }) ERROR);
`: &s\n", Name |;
`printt ( “Declaration name
`‘* Translate Parent index to maze */
`cc = qed_get_declaration | Parent, NULL, &Name, NULL, NULL, NULL,
`MULL, NULL, WULL >
`if ({ cc } ERROR {J};
`printf ( *Location, name
`printf | “Location,
`(x, ¥)
`
`> s\n", Name py
`7 Si, Si\n*,. Pos, YEos );
`
`switch { Type }
`ase QEDSINGLE:
`prinkf {
`“SINGLE declaration\n" };
`ec = ged_get_single | i, &Value };
`if (| cc ) ERROR();
`printf { "Valwe \n", Value) +
`break;
`
`{c
`
`case GED_ENUM:
`fion'
`he
`nm”
`princt
`(
`“EMUM deciara
`ec = ged_get_emum {
`ft
`aValue, kRangeFrom,
`tRangeTo }+
`22 ( ce ) ERROR);
`princf ( "Range irom - to
`«= $i - #2
`Value #1 \n", RangeFrom,
`Rangel, valnue-+RangeFroe );
`break;
`
`case GEDTYPEENUM:
`oxinr? (
`“TYPEENUM declaration\n* 4;
`ec = ged_get_typeenum [ i, &Typetecl, &CurTyp=,. MULL, &Rangerrom,
`kRangeto }y
`iz { cc } ERROR(};
`/* Translate TypeDecl index to meme */
`oc = ged_get_declaration ( TypeDecl, MOLL, kName, NULL, NULL,
`MULL, WULG, NULL, NULL }#
`"“Hange from.- to
`: $i
`- $3\m", RangeFrom, RanmgeTo |;
`|
`
`"Type control
`1 $sin", Mame |;
`{
`¢* Tramslate CurType index to mame */
`cc = ged_get_elem | TypeDecl, CurType, EMame, HULL , NULL, MUBL i;
`if {ce ) ERROR [};
`printt { “Current
`type
`2
`tsin*, Name };
`break;
`
`14
`
`15
`
`
`
`14
`
`
`
`Ke
`
`A resource such as ‘price’is typically defined as DYNAMIC. The unit is also
`defined in the binary resource table (allowing country specific currency).
`
`Three attribute bits are defined for controlling the appearance of each
`resource:
`
`QED_LIST
`QEDMINIMAX
`QED_OPTIMIZE
`
`The resource should be included in totallist prints.
`Minimum/maximum resource constraints exist.
`Optimize support exists.
`
`Resource declarations include menu location coordinates.
`
`salesPLUS™
`
`
`3.3
`Resource Handling
`
`This section describes the application interface to the salesPLUS™ API
`resource concept. The following functions are covered by the
`explanation/example:
`
`qed_get_resource
`ged_load_resource
`|save_resource
`qed_resource_value
`ged_set_resource
`ged_modity_resource
`
`iL.
`
`2.
`
`3.
`
`4.
`
`The “qed_get_resource” function returns common information about the
`specified (by index) resource. The global variable <qed_no_resource>
`contains the total number of resources in the loaded configuration data.
`The “qed_load_resource" and "qed_save_resource” functions allow
`DYNAMIC resources to Save/load a set of values for the resource (E.g.
`prices). The extension of the resource files must be '<resource>.tbi'.
`
`The "ged_resource_value" retrieves the accumulated value for a resource
`(e.g. price).
`
`The “qed_set_resource" and "qed_modify_resource” allow the value of
`DYNAMIC resources to be changed. The resource value of a single
`component can be changed by the former function. An overall resource
`reduction in percentage can be made by thelatier function. A 10%
`reduction of all the prices could for example be made by onecall of
`“ged_modify_resource”.
`
`Resource may be declared as STATIC or DYNAMIC. For DYNAMIC resources
`the individual values are loaded irom a separate binary resource table. A
`default name for this resource table is also retumed by the “qed_get_resource”
`function.
`An attribute bit is set if the resource is DYNAMIC:
`
`QED_DYNAMIC
`
`References between the loaded configuration data and the resource table are
`made through the objects IDs as defined in salesPLUS™ Definer. Object IDs
`which do not exist in a loaded resource table are skipped and their resource
`values are set to 0.
`
`16
`
`v7
`
`
`
`15
`
`
`
`
`
`Example 3.3.4
`
`di
`le displays all the
`
`reso
`
`nS
`
`information for the loaded configuration
`ou
`
`example
`is
`This €
`system.
`Each time an object is selected/discarded the summation of values for the
`resources may change. Use the "qed_resource_value™ to get the current value
`for a specific resource.
`
`void DisplayResource | void }
`{
`int
`ete iF
`
`Pia
`‘cena, “imix, *nefaulerables
`Long
`ACCY;
`char
`*Text, *Graphics, *Free;
`snort
`EPos, YPos, Parent;
`
`i
`for [
`= G; i < ged_mo_resource;
`i++ }
`1
`
`oc = ged_get_resource [ 1, &Name, &Text. eGraphics, &Free, &Parent,
`&XPos, &YPos, MULL, BUmit, &calc, sDefaultTable, attr) +
`if ( cc } ERROR { ec Jy
`Beint= { “Resource name
`: ts\n", Mame };
`Princt
`| “Resource text
`: Re\n", Text br
`printf { “Position M-pos = $d ¥-pes= td Menu #d", EPOs, YPos, Parent);
`orint® { "Resource attributes
`:" };
`LF | Atctr & QED_LIST
`printé (
`" List"
`if ( Attr & QED_MTWIMAx }
`prantl
`{
`" MINIMAX"
`J?
`i= ( Attr & OEDOPTIMIZE |
`print® {
`* OPTIMIZE’
`|;
`switch! cale |
`t
`
`case MENTMUM:
`printf! “Maximum method ‘\n);
`break;
`case ADDITION:
`print£( “Addition method ‘mh;
`seas
`_
`iE ( Atte & QED_DYNAMIC }
`(
`
`"\nDYNAMIC resource\n" };
`BrincE |
`ts\n“, DefaulcTable };
`:
`printf { “Default table
`/* Loa resource values fron extern table */
`ec = ged_load_resource {| i, DefayleTable };
`if { c¢ } ERROR (€ cc Jj;
`
`’* The unit of the resource may have been updated From
`table,e.g. DKR int DM */
`cco = Ged_get_resource (2, NULL, NULL, MULL, SUL, MULL, NULL,
`MULL, SUnit, NULL, MULL, MULL jy
`bs Hh
`ec) ERROR ( ce };
`
`
`
`PrintEl
`
`|
`
`“Resource unit
`
`: sin", Omit
`
`py
`
`“\nSTATIC resource\n" jy
`printt (
`print’ { "Resquree unit
`
`3 isin", Unit
`
`by
`
`5else
`‘
`¥
`
`<5
`
`'
`
`}
`
`Example 3.3.b
`i
`This exampleillustrates how to access the current resource values.
`void resource_value ( woid }
`{
`int
`az
`Long
`Value;
`char
`*Name, *Onit;
`
`ie+ j
`& < qed_mo_resource;
`for { + =O;
`t
`ec = ged_resource_value [ i, &¥elue J;
`if { ce ) SRROR { ce };
`‘* Get name and unit for print out */
`oc = ged_getresource ( 1, Game, NULL, NULL, NOLL, NULL, NULL, NUEL,
`Emit, NULL, MULL, BULL };
`aif
`| oc ) FRROR | cc be
`printt { “Shs
`; #17 ([e4s}\n", Mame, Value, Unit"
`i
`i
`Tr
`
`|;
`
`j
`
`e
`5
`a
`Depending on the loaded configuration data and the assignments made,the
`example above may give a printed copy like this:
`5
`Price:
`Weight:
`Horse power:
`
`250300
`1227
`100
`
`[DKK]
`[kg]
`[hp]
`
`18
`
`19
`
`
`
`16
`
`
`
`KE]
`
`saespius™
`
`Example 3.3.c
`
`This exampleillustrates how to change the value of a resource.
`wold resourcechange { short resource, short for_free, short rebate }
`1
`ine
`ai
`long
`Value;
`char
`“Name, *Onit;
`
`** give the component away */
`cc = ged_set_resoucce [| for_free, NULL, resource, NULL,
`z= ( oc )}) BRROR { ce };
`
`0
`
`|
`
`fF
`
`/* change the resource fer the all components */
`ce = qed
`ityuresource [| resource, rebate |:
`af | ce ) ERROR { ec iy
`resourcevalue [);
`
`
`
`Displaying Objects and Options
`
`The AP! includes 2 functions for querying the state of objects:
`
`qed_status
`ged_free
`
`1.
`
`2
`
`The function "qed_status” returns the current status for a given object.
`The "qed_status" function retums. an array of status codes (one for each
`element).
`
`The function "qed_free" is more advanced. It uses the inference
`algorithm to find possible new values (free values) for a given object.It
`may be used in selection dialogues to inform the user of the values
`possible to select (eliminates the traditional trial and error sequence).
`The "ged_free" function returns an array of status codes (one for each
`element).
`
`The following values are defined for the returned status code(s), both for
`“qed_free" and "qed_status" functions:
`
`QED_SELECTED
`
`QED_DISCARDED
`
`The object'element has been selected by calling the
`“qed_select* function.
`
`The object/element has been discarded by calling the
`“qed_discard” function.
`
`QED_CONCLUDED
`
`The abject/element has been concluded by the
`
`20
`
`|
`
`QED_REJECTED
`
`QED_FREE
`
`inference algorithm as a consequence of other
`selections or the use of resource limits.
`
`The object(element has been rejected by the
`inference algorithm as a consequence of other
`selections or the use of resource limits.
`
`There are no restrictions for a new object/element
`assignment except for the domain constraint
`governing the object.
`
`Objects reporting a QED_SELECTED, QED_DISCARDED, or QED_FREE
`status may be changed by calling "qed_select", “qed_discard", or the
`“ged_cancel" function.
`
`A simple example of the difference between the retumed information:
`
`Two variables
`One rule
`
`Ar:l[@,.4),
`©
`»
`B
`ui
`
`BS srl lp.
`
`4 is now selected to 3,
`
`Object element!
`ALO)
`All)
`Aj]
`Aja)
`ALal
`
`“ged_status”
`QED_DISCARDE
`QED_DISCARDED
`QEDDISCARDED
`QED_SELECTED
`QEDDISCARDED
`
`“qed_free™
`QED_FREE
`QED_FREE
`QED_FREE
`QED_FREE
`QED_FRER
`
`REO)
`BEL
`Bi2}
`Bi3)
`Bid}
`
`\
`
`GEDFREE
`QEDFREE
`QED_AEJECTED
`QED_REJECTED
`Q=NREIECTED
`
`QEDFREE
`QED_FREE
`QED_REJECTED
`QEDREJECTED
`QED_RETRCTED
`
`An object/element reported to be QED_FREE by "qed_free" is only guaranteed
`to be so jf the <MaxTime> parameter was sufficiently large because it is NP-
`HARD to detennine this unboundness.If selecting such an apparently free
`object/element the inference engine will detect such a value to be illegal and
`reject it.
`
`The actual calling sequence in an object selection dialogue depends on the
`class of the abject. See the following source code.
`
`21
`
`
`
`17
`
`
`
`
`
`Example 3.4.a
`
`Example 3.4.b
`
`K|
`
`The "display_free" function takes an index parameter which mustrefer to an
`Thisisa subroutine used in the example below. The routine prints a related
`object declaration.
`text for the different <Status> values.
`
`}
`
`void display_free [ short Object
`at
`GED_DSCLARATION
`Type;
`cc,
`i, ®, KF
`*Status;
`NoElex;
`Rangerrom, RangceTo;
`MaxTime;
`*Name;
`
`
`
`¢* Get object type */
`NULL, MULL,
`cc = ged_getdeclaration { Object, &£Type,
`NULL, BULL, MULL );
`if | cc } ERROR();
`¢* Print object mame */
`: %s", Name ih
`"Name
`(
`peintt
`‘* Max.
`time before returm = 1 Second */
`MaxTime = 100;
`ec = Ged_free ( Chject, MaxTime, &Status |;
`Switch ( Tyne )
`
`ase QED_ONEOF:
`| Object, MULL, ENeElem }:
`ec = ged_cet_oneof
`if
`{ ce ) BRROR(};
`for ( ¢ = 0; @ < WoElem; e+ }
`{
`
`1c
`
`name
`
`*/
`
`€, Name |};
`{ i,
`ec = gedget_eclemmame
`if ( cc ) ERROR (}2
`/* Print element
`: $s *, Name };
`print [ *\nElement
`PrintStatus ('Status[ i ] };
`/* Print status */
`reak;
`/* Note: Omiy 1 status code returned */
`case OED_STWGLE:
`; ts *, Name };
`/* Print object */
`printf [ “\n0bject
`hb:
`Primtstatus( status, 0 7
`break;
`case QED=NOM:
`oc = ged_get_enum ({ Object, NULL, &RanmoeFrom, Rangeto |};
`iE [| oc ) ERROR (I;
`for ( ¢ = 0, x = RangeFrom; « «<= RangeTo; @++, K++ }
`rintt (| "\Value = $i"; = JF
`** Beimc value *;
`PrintsStatus { Statusi ei
`i;
`** Print status */
`I
`break;
`cese QED_ATHOSTONE:
`
`}b
`
`tp
`
`int Seatus }
`
`};
`
`};
`
`yoid PrintStatus {|
`1
`switch (| Status }
`ase Q2D_SELECTED;
`printf ( “Selected by user" |;
`break;
`case QED_DISCARDED:
`printf | "Siscarded by user’
`
`break;
`case QEDCONCLUDED:
`print? { "Selected by inference algorithm" |;
`break;
`case QED_REJECTED:
`printf ( "Discarded by inference algorithm’
`break;
`case QEDPREE:
`printé {
`“State undefined" };
`break;
`
`éc
`
`}
`
`
`
`18
`
`
`
`salesPLUS™
`
`
`3.5
`
`Description of Objects
`
`All objects and elements are primarily identified by their names. An additional
`text exists to give a multi-line description of the object. Furthermore,it is
`possible to retrieve the declared resources for a given object/element. This
`section gives an example of how to make a description of objects/elements.
`The following functions are used in the examples:
`
`ged_get_text
`qed_get_elem
`ged_get_resource_list
`ged_get_id
`
`The "ged_get_text" function returns the explanation text for a given object. For
`multi-value objects (QED_ONEOF and QED_ATMOSTONE)use the
`“qged_get_elem® to retrieve the explanation text for each declared value
`(element).
`
`The "ged_get_resource_list" returns an array of resource information for the
`specified object/element.
`
`The "ged_get_id” function returns the identification string for the specified
`object/element.
`
`Example 3.5.a
`
`The following example illustrates how to retrieve both the description text and
`resource information of an abject/element.
`void describe {
`int index,
`int Elem,
`int type |]
`{
`int
`ee, F;
`CEDRESOURCE
`*Kesource;
`short
`"ho;
`char
`"Text, *Id;
`
`char
`"Name, “Tnits
`
`ec = ged_get_id ( Index, Biles. SIa |;
`if | cc) ERSOR ih ;
`
`print? ( "iD
`
`Id ja
`4s \n",
`** For all declared resource values */
`
`co = ged_get_resourcelist |
`af
`{ cc ) ERROR [};
`
`Index, Elem, &No, &Resource };
`
`for
`
`{| b= 0:
`
`2 = Hor ies |
`/* Get resource mame and unit */
`oc. = géd_get_resource ( Resource! i ].index, &Name, NULL, NULL,
`HULL, NULL, NOLL. MULL, &Umit, NULL, NULG, AULD }}
`if {cc } ERROR ();
`/* Prank resource information */
`| & |] in", Name, Besource[ i J].Value, Droit
`
`printt [{ "8s: 251i
`
`fj;
`
`} s
`
`witch (type)
`EE
`case QED_ONEOF:
`case ORD_ATMOSTONE:
`
`‘
`
`cc = ged_det_eler [
`aE—E
`{ cc } EXROR [)};
`
`¢* Get the element explanation text */
`Index, Elem, NULL, G6Text, MULL ,NiULL |};
`¢* Print explanation */
`printé { *ts\n", Text };
`break;
`case QED_SINGLE:
`case QEDENUM:
`case QEDTYPEENUM:
`{ Index, &Text 1;
`ec = ged_geti_text
`if { cc ) ERROR 1);
`
`
`24
`
`
`
`19
`
`
`
`salesPLUS™
`
`The print may look like this:
`TD
`+ Bixeyz 325-67
`Weight
`3.325 5 ko J
`Price
`3256006. OK
`Horse ower
`174 | hp }
`
`‘|
`
`The function "qed_select* assigns an object to the specified element.
`This assignmentis stored in the chronological assignment list for the
`undo-operation. As a special feature for objects of the class AtMostOne
`the Element parameter can be specified to QED_NONE {-1). This wiil
`discard all elements in one operation.
`
`The function "qed_discard" removes an element from thelist of valid
`Turbo engine. The engine.....
`elements for the object.
`rninarene
`This domain reduction is stored in the chronological assignment list for
`the undo-operation.
`
`3.6
`
`Assigning Objects
`
`In this part the usage of the following functions for assignment and unbindingis
`elaborated:
`
`qed_select
`ged_discard
`qed_cancel
`qed_cancel_last
`q