CASP Python Libraries
This documentation primarily focuses on the usage of functions from 'casp', 'casp_be', 'casp_gpio' and 'casp_udio' namespaces.
Loading...
Searching...
No Matches
casp.py
1"""! This module defines all necessary functions to
2
3 - start CASP process
4 - create a new project or open an existing project
5 - set target on which the created model is executed
6 - create a model with blocks as per desired logic
7 - add blocks to the model
8 - adjust each block parameters as required
9 - connect the blocks
10 - build and compile the model
11 - run the model on the target hardware
12 - and finally when every thing is done, close the CASP process
13
14 All functions in this module uses global object \ref _casp_process.casp_proc from \ref _casp_process.py module.
15"""
16
17import importlib
18
19import sys
20if sys.version_info[:3] < (3,9):
21 from typing import List as list
22
23from _casp_process import casp_proc, casp_bv_proc
24import casp_utils as utils
25import casp_defs as defs
26import casp_targets as targets
27import casp_wtypes as wtypes
28import casp_pins as pins
29
30
31def Init(make_visible: bool=False, casp_file: str="CASP-Eval"):
32 """! Initializes CASP subprocess. This is the first function to be called before using any other functions in this module.
33
34 Arguments:
35
36 visible: Set True to make CASP window visible.
37
38 casp_file: Set CASP executable file to be invoked. Set this argument only if the executable file version is different from 'CASP-Eval'.
39 """
40 casp_proc.init(make_visible, casp_file)
41
42def Close():
43 """! Terminates CASP subprocess and releases the resources.
44 """
45 casp_proc.close()
46
48 """! Invokes BlockViewer process for user to browse CASP blocks, view block parameters, block documentation etc.
49 """
50 casp_bv_proc.init()
51 #response = casp_proc.write("casp.sys.blk.viewer")
52 #print(f"CASP: {response.strip()}")
53
55 """! Displays available serial ports on the host. User can use this function before using the \ref ProgrammerPortSet() function.
56 """
57 response = casp_proc.write("casp.sys.serial.ports")
58 print(f"CASP: {response.strip()}")
59
60def Refresh():
61 """! Refreshes CASP project. For further details about refreshing CASP project, please refer CASP main documentation \ref Help().
62 """
63 response = casp_proc.write("casp.sys.refresh")
64
66 """! Invokes CASP Serial Terminal window.
67 """
68 response = casp_proc.write("casp.sys.terminal")
69
70def Rtv():
71 """! Opens CASP Remote Terminal Viewer (RTV) process. For further details please refer to CASP main documentation \ref Help().
72 """
73 response = casp_proc.write("casp.sys.rtv")
74
76 """! Opens CASP Bluetooth Low Energy (BLE) process. For further details please refer to CASP main documentation \ref Help().
77 """
78 response = casp_proc.write("casp.sys.ble.client")
79
80def Help():
81 """! Opens CASP main documentation.
82 """
83 response = casp_proc.write("casp.sys.help")
84
85def HelpBsp():
86 """! Opens CASP board support package (BSP) documentation.
87 """
88 response = casp_proc.write("casp.sys.help.bsp")
89
91 """! Opens CASP Python Libraries documentation.
92 """
93 response = casp_proc.write("casp.sys.help.python")
94
96 """! Opens 'CASP User Data' directory from user's Documents folder.
97 """
98 response = casp_proc.write("casp.sys.dir.user_data")
99 print(f"CASP: {response.strip()}")
100
102 """! Opens current CASP target support folder.
103 """
104 response = casp_proc.write("casp.sys.dir.target_support")
105 print(f"CASP: {response.strip()}")
106
108 """! Opens current CASP project directory.
109 """
110 response = casp_proc.write("casp.sys.dir.project")
111 print(f"CASP: {response.strip()}")
112
114 """! Opens CASP tutorials directory.
115 """
116 response = casp_proc.write("casp.sys.dir.tutorials")
117 print(f"CASP: {response.strip()}")
118
120 """! Opens CASP examples directory.
121 """
122 response = casp_proc.write("casp.sys.dir.examples")
123 print(f"CASP: {response.strip()}")
124
125def ProjectCreate(proj_name: str=None) -> str:
126 """! Creates new CASP project and returns the project path.
127
128 Arguments:
129
130 proj_name: Project name to be created.
131
132 Return Value:
133
134 Returns project path where the project is created.
135 """
136 if proj_name:
137 response = casp_proc.write("casp.proj.create", [proj_name])
138 else:
139 response = casp_proc.write("casp.proj.create")
140 strs = utils.SplitString(response.strip())
141 print(f"CASP: {strs[0]}")
142 pro_path: str = ""
143 if len(strs) > 1:
144 pro_path = str(strs[1])
145 return pro_path
146
147def ProjectOpen(proj_full_path: str=None) -> str:
148 """! Opens existing CASP project.
149
150 Arguments:
151
152 proj_full_path: Project full path (along with project file extension .prj) should be provided as argument. If no argument is provided, CASP opens most recent project created or closed.
153
154 Return Value:
155
156 Returns project path that was opened.
157 """
158 if proj_full_path:
159 response = casp_proc.write("casp.proj.open", [proj_full_path])
160 else:
161 response = casp_proc.write("casp.proj.open")
162 strs = utils.SplitString(response.strip())
163 print(f"CASP: {strs[0]}")
164 pro_path: str = ""
165 if len(strs) > 1:
166 pro_path = str(strs[1])
167 return pro_path
168
170 """! This function does a couple of things.
171
172 - It creates a temporary project along with a default workspace (.wsp) file.
173 - Loads/open the temporary project.
174 - Creates two simulation panel windows of type '2D Plotter' and 'Controls/Meters'
175
176 Please note that the temporary project files created using this function and further modified using other functions will be available till next CASP process start. Once CASP restarts these files will be deleted.
177
178 User is recommended to use this function (in place of above two functions) to quickly create a project and start working on it.
179
180 Return Value:
181
182 Returns project path that was opened.
183 """
184 response = casp_proc.write("casp.proj.create")
185 strs = utils.SplitString(response.strip())
186 print(f"CASP: {strs[0]}")
187 response = casp_proc.write("casp.proj.open")
188 strs = utils.SplitString(response.strip())
189 print(f"CASP: {strs[0]}")
190 pro_path: str = ""
191 if len(strs) > 1:
192 pro_path = str(strs[1])
193 return pro_path
194
196 """! Clears default project workspace i.e. deletes all blocks that were created in the workspace. This function is rarely required to be used by the user.
197 """
198 response = casp_proc.write("casp.proj.wsp.clear")
199 print(f"CASP: {response.strip()}")
200
202 """! Opens project's documentation.
203 """
204 response = casp_proc.write("casp.sys.help.proj")
205
207 """! Saves current project.
208 """
209 response = casp_proc.write("casp.proj.save")
210 print(f"CASP: {response.strip()}")
211
213 """! Closes current project.
214 """
215 response = casp_proc.write("casp.proj.close")
216 print(f"CASP: {response.strip()}")
217
218def TargetSet(target_name: str):
219 """! Set target hardware on which the current model has to execute. It also updates \ref casp_pins.py with the selected target pin variables for later use, and reloads it.
220
221 Arguments:
222
223 target_name: Target name string from \ref casp_targets.py file.
224 """
225 response = casp_proc.write("casp.proj.set.target", [target_name])
226 importlib.reload(pins) #reload pins module
227 print(f"CASP: {response.strip()}")
228
229def TargetIdSet(target_id: str):
230 """! Set target ID.
231
232 Arguments:
233
234 target_id: Target ID string to be set.
235 """
236 response = casp_proc.write("casp.proj.set.target_id", [target_id])
237 print(f"CASP: {response.strip()}")
238
239def ProgrammerSet(programmer: int = defs.PROGRAMMER0):
240 """! Set programmer port. In most cases leave it to default.
241
242 Arguments:
243
244 programmer: Use either \ref casp_defs.PROGRAMMER0 or \ref casp_defs.PROGRAMMER1.
245 """
246 response = casp_proc.write("casp.proj.set.programmer", [str(programmer)])
247 print(f"CASP: {response.strip()}")
248
249def ProgrammerPortSet(serial_port: str):
250 """! Set serial port to which the device or development board to be programmed is connected. Use function \ref SerialPorts() to display available serial ports on the host.
251
252 Arguments:
253
254 serial_port: Set serial port to which the device to be programmed is connected.
255 """
256 response = casp_proc.write("casp.proj.set.programmer.port", [serial_port])
257 print(f"CASP: {response.strip()}")
258
259def RemoteBuildIPSet(ip: str):
260 """! Set IP address of remote device supporting CASP Remote Build protocol. Please refer CASP main documentation for details on CASP Remote Build feature.
261
262 Arguments:
263
264 ip: Set remote device IP.
265 """
266 response = casp_proc.write("casp.proj.set.rbuild.ip", [ip])
267 print(f"CASP: {response.strip()}")
268
269def RemoteBuildRtvEnable(enable: bool = True):
270 """! Set enable or disable Remote Terminal Viewer feature on remote build device. Please refer CASP main documentation for details on Remote Terminal Viewer.
271
272 Arguments:
273
274 enable: Set True to enable and False to disable.
275 """
276 response = casp_proc.write("casp.proj.set.rbuild.rtv", [str(int(enable))])
277 print(f"CASP: {response.strip()}")
278
279def GenPyCode(skip_disabled_blocks: bool = True):
280 """! Generates Python code for the current project model. The generated file (.py) will be located in projects directory.
281
282 Arguments:
283
284 skip_disabled_blocks: Skips disabled blocks in the generated code.
285 """
286 response = casp_proc.write("casp.proj.gen.py_code", [str(int(skip_disabled_blocks))])
287 print(f"CASP: {response.strip()}")
288
289def SimPanelWindowAdd(grp_name: str, wnd_name: str, wnd_type: int):
290 """! Adds new sub-window to an existing group. Creates new group if group name is not found.
291
292 Arguments:
293
294 grp_name: Existing group name to which new sub-window is added.
295
296 wnd_name: New sub-window name to be added. It should be unique to existing sub-window names in the group.
297
298 wnd_type: Sub-window type. It shall be one of the constants defined in \ref casp_wtypes.py module.
299 """
300 response = casp_proc.write("casp.sim_panel.subwnd.add", [grp_name, wnd_name, str(wnd_type)])
301 print(f"CASP: {response.strip()}")
302
303def SimSetupFiniteTime(set: bool = True):
304 """! Sets simulation execution to finite time.
305
306 Arguments:
307
308 set: Set True to set simulation execution to finite time or False to set simulation execution time to infinite.
309 """
310 response = casp_proc.write("casp.sim_setup.finite_time", [str(int(set))])
311 print(f"CASP: {response.strip()}")
312
313def SimSetupEndTime(time_msec: int = 1000):
314 """! Sets simulation end time in milli seconds.
315
316 Arguments:
317
318 time_msec: Set end time in milli seconds.
319 """
320 response = casp_proc.write("casp.sim_setup.end_time", [str(time_msec)])
321 print(f"CASP: {response.strip()}")
322
323def SimSetupTimeStep(time_usec: int = 1000):
324 """! Sets simulation time step in micro seconds.
325
326 Arguments:
327
328 time_usec: Set time step in micro seconds.
329 """
330 response = casp_proc.write("casp.sim_setup.time_step", [str(time_usec)])
331 print(f"CASP: {response.strip()}")
332
333def SimSetupPlotStep(plot_step: int = 1):
334 """! Sets simulation plot step.
335
336 Arguments:
337
338 plot_step: Set plot step in multiples of simulation time step.
339 """
340 response = casp_proc.write("casp.sim_setup.plot_step", [str(plot_step)])
341 print(f"CASP: {response.strip()}")
342
343def SimSetupPlotSamples(plot_samples: int = 10000):
344 """! Sets simulation plot samples. It sets specified fixed plot samples buffer (FIFO buffer) during simulation. Plot samples are pushed into the buffer at each simulation plot step. If the buffer is full the first in sample will be discarded. Higher buffer values demand more memory and CPU resources.
345
346 Arguments:
347
348 plot_samples: Set number of plot samples.
349
350 Example:
351
352 For a simulation time step=1msec with plot step=1 and plot samples set to 10000, the FIFO buffer size can hold samples for 10 secs (0.001*1*10000).
353 """
354 response = casp_proc.write("casp.sim_setup.plot_samples", [str(plot_samples)])
355 print(f"CASP: {response.strip()}")
356
357def SimSetupSpeedFactor(sf: float = 1):
358 """! Sets simulation speed factor. This value should be non negative.
359
360 - Speed factor 0 will run the simulation at full speed.
361 - Speed factor 1 will run the simulation in real time.
362 - Speed factor between 0 and 1 will run the simulation slower than real time.
363 - Speed factor >1 will run the simulation faster than real time.
364
365 In case 3 and 4 above the simulation speed is with respective to real time.
366
367 Arguments:
368
369 sf: Set simulation speed factor.
370 """
371 response = casp_proc.write("casp.sim_setup.speed_factor", [str(sf)])
372 print(f"CASP: {response.strip()}")
373
374def SimSetupPrecision(precision: int = defs.PRECISION_32):
375 """! Sets simulation integer and floating point precision to 32-bit, 48-bit (applicable to FPGA) and 64-bit.
376
377 Arguments:
378
379 precision: Set simulation precision constants as define in module \ref casp_defs.py. Typical values are \ref casp_defs.PRECISION_32, \ref casp_defs.PRECISION_48, \ref casp_defs.PRECISION_64.
380 """
381 response = casp_proc.write("casp.sim_setup.precision", [str(precision)])
382 print(f"CASP: {response.strip()}")
383
385def SimSetupOptLevel(opt_level: int = 1):
386 """! Sets compiler optimization level. Typical values are from 0 to 5. Default value is 1.
387
388 - 0: No optimization
389 - 1 to 3: Increasing optimization level from 1 to 3
390 - 4: Optimize for size
391 - 5: Optimize for speed
392
393 Arguments:
394
395 opt_level: Set compiler optimization level from above values.
396 """
397 response = casp_proc.write("casp.sim_setup.cmp_opt_level", [str(opt_level)])
398 print(f"CASP: {response.strip()}")
399
400def SimSetupMaximumModelThreads(max_threads: int = 1):
401 """! Sets maximum threads limit that can run in parallel during execution.
402
403 Arguments:
404
405 max_threads: Set maximum threads limit value. 0 value indicate that the maximum threads are set based on the available CPU cores on the target. The set value will be limited to available CPU cores on the target.
406 """
407 response = casp_proc.write("casp.sim_setup.limit_model_threads", [str(max_threads)])
408 print(f"CASP: {response.strip()}")
409
410def SimSetupMaximumBlockThreads(max_threads: int = 1):
411 """! Sets maximum block threads limit that can run in parallel within a block during execution.
412
413 Arguments:
414
415 max_threads: Set maximum block threads limit value. 0 value indicate that the maximum threads are set based on the available CPU cores on the target. The set value will be limited to available CPU cores on the target.
416 """
417 response = casp_proc.write("casp.sim_setup.limit_block_threads", [str(max_threads)])
418 print(f"CASP: {response.strip()}")
419
420def SimSetupTargetPythonSupport(enable_disable: bool = True):
421 """! Enables or disables python support for the current target. Here, python supprt means blocks having embedded python code will be executed during simulation if this feature is enabled otherwise compilation will generate and error. User can enable it only if the target supports embedded python.
422
423 Arguments:
424
425 enable_disable: Set True to enable or False to disable this feature.
426 """
427 response = casp_proc.write("casp.sim_setup.enable_target_python", [str(int(enable_disable))])
428 print(f"CASP: {response.strip()}")
429
430def SimSetupOpenMpThreads(max_threads: int = 1):
431 """! Sets maximum OpenMP threads that can be created for the current target (if this feature is supported by the target).
432
433 Arguments:
434
435 max_threads: Set maximum threads (1,2,3...). Value 1 means this feature is disabled. 0 means the maximum value is decided based on number of CPU cores available on the target.
436 """
437 response = casp_proc.write("casp.sim_setup.openmp_threads", [str(max_threads)])
438 print(f"CASP: {response.strip()}")
439
440def SimSetupOpenClSupport(platform_index: int = -1, device_index: int = -1):
441 """! Configures OpenCL support for current target.
442
443 Arguments:
444
445 platform_index: Set OpenCL platform index (-1,0,1,2...)
446
447 device_index: Set OpenCL device index (-1,0,1,2...)
448
449 If both 'platform_index' and 'device_index' arguments are -1 then this feature is disabled.
450 """
451 text = str(platform_index)+","+str(device_index)
452 response = casp_proc.write("casp.sim_setup.opencl", [text])
453 print(f"CASP: {response.strip()}")
454
455def SimSetupCudaSupport(device_index: int = -1):
456 """! Configures CUDA support for current target.
457
458 Arguments:
459
460 device_index: Set CUDA device index (-1,0,1,2...). -1 disables CUDA support.
461 """
462 response = casp_proc.write("casp.sim_setup.cuda", [str(device_index)])
463 print(f"CASP: {response.strip()}")
464
466 """! Quickly validates current model for any errors and displays the result of validation in brief. If the validation fails, user can check the log files in project directory for details.
467 """
468 print("CASP: Validating model...")
469 response = casp_proc.write("casp.sim.validate")
470 print(f"CASP: {response.strip()}")
471
472def Build():
473 """! Builds current model and displays the result of the build process. User should check the log files in the project directory for details if the build fails.
474 """
475 print("CASP: Build started...")
476 response = casp_proc.write("casp.sim.build")
477 print(f"CASP: {response.strip()}")
478
480 """! Generally, \ref casp.Build() function skips un-modified code files during build to speed up the build process. However, the BuildFresh() function deletes all the intermediate build files from previous build and freshly rebuilds the model. After the build process is completed, it displays the result of the build process in brief. User should check the log files in the project directory for details if the build process fails.
481 """
482 print("CASP: Re-Build started...")
483 response = casp_proc.write("casp.sim.rebuild")
484 print(f"CASP: {response.strip()}")
485
487 """! Cancels current build process.
488 """
489 print("CASP: Build cancel started...")
490 response = casp_proc.write("casp.sim.cancel_build")
491 print(f"CASP: {response.strip()}")
492
494 """! Clears previous build data including all the intermediate build files.
495 """
496 print("CASP: Build clear started...")
497 response = casp_proc.write("casp.sim.build.clear")
498 print(f"CASP: {response.strip()}")
499
501 """! Starts simulation if the target supports simulation panel. Else it starts to program the target board with generated binary and resets the target board so that the uploaded binary will get executed. This function also builds the model if needed.
502 """
503 print("CASP: Starting simulation (or target programming)...")
504 response = casp_proc.write("casp.sim.start")
505 print(f"CASP: {response.strip()}")
506
508 """! Starts simulation (or target programming) with previous build data. This function does not re-build the model.
509 """
510 print("CASP: Starting simulation (or target programming)...")
511 response = casp_proc.write("casp.sim.start_prev")
512 print(f"CASP: {response.strip()}")
513
515 """! Stops current simulation (or target programming) process.
516 """
517 print("CASP: Stopping simulation (or target programming)...")
518 response = casp_proc.write("casp.sim.stop")
519 print(f"CASP: {response.strip()}")
520
521def BlockAdd(blk_path: str, blk_name: str=" ") -> int:
522 """! Adds new block to the current model. The module corresponding to the block to be added shall be first imported. These block modules are available in pycasp/blks directory.
523
524 Arguments:
525
526 blk_path: block path constant from the corresponding block module. Generally, it is in the form of <block module>.path.
527
528 blk_name: any meaning full string.
529
530 Return Value:
531
532 Block Id (of type integer) if the block instance is created and added to the model or else 0. It is better to store the return value as it will be referred in functions related to the block.
533 """
534 response = casp_proc.write("casp.blk.add", [blk_path, blk_name])
535 strs = utils.SplitString(response.strip())
536 print(f"CASP: {strs[0]}")
537 blk_id:int = 0
538 if len(strs) > 1:
539 blk_id = int(strs[1])
540 return blk_id
541
542def BlockHelp(blk_id: int):
543 """! Displays block documentation of specified block Id. The module corresponding to the block Id shall be first imported from pycasp/blks directory.
544
545 Argument:
546
547 blk_id: It should be the reference block Id (and not the block Id of the created block instance). Generally, it is in the form of <block module>.id.
548 """
549 response = casp_proc.write("casp.blk.help", [str(blk_id)])
550 print(f"CASP: {response.strip()}")
551
552def BlockNameSet(blk_id: int, blk_name: str):
553 """! Sets block name of the specified block instance Id.
554
555 Argument:
556
557 blk_id: block instance Id for which the block name shall be set.
558
559 blk_name: a user friendly name to be set.
560 """
561 response = casp_proc.write("casp.blk.set_name", [str(blk_id), blk_name])
562 print(f"CASP: {response.strip()}")
563
564def BlockEnable(blk_id: int, enable: bool=True):
565 """! Enable or disable a block in the current model.
566
567 Argument:
568
569 blk_id: block instance Id
570
571 enable: True to enable the block or False to disable it
572 """
573 response = casp_proc.write("casp.blk.enable", [str(blk_id), str(int(enable))])
574 print(f"CASP: {response.strip()}")
575
576def BlockRelocate(blk_id: int):
577 """! Auto relocates the block instance in the workspace. This function is useful only when CASP window is visible and user wants to re-locate the block in the workspace.
578
579 Argument:
580
581 blk_id: block instance Id to re-locate
582 """
583 response = casp_proc.write("casp.blk.re_locate", [str(blk_id)])
584 print(f"CASP: {response.strip()}")
585
586def BlockParaSet(blk_id: int, grp_para_name: str, para_val: str):
587 """! Sets block parameter value of the specified block instance Id.
588
589 Arguments:
590
591 blk_id: block instance Id
592
593 grp_para_name: parameter name string of the block parameter. Generally, it is in the form of <block_module_name>.Para.<block_group_constant>.<block_parameter_constant>.name.
594
595 para_val: new value of the block parameter. Parameter value can be of absolute value or one of the value from the parameter list. Refer block module help for parameter value list.
596 """
597 response = casp_proc.write("casp.blk.set_para", [str(blk_id), grp_para_name, para_val])
598 print(f"CASP: {response.strip()}")
599
600def BlockInitConditionSet(blk_id: int, grp_para_name: str, para_val: str):
601 """! Sets block initial condition value of the specified block instance Id. The function is similar to \ref casp.BlockParaSet() except it sets block initial condition values instead block parameter values. Refer \ref casp.BlockParaSet() for details.
602 """
603 response = casp_proc.write("casp.blk.set_init", [str(blk_id), grp_para_name, para_val])
604 print(f"CASP: {response.strip()}")
605
606def BlockPortsConnect(blk_id1: int, port_name1: str, blk_id2: int, port_name2: str, auto_update_input_port_para: bool=True):
607 """! Connects two block ports.
608
609 Arguments:
610
611 blk_id1: block1 Id
612
613 port_name1: port name of block1
614
615 blk_id2: block1 Id
616
617 port_name2: port name of block2
618
619 auto_update_input_port_para: auto updates input port data type and size based on connected output port parameters.
620 """
621 response = casp_proc.write("casp.blk.connect_ports", [str(blk_id1), port_name1, str(blk_id2), port_name2, str(int(auto_update_input_port_para))])
622 print(f"CASP: {response.strip()}")
623
624def BlockDelete(blk_id: int) -> bool:
625 """! Deletes specified block Id instance from the model.
626
627 Argument:
628
629 blk_id: block Id to delete
630
631 Returns:
632
633 True if successful else False
634 """
635 response = casp_proc.write("casp.blk.del", [str(blk_id)])
636 print(f"CASP: {response.strip()}")
637 if "Error" in response.strip():
638 return False
639 return True
640
WspClear()
Clears default project workspace i.e.
Definition casp.py:195
ProgrammerPortSet(str serial_port)
Set serial port to which the device or development board to be programmed is connected.
Definition casp.py:249
SimSetupFiniteTime(bool set=True)
Sets simulation execution to finite time.
Definition casp.py:303
BlockRelocate(int blk_id)
Auto relocates the block instance in the workspace.
Definition casp.py:576
bool BlockDelete(int blk_id)
Deletes specified block Id instance from the model.
Definition casp.py:624
int BlockAdd(str blk_path, str blk_name=" ")
Adds new block to the current model.
Definition casp.py:521
SimSetupMaximumModelThreads(int max_threads=1)
Sets maximum threads limit that can run in parallel during execution.
Definition casp.py:400
SimSetupPrecision(int precision=defs.PRECISION_32)
Sets simulation integer and floating point precision to 32-bit, 48-bit (applicable to FPGA) and 64-bi...
Definition casp.py:374
ModelValidate()
Quickly validates current model for any errors and displays the result of validation in brief.
Definition casp.py:465
ProjectSave()
Saves current project.
Definition casp.py:206
HelpBsp()
Opens CASP board support package (BSP) documentation.
Definition casp.py:85
FolderTargetSupport()
Opens current CASP target support folder.
Definition casp.py:101
SimSetupOpenClSupport(int platform_index=-1, int device_index=-1)
Configures OpenCL support for current target.
Definition casp.py:440
BlockEnable(int blk_id, bool enable=True)
Enable or disable a block in the current model.
Definition casp.py:564
Build()
Builds current model and displays the result of the build process.
Definition casp.py:472
str ProjectOpen(str proj_full_path=None)
Opens existing CASP project.
Definition casp.py:147
ProgrammerSet(int programmer=defs.PROGRAMMER0)
Set programmer port.
Definition casp.py:239
str ProjectOpenDefault()
This function does a couple of things.
Definition casp.py:169
SerialTerminal()
Invokes CASP Serial Terminal window.
Definition casp.py:65
GenPyCode(bool skip_disabled_blocks=True)
Generates Python code for the current project model.
Definition casp.py:279
BlockInitConditionSet(int blk_id, str grp_para_name, str para_val)
Sets block initial condition value of the specified block instance Id.
Definition casp.py:600
Help()
Opens CASP main documentation.
Definition casp.py:80
BuildCancel()
Cancels current build process.
Definition casp.py:486
SimSetupMaximumBlockThreads(int max_threads=1)
Sets maximum block threads limit that can run in parallel within a block during execution.
Definition casp.py:410
TargetSet(str target_name)
Set target hardware on which the current model has to execute.
Definition casp.py:218
SimStop()
Stops current simulation (or target programming) process.
Definition casp.py:514
Close()
Terminates CASP subprocess and releases the resources.
Definition casp.py:42
SimPanelWindowAdd(str grp_name, str wnd_name, int wnd_type)
Adds new sub-window to an existing group.
Definition casp.py:289
SimStartPrev()
Starts simulation (or target programming) with previous build data.
Definition casp.py:507
TargetIdSet(str target_id)
Set target ID.
Definition casp.py:229
SimSetupPlotSamples(int plot_samples=10000)
Sets simulation plot samples.
Definition casp.py:343
FolderProject()
Opens current CASP project directory.
Definition casp.py:107
FolderExamples()
Opens CASP examples directory.
Definition casp.py:119
str ProjectCreate(str proj_name=None)
Creates new CASP project and returns the project path.
Definition casp.py:125
RemoteBuildIPSet(str ip)
Set IP address of remote device supporting CASP Remote Build protocol.
Definition casp.py:259
BlockViewer()
Invokes BlockViewer process for user to browse CASP blocks, view block parameters,...
Definition casp.py:47
BleClient()
Opens CASP Bluetooth Low Energy (BLE) process.
Definition casp.py:75
HelpPython()
Opens CASP Python Libraries documentation.
Definition casp.py:90
BlockParaSet(int blk_id, str grp_para_name, str para_val)
Sets block parameter value of the specified block instance Id.
Definition casp.py:586
BlockNameSet(int blk_id, str blk_name)
Sets block name of the specified block instance Id.
Definition casp.py:552
Init(bool make_visible=False, str casp_file="CASP-Eval")
Initializes CASP subprocess.
Definition casp.py:31
Rtv()
Opens CASP Remote Terminal Viewer (RTV) process.
Definition casp.py:70
BlockHelp(int blk_id)
Displays block documentation of specified block Id.
Definition casp.py:542
BlockPortsConnect(int blk_id1, str port_name1, int blk_id2, str port_name2, bool auto_update_input_port_para=True)
Connects two block ports.
Definition casp.py:606
SimSetupEndTime(int time_msec=1000)
Sets simulation end time in milli seconds.
Definition casp.py:313
ProjectClose()
Closes current project.
Definition casp.py:212
SimSetupPlotStep(int plot_step=1)
Sets simulation plot step.
Definition casp.py:333
BuildFresh()
Generally, casp.Build() function skips un-modified code files during build to speed up the build proc...
Definition casp.py:479
FolderUserData()
Opens 'CASP User Data' directory from user's Documents folder.
Definition casp.py:95
Refresh()
Refreshes CASP project.
Definition casp.py:60
FolderTutorials()
Opens CASP tutorials directory.
Definition casp.py:113
SerialPorts()
Displays available serial ports on the host.
Definition casp.py:54
SimStart()
Starts simulation if the target supports simulation panel.
Definition casp.py:500
SimSetupSpeedFactor(float sf=1)
Sets simulation speed factor.
Definition casp.py:357
ProjectHelp()
Opens project's documentation.
Definition casp.py:201
SimSetupTargetPythonSupport(bool enable_disable=True)
Enables or disables python support for the current target.
Definition casp.py:420
SimSetupTimeStep(int time_usec=1000)
Sets simulation time step in micro seconds.
Definition casp.py:323
SimSetupCudaSupport(int device_index=-1)
Configures CUDA support for current target.
Definition casp.py:455
SimSetupOpenMpThreads(int max_threads=1)
Sets maximum OpenMP threads that can be created for the current target (if this feature is supported ...
Definition casp.py:430
BuildClear()
Clears previous build data including all the intermediate build files.
Definition casp.py:493
SimSetupOptLevel(int opt_level=1)
set compiler optimization level (0 to 5: 4-opt for size, 5-opt for speed)
Definition casp.py:385
RemoteBuildRtvEnable(bool enable=True)
Set enable or disable Remote Terminal Viewer feature on remote build device.
Definition casp.py:269