Multiple target support with a single configuration

This forum contains common answers to questions and tutorials produced for the community.
dberezowski
Posts: 65
Joined: Wed Sep 08, 2010 4:03 pm

Multiple target support with a single configuration

Post by dberezowski » Tue Sep 14, 2010 9:33 am

Our application is required to support multiple "vehicles" where the primary difference, from a configuration standpoint, will be a different bitmap or two on a few pages. All other aspects of the configuration ( bitmaps, variables, events, etc. etc. ) will be 100% the same. We will have a single application executable which will support multiple vehicles at run time via a configuration file. To the extent that it is possible, we would like to do this will a single configuration. Configurator 2.1 allows for duplicating a page which is a welcome addition. The challenge I see is managing the event/variable/etc. references ( names ) of multiple ( essentuially ) identical pages. Conceptually it would be advantages if certain variables could be referenced as an array or list whereby an index would specify which page and/or variable to use. A conceptual example follows.

const int VEHICLE_ID_MUSTANG = 0;
const int VEHICLE_ID_CAMARO = 1;
const int VEHICLE_ID_TRANSAM = 2;
etc. etc.

int vehicleID; // assigned at run time via a configuration file

// if someConfiguratorDatabaseVariable[vehicleID] 's value is x then display OperationPage[vehicleID];
// if someConfiguratorDatabaseEvent[vehicleID] 's value is y then display ConfigurationPage[vehicleID];
// if someConfiguratorDatabaseAction[vehicleID] 's value is z then do something else based on the vehicle id.
etc.

Any thougths on how this could be accomplished? Please note that the Configurator implementation method shown above is strickly conceptual in nature.
jpurdum
Enovation Controls Development
Enovation Controls Development
Posts: 153
Joined: Mon Jun 21, 2010 11:19 am

Re: Multiple target support with a single configuration

Post by jpurdum » Tue Sep 14, 2010 10:26 am

I've passed this one on to the group for input.

john p.
jedwards
Enovation Controls Development
Enovation Controls Development
Posts: 16
Joined: Fri Jul 30, 2010 8:24 am

Re: Multiple target support with a single configuration

Post by jedwards » Tue Sep 14, 2010 12:07 pm

As long as the configuration you are managing is really the same configuration and you are just wanting to change images.

Solution 1:
It would be fairly straight forward to put the images for each configuration in a Lamp Gauge and then drive that lamp gauge with a user defined variable set to the current configuration selection (eg: vehicleId). However, this might not be the best solution for performance because the Lamp Gauge will force all those images to automatically be drawing dynamic, which is the images are large will cause a performance problem.

Solution 2:
You could keep different Image Widgets on the page for each different vehicle type and control their show and hides with a script. However, this is bit more complicated because you would need to drive the script when moving into and out of the correct view. So instead of keys driving a view directly, your key would drive a state machine that would:
1 - execute script to show / hide corresponding image widgets
2 - fire the event to switch to the view you wanted to switch to
You would need to do the operations on switching to the view and switching away from the view.
dberezowski
Posts: 65
Joined: Wed Sep 08, 2010 4:03 pm

Re: Multiple target support with a single configuration

Post by dberezowski » Wed Sep 15, 2010 10:59 am

Could you provide an example of the proposed solution below?

Solution 2:
You could keep different Image Widgets on the page for each different vehicle type and control their show and hides with a script.
boyce
Enovation Controls Development
Enovation Controls Development
Posts: 322
Joined: Wed Sep 08, 2010 5:09 pm

Re: Multiple target support with a single configuration

Post by boyce » Thu Sep 16, 2010 9:31 am

I don't want to interrupt the current conversation, but I want to post an example script that implements the conceptual example in the original post. I'll attach a file with the complete configuration.

//---------------------------------------------------------------------------------------------
// Murphy Scripting
// - Leave EventName as $EventName for main script method
//---------------------------------------------------------------------------------------------

const int VEHICLE_ID_MUSTANG = 0;
const int VEHICLE_ID_CAMARO = 1;
const int VEHICLE_ID_TRANSAM = 2;

const int x = 123;
const int y = 246;

int vehicleID = 0;

int [] vehicleVariables(3);

int [] eventConfigurationPageView = {EventID("Mustang Configuration"),
EventID("Camaro Configuration"),
EventID("TransAm Configuration")};
int [] eventOperationPageView = {EventID("Mustang Operation"),
EventID("Camaro Operation"),
EventID("TransAm Operation")};


void $EventName ()
{
smRead(smGetHandle("UserDefinedVariable.VehicleID"), vehicleID);

smRead(smGetHandle("UserDefinedVariable.VehicleMustang"),
vehicleVariables[VEHICLE_ID_MUSTANG]);
smRead(smGetHandle("UserDefinedVariable.VehicleCamaro"),
vehicleVariables[VEHICLE_ID_CAMARO]);
smRead(smGetHandle("UserDefinedVariable.VehicleTransAm"),
vehicleVariables[VEHICLE_ID_TRANSAM]);

if (vehicleVariables[vehicleID] == x)
{
sendEvent(eventConfigurationPageView[vehicleID]);
}
else if (vehicleVariables[vehicleID] == y)
{
sendEvent(eventOperationPageView[vehicleID]);
}

}
Attachments
Multiple Target.zip
Multiple target script example.
(3.2 MiB) Downloaded 30 times
Boyce Schrack
Enovation Controls
mbowdich
Posts: 209
Joined: Tue Oct 05, 2010 10:54 am

Re: Multiple target support with a single configuration

Post by mbowdich » Thu Oct 14, 2010 8:44 am

Option 2 - This can also be done with a relatively simple state machine and you can still change screens directly. I use it on my system. If you trigger an event when your configuration variable changes, you can hide and display your multiple widges at one time on multiple views. If you hide or show widgets on a view that is not currently being displayed, it will still make the change. Since that happens, you can still change views directly with a button. I use it to keep my digital engine rpm centered below rotary gauges as I transition from 3 digits to 4 digits.