Ticket #3037: plant.mos

File plant.mos, 1.7 KB (added by Ravi Saripalli <ravi.saripalli@…>, 10 years ago)
Line 
1/* A simple script to run my Plant Model
2 Author: Ravi Saripalli
3 Date: 24 May. 2014
4 Version 3.0
5*/
6
7/*************** Load Models *********/
8echo(false) ;
9print(getSettings());
10cd("./work");
11loadFile("../plant.mo");
12loadFile("../Reservoir.mo");
13loadFile("../MyGas.mo");
14//ThermoS.Util.ldFile("../plant.mo"); // The main plant simulation
15//ThermoS.Util.ldFile("../summary.mo"); // enable summary reports
16cd("..");
17print("Checking Model \n");
18ans:=checkModel(plant);
19getErrorString();
20print("Checked Model \n");
21/************ Cleanup Work **********/
22print("Cleaning Up Work Area\n") ;
23system("rm work/*");
24cd("./work"); // Do all the dirty work here
25system("pwd");
26
27
28/* if you don't set timeStep it is calculated as (stopTime-startTime)/count
29 which can be bad news fi you set too large a stopTime this really
30 caught me off gaurd, lost few weeks of effor */
31
32tEnd := 5;
33iniStepSize := 1 ;
34count := integer(floor(tEnd / iniStepSize)) ;
35
36setDebugFlags("infoXmlOperations,failtrace");
37flags := "-lv=LOG_NLS" ;
38
39print("Starting the Plant \n");
40simulate(plant);
41/*
42simulate(plant, startTime=0, outputFormat="mat",
43 stopTime=tEnd, tolerance=1e-6, // numberOfIntervals=count,
44 simflags=flags) ;
45*/
46// cflags="-ffloat-store", simflags=flags) ;
47
48getErrorString();
49sVars := readSimulationResultVars("plant_res.mat") ;
50//print(sVars);
51if (size(sVars,1) == 0) then // no variables then bailout
52 print("simulation failed ... bailing out\n");
53else
54 print("simulation done\n");
55 print("No. of Plant Variables = " + String(size(sVars,1)) + "\n");
56end if;
57echo(true);
58//Summary.genReport("plant_res.mat", "htr", 5);