0% found this document useful (0 votes)
371 views

GeckoSCRIPT PDF

Uploaded by

D M
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
371 views

GeckoSCRIPT PDF

Uploaded by

D M
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Script-based Simulation Control using GeckoSCRIPT

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

GeckoCIRCUITS is a powerful circuit GeckoSCRIPT is a tool within Gecko-


simulator optimized for power electronics. CIRCUITS which allows for script-based
Its library offers the user a large number simulation control. Via the GeckoSCRIPT
of circuit, control and thermal com- tool, the user can write and execute a
ponents for modeling power electronic script in the Java programming language,
systems. The user must properly set using specially provided functions for
element parameters such as on- manipulating the model parameters and
resistance, forward voltage, controller simulation inside GeckoCIRCUITS, as well
coefficients, inductance, or thermal as the full Java API.
capacity in order to model a system
accurately. In this tutorial, we will show the functio-
nality of the GeckoSCRIPT tool through the
There is a wide range of problems – e.g. example of tuning a controller for a buck
optimizations for efficiency or controller converter. We will also show how to use
tuning – for which the user must simulate, the GeckoSCRIPT functions to allow scrip-
change some element parameters, re- based control of GeckoCIRCUITS from
simulate, and so on until a desired MATLAB.
solution is found. As of version 1.4,
GeckoCIRCUITS provides a way of
automating such a process.

Introduction

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

To open the GeckoSCRIPT tool, start The top field, Imports, allows you to im-
GeckoCIRCUITS, and click on the GECKO port any Java class or package for use
menu (furthest to the right on the menu within your script (e.g. java.util). Therefore
bar). There you will find a menu item the entire Java API is available for use.
called GeckoSCRIPT.

The middle field, field declarations, allows


you to define and initialize variables for
use in your script.

This will open the scripting environment:

The text field public void runScript() at the


bottom is where you write the code for
your script.

All coding is done in the Java program-


ming language and correct Java syntax
Users already familiar with Gecko- must be used.
CIRCUITS will note the similarity with the
Java block interface. There are four tabs
at the top of the window, with the ‘Code’
tab opened by default. There are white
Getting Started
editable text fields which comprise the
GeckoCIRCUITS version 1.4 or later is
GeckoSCRIPT code editor.
required

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

The grey non-editable upper-right window mostly identical to the names of the para-
lists the GeckoSCRIPT-specific functions meters used in the dialog boxes.
which are available for modifying the
parameters of an element of a model and To simplify the writing of scripts, Gecko-
for controlling the execution of the simu- SCRIPT provides a listing of all blocks
lation of the model. A detailed description available in a model, their names, and for
of each function with a simple example of each type of block, the accessible para-
its use is available by clicking on the meters and outputs, along with their de-
Details button. scription. To show this listing, click on the
Available Blocks button. As our model is
currently blank, the list is empty.

GeckoSCRIPT functions work by operating


on element and parameter names, which
must be passed to the functions as Java
Strings (i.e. enclosed by “”). The names of
circuit and thermal elements are visible in
GeckoCIRCUITS in the schematic window,
and in the parameter setting dialog box
that appears when elements are clicked
on. Names of control elements are visible Getting started
in the parameter dialog box. The names of GeckoSCRIPT-specific functions for
the parameters used by GeckoSCRIPT are manipulating model blocks and
controlling the simulation

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

Now, go back to the GeckoCIRCUITS main To see a listing of available outputs, add a
window, and construct a simple RC circuit voltage measurement block to the model
schematic: (e.g. measuring the voltage across the
resistor). Click the ‘Refresh’ button again.
You will see a list of output names and
their description.

Then return to the Available Blocks win-


dow and click the Refresh button. You will
now notice the two circuit elements listed,
with the names of their accessible para-
meters and their descriptions.

When accessing and modifying the para-


meters of the blocks in the model using
the GeckoSCRIPT functions, you must use
the names listed here.

For control elements (which include the


measurement blocks, e.g. voltmeters and
amperemeters), the outputs of the block
are also accessible. Accessing control
element outputs is the means by which
simulation results are extracted from the
model through GeckoSCRIPT. SCOPEs are
not accessible via GeckoSCRIPT.

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

Now let’s write a simple script and try to


compile it. In the script code field, enter
the following code:

setParameter("R.1","R",50);
setParameter("C.1","C",1e-6);
writeOutputLn("Hello World!");

The setParameter function changes the


parameter of an element. From the list we
looked at previously, we can see than the
resistor’s name is R.1, and that the para-
meter denoting resistance is named R. So
we use these as the arguments to the The lower text field displays messages
function, along with the value of the from the compiler. If your code is free of
resistance we wish to set. The same is syntax errors, you will receive a message
done for the capacitor and its capacitance. that the compilation has been successful.
Otherwise, the errors from the compiler
The writeOutputLn function is provided in will be displayed along with line numbers
order to write any sort of output you may where the errors are found. For the line
want to the Script Output tab. You can also numbers, refer to the upper text field
write any output you like to a file by using displaying the full code.
the file I/O classes provided by the Java
API.

Now click on the Compile Code button.


You will notice that the GeckoSCRIPT
window automatically switches to the
Compiler Output tab. This tab contains two
text fields. On top is the full Java code that
is compiled. GeckoSCRIPT creates a
custom class, along with the imports and
field declarations specified by the user,
with a runScript() method that executes
the user-specified script.

Getting started Writing a simple script


The list of block, parameter, and output The setParameter(…) function
names that is used to modify the model The writeOutputLn(…) function
Compiler output and messages

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

Now let’s run the simple script written will demonstrate its functionality using a
previously. Click on the Run button. You simple example where the controller
will notice that the GeckoSCRIPT window parameters for a buck converter are tuned
automatically switches to the Script to achieve a stable voltage regulation.
Output tab. This is where any output
written using the writeOutput or the
writeOutputLn functions will be displayed.
The text field under this tab now displays
the phrase Hello World!, as was specified
in the script. Please go back to the Gecko-
CIRCUITS main window. You will notice
that the resistor and capacitor parameter
values have been changed to those speci-
fied in the script. GeckoSCRIPT has per-
formed as instructed.

You will notice there is also a Help tab. It


displays some basic information about
GeckoSCRIPT. Now, click Close Window to
close the GeckoSCRIPT window. Any code
you write is saved along with the model.

Running a simple script


Now that you have familiarized yourself GeckoSCRIPT output
with the GeckoSCRIPT environment, we Check parameter values have changed

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

Included with this tutorial is a file called and the period of this oscillation, denoted
buck_control.ipes Open this model in Tu, are then used to calculate the three
GeckoCIRCUITS. PID controller coefficients – the
It contains a circuit with a simple Buck proportional gain Kp, integral gain Ki and
converter, together with a control loop differential gain Kd.
modelling a PID controller using the PI
and PD control blocks available in Gecko- Now this of course can be done by the
CIRCUITS. The proportional gain is set to user manually: simulate, increase the
1, and the integral and differential gains to proportional gain in the model’s PI block,
zero, i.e. the loop is uncompensated. Via simulate, and repeat until Ku and Tu are
the constant block, the output reference is found. A much more convenient and faster
set to 6 V, and the input voltage is 12 V. If way to do it is to use GeckoSCRIPT.
you run the simulation and open the
uppermost SCOPE showing the output vol- To facilitate this, a Java block is included
tage, you will see the output voltage is 3 V. in the model that monitors the output
Therefore, a proper controller giving voltage, and determines whether it
required output voltage regulation must oscillates and constant frequency and
be designed. amplitude. The outputs of the Java block
are the amplitude of oscillation, a digital
A common approach to PID controller signal indicating (1/0 i.e. true/false)
tuning is the Ziegler-Nichols method. In whether the amplitude is constant, the
this method, with the other gains set to period of oscillation and a digital signal
zero, the proportional gain is increased indicating whether the period is constant.
until the output of the control loop – in this
case the output voltage of the converter –
oscillates at a constant frequency and Controller tuning example
amplitude. This ultimate gain, denoted Ku, Open buck converter model
Ziegler-Nichols tuning procedure

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

Now open GeckoSCRIPT. A script imple- The first part of the script code initializes
menting the Ziegler-Nichols algorithm the most important model values. Using
has already been included with the model. the setParameter function, the inductance
and capacitance values of the converter
output LC filter are set, the output voltage
reference, and the initial PID coefficents.

In the field declarations we have declared On line 5 we set the switching frequency of
all the variables we need for the algo- the converter, by setting the frequency
rithm: the PID controller coefficients, the parameter of the signal generator block
ultimate gain and period, Boolean flags for that creates a sawtooth waveform used to
whether the amplitude and frequency are generate a pulse-width modulated signal
constant, and a flag that tells us when to for the converter main switch.
stop searching.

Now click the Available Blocks button. You


will then see a listing of all the circuit and
control blocks in the circuit by type and
name, their accessible parameter names
along with the parameter descriptions, Controller tuning example
and their accessible outputs (for control Script written for the Ziegler-Nichols
blocks). tuning algorithm

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

The following code increases the pro- and the since the number of outputs can
portional gain in a loop while running the vary, the outputs are simply designated
simulation and checking whether Ku has numerically from top to bottom, starting
been found. from zero. Note that the names are how-
ever still Strings, not numbers. In this
case we are interested in output “1” and
“3”.

In the next part of the code, if the ampli-


tude and period of oscillation are indeed
constant, we retrieve the observed period
We use a standard Java while loop, and of oscillation Tu from the simulation – in
after displaying a short message, we call this case output “2” of the Java block –
the runSimulation() function in line 19. and the ultimate gain Ku, which is para-
Calling this function executes the simu- meter “r0” of the PI control block.
lation according to the parameters (step-
width and end-time) specified in the
simulation configuration dialog accessible
via the Simulation -> Parameter menu.
In this dialog, you are able to define para-
meters as start- and end-times of the
simulation as well as other solver options.
Calling the runSimulation() function within
GeckoSCRIPT has the same effect as the
user clicking Simulation -> Init & Start in
the GeckoCIRCUITS main window. The getParameter function allows us to
do this, by specifying the block and para-
The next step is to check the Java block meter name we wish to read.
outputs in the model to see whether the
amplitude and period of oscillation of the
output voltage is constant, which indicates
whether we should stop the search or
continue.

This is done via the getOutput function. As


you can see, the arguments for this func-
tion are the name of the control block
(JAVA_FUNCTION.5 in this case), and the Controller tuning example
name of the output. As the output of the runSimulation()
Java block can represent different values, getOutput(…)
getParameter(…)

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

Then a message is displayed in the script Now that you have examined and under-
output that the tuning process is finished, stood the script you can compile it.
and the flag to exit the loop is set. Compilation should finish successfully.

If the amplitude and period are not both Keeping the SCOPE which displays the
constant, we increase the proportional output voltage open, run the script. You
gain by 0.1, set this in the model as the will see the output of the script change as
new proportional gain, and continue the loop is executed, and you will also see
running the loop. the model re-simulated (with different
results, as the gain is changing) with each
Once the loop finishes, the last part of the loop iteration.
code calculates the PID coefficients
according to the Ziegler-Nichols PID
tuning rule, and sets these parameters in
the PI and PD control blocks in the model.

Please note the use of the setParameters


function in line 46. This allows you to set
all the parameters of a block at once, by Finally, the loop will stop, and the SCOPE
specifying the block name, and the para- will sho w a converter regulating the
meter names and values as an array of output voltage at 6 V which is the pre-
Strings and numbers respectively. defined reference voltage. A stable set of
controller coefficients have been found.
At the end of the script, the simulation is These are now displayed in the main
run again in order to see the final results window underneath the control blocks.
of the tuning algorithm.

Controller tuning example


setParameters(…)
Compiling the script
Running the script

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

Also, try using a function to access a para-


meter or output or block that does not
exist in the model. Such errors are not
caught at compile-time since they depend
on the model itself, but run-time errors
will be displayed in the script output tab if
you attempt to access something which
does not exist.

The gain at which a control loop oscillates


at constant period and amplitude is not
necessarily unique. The initial value of the
proportional gain in this script has been
rather arbitrarily set to 2.2. Try using a
different value, e.g. 0.5 or 1.0, and see
what happens.

Also, try changing the output reference


voltage, the switching frequency, or the LC
filter values by modifying the appropriate
lines in the script code. By doing so you
change the dynamics of the system, which
results in different PID coefficients. Try
making such changes, recompile the
script, and re-run it to see the different
results.

Controller tuning example


Modifying the script
Run-time errors

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

So far we have shown how to write simu- This tutorial was implemented and tested
lation control scripts using the scripting on MATLAB release 2010b. Java 1.6 has to
environment provided within Gecko- be the actual Java version in the MATLAB
CIRCUITS. However, sometimes coupling environment. Before proceeding make
a GeckoCIRCUITS simulation with another sure that Java 1.6 is the actual Java
simulation or computation program is version in the MATLAB environment:
desirable.
>> version -java
All of functions for model manipulation
ans =
and simulation control available in Gecko- Java 1.6.0 with Sun
SCRIPT within GeckoCIRCUITS, some of Microsystems Inc. Java
which were described previously, are also HotSpot(TM) Client VM mixed
available for control of GeckoCIRCUITS mode
®
through and within MATLAB .

This allows a user to load GeckoCIRCUITS In the Help Directory of MATLAB you will
into the MATLAB environment, control a find a description of how to install a newer
simulation from the MATLAB environment Java version if necessary.
(from the command line or an m-file), to
use MATLAB functions to calculate
parameters for the simulation, and to plot
simulation results – or the results of
several simulations – within MATLAB.

In the following we will show how a script


for PID tuning like that presented in the
previous sections can be implemented
using GeckoCIRCUITS and MATLAB.

Controlling GeckoCIRCUITS in MATLAB


using GeckoSCRIPT functions
Check the Java version in MATLAB

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

In order to use GeckoCIRCUITS in MAT- You can view and undo your changes to
LAB, you must first tell MATLAB of its the dynamic class path employing the
location. If you are using a Windows commands
machine and have installed GeckoCIR-
CUITS into a directory called >> javaclasspath
C:/GeckoCIRCUITS/, then the path to the >> javarmpath
GeckoCIRCUITS simulator is
When you have set the static class path by
C:/GeckoCIRCUITS/GeckoCIRCUITS.jar editing classpath.txt, then you must re-
start MATLAB to apply the changes. The
To add this to MATLAB’s class path, dynamic class path setting, however, will
append the above line to MATLAB’s only persist during your current MATLAB
classpath.txt file. You can do this within session.
MATLAB by typing
Please save your simulation model and
>> edit classpath.txt close GeckoCIRCUITS now.

which will open that file in the editor.

Please note that by default, the file per-


mission is set to read-only. Therefore you
may need administrator rights to change
the file permission.

If you don’t have the permission to change


the file classpath.txt, you can also define
the path locally for your MATLAB session
to a dynamic class path. Therefore,
execute the following command:

>> javaaddpath 'C:/GeckoCIRCUITS


/GeckoCIRCUITS.jar'

Controlling GeckoCIRCUITS in MATLAB


using GeckoSCRIPT functions
Add path to GeckoCIRCUITS

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

The functions for controlling a Gecko- This will open the GeckoCIRCUITS main
CIRCUITS simulation and model from window. You will also see this message
MATLAB are identical to those listed in the displayed in the MATLAB command line:
GeckoSCRIPT main window and function
in the same way. The functions for MAT- Starting GeckoCIRCUITS in OS JVM
(outside MATLAB)...
LAB are located in a Java package called GeckoCIRCUITS should now be running
gecko.GeckoRemote.*. outside of MATLAB at port 43035
You are now connected to the
GeckoCIRCUITS instance at port
To avoid calling the functions always with 43035
the full package name, import this
package into MATLAB with the command If an error message is displayed instead,
the port is already being used or is
>> import('gecko.GeckoRemote.*') blocked. Try then another port number.
On most machines, the default port 43035
As of version 1.6, communication between should be free.
MATLAB and GeckoCIRCUITS is done
using network ports on the local machine. It is also possible that any firewall
This allows GeckoCIRCUITS to run outside program you have installed on your
of MATLAB, in your operating system’s computer will complain about
Java Virtual Machine (JVM), rather than unauthorized access from MATLAB or the
MATLAB’s, while still allowing you to Java Runtime Environment. On Windows
control simulations and access their machines for example, if prompted by a
results from MATLAB. message from the firewall, click “Allow
Access” in either case. Even if you do not
As a result, besides the list of functions have administrative rights to do this,
you have already seen in GeckoSCRIPT, ignoring such messages (i.e. clicking
for control from MATLAB there are “Cancel” in this example) should not be a
several more functions necessary. One of problem, since both MATLAB and
them is startGui(int port). This function GeckoCIRCUITS are running on the local
starts a new instance of GeckoCIRCUITS, machine.
enabled for remote access, from MATLAB.
You must specify a free network port NOTE: If you are already familiar with
number. If you do not, GeckoCIRCUITS will GeckoCIRCUITS and MATLAB, and have
previously used the old package
attempt to use the default port, 43035.
GeckoExternal, see Appendix for instructions
Therefore, before you proceed, type into
on migrating to GeckoRemote .
the MATLAB command line

>> startGui() Controlling GeckoCIRCUITS in MATLAB


using GeckoSCRIPT
Import GeckoRemote package
startGui()

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

If problems with the firewall persist,


please contact your System Administrator
and ask him to allow MATLAB and Java
access to the network ports. Ask for
advice on which network ports to use.

Now, it is not necessary to start


GeckoCIRCUITS from inside MATLAB
using the startGui() function. You can
connect from MATLAB to GeckoCIRCUITS
if it is already running, provided it is Since everything was set up as we want it
enabled for remote access. To try this out, already when we called startGui(), click
let us first disconnect from the “OK”. Now go back to the MATLAB
GeckoCIRCUITS instance we started from window. Connect again to GeckoCIRCUITS
MATLAB. To do this, type – this time let’s specify the port explicitly –
by typing into the command line
>> disconnectFromGecko()
>> connectToGecko(43035)
A message in the MATLAB command
window will inform you that the Once more there will be a notification
connection has been severed. However message that you are now connected:
GeckoCIRCUITS is still running. Go to the
You are now connected to the
GeckoCIRCUITS window. Under the Tools GeckoCIRCUITS instance at port
menu click the Remote Access Settings 43035
option.

A dialog window will open, allowing you to


enable or disable remote access and Controlling GeckoCIRCUITS in MATLAB
control of GeckoCIRCUITS, and at which using GeckoSCRIPT
port. Connecting to an already-running
instance of GeckoCIRCUITS

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

Now, let’s go back to our simulation task. You can now verify that the converter is
again not regulating the output voltage
Open the model you previously modified properly by typing into MATLAB
and saved, buck_control.ipes. You can do
this from MATLAB by typing >> runSimulation()

>> openFile('buck_control.ipes') which will simulate the model as shown


earlier from within GeckoSCRIPT.
Assuming the file is in your MATLAB
working directory (otherwise, specify the
correct path).

We will repeat the tuning procedure from


before, now from within MATLAB. Since
we saved the model last time with the new
PID coefficients, we need to reset the
control blocks to their original, un-tuned
values. Do this from the MATLAB
command line by typing

>> setParameter('PD.1', 'a1',0)


>> setParameter('PI.1','a1',0)
>> setParameter('PD.1', 'r0',1)

You will see the parameters change in


GeckoCIRCUITS. Note the different use of
quotation marks for strings (single rather
than double as in Java code). This is
because in MATLAB you must respect
MATLAB syntax, even though the functions
are imported from a Java package.

Controlling GeckoCIRCUITS in MATLAB


using GeckoSCRIPT
Using GeckoSCRIPT functions from the
MATLAB command line

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

Included with this tutorial is a file called Now let’s take a look at the m-file. Up to
buck_control_tuning.m, which you can line 21, the script does the same as
open from MATLAB. It is an m-file that previously, only with MATLAB syntax
performs the Ziegler-Nichols tuning, just rather than Java. Now look at lines 21 to
like the script we previously analysed and 24. In order to control a simulation step-
ran from within GeckoCIRCUITS. by-step, we first must initialize it and for
this we use the function initSimulation.
There are however, some differences. If
you look at the simulation we performed
during the tuning process earlier, you will
notice that the simulation was performed
each time for 0.02 seconds. However, we
can tell whether we have reached Ku
much earlier than that. We only need to
see a few cycles. Wouldn’t it be better if We define a step-width dt and simulation
we could run a part of the simulation, time tEnd and pass these as arguments to
check the results, then change the para- the function. We also define a variable to
meters if necessary, and continue, and so keep track of how much of the simulation
on? time we’ve covered.

There are certain GeckoSCRIPT functions You can also call initSimulation() without
which allow for just that. arguments. In that case the simulation is
initialized with parameters specified from
You can use GeckoSCRIPT functions to within GeckoCIRCUITS, just like when you
simulate one single simulation step at a call runSimulation().
time, so simulate several steps at a time,
and to simulate a specified certain time
(e.g. 10 microseconds).

Controlling GeckoCIRCUITS in MATLAB


using GeckoSCRIPT
m-file with tuning algorithm
Doing a partial simulation

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

Now let’s take a look at the loop which Then we must tell GeckoCIRCUITS that the
performs the tuning. Apart from the MAT- simulation is finished. We do this in line 55
LAB / Java syntax differences, you will by calling endSimulation().
notice that instead of using the
runSimulation() function as before, which The rest of the script is the same as
runs the entire simulation up to tEnd, we before within the Java version.
are using simulateTime.
Note that instead of using simulateTime,
you can use simulateSteps, and specify
the exact number of steps to simulate
rather than the time to simulate.

Now execute the m-file. You should see


the same output as before, but now in the
MATLAB console. Check again the
simulation results, and you will see that
the coefficients have been found at that
The argument is the length of time we the converter regulates at 6 V.
wish to simulate. This function continues
from where the simulation last left off (or
starts from zero, if it has not started) and
simulates for the specified time. In this
case (line 30) we chose 2 milliseconds,
giving the system plenty of time to settle
before analysing it. We also keep track
(line 31) of how much we’ve simulated so
far. The rest of the loop is the same as in
the previous example.

Now take a look at what happens after the


loop (lines 51-55). First, we must check
whether we have simulated up to the
specified end time, and if not, simulate the
remainder (lines 51-53).

Controlling GeckoCIRCUITS in MATLAB


using the GeckoSCRIPT interface
simulateTime()

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

In this tutorial, a step-by-step introduction


was given on how to control a GeckoCIR-
CUITS model and simulation via a custom-
made script using special functions pro-
vided by GeckoCIRCUITS for that purpose,
both using the GeckoSCRIPT tool within
GeckoCIRCUITS and through MATLAB.
The tutorial demonstrated how to tune the
PID coefficients for a buck converter’s
controller using a simple script written by
the user.

This tutorial example gives a good starting


point to the reader who wants to imple-
ment sophisticated scripts for simulation
control for the purpose of performing
parameter sweeps, optimizations, and so
forth.

Further examples demonstrating more


advanced and practical uses of Gecko-
SCRIPT functions will be periodically Contact Information / Feedback
made available via the Gecko Newsletter.
Dr. Andreas Müsing

Gecko-Simulations AG
Physikstrasse 3, H13
CH-8092 Zurich, Switzerland

Phone +41-44-632 4265


Fax +41-44-632 1212

www.gecko-simulations.com
[email protected]

Document version: February 2014

Summary
Contact information

GeckoCIRCUITS Coupling with External Software


Script-based Simulation Control using GeckoSCRIPT

APPENDIX
Switching from GeckoExternal to
GeckoRemote for MATLAB Use

Prior to GeckoCIRCUITS version 1.6, the The main advantages are that
package gecko.GeckoExternal was used
for controlling GeckoCIRCUITS from 1) You can now close GeckoCIRCUITS,
MATLAB. even if when started from MATLAB,
without having to close all of MATLAB;
As of version 1.6, this API is deprecated –
please do not use it anymore. Switch to 2) You don’t have to worry about memory
using gecko.GeckoRemote instead. allocation for Java inside MATLAB;

GeckoExternal remains usable for 3) You will not have problems with
purposes of backwards compatibility. compiling your simulation models’ Java
using it, it will display a message that it is blocks when running GeckoCIRCUITS
deprecated and recommend moving to from MATLAB. This was a serious
GeckoRemote, but otherwise it will work problem experienced by many users.
as before. Therefore your old MATLAB
scripts, written before version 1.6, are still
usable as they are. From a user’s point of view, the changes
are minor and easy to make. In your old
However, GeckoExternal is no longer scripts, simply change the line
maintained or supported. Therefore you import(‘gecko.GeckoExternal.*’)
are strongly urged to switch to using to
GeckoRemote in your MATLAB scripts. import('gecko.GeckoRemote.*')
and everything else should work without
The main reason for the switch is that modifications. Please note that now you
GeckoRemote enables GeckoCIRCUITS to must be mindful of port numbers in some
run in your operating system’s Java cases – please read the section of this
Virtual Machine (JVM) rather than tutorial dealing with setting up the
MATLAB’s JVM. GeckoCIRCUITS-MATLAB link.

This approach makes it easier for you to


Controlling GeckoCIRCUITS in MATLAB
work with GeckoCIRCUITS from MATLAB.
using the GeckoSCRIPT interface
APPENDIX: Migrating from
GeckoExternal to GeckoRemote

GeckoCIRCUITS Coupling with External Software

You might also like