Anylogic PLE: I want a slider or other control to affect the arrival schedule for my source in anylogic - schedule

I am doing my thesis using Anylogic and I've run into a little problem. I have two different schedules for my source, in the process modeling section. I want/need a control option such as a slider to affect the used schedule in the source block. Is there a way to do this?
Thank you in advance,
a student in need

Sure, there are many different ways and this is a quick way:
create a radio button control called radioas below:
Obviously, create 2 schedule objects, here named schedule and schedule2.
In your source, switch the schedule selection to a dynamic property where you can add code. Write as below:
Now the source applies the schedule you select in the radio button at any time.
cheers

Related

Linking radio buttons to select groups of schedules in Anylogic

I am trying to link a radio button which allows the model user to select an operating scenario for the simulation (scenario A-E), and I need this radio button selection to provide conditional control to specify which rate schedule is to be applied by each source block.
i.e. if Operating Scenario A radio button is selected, Source 'WestboundArrival' uses arrival schedule A1, Source 'EastboundArrival' uses arrival schedule A2 etc
I am struggling to find a previous example of how to tackle this.
I think that an approach whereby the radio button selection outputs a variable using the 'Action' tab, and using this variable output to select the rateschedule used by the source. I am having difficultly in creating a link.
Any pointers would be welcomed.
You can just add a parameter "choice" and link this to the radiobutton (make sure its an int).
Then in your sourceblock you can add code like this:
choice==0?schedule:schedule1
If you now run your model, the rate schedule used by source will be selected based on your radiobutton selection. You can also change it during runtime.
And please be aware that the radiobutton index is zero based, so the button defined first is 0, next one is 1 etc.
Good luck!

Condition in Event Structure Labview

Hi Guys,
I have in my labview project the needs to use the same prev/next buttons with different tab controls, so I tried to put the value change of those buttons in an event structure but I would to put in AND condition the availability of the current tab.
Any Idea??
Thank you very much.
Guido
You have to consider using Dynamic Registering for Events: http://zone.ni.com/reference/en-XX/help/371361K-01/lvhowto/dynamic_register_event/
You should create Dynamic event register and when tab control state is enabled/visible you will generate user event.
For example please refer to NI Example Finder and open "User Event Generation.vi"
Hope this helps!
If you use property nodes for the tab controls, you can use the equality primitive to confirm whether the currently active tab is the one your event should handle. By adding more checks or processing, you can eliminate false positives.
Example
Apologies for the bad wiring, the snippet tool mutated the block diagram.

Connect two controls in LabVIEW?

I have two boolean elements or swritches.
When I turn on the first one, the second one should switch off and vice versa.
So, I am trying to make elements both indicators and controls.
I read that I have to turn on the Digital Display which is under the visible items submenu but there is no such option.
Could you please help me figure this out?
Thanks in advance.
I am new in LabVIEW, so if this question has already been answered or if it is a stupid question, I am sorry.
If you want one control on the block diagram with two different user indicators, you should use an XControl, I created a simple example here.
UPDATE: Added a demo VI to the example /UPDATE
If you want two control on the block diagram with two different user indicators, you should use user event and local variables to control the two states:
You can only have 'Digital Display' with a gauge or some kind of numeric control

Listen for Table Filter Activation

I have a table that has a series of filters across the top of it (as per usual.) This table feeds a massive graph that has multiple series of data in it. In order to hide different series of data I have grouped the information in the tables. I can then click on the minus button to remove a series of data from the graph by collapsing the group, or click the plus button to add it back in the same way. Yes, I know, not the best solution. It was an early effort, what can I say? My default is for all data to be hidden (all groups collapsed).
I have a user (a very important user) who wants to be able to use the filters across the top to find the specific series they are looking for. The filter will find the collapsed series just fine, but the series will not display because it is collapsed.
So, What I'm trying to do is get all groups to auto-expand when the filter is activated. This should work as a stop gap measure until I can simply redesign the chart.
The Problem: I can't figure out how to make Excel notice when the filter has been clicked on (or otherwise used). I've tried using Worksheet_Change and Worksheet_SelectionChange, but neither of them activate the code I have set up in the listener. That code, FYI, checks to make sure the filter is in use and adjusts the groupings accordingly. It should work fine if I can just get Excel to notice it's existence.
I've looked into making my own listener, but there's nowhere in the code I can insert it to make it activate. I just need a listener that will notice when the filter has been changed.
Any thoughts? After an hour of searching I'm stumped...
Okay, after some research I figured out a work around. The big problem here is that changing a filter does not raise any events that can be heard by VBA. Big problem.
Simple Solution: Create something that will activate a listener.
What I ended up doing was finding a cell somewhere outside of my table that wasn't going to be affected by the collapses, then I added a very simple formula (=Count(H:H)). Now whenever the table is collapsed the count is affected which activates the Worksheet_Calculate listener. And voila! I can dynamically change the groupings all I want :-).
So there you have it. If you need to detect a filter being activated via a Worksheet listener, you just need to set up a formula to activate the calculate listener.
Reference: [MSDN Article on the same thing].1 There is apparently a much more robust way to fix this problem as well which is detailed in the article.
You mentioned table, so assuming it's PivotTable you may try,
Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
If it's simply a Targe Range change then,
If Intersect(Target, Range("A2"))

Gridview with different template per datasource

I have a gridview that I would like to be able to bind to several sqldatasources, but still use template fields. Each datasource is different and would have different columns so I'm not sure how to go about this. Is it possible to define a set of template fields or overlying template per datasource?
The one way I can think of to do this would be to populate the GridView with rows dynamically from you datasources and then use the OnRowCreated event to switch the fields you want into template fields.
You can either extend the ITemplate interface or you can use a custom ascx control to load into the field like so.
TemplateColumn bc = new TemplateColumn();
bc.HeaderText = "Template Column";
bc.ItemTemplate = Page.LoadTemplate(TEMPLATEFILE);
grid.Columns.Add(bc);
Here are a few good links to help you out if you decide to take this road, really you may get better performance (and less maintainability headaches) from separating them out. Even update panels based on user input would be fine.
Link 1
Link 2
If you want to change your approach and your not sure about which option will suit you best try posting a bit more background about your project and we can go from there.
Happy Coding!
Personally with this it would sound more appropriate to have a separate datagrid control for each one.