Running McSimAPN.
Given a model, running it simply requires L-click on the [RUN] button. However, it won't run for ever. First it will freeze (Hold) at HoldStep intervals. Experience shows that models can run too fast for people to act as they see things happening, so the approach here is to interupt the running so that it will not get out of hand.
That suggests that to complete a run, from StartTime to FinTime, it will be necessary to repeatedly click the run button.
In principle is is, but there is a trick:
L-click once on the McSimAPN [RUN] button then hold down the keyboard [ENTER] key and it will have the effect of keeping the run going till it reaches Fintim or you release the button.
Even at Fintim, it doesn't stop, it just slows down and does a step by step computation.
The [Step] button does one step at a time. It actually initiates a tiny run which just advances time one Delt each step. Its original intent was simply for checking purposes. However, because it repeatedly stops and updates display and graph, it actually functions as a slow running mode. So to see how things develop L-click on [STEP] for a single step and also you then have the same continuous mode as with the [RUN] button, but slower.
Even simpler,of course, to get an uninterupted run, chose HoldStep to be as big as FinTim. Even then during the run, McSimAPN will be watching out to check if you have clicked a control button or a block and will go into HOLD mode till you have done what you want.
The RUN button changes to a HOLD button while between HoldStep intervals.
This means you can click it to freeze the run without having to move the mouse.
The run may be interupted, but the records will not show it. Values don't change while in HOLD mode (unlike the old analogue computers which would always drift a bit).
Changes during a run
In hold mode, which comes regularly or when you select a control button, the model is frozen NOT reset. You can change anything you like then select RUN to continue. Each block contains all its own state and connection values and uses whatever values they have at each time step. Changes, including changed connections and even new blocks, therefore become effective immediately.
Although it was frowned upon, we used to be able to "hot-wire" analogue computers. McSimAPN replicates that behaviour without the risk of electrocution.
Saving State
A frozen model can be saved in its current state. This allows a return to an interesting condition for a retry or repeat as the restored model will be in exactly the same state as it was when saved. This includes the data stored in memory M-blocks and conveyor belts,B-blocks.
The exception is the recording for the Graphs/Data logging will not be saved or restored. That is a separate operation, needing a File-SaveTape operation. The restoration hasn't been programmed, so if you stop the McSimAPN programme, when you reload and continue, the oscilloscope based recording will pick up from where you left off. As these recordings are text files, you can subsequently merge them to make a continuous record. There is an alternative route via the Excel link (User block) to give a data logger effect.
When you restore a model saved for continuation, first make the changes you want to try, then hit RUN for it to continue. DON'T hit RESET before RUN as the model will revert, as it should, to initial conditions.
Very Long Runs, Operator Training Process Simulator
If you are modelling a system that is stable, dynamically, and want to use it as a model of a process, for example to teach operators of the real process then you can make FinTim extemely large and just keep going.
The time of day clock (lower left) will convert seconds into minutes, hours and days.
You can create imitations of motion or instrument panels and give the user only what he/she would see in the real industrial process. The chances are that the model will run faster than real time so the training will be accelerated.
I've used this for a slow thermal process, including investigating start-up and shut-down procedures, and for looking at several days of operation of a partially automated factory.
Repeated Runs, Cyclic Boundary Conditions.
The model can be set to run repeatedly, going back to Startime automatically at Fintim and performing a Reset as it does so. Thus a user can experiment with parameters or sweep through a range of values to see the effects.
RepCount: The control for this is in the block 18, RepCount. If it is OFF (the default state) then the run stops at Fintim as normal, but if it is ON then each time Fintim is reached an automatic RESET takes place and the model will carry on, repeating runs from StartTime to FinTime until the count of runs reaches the maximum set as the "Max Contents" (Note that as for any other block the "Max Contents" is the sum of the "cc" value and whatever it gets ftom the input C connection).
If the HoldTime choice stops the model before or at Fintim then it behaves normally, and a click on RUN will be required to continue. Making the Holdstep longer than FinTim means HoldTime is never reached, but the HOLD button will stop the run anytime.
The RepCounter can be used to control the parameter sweep. Demonstration models show a first order lag moving towards a steady state value set by the RunCount and a Monte Carlo simulation that tallies the sucesses and failures, run by run to give an estimated probability of success after a limited number of runs.
Problems where the boundary conditions are cyclic, for example the operation of a furnace that cools overnight and starts up again in the morning or a batch chemical process which has to be returned to the same conditions at the end of each batch can be handled by the repeated run mode, where the end values are trapped and initial conditions are NOT RESET. This is done by using a Access, @-blocks, to put the (current) output values of integrators back into their initial conditions. Since Containers (constants) can also be reset the same applies to them. An alternative approach is to allow a very long run and generate a time value by using the output of an integrator in cyclic mode 1. (See the CyclicBCs.txt Demo)
HoldBlock
On the timing set-up window (rt-click on a clock) there is a location for chosing which block (if any) will be used to trigger a HOLD. If the output value of this block goes above zero, then the run is frozen. Making a logical comparison with some defined value will provide such a trigger. For instance, the RepCounter could be monitored, or a collision detected.
The ID number of the HoldBlock is held in the Dn value of the RepCount block (Block 18), so that is is preserved, along with other system timing parameters when a model is saved. It can be accessed there by using an access, @, block if you want to have it as part of a computation.
.
|
MJMcCann-Consulting
Help Index:
Index/Search
Background
Simulation Concepts
Continuous Systems
Discrete Systems
McSimAPN Structure
McSimAPN Operation
Using McSimAPN
Start McSimAPN
Save Model,data
Create Blocks
Run-Hold-Reset
Link Excel+VBA
PetriNet Block Types
A activity/action
B belt conveyor
C container/constant
D diverter(random)
Analogue Block Types
E exponents
F flux/flow
G function Generator
H hysteresis
I integrator
J inductor
K logic element
L logarithms
M memory
N note/label
O oscilloscope/graph
p not assigned
Q quantizer/rounding
R relay on/off
S sin/asin/atan
T timer/clock
U user link Excel
V visual voltmeter
W sWitch selector/MUX
X multiply
y not assigned
Z random (fuZZ)
& signed summation
% division/difference
@ access/move values
|