Compiling, Linking, and Running Simulation Models With Psim3 and C++ Compilers (Linux and Windows) - A. Using A Command Window On Microsoft Windows
Compiling, Linking, and Running Simulation Models With Psim3 and C++ Compilers (Linux and Windows) - A. Using A Command Window On Microsoft Windows
ompiled using the !N" ompilers #Linu$ and %indows&' (' "sing a Command %indow on Mi roso)t %indows
*n an appropriate dire tory #)or e$ample, +models,&, pla e the C++ programs, the header )iles, the Psim3 library ompiled with the C++ !N" ompiler )or %indows, +libpsim'a,' -o ompile, link, and reate an e$e utable )ile on the .*S prompt, use the +psim3'bat, bat h )ile /or e$ample to ompile and link the )ile +batmio' pp,, type the )ollowing ommand: C:\models> psim3 batmio.cpp -o e$e ute the program and run the orresponding simulation model, type the name o) the de)ault e$e utable )ile: C:\models> a.exe -o redire t the output to a )ile +simul't$t,:
-o onne t to CS3, use Se ure Shell instead o) :telnet:' Conne t to + s3'kennesaw'edu,' %hen you are onne ted to CS3, type your user name, then your password' %hen using a similar system with Linu$, arry out the )ollowing hanges to the spe i)ied )iles supplied on the C.' -he s ript )ile to ompile and link a C++ program with the Psim3 and Pthreads libraries is +psim3;linu$,' -his )ile should be renamed to +psim3,' -he library +libpsim3;linu$, should be renamed to +libpsim3'a,' *n the Linu$ *perating System, the <bash< shell, is the de)ault shell )or Linu$' ()ter you login, Linu$ types a dollar sign #=& as the system prompt' -his indi ates that the *S is waiting )or a ommand' 3t is re ommended that you reate a working dire tory )or your )iles under your root dire tory' >ou an use the :mkdir: ommand to make a new dire tory under the urrent dire tory, then hange to the new dire tory with the : d: ommand' Copy the appropriate )iles: the :psim3: s ript )ile and the )iles that implement the desired simulation model' /or e$ample: <bat h' pp<, and <bats9)' pp<' 3n "ni$, the dot #'& indi ates the urrently working dire tory' -o opy the rele1ant )iles )rom the :8usr8psim3: system publi dire tory #on CS3&, type the )ollowing ommands
$ nano batch.cpp
-o ompile, link, and reate the e$e utable )ile Ba'outC with the +bat h' pp, )ile, type the )ollowing ommand:
$ ./psim3 batch.cpp
-he two hara ters :'8: must be in luded be)ore any ommand #e$e utable or s ript )ile& that are stored in your working dire tory' -he abo1e ommand ompiles the C++ sour e )ile and links to the Psim library' -his produ es an e$e utable )ile alled :a'out:, by de)ault' -o rename the e$e utable )ile +a'out, to <bat h<, type this ommand:
$ mv a.out batch
-o run the e$e utable program produ ed abo1e:
$ ./a.out
-o redire t the output to a )ile :simul't$t:: $ ./a.out > simu1.txt -o read the +simu7't$t, )ile, whi h is your programAs output, use this ommand:
$ more simu1.txt -o trans)er the output )ile )rom the CS3 ser1er to your PC, use a )ile trans)er utility program, su h as SS4 Se ure /ile trans)er'