Need more help and support?

Frequently asked questions

  1. How do you model queue processes within Powersim?
  2. What is the significance of the 'time unit' in the Project Settings page?
  3. How can I connect a database to a Powersim model?
  4. How can I use a time graph as an input control? (this method also works for time tables from Studio 7 SR3 onwards)

1. Question
How do you model queue processes within Powersim?

1. Answer
The modelling of queues is automatic within Powersim. Our consulting team has used it to amazing effect for modelling the training process within some of the parts of the UK arms services. For example, to become a qualified fast jet fighter pilot you have to pass 5 different training courses and if you fail one you can move to a different part of the training pipeline and become a multi-engine pilot or a helicopter pilot. Before each course is a waiting list of students who have are queuing for a space. The size of the waiting lists (queues) are a function of the timetable for the subsequent course (these affect the rate with which students flow from the waiting list and onto the course) and the pass rate, frequency and capacity of preceding courses (these affect the rate that students join the waiting list).

In Powersim terminology a queue is a “level” (also referred to as a “stock” in the dynamic simulation literature). This is the rectangular icon you can place into diagrams within Studio. To join or leave a queue you need to flow into (to join) or out of (to leave) the stock, so you need to add in flows. You can then expand your model to include calculations for the flow rates in and/or out. In an integrated process, the flow rate in and the flow rate out would depend on the performance of the upstream process(es) and the process itself.

In the tutorials and samples included, I suggest that you look at the Oilrig model and the Inventory model that should have been installed with the version you downloaded from our website the other day and is used in the tutorials. The inventory model is all about building products, thus creating an inventory and then shipping them out. The inventory is effectively a queue for the shipping process.

Back to top

2. Question
What is the significance of the 'time unit' in the Project Settings page?

2. Answer
The time unit in Project Settings has no physical significance for the project itself: it simply determines how Powersim converts between time (on the calendar) and numbers. If Project Settings › Time Unit is set to 1 minute, then entering 1 into the timestep box will cause a model timestep of 1 minute; if it is set to 1 day then entering 1 into the timestep box will cause a timestep of 1 day.

The only effect this has on model calculations is attempting to calculate NUMBER(1«da») for example. If time unit is set to 1 minute, this function will return the number of minutes in a day. If time unit is set to 1 day, it will return 1. (For dates the NUMBER function returns the number of time units from 01/01/01 BC 00:00:00). This is generally of no practical significance in modelling since you would not want to perform this operation. This option is included mainly in order to offer back-compatibility with Powersim Constructor and is of little (to no) significance within Powersim Studio. It does not effect summary intervals, or how graphs will display and has only the small impact on calculation and data entry suggested above.

Back to top

3. Question
How can I connect a database to a Powersim model?

3. Answer
Use VBFUNCTION! The attached file demonstrate using VBFUNCTION to connect to a Microsoft Access (strictly Microsoft Jet) database.

The databasesimple.sip file shows a single variable getting data from a database table.

First, you’ll need to set the filename of the database correctly in the Database connection variable (or just put the database in the root of the c drive) - I’ve made this as user-friendly as is possible within the context of VBFUNCTION - open the definition for the variable and in the line that says FileName=, enter the filename of the tester.mdb database. Note that within a string Powersim needs to see \” to think " and \ \ to think \ - so c:\tester.mdb needs to be entered as c:\\tester.mdb. In a real-world application to be more user-friendly you could just pick the string up from the registry and write a separate application to set these registry values.

Now, it should work fine (you might need to save, close and re-open). Feel free to open access and change the file within access, the data will update in Powersim every time you reset.

To show it getting 20,000 values from a dataset change “Values”=1..2,1..5 to “Values”=1..2,1..20000. This slows down the updating operation (on reset), but has seemingly no effect on run-speed. Theoretically, therefore, this could be used for large scale data exchange.

The databasecomplex.sip file shows how to control the update of data.

Again, set the filename as before in the Database Values from Table 1 variable. Clicking the update button or resetting the simulation will update the values (and the update time as well). Open the database tester.mdb and change the values to show that this is true.


Works with any kind of database that Microsoft ADODB can connect to. Run any SQL query you want.


Basically, difficult to know how scalable this is. Need to place a VBFUNCTION in each variable you want to import Need to know how big the dataset is in advance. Won’t do anything nice if something goes wrong (no way of generating an error message which is more informative than - something has gone wrong).

Back to top

4. Question
How can I use a time graph as an input control? (This method also works for time tables from Studio 7 SR3 onwards).

4. Answer
It is possible to use the time graph control as an input control. However, the method for doing this is (unfortunately) not for the faint hearted - like setting up a dataset, it’s easy when you know how. I’ve attached a file that demonstrates the technique.

  1. First create the variable which you wish to enter a time series into. This variable should be an auxiliary (since it will be changing throughout time). Set the transfer direction for this variable to IN (as if the varable was being imported from Excel) - this is done from the properties - advanced tab.
  2. Open the project tree (press Alt-0). This window lays out the units, ranges, components and datasets within you current simulation. It’s generally of limited use - unless you are setting up datasets (common), or working with multiple components (generally quite rare).
  3. The time graph which you are entering data into has to be drawn in the Private Diagrams area (as opposed to the Shared Diagrams). Double-click on Private Diagrams within the Project Tree. This will open the Private Diagrams. Draw a time graph control within this. Basically, we are going to drop the variable we have created into this diagram, but this must be done via a dataset in order to allow input into the variable.
  4. Create a Studio Dataset by right-clicking on the Project Item in the Project Tree (this is done from the same place as you would create a Spreadsheet Dataset). A studio dataset is an alternative type of dataset within Studio, it is rarely used - but allows the user to import data from text files, amongst other things.
  5. Open the dataset window. You will see a cylinder with dataset written next to it.
  6. Drag and drop the variable you into which you wish to enter information into the dataset (as you would do for a Spreadsheet dataset - take the variable from the diagram window and drag it on top of the cylinder mentioned at the previous step), in order to create the dataset variable.
  7. Right-click at the top of the dataset window and select the option Allow Manual Edit. Open the properties window for the dataset to set the time granularity for the input, and the start and end dates for the input.
  8. Double-click on the dataset variable to open the properties window and then click history in order to view the values taken by this variable. You will see that these are all questions marks - if we leave it as it is then we will not see a line on the time graph. Enter any value for the first two elements so that a line will appear on the time graph - do this by double-clicking on those elements.
  9. Now connect the dataset to the component using the co-models window. As for importing from Excel, select the co-models window, right click and select Create Dataset Connection and then select the dataset which you have just created.
  10.  Select the connection to the dataset within the co-models window, right-click and first select Auto-connect to main model and then set the transfer type to manual.
  11.  Go back to the time-graph that you have created and go to the parameters window. Open the co-models folder, open the folder corresponding to the connection you’ve just created and then click on the dataset variable to place it into the time graph.
  12.  Click OK, and then the variable will appear within the time-graph. You will be able to drag-and-drop it within this time-graph. Phew!

Back to top

For any further questions on our business modelling process and simulations, contact a Powersim consultant today on 01483 467220

Call Us: 01483 467220