Controling components from Visual logic

Controling components from Visual logic

Postby Julius Augspurger » Sun Mar 12, 2017 2:38 pm

Dear Simulators!

Being quite new to this, I have run into some trouble and hope that you can help.

At the end of last year, I have bought Simul8 Professional Plus. I work for a vegetable oil refinery. We have a great many production lines and want to make quite a few changes. I thought it would be good to be able to simulate them, before we go ahead and do the investment.

We have two types of production lines, batch and continuous. My approach is to develop working models for those, turn them into a component, in order to keep a better overview and configure them from a spreadsheet, so I can try different settings easily.

I have written a simple program that can extract data from a list, but have trouble writing to the right place.

What I would like to do is the following:

- select the component, based on it's name. Something like CMP_LineName
- change properties of basic elements within the component.

I expected to do something like set CMP_LineName.Queue_1.property = SS_Spreadsheet[R,C].

Any tips?

Regards,

julius

Re: Controling components from Visual logic

Postby OliverPX » Fri Mar 17, 2017 11:42 am

Hi Julius,

Something like this should be possible to do. At what point do you need to change the parameters of objects within the components? On Creation of the component, or afterwards?

You can certainly reference objects within the component, though it may be a bit trickier using "On Create VL". Since a component will be "Selected" when dropping it onto the screen, you can use the LOOP OBJECTS ALL SELECTED Visual Logic command to loop the component, and therefore look what is inside of the component to then change the properties.

Re: Controling components from Visual logic

Postby Julius Augspurger » Sat Mar 18, 2017 9:25 am

I want to do this on button click. That's no problem. I would like to have example code that sets the average timing for an activity in a component. Something like SET Component1.Activity1.Average=SS_sheet[1,1]


Return to “SIMUL8 Cafe”